Skip to content

Instantly share code, notes, and snippets.

@marek-safar
Created January 27, 2020 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marek-safar/4bf9d02b7ddc2c96a2d023c0997042ed to your computer and use it in GitHub Desktop.
Save marek-safar/4bf9d02b7ddc2c96a2d023c0997042ed to your computer and use it in GitHub Desktop.
System.TypeAccessException : Attempt by security transparent method 'System.HexConverter.ToString(System.ReadOnlySpan1<Byte>, Casing)' to access security critical type 'System.ReadOnlySpan1<System.Byte>' failed.\n\nAssembly 'System.Diagnostics.DiagnosticSource, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
Stack trace
at System.HexConverter.ToString(ReadOnlySpan`1 bytes, Casing casing)
at System.Diagnostics.ActivitySpanId.CreateRandom() in /_/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs:line 1201
at System.Diagnostics.Activity.GenerateW3CId() in /_/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs:line 740
at System.Diagnostics.Activity.Start() in /_/src/libraries/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs:line 490
at System.Diagnostics.Tests.ActivityTests.IdFormat_W3CValidVersions() in /_/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs:line 565
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment