[Mono-bugs] [Bug 445852] New: Mono runtime fails loaded some nested classes
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Nov 17 18:27:13 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=445852
Summary: Mono runtime fails loaded some nested classes
Product: Mono: Runtime
Version: 2.0
Platform: x86-64
OS/Version: Ubuntu
Status: NEW
Severity: Normal
Priority: P5 - None
Component: JIT
AssignedTo: lupus at novell.com
ReportedBy: khester at pacificbiosciences.com
QAContact: mono-bugs at lists.ximian.com
CC: casey.s.marshall at gmail.com
Found By: Community User
Created an attachment (id=252753)
--> (https://bugzilla.novell.com/attachment.cgi?id=252753)
A mono/metadata/class.c patch to fix this problem.
While diagnosing a problem of running F# inside of mono 2.0.1 runtime (official
release), I noticed a more fundamental error in how mono is loading nested
classes.
I think I've found the problem and attached a patch to this bug report.
---
If you create an instance of a nested class when the containing class has never
been previously referenced, the creation of the inner class fails with the
following message:
<FIXME - add message>
The underlying cause of this problem is in
metatdata/class.c:mono_class_from_name(<image>, "My.Namespace",
"ParentClassName/NestedClassName").
The parent class is found correctly, but unless some other operation has caused
mono_class_init() to be called on 'ParentClass' previously,
mono_class_from_name fails to find 'NestedClass'. I suspect this problem was
not previously found, because typically an instance of a parent class is
created before it creates/uses/exposes some class that was nested inside
itself. However, because F# hides all functions inside somewhat redundant
outer classes (the 'module' in F# speak) this pattern becomes far more common.
My fix is to make class.c/return_nested_in() ensure that the outer class has
been inited. For most (but not all) C# uses this call is a nop because the
outer class will already have been inited somewhere else. If it has not been
inited, it must be inited at this point, because mono_class_init is the only
thing that populates the nested_classes list that is about to be iterated over.
I can also submit a unit test if you want - I figured I'd create this bug
report to get a # assigned at least.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list