BUG: Return Type Marshaling of GUID Causes an Exception Error (326708)



The information in this article applies to:

  • Microsoft Visual J# .NET (2003)
  • Microsoft Visual J# .NET (2002)

This article was previously published under Q326708

SYMPTOMS

When you use platform invoke to call a method with a return type of com.ms.com._Guid, you may receive the following exception error message for Microsoft Visual J# .NET 2003:
An unhandled exception of type 'System.DllNotFoundException' occurred in MyApp.exe .

Additional information: Unable to load DLL (Test.dll).

For Microsoft Visual J# .NET 2002, you may receive the following exception error message:
An unhandled exception of type 'System.Runtime.InteropServices.MarshalDirectiveException' occurred in MyApp.exe

Additional information: Method's type signature is not PInvoke compatible.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

The following Visual J# .NET sample code compiles without an error, but you receive the error message that is described in the "Symptoms" section when you execute the code:
import com.ms.com.*;

public class TestGuid
{
	/** @dll.import("Test.dll") */ 
	public static native _Guid returnGUID();
	
	public static void main(String[] args)
	{
		System.out.println("Try to get GUID from native");	
		_Guid aguid = returnGUID();
	}
}
				

Modification Type:MajorLast Reviewed:1/27/2004
Keywords:kbbug kbnofix KB326708