PInvokeStackImbalance on load

PInvokeStackImbalance on load

Postby powelerl » Tue 28 Nov 2017 18:09

Works for 64bit, fails for 32bit. I am 100% sure the correct Oracle client is in PATH env according to bitness.

NuGet v9.5.399 / .NET Standard 2.0
.NET Framework 4.6.2
Oracle 12c Release 1 32bit


Code: Select all
Managed Debugging Assistant 'PInvokeStackImbalance'  occurred
  Message=Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'Devart.Data.Oracle!Devart.Data.Oracle.Oci::nativeOCIEnvCreate' 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.'
powelerl
 
Posts: 31
Joined: Thu 22 Dec 2016 10:00

Re: PInvokeStackImbalance on load

Postby powelerl » Tue 28 Nov 2017 18:12

Weird, works for netcoreapp2.0 in 32bit mode (as well as 64bit).
powelerl
 
Posts: 31
Joined: Thu 22 Dec 2016 10:00

Re: PInvokeStackImbalance on load

Postby Pinturiccio » Mon 04 Dec 2017 16:12

We are working on the issue, and we will post here when we get any results.
Pinturiccio
Devart Team
 
Posts: 2046
Joined: Wed 02 Nov 2011 09:44

Re: PInvokeStackImbalance on load

Postby Pinturiccio » Wed 06 Dec 2017 17:05

powelerl wrote:Managed Debugging Assistant 'PInvokeStackImbalance' occurred

The pInvokeStackImbalance MDA is implemented only for the 32-bit x86 platforms. For more information, please refer to https://docs.microsoft.com/en-us/dotnet/framework/debug-trace-profile/pinvokestackimbalance-mda
Thus this error can occur only in a 32-bit application. A 64-bit application will ignore it.
Moreover, this behavior occurs only in the debug mode and won't occur in the release mode. So if you disable MDA or run code in the release mode, everything should work.
Pinturiccio
Devart Team
 
Posts: 2046
Joined: Wed 02 Nov 2011 09:44

Re: PInvokeStackImbalance on load

Postby powelerl » Wed 06 Dec 2017 20:13

OK. But isn't there a erroneous PInvoke call somewhere? Sounds like compiling without type safety and have a go.
powelerl
 
Posts: 31
Joined: Thu 22 Dec 2016 10:00

Re: PInvokeStackImbalance on load

Postby powelerl » Sun 10 Dec 2017 16:55

I disabled the MDA and error gone, of course. Now I have a program that hangs indefinitely loading data from the database. I guess the error is real.
powelerl
 
Posts: 31
Joined: Thu 22 Dec 2016 10:00

Re: PInvokeStackImbalance on load

Postby Shalex » Tue 12 Dec 2017 15:57

Thank you for your report. We have reproduced the issue and are investigating it.
Shalex
Devart Team
 
Posts: 7839
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle