Null reference exception in LogMessagePacketBase.ReadFromStream calling TaskEngineAssemblyResolver.RemoveHandler
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 139
Description
### Steps to reproduce
Running build.cmd in https//github.com/dotnet/winforms repo MSBuild will randomly null ref trying to remove the handler from the `TaskEngineAssemblyResolver`.
https://github.com/microsoft/msbuild/blob/eb3b0a79d52bf2029913ac50ad6fa64f7497d7f0/src/Shared/LogMessagePacketBase.cs#L407
Happens every few dozen times. This is on Win10 1903 with the latest patches.
I couldn't get symbols to load, but here is the dump:
```
0:039> !pe
Exception object: 03cac8b0
Exception type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
InnerException:
StackTrace (generated):
SP IP Function
0BAEE9C8 05CCAF80 Microsoft_Build_ni!Microsoft.Build.Shared.LogMessagePacketBase.ReadFromStream(Microsoft.Build.BackEnd.ITranslator)+0x330
0BAEEA1C 05CCE6AA Microsoft_Build_ni!Microsoft.Build.Shared.LogMessagePacketBase.Translate(Microsoft.Build.BackEnd.ITranslator)+0x4a
0BAEEA30 05CCABE5 Microsoft_Build_ni!Microsoft.Build.BackEnd.LogMessagePacket.FactoryForDeserialization(Microsoft.Build.BackEnd.ITranslator)+0x25
0BAEEA3C 05CCE647 Microsoft_Build_ni!Microsoft.Build.BackEnd.NodePacketFactory+PacketFactoryRecord.DeserializeAndRoutePacket(Int32, Microsoft.Build.BackEnd.ITranslator)+0x17
0BAEEA50 05CCE621 Microsoft_Build_ni!Microsoft.Build.BackEnd.NodePacketFactory.DeserializeAndRoutePacket(Int32, Microsoft.Build.BackEnd.NodePacketType, Microsoft.Build.BackEnd.ITranslator)+0x41
0BAEEA70 05CCABAC Microsoft_Build_ni!Microsoft.Build.BackEnd.NodeManager.DeserializeAndRoutePacket(Int32, Microsoft.Build.BackEnd.NodePacketType, Microsoft.Build.BackEnd.ITranslator)+0x2c
0BAEEA8C 05CCAABB Microsoft_Build_ni!Microsoft.Build.BackEnd.NodeProviderOutOfProcBase+NodeContext.ReadAndRoutePacket(Microsoft.Build.BackEnd.NodePacketType, Byte[], Int32)+0x8b
0BAEEACC 05CCA9C2 Microsoft_Build_ni!Microsoft.Build.BackEnd.NodeProviderOutOfProcBase+NodeContext.BodyReadComplete(System.IAsyncResult)+0x142
0BAEEB00 70F6A6D6 System_Core_ni!System.IO.Pipes.PipeStream.AsyncPSCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)+0xa6
0BAEEB18 726F91BD mscorlib_ni!System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)+0x8d
StackTraceString:
HResult: 80004003
05ccaf4c c745e800000000 mov dword ptr [ebp-18h],0
05ccaf53 c745ecfc000000 mov dword ptr [ebp-14h],0FCh
05ccaf5a 6893afcc05 push offset Microsoft_Build_ni!Microsoft.Build.Shared.LogMessagePacketBase.ReadFromStream(Microsoft.Build.BackEnd.ITranslator)+0x343 (05ccaf93)
05ccaf5f eb00 jmp Microsoft_Build_ni!Microsoft.Build.Shared.LogMessagePacketBase.ReadFromStream(Microsoft.Build.BackEnd.ITranslator)+0x311 (05ccaf61)
05ccaf61 837dcc00 cmp dword ptr [ebp-34h],0
05ccaf65 7429 je Microsoft_Build_ni!Microsoft.Build.Shared.LogMessagePacketBase.ReadFromStream(Microsoft.Build.BackEnd.ITranslator)+0x340 (05ccaf90)
05ccaf67 8b0d2c13ad05 mov ecx,dword ptr [Microsoft_Build_ni+0x132c (05ad132c)]
05ccaf6d bae4010000 mov edx,1E4h
05ccaf72 ff15d41ec505 call dword ptr [CLRStub[JumpStub]@79670e6505c51ed4 (05c51ed4)] (JitHelp: CORINFO_HELP_GETSHARED_GCSTATIC_BASE)
05ccaf78 8bf0 mov esi,eax
05ccaf7a 8b8eec020000 mov ecx,dword ptr [esi+2ECh]
>>> 05ccaf80 3909 cmp dword ptr [ecx],ecx
05ccaf82 ff15ac5aae05 call dword ptr [Microsoft_Build_ni+0x15aac (05ae5aac)] (Microsoft.Build.BackEnd.Logging.TaskEngineAssemblyResolver.RemoveHandler(), mdToken: 060013cf)
05ccaf88 33d2 xor edx,edx
05ccaf8a 8996ec020000 mov dword ptr [esi+2ECh],edx
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.