-
Notifications
You must be signed in to change notification settings - Fork 316
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
Coverlet in-proc data collector may crash with access violation because the type is null #2978
Comments
The data collector settings are: <title>Document</title>
|
The runsettings file used was:
|
I'm guessing that coverlet.collector.dll isn't loaded or found. Note the version of coverlet.collector.dll in RunSettings is 1.0.0.0, but the actual version on my machine is 1.3.0.0. It needs to do more detailed logging here: vstest/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs Line 162 in 92f2100
The PATH environment variable contents is:
Not sure where it's supposed to find coverlet.collector.dll from. |
This seems like a relevant doc: |
Is there no way to disable the in-proc coverlet collector? Why is it running? We're not passing |
This also seems related: the 100 ms timeout issue again |
Can you try to remove from runsettings the section Coverlet collectors(out/in process) were introduced as workaround for the First version of Coverlet was implemented with msbuild tasks and it's supported yet. For this reason @vagisha-nidhi wrote the first version of collectors. Out of process collector does the instrumentation as usual, in-process collector ensure that flush to file be done. Adding the in-process collector is the key to orchestrate the "shutdown" in a correct way being "orchestrated" by VSTest platform. Current implementation inside VSTest injects the inprocess collector during startup with a custom argument processor. The result is something like https://github.com/microsoft/vstest/blob/main/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs#L263 The problem could be that the inprocess collector section is created manually and the codebase is not the path the adapter and so collector dll is not found. The path is created by processor here https://github.com/microsoft/vstest/blob/main/src/vstest.console/Processors/CollectArgumentProcessor.cs#L131 and should point to local nuget folder. The code below was added because we cannot use the assembly qualified name with a "fixed version"(I discovered this bug after first release) and so we need to search the type manually and to avoid to load types on runsettings in-proc injection generation inside argument processor we fixed here vstest/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs Lines 74 to 83 in 92f2100
The reason to move to 30sec is to prevent this issue and in that case we could avoid to use collectors at all and stick with msbuild that supports also more feature because is not limited by VSTest rules/semantics(it's not clear to me why it's not possible in case of stop click on ide exit immediately with a cancellation token source or something like that, but I don't have any idea on current implementation so I think there is a good reason). Another planned thing is to change completely how coverlet collect the hits and use a shared memory with a sidecar process so in case of crash we don't lose the hits. But this change is "huge" and time consuming. FYI some details here coverlet-coverage/coverlet#808 |
Related: #2599 (comment) |
I have made a PR that adds a PackageReference to I think one thing that can be improved is a better error message if coverlet.collector can't be found. |
Also we don't have a RunSettings file at all, the RunSettings XML that I pasted earlier I'm guessing was the default or generated one I think? Interesting why the in-proc collector was enabled by default. |
Mmm I think that this could happen if we're passing in some way |
We are investigating crashes during CI for an internal repo (VSLanguageServerClient), where the stack looks like this:
The
dataCollectorType
is null here:vstest/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs
Line 104 in 92f2100
The way
dataCollectorType
is assigned using Reflection is flaky:vstest/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs
Lines 74 to 83 in 92f2100
There is no validation if the type can't be found:
vstest/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs
Lines 89 to 90 in 92f2100
As a result the test run will crash and disappear with no symptoms other than the "Test host process crashed".
The dumps are available internally, ping KirillO.
The text was updated successfully, but these errors were encountered: