Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / October 2004

Tip: Looking for answers? Try searching our database.

MarshalDirectiveException only in release mode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill - 20 Oct 2004 03:05 GMT
When running our assembly which PInvokes to an unmanaged dll, I am getting
the exception System.Runtime.InteropServices.MarshalDirectiveException : Can
not marshal parameter #1: Invalid managed/unmanaged type combination
(Int/UInt must be paired with I or U).  This exception only occurs when
compiling in release mode.  The PInvoke call resembles this:

[DllImport("UnmanagedLibrary", EntryPoint = "FunctionName1")]
internal static extern ErrorCode FunctionName1(IntPtr pHandle,
PropertyTagEnum prop, uint    uval);

The header in the Unmanaged Library is:
XXX_API ErrorCode FunctionName1(DecompHandle handle, PropertyTag prop,
unsigned long ulValue);

I tried changing the IntPtr pHandle to int, and receive a similar exception:
Can not marshal parameter #1: Invalid managed/unmanaged type combination
(Int32/UInt32 must be paired with I4 or U4).  I tried adding a
[MarshalAs(UnmanagedType.I4)] but it still throws the exception.

Any ideas?

-Bill
Bill - 20 Oct 2004 19:53 GMT
Come to find out this was a strange problem with the obfuscator we use.

-Bill

> When running our assembly which PInvokes to an unmanaged dll, I am getting
> the exception System.Runtime.InteropServices.MarshalDirectiveException : Can
[quoted text clipped - 18 lines]
>
> -Bill

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.