BUG: Exception error when you use a declare function that returns a date type in Visual Basic .NET 2003 and in Visual Basic .NET 2002 (327113)
The information in this article applies to:
- Microsoft Visual Studio .NET (2002), Academic Edition
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
- Microsoft .NET Framework Class Libraries 1.1
- Microsoft .NET Framework Class Libraries 1.0
- Microsoft Visual Studio .NET (2003), Academic Edition
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Professional Edition
This article was previously published under Q327113 SYMPTOMS When a function in a DLL returns a date type and you call
the function from a Microsoft .NET application by using PInvoke, you receive the following error message:
System.Runtime.InteropServices.MarshalDirectiveException : This method's type
signature is not PInvoke compatible. CAUSE In this version of the Microsoft .NET Framework, PInvoke cannot return dates. RESOLUTION To work around this problem, you can declare the function
to return a double value instead of returning a date, and you can then use the
following method to get the date:
System.DateTime.FromOADate(ByVal d As Double) As DateTime
STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 9/14/2005 |
---|
Keywords: | kbvs2002sp1sweep kbbug KB327113 |
---|
|