Assembly crash: System.Runtime.CompilerServices.Unsafe after update 1.18
See original GitHub issueDescribe the bug This is probably not as easy to reproduce or describe - but I will try my best here. Before updating to 1.18 we were using 1.17. After updating .NET Tracer on the servers itself - the web application crashes completely. There was not a single change in our code - so I knew it is caused by NET Tracer. After uninstalling 1.18 and reinstalling 1.17 the issue was gone.
Showing this page and message: Server Error in ‘/’ Application.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
--
[FileNotFoundException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
System.ReadOnlySpan`1..ctor(T[] array, Int32 start, Int32 length) +0
StackExchange.Redis.ServerSnapshot.get_Span() +90
StackExchange.Redis.ConnectionMultiplexer.ActivateAllServers(TextWriter log) +47
StackExchange.Redis.<ReconfigureAsync>d__151.MoveNext() +6564
[AggregateException: One or more errors occurred.]
System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +51
System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) +128
System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout) +12
StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Object configuration, TextWriter log) +153
System.Lazy`1.CreateValue() +221
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Lazy`1.get_Value() +147
Microsoft.Web.Redis.RedisSharedConnection.get_Connection() in C:\TeamCity\buildAgent\work\59b31e8e4035fd30\src\Shared\RedisSharedConnection.cs:71
Microsoft.Web.Redis.<>c__DisplayClass7_0.<Eval>b__0() in C:\TeamCity\buildAgent\work\59b31e8e4035fd30\src\Shared\StackExchangeClientConnection.cs:68
Microsoft.Web.Redis.StackExchangeClientConnection.OperationExecutor(Func`1 redisOperation) in C:\TeamCity\buildAgent\work\59b31e8e4035fd30\src\Shared\StackExchangeClientConnection.cs:95
Microsoft.Web.Redis.StackExchangeClientConnection.RetryLogic(Func`1 redisOperation) in C:\TeamCity\buildAgent\work\59b31e8e4035fd30\src\Shared\StackExchangeClientConnection.cs:122
Microsoft.Web.Redis.StackExchangeClientConnection.Eval(String script, String[] keyArgs, Object[] valueArgs) in C:\TeamCity\buildAgent\work\59b31e8e4035fd30\src\Shared\StackExchangeClientConnection.cs:68
Microsoft.Web.Redis.RedisConnectionWrapper.TryCheckWriteLockAndGetData(Object& lockId, ISessionStateItemCollection& data, Int32& sessionTimeout) in C:\TeamCity\buildAgent\work\59b31e8e4035fd30\src\RedisSessionStateProvider\RedisConnectionWrapper.cs:232
Microsoft.Web.Redis.RedisSessionStateProvider.GetItemFromSessionStore(Boolean isWriteLockRequired, HttpContextBase context, String id, CancellationToken cancellationToken, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actions) in C:\TeamCity\buildAgent\work\59b31e8e4035fd30\src\RedisSessionStateProvider\RedisSessionStateProvider.cs:293
Microsoft.Web.Redis.<GetItemAsync>d__19.MoveNext() in C:\TeamCity\buildAgent\work\59b31e8e4035fd30\src\RedisSessionStateProvider\RedisSessionStateProvider.cs:195
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +66
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +30
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +16
Microsoft.AspNet.SessionState.<GetSessionStateItemAsync>d__74.MoveNext() +396
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +66
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +30
Microsoft.AspNet.SessionState.<AcquireStateAsync>d__65.MoveNext() +800
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +66
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +30
Microsoft.AspNet.SessionState.TaskAsyncHelper.EndTask(IAsyncResult ar) +69
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +315
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +231
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134
Since I believe it’s somewhat related to assembly dependencies - this is our web.config It made no difference which version of Datadog.Trace was present
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Datadog.Trace" publicKeyToken="DEF86D061D0D2EEB" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.17.0.0" newVersion="1.17.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Channels" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.6.1" newVersion="4.0.6.1"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="CC7B13FFCD2DDD51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
To Reproduce I will provide any information when needed. I’m not sure of what is causing this behavior so I can’t reproduce this with a blank web application.
Expected behavior
No matter what version of System.Runtime.CompilerServices.Unsafe
is used - this should not crash the entire application.
Runtime environment (please complete the following information):
- Instrumentation mode: manual and with NuGet package
- Tracer version: 1.18
- OS: Windows Server 2019 Datacenter
- CLR: ASP.NET Version:4.8.4075.0
- Running IIS
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
Hey, @scownTownV. We recently merged PR #806 which removes several external dependencies from the Tracer, including
System.Runtime.CompilerServices.Unsafe.dll
. These changes will be included in the next release, which should be out this week. (edit: typo)Hi @gc-dev1 and @scownTownV , we’ve just released version 1.19.0 of the .NET Tracer which should resolve this issue. I will close this pre-emptively but please feel free to re-open if you’re still encountering the issue on 1.19.0.