[Mono-bugs] [Bug 66238][Blo] New - Incorrect returning string to native code from delegate

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 19 Sep 2004 10:26:17 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by ddmk@mail.ru.

http://bugzilla.ximian.com/show_bug.cgi?id=66238

--- shadow/66238	2004-09-19 10:26:17.000000000 -0400
+++ shadow/66238.tmp.8671	2004-09-19 10:26:17.000000000 -0400
@@ -0,0 +1,50 @@
+Bug#: 66238
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: Windows XP
+Status: NEW   
+Resolution: 
+Severity: 004 Four hours
+Priority: Blocker
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ddmk@mail.ru               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Incorrect returning string to native code from delegate
+
+for next delegate which is passed to native code and called from it 
+
+public delegate string TGetInterfaceFilePath(int TypeID);
+
+the fuction called for it declared as following
+
+static public string GetFilePath(int IID)
+{	
+if (Interfaces[IID].assembly==null) return null; 
+Console.WriteLine("returning .NET path: "+Interfaces 
+IID].assembly.Location);
+//Interfaces[IID].assembly  is type of System.Reflection.Assembly
+return Interfaces[IID].assembly.Location;
+}
+
+
+First calling of this delegate from native code is ok returned string is 
+also valid pointer 
+
+(
+from native code memory for returning string is deallocated by 
+CoTaskMemFree(ptr);
+)
+Second call of this delegate is failed with Null Pointer Exception.
+(or address of returning string is invalid)
+
+returning .NET path: 
+C:\SomePath\interfaces\IF_CLR_32347_223425.dll
+Unhandled Exception: System.NullReferenceException: Object reference not 
+set to an instance of an object
+
+I try to make a bug test if it need.