Operation could destabilize the runtime when using the Grammar Explorer on any sample using VS 2019.
See original GitHub issueHey 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:
System.Security.VerificationException: Operation could destabilize the runtime.
at Irony.Parsing.ParsingContext.ComputeStackRangeSpan(Int32 nodeCount)
at Irony.Parsing.ReduceParserAction.GetResultNode(ParsingContext context)
at Irony.Parsing.ReduceParserAction.Execute(ParsingContext context)
at Irony.Parsing.Parser.ExecuteNextAction()
at Irony.Parsing.Parser.ParseAll()
at Irony.Parsing.Parser.Parse(String sourceText, String fileName)
at Irony.Parsing.Parser.Parse(String sourceText)
at Irony.WinForms.Highlighter.EditorAdapter.ParseSource(String newText) in C:\Enablon\Irony\Irony.WinForms\Highlighter\EditorAdapter.cs:line 79
at Irony.WinForms.Highlighter.EditorAdapter.ParserLoop() in C:\Enablon\Irony\Irony.WinForms\Highlighter\EditorAdapter.cs:line 119
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.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
"Operation could destabilize the runtime" and PEVerify ...
After compiling my app in VS2019 RC (no changes from the 2017 version, and same .NET target) I started getting “Operation could destabilize...
Read more >Json.NET + VerificationException Operation could ...
This exception can occur when you have Visual Studio Ultimate and IntelliTrace activated. Try to add Newtonsoft.dll on IntelliTrace ignore list:.
Read more >UI & Interaction Components
VerificationException (operation could destabilize the runtime) is thrown when the source code is rebuilt using VS 2019. Spreadsheet.
Read more >Operation could destabilize the runtime error profiling ASP. ...
When profiling an ASP.NET web application, the following error may appear in the web browser window: Operation could destabilize the runtime.
Read more >Users Guide - Appeon InfoMaker® 2019 R2
1.1 About InfoMaker. InfoMaker is a reporting tool. InfoMaker is a powerful and easy-to-use reporting tool that lets you query databases and.
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 Free
Top 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
I found the underlying issue. The difference between VS 2017 and VS 2019 is the default
LangVersion
selection behavior.In VS 2017, the default is to default to the latest “major” version of the C# language, which is 7.0. In VS 2019, the default for SDK projects (which the Irony project now is), is latest “minor”, which is 7.3.
If I manually specify LangVersion 7.3 or 7.2, tests fail in both VS 2017 and VS 2019. If I manually specify LangVersion 7.1 or 7.0, tests again pass in either version of visual studio.
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 https://github.com/dotnet/roslyn/issues/27382.
I guess for now the solution is to either:
SecurityTransparent
assembly attribute from the same project.Ah, so that’s worse than I thought.
Sure, thank you! 👍