-
Notifications
You must be signed in to change notification settings - Fork 24
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
Enable Profiler in WebApplicationFactory cause DI error #186
Comments
Hi sloncho, thanks for reporting the error. https://github.com/xiaomi7732/Profiler-WebApplicationFactory-tests-troubleshooting and help me understand the difference between that project and yours and why there is no issue on my side. Command logs FYI: PS D:\Demo\ProfilerWithWebApplicationFactory\UnitTestsNet3> dotnet test
CSC : warning CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Users\user\.nuget\packages\system.text.json\6.0.1\analyzers\dotnet\roslyn3.11\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [D:\Demo\ProfilerWithWebApplicationFactory\UnitTestsNet3\UnitTestsNet3.csproj]
CSC : warning CS8032: An instance of analyzer System.Text.Json.SourceGeneration.JsonSourceGenerator cannot be created from C:\Users\user\.nuget\packages\system.text.json\6.0.1\analyzers\dotnet\roslyn4.0\cs\System.Text.Json.SourceGeneration.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [D:\Demo\ProfilerWithWebApplicationFactory\UnitTestsNet3\UnitTestsNet3.csproj]
Test run for D:\Demo\ProfilerWithWebApplicationFactory\UnitTestsNet3\bin\Debug\netcoreapp3.1\UnitTestsNet3.dll(.NETCoreApp,Version=v3.1)
Microsoft (R) Test Execution Command Line Tool Version 16.7.1
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Test Run Successful.
Total tests: 2
Passed: 2
Total time: 9.8030 Seconds
PS D:\Demo\ProfilerWithWebApplicationFactory\UnitTestsNet3> |
Since the process id, in this case, isn't critical to have, I have a workaround baked into the next release. ETA to ship with 2.5.1. |
@sloncho, just so that you know, the workaround should have been released in this beta package: |
Stable package released: https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.5.1 |
This is reported in #182. Since it looks like a different bug, I moved it here.
Basically, sloncho reported that Enabling Profiler in WebApplicationFactory scenario breaks the DI graph due to lack of process id.
Here's the attached callstack:
This is initially found on 2.5.0. I have a hunch that it is due to the fix of #140 and #167. I'll investigate.
The text was updated successfully, but these errors were encountered: