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.

DPIAwareness: ArgumentException when opening a ContextMenuStrip

See original GitHub issue
  • .NET Core Version: 3.1.0

  • Have you experienced this same bug with .NET Framework?: No

Problem description:

We are experiencing the following crashreports from some users when they open a contextMenu. All reports originate from Windows10 (version 1607 - build 14393 or later), but we are not able to simulate it on our side.

System.Windows.Forms.System.ArgumentException: dpiContext (Parameter 'DPI_AWARENESS_CONTEXT_UNSPECIFIED')
    at System.Windows.Forms.CommonUnsafeNativeMethods.TrySetThreadDpiAwarenessContext
    at System.Windows.Forms.DpiHelper+DpiAwarenessScope.Dispose
    at System.Windows.Forms.ToolStripManager+ModalMenuFilter.PreFilterMessage
    at System.Windows.Forms.Application+ThreadContext.ProcessFilters
    at System.Windows.Forms.Application+ThreadContext.PreTranslateMessage
    at System.Windows.Forms.Application+ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage
    at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop
    at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner
    at System.Windows.Forms.Application+ThreadContext.RunMessageLoop
    at System.Windows.Forms.Application.Run

our app is PerMonitorV2 aware as defined in app.manifest:

  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
	<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
	<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
    </asmv3:windowsSettings>
  </asmv3:application>

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
filipnavaracommented, May 14, 2020

Unfortunately the self-contained output is kind of on the big side so I had to share it through external service that allows larger files.

https://send.firefox.com/download/b48739bcf3c1097f/#4aBM9eavZZCiGZsTYQPuPg

The link will be valid for a week, or 100 downloaded, whichever comes first. I can reupload it elsewhere if it becomes an issue.

0reactions
merriemcgawcommented, Jun 4, 2020

I think we are going to take this for .NET 5, but for 3.1 I don’t think we’re going to take it until/unless we can determine that there is a repro that we could expect to hit occasionally. If you could provide the binary again, if we inspect it in ILSpy and find a more common repro I’ll happily reconsider this for 3.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ContextMenuStrip doesn't DPI scale when Form is dragged ...
The ContextMenuStrip doesn't scale when its parent Form is dragged between monitors of different resolution/scaling. The ContextMenuStrip is ...
Read more >
How to: Handle the ContextMenuStrip Opening Event - ...
The following code example demonstrates how to handle the Opening event. The event handler adds items dynamically to a ContextMenuStrip control.
Read more >
sitemap-feedback-posts.xml
... https://www.syncfusion.com/feedback/64/argumentexception-occurs-while- ... -functionality-to-highlight-the-matching-open-and-close-brackets-in-wpf ...
Read more >
ComponentSource News | Data Editor Components
The sample displays open, high, low, close, and volume of a stock, ... ArgumentException "Parameter is not valid" when saving editor changes and ......
Read more >
Viewing online file analysis results for 'mywifi.exe'
Opened the service control manager ... <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/Windo.
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