Implementing a class

Hi,

I want to create a class (Msil code) using Phoenix. For this, I used MsilTypeSymbol and AggregateType to represent the class type. And added fields and methods by using addField and addMethod. However, the code don′t work and the message below is shown:

Code Snippet

Phoenix Assertion Failure: e:\sdkjul2007wix\src\phx\metadata\metadata.cpp, Line 11606
typeSymbol->LexicalParentSymbol != nullptr
in (Function number 8272) Main [line 5] during Emit
in (PEModule) base.exe during Emit
in (Program) <unnamed unit>
Unhandled Exception: System.NullReferenceException: Referência de objeto n?o definida para uma instancia de um objeto.
em Phx.Metadata.EmitterImplementation.EmitTypeSymbol(TypeSymbol typeSymbol)
em Phx.Metadata.EmitterImplementation.EmitTypeDeclarations()
em Phx.Metadata.EmitterImplementation.PreAssignTypeTokens()
em Phx.Metadata.EmitterImplementation.Export()
em Phx.Metadata.Emitter.Export()
em Phx.PE.Writer.CreateMetadata()
em Phx.PE.Writer.Write()
em MsilComp.EmitPhase.Execute(Unit unit) na E:Perfil\Documents\Visual Studio 2005\Projects\MsilComp\EmitPhase.cs:linha 84
em Phx.Phases.Phase.DoPhase(Unit unit)
em Phx.Phases.PhaseList.DoPhaseList(Unit unit)
em MsilComp.Compiler..ctor(String[] args) na E:\Perfil\Documents\Visual Studio 2005\Projects\MsilComp\compiler.cs:linha 48
em MsilComp.Compiler.Main(String[] args) na E:\Perfil\Documents\Visual Studio 2005\Projects\MsilComp\compiler.cs:linha 23


I think I should add metada info, but I don′t know how and where?

Even if I sets a link to the base class System.Object by using the AggregateType.AppendBaseTypeLink method and I don′t want implement personalized constructor, should I implement the constructor method?

[1961 byte] By [gavelino] at [2008-2-25]
# 1
MSIL classes always have a parent scope (typically an assembly or module). You need to put the new class type into the proper scope. Look at ImportSymbol in the mtrace sample for some inspiration -- in your case the assembly symbol should come from the assembly associated with your PE module.

AndyAyers-MSFT at 2007-10-2 > top of Msdn Tech,Visual Studio,Phoenix...

Visual Studio

Site Classified