[Mono-bugs] [Bug 79181][Nor] New - Assembly.CodeBase does not return the expected result

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Aug 26 18:21:41 EDT 2006


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 dna at informatik.uni-kiel.de.

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

--- shadow/79181	2006-08-26 18:21:41.000000000 -0400
+++ shadow/79181.tmp.10614	2006-08-26 18:21:41.000000000 -0400
@@ -0,0 +1,42 @@
+Bug#: 79181
+Product: Mono: Class Libraries
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: Ubuntu 6.06 (dapper)
+Status: NEW   
+Resolution: 
+Severity: 001 One hour
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: dna at informatik.uni-kiel.de               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Assembly.CodeBase does not return the expected result
+
+Description of Problem:
+I'm using Mono 1.1.16.1 from the x86 Linux Installer.
+
+The goal is to get the program directory:
+
+string assemblyPath =
+System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
+string programDir =
+Path.GetDirectoryName(assemblyPath.TrimStart("file:///".ToCharArray()));
+
+Result on Windows (.NET 2.0)
+assemblyPath = file:///C:/Projects/TestApp/bin/Debug/TestApp.exe
+programDir = C:\\Projects\\TestApp\\bin\\Debug
+
+Result on Mono/Linux (1.1.16.1):
+assemblyPath = file:///home/username/Projects/TestApp/bin/Debug/TestApp.exe
+programDir = home/username/Projects/TestApp/bin/Debug
+
+The expected result of Assembly.CodeBase on Linux/Mono should be:
+file:////home/username/Projects/TestApp/bin/Debug/TestApp.exe
+
+
+Maybe this is not a bug, but then you need extra code to identify the
+operationsystem. And this is not a good solution.


More information about the mono-bugs mailing list