0

This is about a Windows Forms application, .Net 4.0, Visual Studio 2010.

My imaging application uses PortableDeviceApiLib and PortableDeviceTypesLib using generated Interop libraries. This causes type information load failure when PortableDevice types are referenced UNLESS I build specifically for x86. However, in x86 my DLLImports from Shell32.dll cause a run-time "stack imbalance" error when the program terminates; this imbalance does not occur with other build, such as AnyCPU.

Another Windows Forms app on the same machine app exhibits no significant problems with the PortableDeviceApiLib, but it does not use Shell32.dll.

Bulding my imaging app with other than x86 causes a VS warning about 'MIDL' versus 'x86' incompatibilities potentially causing run-time failures.

Another wrinkle is that I'm using the recommendation in Enumerating Windows Portable Devices in C# to decompile, edit and recompile the Interop.PortableDeviceApiLib.dll to allow enumerating more than one portable device. This does not seem to affect the type library load failures.

I have usually used AnyCPU for .Net apps, both Forms and WPF. Any other ideas about build settings I could try?

dhovel
  • 61
  • 3
  • You cannot get help for such a torrent of bizarre problems. Ask one at a time, document it carefully. – Hans Passant Sep 12 '14 at 18:38
  • The core problem is the "type loader failure" when using the interop libraries generated for PortableDeviceTypesLib. It fails with all other builds than x86. But using x86 generates a "stack imbalance" error using Shell32.dll. – dhovel Sep 12 '14 at 20:10
  • The problem with Shell32.dll is fixed. I am still confused as to why I must build/run with x86 only. This occurs in both apps using the generated Interop libraries. – dhovel Sep 12 '14 at 21:21

0 Answers0