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.

AccessViolationException with MenuStrip and VisualStyleState.NoneEnabled

See original GitHub issue
  • .NET Core Version: .NET Core Version: 3.0.0-preview7-27912-14
  • Have you experienced this same bug with .NET Framework?: No

Problem description: When you disable visual stiles:

            Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;
//          Application.EnableVisualStyles();

The winForms mdi app with MenuStrip ans submenus are crushed with AccessViolationException, after you open sub menu and live it (move cursor out of the menu - see gif below). Windows 7 pro x64.

Actual behavior:

Exception, Event logs, Gif of the error

nc

AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Application: WinFormsCoreTest.exe
CoreCLR Version: 4.700.19.32702
.NET Core Version: 3.0.0-preview7-27912-14
Description: The process was terminated due to an internal error in the .NET Runtime at IP 000007FEC76FA8D4 (000007FEC7540000) with exit code c0000005.
Faulting application name: WinFormsCoreTest.exe, version: 1.0.0.0, time stamp: 0x5d29536d
Faulting module name: coreclr.dll, version: 4.700.19.32702, time stamp: 0x5d155e43
Exception code: 0xc0000005
Fault offset: 0x00000000001ba8d4
Faulting process id: 0x248c
Faulting application start time: 0x01d54f9f444a10b0
Faulting application path: D:\save\projects\WinFormsCoreTest\bin\Debug\netcoreapp3.0\WinFormsCoreTest.exe
Faulting module path: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.0.0-preview7-27912-14\coreclr.dll
Report Id: b32877c1-bb92-11e9-8c38-40b0760b80f2

Expected behavior: No AccessViolationException.

Minimal repro: WinFormsCoreTest.zip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:21 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
RussKiecommented, Aug 13, 2019

No hurry, it won’t make 3.0; depending on severity it may make in 3.1, but most likely won’t get addressed until 5.0.

1reaction
JeremyKuhnecommented, Aug 13, 2019

It does, in fact, repro on 4.8 if you enable the new keyboard state machine. In the app.config you can add:

  <runtime>
    <AppContextSwitchOverrides value="Switch.UseLegacyAccessibilityFeatures=false;Switch.UseLegacyAccessibilityFeatures.2=false;Switch.UseLegacyAccessibilityFeatures.3=false;Switch.System.Windows.Forms.UseLegacyToolTipDisplay=false"/>
  </runtime>

The basic problem is that we’re trying to get the size of the tooltip bubble when it isn’t active. Windows unfortunately doesn’t guard well here, and AVs when there isn’t an active tooltip window.

We should follow up on the repro crash for 4.8. I’ll tag where the specific fix is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

editplus-acp/stx/cs4mvc2.stx at master
Automatically exported from code.google.com/p/editplus-acp - editplus-acp/stx/cs4mvc2.stx at master · wy88y/editplus-acp.
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