Bug 2197 - Result of execution of Assembly.GetCallingAssembly() differs between mono and windows native
Summary: Result of execution of Assembly.GetCallingAssembly() differs between mono and...
Status: RESOLVED ANSWERED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-11-25 07:30 UTC by Damiano
Modified: 2017-07-11 21:56 UTC (History)
5 users (show)

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


Attachments
TestCase + VS.NET 2010 Solution (11.32 KB, application/gzip)
2011-11-25 07:30 UTC, Damiano
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Damiano 2011-11-25 07:30:39 UTC
Created attachment 946 [details]
TestCase + VS.NET 2010 Solution

Execution of the call differs when called from native windows environment and within Mono under Linux environment.

Windows Output:

C:\Sorgenti\TestSolution\Test\bin\Debug>Test.exe
Executing: Lib2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Calling: Lib2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Entry: Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

Mono under Linux:

damiano@imhotep:~/monitoring/gpalm/prova$ mono Test.exe 
Executing: Lib2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Calling: Lib1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Entry: Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null


The test case sources has been compiled under VS.NET2010.

The problem involves how calling assembly is evaluated in static constructors.
Comment 1 Rodrigo Kumpera 2017-07-11 21:56:09 UTC
Evaluation of a static constructors can be done before a method on the target begins execution, meaning it doesn't need to necessarily be on stack.

Which is what happens here, we have Class1::Go on stack invoking the cctor and that's ok by the spec.