Skip to content

Local test run fails for target net461 with FileLoadException S.R.CS.Unsafe #42250

@devsko

Description

@devsko

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions