Skip to content

Tests result file cannot be written for Windows packaged apps #1511

@jfversluis

Description

@jfversluis

On the MAUI repo we have this PR: dotnet/maui#29905

The change is simple, bump the xharness version and make the version more central. However, bumping the xharness version breaks our tests on Windows. Before I do into the details: of course Windows is not officially supported and we are using the AndroidApplicationEntryPoint to make it work for Windows, but it has always worked for us... And I think looking at the logs it still mostly works now, except for 1 thing!

We have tests running for unpackaged and packaged apps. The unpackaged apps work, its just the packaged app that doesn't work. And I think even those work, the tests seem to run it just can't write the results file because the file is in use. Which, again, only happens for packaged apps somehow.

If you have any insights, that would be greatly appreciated!

Completed categories: 1
Failed categories: 0
✓ Successfully completed categories:
- All Tests
An error occurred when executing task 'testOnly'.
Completed in 00:00:14.7502350
Error: System.IO.IOException: The process cannot access the file 'D:\a\1\a\test-results\TestResults-com_microsoft_maui_essentials_devicetests.xml' because it is being used by another process.
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode)
at System.IO.FileInfo.Open(FileMode mode, FileAccess access, FileShare share)
at Cake.Core.IO.File.Open(FileMode fileMode, FileAccess fileAccess, FileShare fileShare) in C:\projects\cake\src\Cake.Core\IO\File.cs:line 63
at Cake.Common.Xml.XmlPeekAliases.XmlPeek(ICakeContext context, FilePath filePath, String xpath, XmlPeekSettings settings) in C:\projects\cake\src\Cake.Common\Xml\XmlPeekAliases.cs:line 95
at Cake.Common.Xml.XmlPeekAliases.XmlPeek(ICakeContext context, FilePath filePath, String xpath) in C:\projects\cake\src\Cake.Common\Xml\XmlPeekAliases.cs:line 36
at Submission#0.XmlPeek(FilePath filePath, String xpath)
at Submission#0.<>b__0_26()
at Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass36_0.b__0(ICakeContext _) in C:\projects\cake\src\Cake.Core\CakeTaskBuilder.Execution.cs:line 26
at Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass39_0.b__0(ICakeContext context) in C:\projects\cake\src\Cake.Core\CakeTaskBuilder.Execution.cs:line 81
at Cake.Core.CakeTask.Execute(ICakeContext context) in C:\projects\cake\src\Cake.Core\CakeTask.cs:line 119
at Cake.Core.DefaultExecutionStrategy.ExecuteAsync(CakeTask task, ICakeContext context) in C:\projects\cake\src\Cake.Core\DefaultExecutionStrategy.cs:line 69
at Cake.Core.CakeEngine.ExecuteTaskAsync(ICakeContext context, IExecutionStrategy strategy, Stopwatch stopWatch, CakeTask task, CakeReport report) in C:\projects\cake\src\Cake.Core\CakeEngine.cs:line 318
at Cake.Core.CakeEngine.ExecuteTaskAsync(ICakeContext context, IExecutionStrategy strategy, Stopwatch stopWatch, CakeTask task, CakeReport report) in C:\projects\cake\src\Cake.Core\CakeEngine.cs:line 341
at Cake.Core.CakeEngine.ExecuteTaskAsync(ICakeContext context, IExecutionStrategy strategy, Stopwatch stopWatch, CakeTask task, CakeReport report) in C:\projects\cake\src\Cake.Core\CakeEngine.cs:line 353
at Cake.Core.CakeEngine.RunTask(ICakeContext context, IExecutionStrategy strategy, CakeTask task, String target, Stopwatch stopWatch, CakeReport report) in C:\projects\cake\src\Cake.Core\CakeEngine.cs:line 254
at Cake.Core.CakeEngine.RunTarget(ICakeContext context, IExecutionStrategy strategy, CakeTask[] orderedTasks, String target, Boolean exclusive, Stopwatch stopWatch, CakeReport report) in C:\projects\cake\src\Cake.Core\CakeEngine.cs:line 229
at Cake.Core.CakeEngine.RunTargetAsync(ICakeContext context, IExecutionStrategy strategy, ExecutionSettings settings) in C:\projects\cake\src\Cake.Core\CakeEngine.cs:line 199
at Cake.Cli.BuildScriptHost1.internalRunTargetAsync() in C:\projects\cake\src\Cake.Cli\Hosts\BuildScriptHost.cs:line 87 at Cake.Cli.BuildScriptHost1.RunTargetAsync(String target) in C:\projects\cake\src\Cake.Cli\Hosts\BuildScriptHost.cs:line 74
at Cake.Core.Scripting.ScriptHost.RunTarget(String target) in C:\projects\cake\src\Cake.Core\Scripting\ScriptHost.cs:line 110
at Submission#0.<>d__0.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray1 precedingExecutors, Func2 currentExecutor, StrongBox1 exceptionHolderOpt, Func2 catchExceptionOpt, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Scripting.Script1.RunSubmissionsAsync(ScriptExecutionState executionState, ImmutableArray1 precedingExecutors, Func2 currentExecutor, Func2 catchExceptionOpt, CancellationToken cancellationToken)
at Cake.Infrastructure.Scripting.RoslynScriptSession.Execute(Script script) in C:\projects\cake\src\Cake\Infrastructure\Scripting\RoslynScriptSession.cs:line 206
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath) in C:\projects\cake\src\Cake.Core\Scripting\ScriptRunner.cs:line 172
at Cake.Features.Building.BuildFeature.RunCore(ICakeArguments arguments, BuildFeatureSettings settings) in C:\projects\cake\src\Cake\Features\Building\BuildFeature.cs:line 99
at Cake.Features.Building.BuildFeature.Run(ICakeArguments arguments, BuildFeatureSettings settings) in C:\projects\cake\src\Cake\Features\Building\BuildFeature.cs:line 49
at Cake.Commands.DefaultCommand.Execute(CommandContext context, DefaultCommandSettings settings) in C:\projects\cake\src\Cake\Commands\DefaultCommand.cs:line 76
##[error]Cmd.exe exited with code '1'.
Finishing: Execute Test Run

Full logs are here: https://dev.azure.com/xamarin/public/_build/results?buildId=154585&view=logs&s=9bbaf420-dcf7-58b8-636e-158bdb1c7405&j=543d8166-a6f0-5956-b086-40ea6bbd176d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions