PInvokeStackImbalance on load

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
powelerl
Posts: 31
Joined: Thu 22 Dec 2016 10:00

PInvokeStackImbalance on load

Post by 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

Post by powelerl » Tue 28 Nov 2017 18:12

Weird, works for netcoreapp2.0 in 32bit mode (as well as 64bit).

Pinturiccio
Devart Team
Posts: 2294
Joined: Wed 02 Nov 2011 09:44

Re: PInvokeStackImbalance on load

Post by 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: 2294
Joined: Wed 02 Nov 2011 09:44

Re: PInvokeStackImbalance on load

Post by 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 ... alance-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.

powelerl
Posts: 31
Joined: Thu 22 Dec 2016 10:00

Re: PInvokeStackImbalance on load

Post by 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

Post by 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.

Shalex
Site Admin
Posts: 8426
Joined: Thu 14 Aug 2008 12:44

Re: PInvokeStackImbalance on load

Post by Shalex » Tue 12 Dec 2017 15:57

Thank you for your report. We have reproduced the issue and are investigating it.

simon.sanschagrin
Posts: 1
Joined: Wed 25 Apr 2018 16:05

Re: PInvokeStackImbalance on load

Post by simon.sanschagrin » Wed 25 Apr 2018 16:07

Was this issue solved? Because I am experiencing the same issue.

Shalex
Site Admin
Posts: 8426
Joined: Thu 14 Aug 2008 12:44

Re: PInvokeStackImbalance on load

Post by Shalex » Thu 26 Apr 2018 17:10

This is a resource demanding task. We cannot provide any timeframe at the moment.

Post Reply