dotnet / dotnet/msbuild

Re-enable tests that dispose the InProcNodeProvider

Open
#515 1 comment 0 reactions 0 assignees View on GitHub
.NET Core CoreCLR-test triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

Various tests dispose the `NodeProviderInProc` instance from the global component host in the following fashion:

``` C#
// Since we're creating our own BuildManager, we need to make sure that the default
// one has properly relinquished the inproc node
NodeProviderInProc nodeProviderInProc = ((IBuildComponentHost)BuildManager.DefaultBuildManager).GetComponent(BuildComponentType.InProcNodeProvider) as NodeProviderInProc;
if (nodeProviderInProc != null)
{
nodeProviderInProc.Dispose();
}
```

This tends to cause failures in other unrelated tests that end up trying to use the disposed instance, generally surfacing as a null reference, for example:

```
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Build.BackEnd.NodeProviderInProc.InProcNodeEndpoint_OnLinkStatusChanged(INodeEndpoint endpoint, LinkStatus status) in c:\git\msbuild\src\XMakeBuildEngine\BackEnd\Components\Communications\NodeProviderInProc.cs:line 417
at Microsoft.Build.BackEnd.NodeEndpointInProc.RaiseLinkStatusChanged(LinkStatus newStatus) in c:\git\msbuild\src\XMakeBuildEngine\BackEnd\Components\Communications\NodeEndpointInProc.cs:line 261
at Microsoft.Build.BackEnd.NodeEndpointInProc.ChangeLinkStatus(LinkStatus newStatus) in c:\git\msbuild\src\XMakeBuildEngine\BackEnd\Components\Communications\NodeEndpointInProc.cs:line 319
at Microsoft.Build.BackEnd.NodeEndpointInProc.SetPeerNodeConnected() in c:\git\msbuild\src\XMakeBuildEngine\BackEnd\Components\Communications\NodeEndpointInProc.cs:line 279
at Microsoft.Build.BackEnd.NodeEndpointInProc.Listen(INodePacketFactory factory) in c:\git\msbuild\src\XMakeBuildEngine\BackEnd\Components\Communications\NodeEndpointInProc.cs:line 176
at Microsoft.Build.BackEnd.InProcNode.Run(Exception& shutdownException) in c:\git\msbuild\src\XMakeBuildEngine\BackEnd\Node\InProcNode.cs:line 155
```

For now, I am disabling all these tests. We may want to go back and find a better way to test this behavior or just delete the tests.

Instances of this include:
- `Scheduler_Tests`
- `TargetEntry_Tests.AfterTargetsShouldReportFailedBuild`
- `SolutionProjectGenerator_Tests.BadFrameworkMonkierExpectBuildToFail`
- `SolutionProjectGenerator_Tests.BadFrameworkMonkierExpectBuildToFail2`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.