Bug 18768 - mkbundle Assembly CodeBase uses Current Working Directory
Summary: mkbundle Assembly CodeBase uses Current Working Directory
Alias: None
Product: Runtime
Classification: Mono
Component: Tools (show other bugs)
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-04-02 17:59 UTC by dabitp
Modified: 2018-01-24 21:58 UTC (History)
4 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description dabitp 2014-04-02 17:59:42 UTC
Operating System: (Mac OSX Mavericks) Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64

Mono Version: Mono JIT compiler version 3.2.6 ((no/9b58377 Thu Jan 16 17:49:56 EST 2014)

Simple Console Application:

	class MainClass
		public static void Main (string[] args)
			Console.WriteLine (Assembly.GetExecutingAssembly().CodeBase);

When executing the produced program either in the Xamarin Studio debugger or via:

mono assemblyName.exe

it works as expected. 

When I use mkbundle to compile the application it returns the incorrect output. It appears to use the current directory appended by the assembly name instead of showing the directory of the assembly.

Expected and working output without using a mkbundle executable:

Incorrect output of the same executable generated by mkbundle:
Comment 1 dabitp 2014-04-02 18:38:56 UTC
I think I forgot to mention that this error occurs when you are in a directory that does not contain the executable. So I ran the mkbundle via ./Debug/testAssembly.mac
Comment 2 Ludovic Henry 2018-01-24 21:02:17 UTC

This is because mkbundle embed the assembly inside the executable, to make it possible to ship as a standalone executable. This is then not a bug, but the expected behavior.

Could you please explain how that breaks your existing solution?

Thank you,
Comment 3 dabitp 2018-01-24 21:58:46 UTC
I honestly don't remember the issue, since it's been a while now (don't work on the project anymore).

We can go ahead and resolve this.


Note You need to log in before you can comment on or make changes to this bug.