[Mono-bugs] [Bug 631409] New: Inconsistent/Invalid order when calling parent's class cctor/ctor
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Aug 16 05:40:12 EDT 2010
http://bugzilla.novell.com/show_bug.cgi?id=631409
http://bugzilla.novell.com/show_bug.cgi?id=631409#c0
Summary: Inconsistent/Invalid order when calling parent's class
cctor/ctor
Classification: Mono
Product: Mono: Runtime
Version: SVN
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: generics
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: pruiz at netway.org
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
Created an attachment (id=383116)
--> (http://bugzilla.novell.com/attachment.cgi?id=383116)
Code demostrating the issue.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4
While trying to use Topshelf (topshelf-project.com) on mono, I've found a
problem related to the order in which mono calls a base/parent's class static
constructors.
Actually the problem can only be reproduced when the class has generic
arguments, and it is instantiated twice with different generic arguments.
When running the same code on MS.Net the order of execution goes like:
> Instantiate a new Child<A> instance..
--> Child.cctor (static ctor)
---> Parent.cctor (static ctor)
--> Parent.ctor
-> Child.ctor
> Instantiate a new Child<B> instance..
--> Child.cctor (static ctor)
---> Parent.cctor (static ctor)
--> Parent.ctor
-> Child.ctor
However, when running on mono (2.6.x, and trunk's 2.7.x), I got:
> Instantiate a new Child<A> instance..
--> Child.cctor (static ctor)
---> Parent.cctor (static ctor)
--> Parent.ctor
-> Child.ctor
> Instantiate a new Child<B> instance.. ==> The one failing! <==
--> Parent.cctor (static ctor)
--> Parent.ctor
-> Child.ctor
-> Child.cctor (static ctor)
Attached it's a tests case reproducing the issue.
Reproducible: Always
Steps to Reproduce:
1. Compile attached example.
2. Run
3. Compare output from first class instantiation with second one, and note the
differences.
Actual Results:
First instance..
ServiceConfiguratorBase.ctor()
ServiceController..cctor
StateMachine..cctor()
StateMachine..ctor()
ServiceController.ctor()
Second instance..
ServiceConfiguratorBase.ctor()
StateMachine..cctor()
StateMachine..ctor()
ServiceController.ctor()
ServiceController..cctor
Expected Results:
First instance..
ServiceConfiguratorBase.ctor()
ServiceController..cctor
StateMachine..cctor()
StateMachine..ctor()
ServiceController.ctor()
Second instance..
ServiceConfiguratorBase.ctor()
ServiceController..cctor
StateMachine..cctor()
StateMachine..ctor()
ServiceController.ctor()
I've tested this on versions 2.6.x and 2.7.1 (trunk), over mono/linux, and
mono/win32.
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list