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

dotnet format tests are failing in main #3004

Closed
MichaelSimons opened this issue Aug 22, 2022 · 13 comments
Closed

dotnet format tests are failing in main #3004

MichaelSimons opened this issue Aug 22, 2022 · 13 comments
Assignees
Labels
area-testing Improvements in CI and testing

Comments

@MichaelSimons
Copy link
Member

Failing CI build (internal Microsoft link)

System.InvalidOperationException : Failed to execute /tarball/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net7.0/.dotnet/dotnet format /tarball/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net7.0/projects-202208192259567698/FormatProject/FormatProject.csproj
Exit code: 3

Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer.

This last passed CI on dotnet/installer@319773e. There were a few commits after that before the next failing CI run on dotnet/installer@d117d57.

@MichaelSimons
Copy link
Member Author

Underlying issue has been resolved, closing.

Repository owner moved this from Blocked to Done in .NET Source Build Sep 7, 2022
@badsyntax
Copy link

@MichaelSimons what was the underlying issue? how did you solve this?

@MichaelSimons
Copy link
Member Author

I'm not sure why this was closed. Trying this today I still see the issue in main and the source-build unit test is still disabled. re-opening.

@MichaelSimons MichaelSimons reopened this Jan 12, 2023
@MichaelSimons MichaelSimons moved this from Done to 8.0 Preview 1 in .NET Source Build Jan 12, 2023
@MichaelSimons
Copy link
Member Author

This seems related to dotnet/format#1785

@MichaelSimons MichaelSimons moved this from 8.0 Preview 1 to 8.0 Preview 2 in .NET Source Build Feb 13, 2023
@MichaelSimons MichaelSimons moved this from 8.0 Preview 2 to Blocked in .NET Source Build Feb 16, 2023
@MichaelSimons
Copy link
Member Author

I tried running the dotnet format tests and it appears a ref assemblies is being loaded. This needs to be addressed for .NET 8.0

     System.InvalidOperationException : Failed to execute /repos/dotnet2/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/.dotnet/dotnet format /repos/dotnet2/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/projects-202307311948161538/FormatProject/FormatProject.csproj
  Exit code: 1
  
  Unhandled exception: System.BadImageFormatException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Reference assemblies cannot be loaded for execution. (0x80131058)
  File name: 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' ---> System.BadImageFormatException: Cannot load a reference assembly for execution.
     at Microsoft.CodeAnalysis.Tools.Commands.RootFormatCommand.FormatCommandDefaultHandler.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
     at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
     at Microsoft.CodeAnalysis.Tools.Commands.RootFormatCommand.FormatCommandDefaultHandler.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
     at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
    Stack Trace:
       at Microsoft.DotNet.SourceBuild.SmokeTests.ExecuteHelper.ValidateExitCode(ValueTuple`3 result, Int32 expectedExitCode) in /repos/dotnet2/test/Microsoft.DotNet.SourceBuild.SmokeTests/ExecuteHelper.cs:line 125
     at Microsoft.DotNet.SourceBuild.SmokeTests.DotNetHelper.ExecuteCmd(String args, String workingDirectory, Action`1 processConfigCallback, Nullable`1 expectedExitCode, Int32 millisecondTimeout) in /repos/dotnet2/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs:line 118
     at Microsoft.DotNet.SourceBuild.SmokeTests.DotNetFormatTests.FormatProject() in /repos/dotnet2/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetFormatTests.cs:line 34
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
     at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
    Standard Output Messages:
   Executing: /repos/dotnet2/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/.dotnet/dotnet new console --name FormatProject --output /repos/dotnet2/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/projects-202307311948161538/FormatProject --language "C#" 
   Executing: /repos/dotnet2/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/.dotnet/dotnet format /repos/dotnet2/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/projects-202307311948161538/FormatProject/FormatProject.csproj

@MichaelSimons MichaelSimons moved this from Blocked to 8.0 RC1 in .NET Source Build Jul 31, 2023
@MichaelSimons MichaelSimons moved this from 8.0 RC1 to In Progress in .NET Source Build Aug 3, 2023
@MichaelSimons
Copy link
Member Author

Fixed with dotnet/installer#17238

@github-project-automation github-project-automation bot moved this from In Progress to Done in .NET Source Build Aug 23, 2023
@mthalman
Copy link
Member

The fix from dotnet/installer#17238 didn't pass in the internal CI run. It's failing on the Alpine leg:

System.InvalidOperationException : Failed to execute /vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/.dotnet/dotnet format /vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/projects-202308231449174553/FormatProject/FormatProject.csproj
Exit code: 3


Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer.

@mthalman mthalman reopened this Aug 23, 2023
@mthalman mthalman moved this from Done to In Progress in .NET Source Build Aug 23, 2023
@NikolaMilosavljevic
Copy link
Member

The fix from dotnet/installer#17238 didn't pass in the internal CI run. It's failing on the Alpine leg:

System.InvalidOperationException : Failed to execute /vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/.dotnet/dotnet format /vmr/test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/Release/net8.0/projects-202308231449174553/FormatProject/FormatProject.csproj
Exit code: 3


Unable to locate MSBuild. Ensure the .NET SDK was installed with the official installer.

Well, this is odd. I'll test this locally to understand why it doesn't work on Alpine.

@NikolaMilosavljevic
Copy link
Member

This seems like another issue with MSBuildLocator - on Alpine it's not finding hostfxr library which is used for discovery of SDK/MSBuild paths.

@mthalman @MichaelSimons should we condition this test to not run on Alpine?

@MichaelSimons
Copy link
Member Author

@mthalman @MichaelSimons should we condition this test to not run on Alpine?

Yes and link to a product issue.

@NikolaMilosavljevic
Copy link
Member

@mthalman @MichaelSimons should we condition this test to not run on Alpine?

Yes and link to a product issue.

Where would the comment/link go - vmr yaml file (this is where we condition OmniSharp tests - https://github.com/dotnet/installer/blob/6fa2d3d9a6b9c445d396080845c375dc5b5480a4/eng/pipelines/templates/stages/vmr-build.yml#L85) or source file for dotnet-format tests?

@MichaelSimons
Copy link
Member Author

I would say the build definition. We should also have a tracking issue on our side that links to the product issue so that we re-enable this test.

@NikolaMilosavljevic
Copy link
Member

Fixed with dotnet/installer#17238 and conditioned the Alpine leg with dotnet/installer#17247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-testing Improvements in CI and testing
Projects
Archived in project
Development

No branches or pull requests

4 participants