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.

PInvokeStackImbalance exception on native calls in 32-bit app

See original GitHub issue

In in a windows .net forms app on calling

var allDevices = InputDevice.GetAll()

I get this exception? Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'Melanchall.DryWetMidi!Melanchall.DryWetMidi.Multimedia.MidiDevicesSessionApi32::OpenSession_Win' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
melanchallcommented, Jan 10, 2022

The problem is solved now. You can install prerelease version of the library NuGet package – 6.1.0-prerelease1.

0reactions
melanchallcommented, May 16, 2022

🚀 6.1.0 version is released now!

Prerelease NuGet packages will be unlisted soon, so please update the package references to the new version.

Thanks for using the library!

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - PInvokeStackImbalance exception when using IntPtr in ...
The error i'm receiving when debugging is: PInvokeStackImbalance: A call to PInvoke function 'DLLTest!DLLTest.Form1::XC_GetFrame' has unbalanced ...
Read more >
pInvokeStackImbalance MDA - .NET Framework
The PInvokeStackImbalance MDA is implemented only for 32-bit x86 platforms. ... the signature and calling convention of the native target.
Read more >
Untitled
Pinvokestackimbalance WebPosted: Visual Studio Debugger, PInvokeStackImbalance was detected Top You do not want to turn off managed debug assistants (MDAs).
Read more >
Unable to load wkhtmltopdf dll · Issue #8
If I try to load the 32 bit version I get this exception: Managed ... 'PInvokeStackImbalance' : 'A call to PInvoke function 'DinkToPdf!...
Read more >
Managed Debugging Assistant 'PInvokeStackImbalance' ...
A call to PInvoke function 'xxx' has unbalanced the stack. ... If I run app as 32 or 64 bit or without Prefer...
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