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

Generate-R4MVC Fails with The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: System.Management.Automation.RemoteException #79

Closed
tchelidze opened this issue Oct 26, 2017 · 6 comments

Comments

@tchelidze
Copy link

tchelidze commented Oct 26, 2017

Steps to reproduce

  • Set Startup project Language version to C# 7.1
  • Run PM> Generate-R4MVC

Error

The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: System.Management.Automation.RemoteException

Solution

Set Startup project Language version to C# lastest major version(default)

Why

After running

"C:\Users\User\.nuget\packages\r4mvc.tools\1.0.0-alpha1-00187\tools\dotnet-r4mvc.exe"

via cmd following meaningful error where produced

Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Inconsistent language versions
Parameter name: syntaxTrees
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonLanguageVersion(ImmutableArray1 syntaxTrees) at Microsoft.CodeAnalysis.CSharp.CSharpCompilation..ctor(String assemblyName, CSharpCompilationOptions options, ImmutableArray1 references, CSharpCompilation previousSubmission, Type submissionReturnType, Type hostObjectType, Boolean isSubmission, ReferenceManager referenceManager, Boolean reuseReferenceManager, SyntaxAndDeclarationManager syntaxAndDeclarations, AsyncQueue`1 eventQueue)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.Update(ReferenceManager referenceManager, Boolean reuseReferenceManager, SyntaxAndDeclarationManager syntaxAndDeclarations)
at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReplaceSyntaxTree(SyntaxTree oldTree, SyntaxTree newTree)
at R4Mvc.Tools.Services.ControllerRewriterService.RewriteControllers(CSharpCompilation compiler)
at R4Mvc.Tools.Commands.GenerateCommand.d__5.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at R4Mvc.Tools.Program.Main(String[] args)

@kevinkuszyk
Copy link
Member

Thanks for your contribution. We welcome pull requests if you would like to submit a fix.

@artiomchi
Copy link
Member

Hey @tchelidze, sorry, I'm not getting notifications for new issues.

I'm wondering if this was related the the MSBuild issues in their repo. I've recently updated the project with the latest MSBuild packages, and unfortunately I can't reproduce the bug. Could you try again with the latest builds, and tell us if it's still happening?

Thanks, and sorry for the delay in checking this out.

@tchelidze
Copy link
Author

Hey @artiomchi

Not sure what issue was related, but just updated to latest 1.0.0-alpha1-00211 version and it works.

Thanks.

@artiomchi
Copy link
Member

Hmm.. Nevermind, I just managed to reproduce it, and it is a real issue!

The exception will only be thrown if the code generator actually tries to change any of the controller generated files. So if the generated files are up to date, everything's fine. Seems like Microsoft's CSharpSyntaxRewriter class generates code with the c# 7 syntax by default, not checking what version was set in syntax nodes that I feed it.

Now that I can reproduce it, I can see what I can do about fixing it!

@romanreal89
Copy link

Hi! Sorry but , I have tha same error.... with version v1.0.0-alpha2-00365
What can I do, to fix it?
Thank you!

PM> Generate-R4MVC -verbose
R4Mvc Generator Tool v1.0.0-alpha2-00365
Using: Visual Studio Professional 2017 - 15.9.28307.858
Project: E:\Projects\Git Vero.Tenders\Vero.TendersNetCore.Web\Vero.TendersNetCore.Web.csproj
Creating Workspace ...
Loading project ...
Compiling project ...
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: System.Management.Automation.RemoteException

@TorreyGarland
Copy link

Same error:

VS 2019 v 16.3.10

MVC Core 3.0 Project

PM> generate-r4mvc
R4Mvc Generator Tool v1.0.0-alpha2-00369

Using: Visual Studio Community 2017 - 15.9.28307.718
Project: C:\Users\torre\source\Highway1\Trunk\Highway1.Web\Highway1.Web.csproj

Creating Workspace ...
Loading project ...
Compiling project ...
The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: System.Management.Automation.RemoteException

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

No branches or pull requests

5 participants