Uploaded image for project: 'MediaPortal 1'
  1. MediaPortal 1
  2. MP1-4256

PInvokeStackImbalance C# call to unmanaged C++ function error after switching to net4

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 1.6.0
    • 1.5.100
    • MediaPortal 1
    • None

    Description

      <p>After switching to net4 environment, VS2010 debug mode starts to show "PInvokeStackImbalance" exception related to unmanaged code for some third party imported dlls.</p><p>According to MS those errors should not be ignored as they can lead to application instabillity or security issues.That same problem will exist when you run MP outside the debugger, but the checks are too costly to perform in anytime other than debugging.</p><p>Fix can be applied either in C++ part of dll or in C# by adding <span class="comment-copy">CallingConvention = CallingConvention.Cdecl on dll import.</span></p><p><span class="comment-copy">Sample fix:</span></p><p><strong><span style="color:#0000ff;">[DllImport("dll file name", CallingConvention = CallingConvention.Cdecl)]</span></strong></p><p><br /></p><p><span class="comment-copy">For now, problematic dlls are (add founded ones here):</span></p><p><strong><span style="color:#ff0000;"><span class="comment-copy">sqlite.dll</span></span></strong></p><p><strong><span style="color:#ff0000;">mpviz.dll</span></strong></p><p><strong><span style="color:#ff0000;">fontEngine.dll</span></strong></p><p><br /></p><p><br /></p>

      Attachments

        Activity

          People

            sebastiii sebastiii
            deda deda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: