Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

0xC0020001: The string binding is invalid. - Only occurring in WPF

Tags:

c++

c#

wpf

First off, I should probably say that I'm probably at a grade 5 level with this stuff... I'm using a C++ add-in in a WPF application. Whenever I try to exit the program, I get this error:

Unhandled exception at 0x770d15de in Raptor.exe: 0xC0020001: The string binding is invalid.

I've been using this blog entry to try and figure the problem out, but I'm having no luck. One thing I noticed though, when I use the same C++ addin in a Console application, calling many of the same methods used in the WPF application, the Console exits without a problem.

I've also gone through the C++ code and cannot find a single static variable declared anywhere. There are static methods though.

Any help would be much appreciated!

EDIT: I enabled a number of debugging features to see where this breaks. It was breaking the sp_counted_impl.hpp file (Boost) on the last bracket of the following:

    virtual void dispose() // nothrow
    {
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
        boost::sp_scalar_destructor_hook( px_, sizeof(X), this );
#endif
        boost::checked_delete( px_ );
    }
like image 868
keynesiancross Avatar asked Aug 06 '12 20:08

keynesiancross


1 Answers

This occurs with certain DLLs that don't link with native libraries and thus their DllMain does not initialize some needed native subsystem (like CRT or ATL). Sounds like you have a mixed-mode DLL of some sort. One recommended solution is to remove the entry point from the managed DLL: Remove the Entry Point of the Managed DLL

  1. Link with /NOENTRY. In Solution Explorer, right-click the project node, click Properties. In the Property Pages dialog box, click Linker, click Command Line, and then add this switch to the Additional Options field.
  2. Link msvcrt.lib. In the Property Pages dialog box, click Linker, click Input., and then add msvcrt.lib to the Additional Dependencies property.
  3. Remove nochkclr.obj. On the Input page (same page as in the previous step), remove nochkclr.obj from the Additional Dependencies property.
  4. Link in the CRT. On the Input page (same page as in the previous step), add __DllMainCRTStartup@12 to the Force Symbol References property.

More detail can be found here: https://support.microsoft.com/en-us/kb/814472

like image 190
exacerbatedexpert Avatar answered Nov 19 '22 14:11

exacerbatedexpert