[Mono-bugs] [Bug 63313][Nor] New - Invocation of NSBundle.MainBundle.resourcePath throws internal InvalidCastException

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 18 Aug 2004 09:34:43 -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 l0ne@email.it.

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

--- shadow/63313	2004-08-18 09:34:43.000000000 -0400
+++ shadow/63313.tmp.19960	2004-08-18 09:34:43.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 63313
+Product: Cocoa#
+Version: 0.1
+OS: Mac OS X 10.3
+OS Details: Mac OS X 10.3.5 (upgrade from 10.2.8)
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Bindings.
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: l0ne@email.it               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Invocation of NSBundle.MainBundle.resourcePath throws internal InvalidCastException
+
+[first time using bugzilla in my life--please forgive any mistakes]
+Invoking the mentioned property (NSBundle.MainBundle.resourcePath) throws an internal 
+InvalidCastException (though this is probably a symptom and not the cause).
+
+Test case <test.cs>:
+
+using System;
+using Apple.Foundation;
+
+namespace Test {
+	class TestClass {
+		[STAThread] static void Main(string[] args) {
+			Console.WriteLine(NSBundle.MainBundle.resourcePath);
+		}
+	}
+}
+
+Compiled with mcs -r:Apple.Foundation.dll test.cs, result placed in .app bundle with the 
+following structure:
+
+.app/
+	Info.plist
+	MacOS/
+		CocoaSharpLoader (symlink)
+	Resources/
+		test.exe (compilation result)
+		Apple.Foundation.dll
+		libFoundationGlue.dylib (symlink)
+		libCocoaSharp.dylib (symlink)
+		libFoundationGlue.0.dylib
+		libCocoaSharp.0.dylib
+		
+Program started in Terminal.app by using cd AppBundle.app/Contents/MacOS; ./
+CocoaSharpLoader <return>
+
+output:
+2004-08-18 15:17:38.856 CocoaSharpLoader[17579] /Users/l0ne/Desktop/Buttami/
+ProvaCocoaSharp.app/Contents/Resources/test.exe
+DEBUG:
+        Assembly: /Users/l0ne/Desktop/Buttami/ProvaCocoaSharp.app/Contents/Resources/
+test.exe
+2004-08-18 15:17:40.070 CocoaSharpLoader[17579] NSBundle__mainBundle0: NSBundle --> 
+<NSBundle: 0x160e6e0>
+DEBUG: Using type: Apple.Foundation.NSBundle, for Objective-C class: NSBundle
+2004-08-18 15:17:40.856 CocoaSharpLoader[17579] NSBundle_resourcePath0: NSBundle </
+Users/l0ne/Desktop/Buttami/ProvaCocoaSharp.app> (loaded) --> <NSPathStore2: 0x1625800>
+ERROR: No class found that derives from NSObject with the name: NSPathStore2
+
+Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination 
+type.
+in <0x00060> Apple.Foundation.NSBundle:get_resourcePath ()
+in <0x00028> Test.TestClass:Main (string[])