Skip to content

chore(csharp): enable formatting check via dotnet format#4351

Merged
CurtHagenlocher merged 2 commits into
apache:mainfrom
CurtHagenlocher:dotnet_format
Jun 1, 2026
Merged

chore(csharp): enable formatting check via dotnet format#4351
CurtHagenlocher merged 2 commits into
apache:mainfrom
CurtHagenlocher:dotnet_format

Conversation

@CurtHagenlocher

Copy link
Copy Markdown
Contributor

No description provided.

@CurtHagenlocher CurtHagenlocher requested a review from lidavidm as a code owner June 1, 2026 18:04
Comment thread csharp/test/Apache.Arrow.Adbc.Tests/TestBase.cs Outdated
@CurtHagenlocher CurtHagenlocher merged commit ffa5f0a into apache:main Jun 1, 2026
13 checks passed
@lidavidm

lidavidm commented Jun 4, 2026

Copy link
Copy Markdown
Member

This always fails for me:

C# Format.....................................................................................Failed
- hook id: dotnet-format
- exit code: 1

Unhandled exception: System.Exception: Restore operation failed.
   at Microsoft.CodeAnalysis.Tools.CodeFormatter.OpenMSBuildWorkspaceAsync(String solutionOrProjectPath, WorkspaceType workspaceType, Boolean noRestore, Boolean requiresSemantics, String binaryLogPath, Boolean logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, String binaryLogPath)
   at Microsoft.CodeAnalysis.Tools.FormatCommandCommon.FormatAsync(FormatOptions formatOptions, ILogger`1 logger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.Commands.RootFormatCommand.FormatCommandDefaultHandler.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
   at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)

Does it need to be always_run or can we have it only trigger on *.cs files?

@CurtHagenlocher

Copy link
Copy Markdown
Contributor Author

This always fails for me:

I think this is because of the projects in the submodule that are referenced by the solution; my guess is that they haven't been fetched when this is run then we get the error because the project references can't be resolved. I tried changing something to address that problem and the subsequent build was successful so I assumed it had worked -- apparently not :(.

Does it need to be always_run or can we have it only trigger on *.cs files?

It could just trigger when there's a change in .cs files or in the csharp subdirectory, but I suspect if it's failing for you then it's probably going to fail for C# changes as well. Is there some other way to force the submodules to be resolved before this hook is run?

Once the next version of the Apache.Arrow.Adbc package ships, we can get rid of the submodule and change the ProjectReferences to PackageReferences.

@lidavidm

lidavidm commented Jun 4, 2026

Copy link
Copy Markdown
Member

Ah, if it's temporary then it's not a big deal. It's just that it fails even when I'm not touching C# at all, which surprised me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants