-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebHostBuilder.ConfigureServices method not found when using nunit3testadapter 4.4.0 #1065
Comments
We are having the same issue but not using WireMock |
@iamzhaoxu Can you add a small repro project ? |
@OsirisTerje Packages Used: |
@Merlijnv Ok, then can you also provide a small repro for your case? |
It's not just this, we are getting method not found exceptions across many of our repos on many different methods.
etc, where the only change is NUnit3TestAdapter 4.3.1 being updated to 4.4.0 This certainly affects .NET 6.0 projects, and may also affect other target frameworks. |
@ghelyar Understand, but please give us a small repro project. Our own test projects works. I don't doubt you all have found something, but we need a repro. |
I'm working to get a simple repro now. It looks like it may only happen on Linux, as I can repro in CI and in WSL but not on Windows so far. It also looks like it might be something to do with tests for asp.net core projects and framework references to asp.net core (e.g. project under test has |
We are also referencing a asp.net project and running Linux pipeline in Azure Devops. Maybe @OsirisTerje could reproduce it that way? |
I have added a repro project using Wiremock.net (sample from wiremock.net), see https://github.com/nunit/nunit3-vs-adapter.issues/tree/master/Issue1065/wiremocktests This repro works, on my Windows machine. I am also using 4.4.0 on a work project with asp.net core and have no issues there. Please also be aware that the adapter have no connections to asp.net core at all, so if it is affected by that, it has to be some sideffects of something. |
I can confirm we have the same issues here as well, our error message is different though:
|
@martin-shields-sage Repro ? And, can you check this using the NUnit.Console ? Also, Windows or Linux? |
I am using WSL (Ubuntu), just debugging through now to see why it is happening exactly |
Here's a simple repro of one of the cases I have seen: replace underscores in the file names with slashes for the directory structure. run works with 4.3.1, fails with 4.4.0 on Linux works with both 4.3.1 and 4.4.0 on Windows It's also possible that rather than OS it's actually which SDKs are installed etc, but I have not been able to narrow that down yet. |
@ghelyar Thanks! What does |
@ghelyar I do get a failure, but not the same one: And it works on Windows, but not on WSL, so thanks! Then I have something to work on. |
Same error here. Multitarget project fails with NUnit3TestAdapater 4.4.0 fails with .net6.0 on linux and works fine on windows. Example error with 4.4.0 on linux with .net6.0
Using NUnit3TestAdapter 4.3.1 everything works like a charm (.net7.0.201, net6.0.14 on linux and windows) |
This is actually the same error I was getting, it's just the 3rd error in my original message:
and then wrapped in an assert throws because I used an exception to cut the repro short. here's another, even simpler repro: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.0" />
<PackageReference Include="System.Text.Json" Version="7.0.2" />
</ItemGroup>
</Project> using NUnit.Framework;
namespace tests;
[TestFixture]
public class Class1
{
[Test]
public void Test()
{
var options = new System.Text.Json.JsonSerializerOptions()
{
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};
}
} This one fails on both Windows and Linux for me on NUnit3TestAdapter 4.4.0, but passes on NUnit3TestAdapter 4.3.1 for both.
However, it only fails if I include System.Text.Json 7.x as a package reference on a .NET 6 project. If I just let it use the framework's built in System.Text.Json, or use the package version 6.0.7, it works fine on NUnit3TestAdapter 4.4.0. The |
apologies for jumping in again, debugging through my issue I get stuck at the point where the exception is thrown, looking at the inner exception it looks like the adapter attempts to load in assemblies
the assembly it is looking for is |
Hi, @OsirisTerje I noticed
|
@iamzhaoxu @ghelyar @nesc58 @martin-shields-sage @Merlijnv |
@OsirisTerje Can confirm the fix works locally. |
For me it works with the 4.4.1-alpha.1. I have another question: |
@OsirisTerje can confirm here this works locally for me as well |
It also works locally for me |
@dickwolff @nesc58 @martin-shields-sage @ghelyar Thanks for confirming!
This comes from the NUnit.Engine 3.16.2 and is used to load deps.json files. It looks like this is the reason for the reflection load issues. In the new alpha it is removed, since the alpha is based on a dev version 3.15.3 of the engine. So, short answer, it is probably the reason for the crashes, and yes, it is removed. That said, in order to get out a 4.4.1 we need to release an engine 3.15.3 first. I'll get that process started first, and hope to have this done real soon. |
Hotfix version 4.4.2, nearly identical to the alpha version attached yesterday, is now released. The difference from the attached version is that the Microsoft.Extensions.DependencyModel is not include in the adapter package. It is not needed there, so it was removed. The release notes is here https://docs.nunit.org/articles/vs-test-adapter/AdapterV4-Release-Notes.html (includes some more explanations) and the package is uploaded to nuget https://www.nuget.org/packages/NUnit3TestAdapter/4.4.2. Thanks, everyone for reporting and providing repros! |
Describe the bug
I try to update the WireMock.Net to 1.5.17 and the nunit3testadapter to 4.4.0 in the test project and I got an exception when starting the wiremock as below
System.MissingMethodException : Method not found: 'Microsoft.AspNetCore.Hosting.IWebHostBuilder Microsoft.AspNetCore.Hosting.IWebHostBuilder.ConfigureServices(System.Action
1<Microsoft.Extensions.DependencyInjection.IServiceCollection>)'. StackTrace: at WireMock.Owin.AspNetCoreSelfHost.StartAsync() at WireMock.Server.WireMockServer..ctor(WireMockServerSettings settings) at WireMock.Server.WireMockServer.Start(Nullable
1 port, Boolean ssl)Error Message:
OneTimeSetUp: System.MissingMethodException : Method not found: 'Microsoft.AspNetCore.Hosting.IWebHostBuilder Microsoft.AspNetCore.Hosting.IWebHostBuilder.ConfigureServices(System.Action
1<Microsoft.Extensions.DependencyInjection.IServiceCollection>)'. Stack Trace: Failed WhenGetArticles_GivenApiReturnTwoErrorResponses_ShouldRetry [54 ms] Error Message: OneTimeSetUp: System.MissingMethodException : Method not found: 'Microsoft.AspNetCore.Hosting.IWebHostBuilder Microsoft.AspNetCore.Hosting.IWebHostBuilder.ConfigureServices(System.Action
1<Microsoft.Extensions.DependencyInjection.IServiceCollection>)'.Stack Trace:
Failed WhenGetArticles_GivenQueryMoreThanBatchSize_ShouldReturnExpected [54 ms]
Error Message:
OneTimeSetUp: System.MissingMethodException : Method not found: 'Microsoft.AspNetCore.Hosting.IWebHostBuilder Microsoft.AspNetCore.Hosting.IWebHostBuilder.ConfigureServices(System.Action`1<Microsoft.Extensions.DependencyInjection.IServiceCollection>)'.
Stack Trace: ....
After I downgrade the nunit3testadapter 4.4.0 back to 4.3.1 then the same test worked again. I am not sure this is issue from WireMock and Nunit3TestAdpter and thereby I raised this issue in both projects.
I heard that WebHostBuilder was depreciated dotnet/aspnetcore#20964 before but I still can see the .NET 7 still try to support it from https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilder.-ctor?view=aspnetcore-7.0.
Expected behaviour:
I will expect the latest of WireMock.Net should work with the latest nunit3testadapter
Test to reproduce
1 Refence WireMock.Net 1.5.17 and nunit3testadapter 4.4.0 in the same test project
The text was updated successfully, but these errors were encountered: