runtime: Local test run fails for target net461 with FileLoadException S.R.CS.Unsafe
Description
Running tests locally for target framework net461 fail when using dotnet build /t:test as well as in VS Test Explorer for projects that reference System.Memory and System.Runtime.CompilerServices.Unsafe like System.Collections.Immutable or System.Text.Json and others. I believe it started to fail with #41616
Example for dotnet build /t:test System.Collections.Immutable.Tests
System.IO.FileLoadException : Die Datei oder Assembly "System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Fehler bei der Überprüfung des starken Namens. (Ausnahme von HRESULT: 0x8013141A)
---- System.Security.SecurityException : Fehler bei der Überprüfung des starken Namens. (Ausnahme von HRESULT: 0x8013141A)
Stack Trace:
bei System.ReadOnlySpan`1..ctor(T[] array, Int32 start, Int32 length)
bei System.ReadOnlyMemory`1.get_Span()
bei System.ReadOnlyMemory`1.ToArray()
bei System.Collections.Immutable.Tests.ImmutableArrayTest.AsMemoryRoundTripStringTests(IEnumerable`1 source)
My usual workflow before running tests
git checkout master
git clean -xdf --exclude=**/.vs
git pull origin master
build.cmd clr+libs -rc Release
build.cmd libs -f net48
Configuration
Current master branch VS 16.8 preview 3
Regression?
Yes, it worked until about a week ago
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (16 by maintainers)
@jkotas made the change to make ILAsm public sign by default on .NETCore. Now we just need to pick up a build of ILAsm with that change to get the fix.
That is expected as NetFramework is a pre-built (it exists on your machine) vs NETCore which is a live built (it’s part of the repository). We were discussing options to initialize the repository with a known last good build so that you don’t need to rebuild the full repo, i.e. when you just want to build and test the libraries. But that problem hasn’t been solved yet.