question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Operation could destabilize the runtime when using the Grammar Explorer on any sample using VS 2019.

See original GitHub issue

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:

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:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dammejedcommented, Mar 13, 2019

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:

  1. Specify <LangVersion>7.1</LangVersion> or below in the 010.Irony project. Or
  2. Remove the SecurityTransparent assembly attribute from the same project.
0reactions
yalliecommented, Mar 13, 2019

To clarify, the compiler that causes the problem is already released.

Ah, so that’s worse than I thought.

Will you accept a PR for one of the above compatibility changes? Locally, I simply added <Features>peverify-compat</Features>

Sure, thank you! 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found