MohawkMEDIC / everest

The Everest Framework is designed to ease the creation, formatting, and transmission of HL7v3 and CDA structures with remote systems.
Apache License 2.0
38 stars 22 forks source link

asp-net core System.NotSupportedException #16

Open TimZwerenz opened 3 years ago

TimZwerenz commented 3 years ago

Hello, I am trying to use the framework on an asp.net core mvc project but I get an runtime exception. I am able to build the XML document, but directly after that I get the following exception:

System.NotSupportedException HResult=0x80131515 Message=The invoked member is not supported in a dynamic assembly. Source=mscorlib StackTrace: at System.Reflection.Emit.InternalAssemblyBuilder.get_Location() at MARC.Everest.Formatters.XML.ITS1.CodeGen.CodeGenFormatter.CreateFormatterAssembly(Type[] rmimTypes, List`1 aides, Boolean generateDeep) at MARC.Everest.Formatters.XML.ITS1.XmlIts1Formatter.BuildCache(Type[] t) at MARC.Everest.Threading.WaitThreadPool.DoWorkItem(WorkItem state) at MARC.Everest.Threading.WaitThreadPool.DispatchLoop() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

I am using the .NET Framework 4.6.1 and I already know that the problem comes from my method for formatting the document:

private static void PrintXml(ClinicalDocument ccda, Stream stream) {

        MARC.Everest.Formatters.XML.ITS1.XmlIts1Formatter fmtr = new MARC.Everest.Formatters.XML.ITS1.XmlIts1Formatter();
        fmtr.GraphAides.Add(new DatatypeFormatter());
        fmtr.ValidateConformance = false;
        XmlStateWriter xsw = new XmlStateWriter(XmlWriter.Create(stream, new XmlWriterSettings() { Indent = true }));
        fmtr.Graph(xsw, ccda);
        xsw.Flush();
    }

If someone can help me fixing this I would be really thankful

TimZwerenz commented 3 years ago

The problem is in the .Graph method.