-
Notifications
You must be signed in to change notification settings - Fork 97
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
Operation could destabilize the runtime when using the Grammar Explorer on any sample using VS 2019. #20
Comments
I found the underlying issue. In VS 2017, the default is to default to the latest "major" version of the C# language, which is 7.0. If I manually specify LangVersion 7.3 or 7.2, tests fail in both VS 2017 and VS 2019. When I run PEVerify on a bad version of the dll, it gives me 4 errors, all related to modifying 'initonly' fields outside of a constructor. I guess it's related to some optimizations that were intended to be made for readonly structs, but nothing in this project is a readonly struct, so I don't understand why the IL would be different. Ultimately I guess it's a bug in the C# compiler. Seems to be caused by dotnet/roslyn#27382. I guess for now the solution is to either:
|
Hi Jeff, thanks a lot for your observations! That's quite interesting and looks like C# bug to me, too. I guess we should try to extract a minimal reproduction case |
Hi Alexey, To clarify, the compiler that causes the problem is already released. I get exactly the same runtime exceptions if I explicitly specify LangVersion 7.2 or above, then compile in VS2017. I suppose the same will be true in any version of VS that supports the 7.2 Lang version. I followed a few links from the issue I mentioned to arrive at this closed issue: They mention that it's in the roadmap to automatically apply the option So it's an intentionally breaking change that only affects few cases (of which Irony is one). The 3rd option I didn't already mention is to use the peverify-compat feature in the project above. It's only a problem during build of the Irony project, so it's not urgent, and doesn't affect anyone consuming the already compiled package on nuget. |
Will you accept a PR for one of the above compatibility changes? It seems like the best balance between allowing newer C# features while still letting the package be marked as |
Ah, so that's worse than I thought.
Sure, thank you! 👍 |
Hey there!
I recently saw that you updated the package for .net standard, so I wanted to try it out.
Things seem to work just fine when I build and run the project in VS2017,
but when I build and run the grammar explorer in VS2019 RC1 Svc1 (latest at the time I'm logging this), I get an exception during any parse operation:
Given that this only happens with VS 2019, which is still in RC, I suppose this is a problem for them to fix, but I wanted to log it to make you aware.
For reference, I started the GrammarExplorer completely fresh, then loaded the
Irony.Samples.dll
as mentioned in the readme.I chose the c# grammar, then typed "namespace f" in the 'test' tab, which immediately triggered the exception.
The text was updated successfully, but these errors were encountered: