Skip to content

CreateAppHost on a locked file takes much longer to fail in net6 than it did in net5 #51771

Open
@marcpopMSFT

Description

@marcpopMSFT

Description

The SDK team has a test that verifies retrying when there is an apphost creation failure:
https://github.com/dotnet/sdk/blob/a30e465a2e2ea4e2550f319a2dc088daaafe5649/src/Tests/Microsoft.NET.Build.Tests/AppHostTests.cs#L257

From digging into our test timing data, this test is now taking > 2 minutes. This appears to be because HostWriter.CreateAppHost is taking ~60 seconds to fail. I verified the issue is in CreateAppHost by creating a small console app that called that and found it was near instance to trigger the exception with a copy of Microsoft.Net.HostModel.dll from 5.0.202 and very long time with 6.0.100-preview 4 SDK.

Below is simple repro I pulled while paused in the test (ie the test is holding a lock on hte apphost)

var IntermediateAssembly = "d:\\repos\\sdk\\artifacts\\tmp\\Debug\\It_retries_on-- - EA39C758\\RetryAppHost\\obj\\Debug\\net5.0\\RetryAppHost.dll";
var AppHostDestinationPath = "d:\\repos\\sdk\\artifacts\\tmp\\Debug\\It_retries_on---EA39C758\\RetryAppHost\\obj\\Debug\\net5.0\\apphost.exe";
var AppBinaryName = "RetryAppHost.dll";
var isGUI = true;
var resourcesAssembly = IntermediateAssembly;

 HostWriter.CreateAppHost(appHostSourceFilePath: AppHostSourcePath,
              appHostDestinationFilePath: AppHostDestinationPath,
               appBinaryFilePath: AppBinaryName,
               windowsGraphicalUserInterface: isGUI,
               assemblyToCopyResorcesFrom: resourcesAssembly);

Configuration

Windows, x64.

Regression?

Regression from 5.0

Data

Test timing comparing a recent run in main vs. 5.0.3xx branches shows 124 seconds for main for the test and 11 seconds for 5.0.3xx.

https://dev.azure.com/dnceng/public/_build/results?buildId=1105065&view=ms.vss-test-web.build-test-results-tab&runId=33748752&resultId=100507&paneView=debug
https://dev.azure.com/dnceng/public/_build/results?buildId=1104827&view=ms.vss-test-web.build-test-results-tab&runId=33743876&resultId=100183&paneView=debug

While this is a failure scenario, taking a whole minute to fail is a poor customer experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions