Author Topic: PInvokeStackImbalance occurred  (Read 4460 times)

AvikB

  • Sr. Member
  • ****
  • Posts: 945
Just downloaded the api from the sticky thread and tried to follow the unfinished tutorial from the wiki. but couldn't get it to work. :/

I am using MusicBee 3 as the startup project and tried the post build command(Does not work if you have musicbee installed in program files folder, which does not let you modify unless permission changed) with write permission and the mb_name.dll successfully copied to the musicbee's plugin directory, but then Visual studio 2013 suddenly throws exception.

Code
PInvokeStackImbalance occurred
Message: Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 'C:\Program Files (x86)\MusicBee\MusicBee3.exe'.
Additional information: A call to PInvoke function 'MusicBee3!MusicBee.Plugin+#=qutMD5_t7mSciBUKmbikMtqoxZzIKqPlcU6OSTKHmqDU=::Invoke' 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.

If i just open msuicbee3.exe without visual studio debuggin then it is fine. the plugin shows in the setting panel.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34312
not sure exactly what you are doing. You shouldnt get any stack imbalances if using the MB API functions.
That check can be disabled in visual studio but i cant remember how. Its called a managed debug assistant

AvikB

  • Sr. Member
  • ****
  • Posts: 945
Yeah i disabled the check and it works fine. Though was wondering if the error is some bug or not.



Ah.. made my first plugin. Thanks, though i was wondering if any extensive documentation available or not? can't find any in the wiki.
Last Edit: February 27, 2016, 03:24:28 AM by AvikB