Trying to publish a test project and execute tests within Azure Pipelines (at the bottom you can find dotnet --info).
Getting the following, when trying to run the tests:
System.TypeInitializationException: The type initializer for 'Foo.Bar' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Bar.Baz' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.FileSystemGlobbing, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
Stack Trace:
at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.ChangeTokenInfo..ctor
at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.ChangeTokenInfo..ctor(CancellationTokenSource tokenSource, CancellationChangeToken changeToken)
at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.GetOrAddFilePathChangeToken(String filePath)
at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.GetOrAddChangeToken(String pattern)
at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()
at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration`1..ctor(Func`1 changeTokenProducer, Action`1 changeTokenConsumer, TState state)
at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider..ctor(JsonConfigurationSource source)
at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
The problem is, that a wrong version of Microsoft.Extensions.FileSystemGlobbing.dll is part of the artifact (2.0.1.18051 and product version 2.0.1-rtm-10011).
It took me some hours to reproduce it and find out what is actually causing the problem.
Finally I tried to start from scratch and aligned the project in baby steps to the project which is causing the problem.
Repro steps (.NET Core 3.1 or .NET 5 does not seem to make a difference):
dotnet new mstest
Observe coverlet.collector version 1.3.0 is installed.
dotnet publish --output out-tests
Observe Microsoft.Extensions.FileSystemGlobbing.dll file version 2.0.1.18051 and product version 2.0.1-rtm-10011 in the output folder.
Update coverlet.collector to version 3.0.3 and observe Microsoft.Extensions.FileSystemGlobbing.dll file version 2.0.1.18051 and product version 2.0.1-rtm-10011 which is not the correct version anymore.
Quickly analyzing the NuGet package did not led to anything beside noticing, that it only targets netstandard1.0.
Nothing seems to have changed from 1.3.0 to 3.0.3 regarding that DLL, no scripts, nothing. I don't get what is going on.
Downgrading coverlet.collector for now.
I don't know if this is the right repo here or if I should raise the bug at coverlet.collector. It seems to me though that publish breaks it somehow, dotnet build always produces the correct version in bin\Debug.
Trying to publish a test project and execute tests within Azure Pipelines (at the bottom you can find
dotnet --info
).Getting the following, when trying to run the tests:
The problem is, that a wrong version of
Microsoft.Extensions.FileSystemGlobbing.dll
is part of the artifact (2.0.1.18051 and product version 2.0.1-rtm-10011). It took me some hours to reproduce it and find out what is actually causing the problem. Finally I tried to start from scratch and aligned the project in baby steps to the project which is causing the problem.Repro steps (.NET Core 3.1 or .NET 5 does not seem to make a difference):
Observe
coverlet.collector
version 1.3.0 is installed.Observe
Microsoft.Extensions.FileSystemGlobbing.dll
file version 2.0.1.18051 and product version 2.0.1-rtm-10011 in the output folder.Observe
Microsoft.Extensions.FileSystemGlobbing.dll
file version 3.100.1221.6909 and product version 1.1.12+4210e7... in the output folder.Update
coverlet.collector
to version 3.0.3 and observeMicrosoft.Extensions.FileSystemGlobbing.dll
file version 2.0.1.18051 and product version 2.0.1-rtm-10011 which is not the correct version anymore.Quickly analyzing the NuGet package did not led to anything beside noticing, that it only targets
netstandard1.0
. Nothing seems to have changed from 1.3.0 to 3.0.3 regarding that DLL, no scripts, nothing. I don't get what is going on. Downgradingcoverlet.collector
for now.I don't know if this is the right repo here or if I should raise the bug at
coverlet.collector
. It seems to me though thatpublish
breaks it somehow,dotnet build
always produces the correct version inbin\Debug
.❯ dotnet --info
:Cross ref., even though it's not about testing: https://github.com/dotnet/aspnetcore/issues/27675