[Mono-bugs] [Bug 417838] New: NRE while importing type
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sat Aug 16 07:57:07 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=417838
Summary: NRE while importing type
Product: Mono: Class Libraries
Version: SVN
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Cecil
AssignedTo: jbevain at novell.com
ReportedBy: rkvinge at novell.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Repro:
using System;
using Mono.Cecil;
class C {
static void Main ()
{
AssemblyDefinition a;
AssemblyDefinition corlib =
AssemblyFactory.GetAssembly(typeof(int).Assembly.Location);
TypeReference ienumerable;
TypeDefinition list;
GenericInstanceType generic;
list = corlib.MainModule.Types ["System.Collections.Generic.List`1"];
ienumerable = list.Interfaces [2];
generic = new GenericInstanceType(ienumerable);
generic.GenericArguments.Add (list.GenericParameters [0]);
//Console.WriteLine (ienumerable.FullName);
a = Mono.Cecil.AssemblyFactory.DefineAssembly("test",
AssemblyKind.Dll);
a.MainModule.Import(generic);
}
}
Result:
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
at Mono.Cecil.DefaultImporter.GetGenericParameter
(Mono.Cecil.GenericParameter gp, Mono.Cecil.ImportContext context) [0x00010] in
/mono/main/src/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs:120
at Mono.Cecil.DefaultImporter.ImportTypeReference (Mono.Cecil.TypeReference
t, Mono.Cecil.ImportContext context) [0x00037] in
/mono/main/src/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs:138
at Mono.Cecil.DefaultImporter.GetTypeSpec (Mono.Cecil.TypeSpecification
original, Mono.Cecil.ImportContext context) [0x000a8] in
/mono/main/src/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs:86
at Mono.Cecil.DefaultImporter.ImportTypeReference (Mono.Cecil.TypeReference
t, Mono.Cecil.ImportContext context) [0x0001e] in
/mono/main/src/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs:135
at Mono.Cecil.DefaultImporter.GetTypeSpec (Mono.Cecil.TypeSpecification
original, Mono.Cecil.ImportContext context) [0x00000] in
/mono/main/src/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs:73
at Mono.Cecil.DefaultImporter.ImportTypeReference (Mono.Cecil.TypeReference
t, Mono.Cecil.ImportContext context) [0x0001e] in
/mono/main/src/mcs/class/Mono.Cecil/Mono.Cecil/DefaultImporter.cs:135
at Mono.Cecil.ModuleDefinition.Import (Mono.Cecil.TypeReference type)
[0x00011] in
/mono/main/src/mcs/class/Mono.Cecil/Mono.Cecil/ModuleDefinition.cs:281
at C.Main () [0x00074] in /home/rolf/test/cecil-3.cs:26
I'm not sure if I'm doing something bad with Cecil though, but in any case I
shouldn't get a NRE.
--
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