dotnet / dotnet/format

Changing compilation options is not supported

Open
#1,768 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

@JoeRobich

With the following command line, it always fails us since we have moved from .NET 6.0.403 SDK to .NET 7.0.100 SDK:

```
dotnet format --severity info --verbosity diagnostic Solution.sln
```

I have omitted sensitive information.

```
Fixing diagnostics...
Running 1 analyzers on Project1.
Running 1 analyzers on Project2.
Running 1 analyzers on Project3.
Running 1 analyzers on Project4.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Failed to apply code fix CSharpPreferHashDataOverComputeHashFixer for CA1850: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax'.
Complete in 754ms.
Analysis complete in 7001ms.
Complete in 14173ms.
Formatted code file 'D:\MyPath\MyFile1.cs'.
Formatted code file 'D:\MyPath\MyFile2.cs'.
Formatted code file 'D:\MyPath\MyFile3.cs'.
Formatted code file 'D:\MyPath\MyFile4.cs'.
Formatted code file 'D:\MyPath\MyFile4.cs'.
Formatted code file 'D:\MyPath\MyFile6.cs'.
Unhandled exception: System.NotSupportedException: Changing compilation options is not supported.
at Microsoft.CodeAnalysis.Workspace.CheckAllowedProjectChanges(ProjectChanges projectChanges)
at Microsoft.CodeAnalysis.Workspace.CheckAllowedSolutionChanges(SolutionChanges solutionChanges)
at Microsoft.CodeAnalysis.Workspace.TryApplyChanges(Solution newSolution, IProgressTracker progressTracker)
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.TryApplyChanges(Solution newSolution, IProgressTracker progressTracker)
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.TryApplyChanges(Solution newSolution)
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(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass21_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c.<b__17_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass15_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c.<b__4_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.CommandLineBuilderExtensions.<>c__DisplayClass7_0.<b__0>d.MoveNext()
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.