System.Exception: Restore operation failed.
See original GitHub issueWhen running dotnet format style -v diag
i get an exception as follows:
The dotnet runtime version is '6.0.3'.
The dotnet CLI version is '6.0.103'.
Using MSBuild.exe located in 'C:\Program Files\dotnet\sdk\6.0.201\'.
Formatting code files in workspace 'D:\code\work\platform\apps\ciri\Ciri.sln'.
Loading workspace.
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.FormatStyleCommand.FormatStyleHandler.InvokeAsync(InvocationContext context) at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass27_0.<<UseVersionOption>b__1>d.MoveNext()--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__24_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseDebugDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()
dotnet format --version
results with 6.0.252703+68bc36719088c86b0ff01334039b0611741b8276
Also, this issue does not appear when running under CI with the same repo.
Any guidance on how I might be able to investigate further?
Issue Analytics
- State:
- Created a year ago
- Reactions:15
- Comments:8 (1 by maintainers)
Top Results From Across the Web
"System Restore Operation Failed" Error Message When ...
This behavior occurs because you are attempting to restore the oldest version of the saved registries. The maximum number of registries is already...
Read more >c# - Microsoft.CodeAnalysis.CSharp and ...
sln . But after formatting I got that error: Analysis complete in 2554ms. Unhandled exception: System.Reflection.ReflectionTypeLoadException: ...
Read more >SCV restore operation fails with the error "Exception while ...
SCV restore operation fails with the error "Exception while calling pre-restore on SCV: Error mounting cloned LUN as datastore"
Read more >SCV Guest File Restore operation failing with error ...
Issue. Guest File Restore operation failing. SnapCenter and vCenter Monitor showing the that disk has been mounted.
Read more >After completing a restore operation, connecting from the GUI ...
A server error has occurred. Reported error message: couldn't connect to host . Cause. The cause for this issue is not known. Solution....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Does running
dotnet restore
work from the commandline? At the moment format is invoking that command as the restore operation.As a workaround you can pass the
--no-restore
flag to dotnet-format. You may need to add a CI step to perform thedotnet restore
prior to running format.It was working fine for me with SDK 6.0.100 but then, when I updated to 6.0.201, it started giving out errors. I then installed the global tool
dotnet-format
and it gave more errors. Now, even if I uninstalled the global tool and reverted myglobal.json
to 6.0.100, it wouldn’t work anymore. Same error as this issue.