Skip to content
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

MSBuildWorkspaceLoader cannot access binlog (regression in dotnet/format tests) #70674

Closed
jjonescz opened this issue Nov 2, 2023 · 4 comments
Assignees
Labels
Area-IDE Bug IDE-Project Project system and MSBuild interactions
Milestone

Comments

@jjonescz
Copy link
Member

jjonescz commented Nov 2, 2023

[xUnit.net 00:00:15.80]     Microsoft.CodeAnalysis.Tools.Tests.MSBuild.MSBuildWorkspaceLoaderTests.CSharpTemplateProject_LoadWithNoDiagnostics(templateName: "xunit") [FAIL]
[xUnit.net 00:00:15.80]       Microsoft.Build.Framework.LoggerException : Failed to write to log file "D:\a\1\s\tests\projects\for_workspace_loader\csharp_xunit_project\csharp_xunit_project.binlog". The process cannot access the file 'D:\a\1\s\tests\projects\for_workspace_loader\csharp_xunit_project\csharp_xunit_project.binlog' because it is being used by another process.
[xUnit.net 00:00:15.80]       ---- System.IO.IOException : The process cannot access the file 'D:\a\1\s\tests\projects\for_workspace_loader\csharp_xunit_project\csharp_xunit_project.binlog' because it is being used by another process.
[xUnit.net 00:00:15.80]       Stack Trace:
[xUnit.net 00:00:15.81]            at Microsoft.Build.Logging.BinaryLogger.Initialize(IEventSource eventSource)
[xUnit.net 00:00:15.81]            at Microsoft.Build.BackEnd.Logging.LoggingService.InitializeLogger(ILogger logger, IEventSource sourceForLogger)
[xUnit.net 00:00:15.81]            at Microsoft.Build.BackEnd.Logging.LoggingService.RegisterDistributedLogger(ILogger centralLogger, LoggerDescription forwardingLogger)
[xUnit.net 00:00:15.81]            at Microsoft.Build.BackEnd.Logging.LoggingService.RegisterLogger(ILogger logger)
[xUnit.net 00:00:15.81]            at Microsoft.Build.Execution.BuildManager.CreateLoggingService(IEnumerable`1 loggers, IEnumerable`1 forwardingLoggers, ISet`1 warningsAsErrors, ISet`1 warningsNotAsErrors, ISet`1 warningsAsMessages)
[xUnit.net 00:00:15.81]            at Microsoft.Build.Execution.BuildManager.<BeginBuild>g__InitializeLoggingService|64_0()
[xUnit.net 00:00:15.81]            at Microsoft.Build.Execution.BuildManager.BeginBuild(BuildParameters parameters)
[xUnit.net 00:00:15.81]            at Microsoft.CodeAnalysis.MSBuild.Build.ProjectBuildManager.StartBatchBuild(IDictionary`2 globalProperties)
[xUnit.net 00:00:15.81]            at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.LoadAsync(CancellationToken cancellationToken)
[xUnit.net 00:00:15.81]            at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadProjectInfoAsync(String projectFilePath, ProjectMap projectMap, IProgress`1 progress, ILogger msbuildLogger, CancellationToken cancellationToken)
[xUnit.net 00:00:15.81]            at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenProjectAsync(String projectFilePath, ILogger msbuildLogger, IProgress`1 progress, CancellationToken cancellationToken)
[xUnit.net 00:00:15.81]         /_/src/Workspaces/MSBuildWorkspaceLoader.cs(54,0): at Microsoft.CodeAnalysis.Tools.Workspaces.MSBuildWorkspaceLoader.LoadAsync(String solutionOrProjectPath, WorkspaceType workspaceType, String binaryLogPath, Boolean logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken)
[xUnit.net 00:00:15.81]         /_/tests/MSBuild/MSBuildWorkspaceLoaderTests.cs(142,0): at Microsoft.CodeAnalysis.Tools.Tests.MSBuild.MSBuildWorkspaceLoaderTests.AssertProjectLoadsCleanlyAsync(String projectFilePath, ILogger logger, String[] ignoredDiagnostics)
[xUnit.net 00:00:15.81]         /_/tests/MSBuild/MSBuildWorkspaceLoaderTests.cs(114,0): at Microsoft.CodeAnalysis.Tools.Tests.MSBuild.MSBuildWorkspaceLoaderTests.AssertTemplateProjectLoadsCleanlyAsync(String templateName, String languageName, String[] ignoredDiagnostics)
[xUnit.net 00:00:15.81]         /_/tests/MSBuild/MSBuildWorkspaceLoaderTests.cs(78,0): at Microsoft.CodeAnalysis.Tools.Tests.MSBuild.MSBuildWorkspaceLoaderTests.CSharpTemplateProject_LoadWithNoDiagnostics(String templateName)
[xUnit.net 00:00:15.81]         --- End of stack trace from previous location ---
[xUnit.net 00:00:15.81]         ----- Inner Stack Trace -----
[xUnit.net 00:00:15.81]            at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
[xUnit.net 00:00:15.81]            at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
[xUnit.net 00:00:15.81]            at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
[xUnit.net 00:00:15.81]            at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
[xUnit.net 00:00:15.81]            at System.IO.FileStream..ctor(String path, FileMode mode)
[xUnit.net 00:00:15.81]            at Microsoft.Build.Logging.BinaryLogger.Initialize(IEventSource eventSource)
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Nov 2, 2023
@arunchndr arunchndr added IDE-Project Project system and MSBuild interactions and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 2, 2023
@arunchndr arunchndr added this to the 17.9 P2 milestone Nov 2, 2023
@jasonmalinowski
Copy link
Member

@jjonescz Is this still happening? I'm seeing the PR linked has green CI now, but maybe I'm looking in the wrong spot?

@jjonescz
Copy link
Member Author

jjonescz commented Jan 8, 2024

@jasonmalinowski You're right, it's not happening anymore. I don't know if the issue has been fixed or it stopped happening for an unrelated reason. Feel free to close this issue.

@jasonmalinowski
Copy link
Member

@jjonescz Do we also need to merge dotnet/format#2005?

@filzrev
Copy link

filzrev commented Feb 5, 2024

it's not happening anymore. I don't know if the issue has been fixed or it stopped happening for an unrelated reason.

When using roslyn 4.9.0-2.final or later.
It seems that the logger' argument is silently ignored. When calling OpenSolutionAsync' or `OpenProjectAsync' with the logger argument.

This behaviour change was introduced in #70469.
And currently there seems to be no way to create a binlog with MSBuildWorkspace API.

I've created a discussion relating to this issue. (#71950)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug IDE-Project Project system and MSBuild interactions
Projects
None yet
Development

No branches or pull requests

4 participants