# \[C#\] Unbalanced Stack?

**URL:** <https://qa.fmod.com/t/c-unbalanced-stack/11726>\
**Category:** FMOD Engine\
**Created:** [November 21, 2014, 8:36pm UTC](https://qa.fmod.com/t/c-unbalanced-stack/11726 "2014-11-21T20:36:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LadyApollo1](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@LadyApollo1](https://qa.fmod.com/u/LadyApollo1)\
**Post date:** [November 21, 2014, 8:36pm UTC](https://qa.fmod.com/t/c-unbalanced-stack/11726/1 "2014-11-21T20:36:42Z")

</div>

Hello,

I’m having trouble migrating from FMOD4 to FMOD5 using the c# wrapper.  
In fmod4 everything was working just fine, but with fmod5 every single function call that I make returns me a strange error.

 ![enter image description here](http://i.imgur.com/4dndnFD.png)

Some research later I found that I could try adding

```
CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)]

```

To the [DllImport(VERSION.dll)] the error persisted.

Is there anything else I can try to do to fix it? Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)\
**Post date:** [November 24, 2014, 12:49am UTC](https://qa.fmod.com/t/c-unbalanced-stack/11726/2 "2014-11-24T00:49:12Z")

</div>

All FMOD API functions are stdcall, which is the default calling convention of pInvoke.

Please make sure you use a matching version of the fmod.dll and fmod.cs.

If you still have problems please let tell us the version of the .net framework you are targeting, which runtime (microsoft, mono), which visual studio version, and if it’s desktop, phone, or windows app store.
