I have noticed what whenever i enable TypeMock and need to use the System.Xml.Xsl.XslCompiledTransform class i get an invalidoperationexception informing me that Instances of abstract classes cannot be created. It appears this is occuring deep in the .net system code. I can always fix this problem by unlinking the profiler (NCover) from TypeMock.
I had this problem with v 4.03 and the previous version. I have tried various versions of NCover with the same result. Also worth noting that this happens within Visual Studio and when run via MSBuild.
I'm not 100% that this is a bug, but it is repeatable and seems to be isolated to the compiled transforms only. Any thoughts?? :D
The full stack is as follows:
) Tests.Templates.TemplateEngineTests.TestTemplateEngine_BasicContent : System.InvalidOperationException : Instances of abstract classes cannot be created.
at System.Diagnostics.SymbolStore.SymDocumentWriter..ctor(ISymUnmanagedDocumentWriter* pDocumentWriter)
at System.Diagnostics.SymbolStore.SymWriter.DefineDocument(String url, Guid language, Guid languageVendor, Guid documentType)
at System.Reflection.Emit.ModuleBuilder.DefineDocumentNoLock(String url, Guid language, Guid languageVendor, Guid documentType)
at System.Reflection.Emit.ModuleBuilder.DefineDocument(String url, Guid language, Guid languageVendor, Guid documentType)
at System.Xml.Xsl.IlGen.XmlILModule.AddSourceDocument(String fileName)
at System.Xml.Xsl.IlGen.GenerateHelper.MarkSequencePoint(ISourceLineInfo sourceInfo)
at System.Xml.Xsl.IlGen.GenerateHelper.MethodBegin(MethodInfo methInfo, ISourceLineInfo sourceInfo, Boolean initWriters)
at System.Xml.Xsl.IlGen.XmlILVisitor.Function(QilFunction ndFunc)
at System.Xml.Xsl.IlGen.XmlILVisitor.Visit(QilExpression qil, GenerateHelper helper, MethodInfo methRoot)
at System.Xml.Xsl.XmlILGenerator.Generate(QilExpression query, AssemblyName asmName)
at System.Xml.Xsl.XslCompiledTransform.CompileIlFromQil(XsltSettings settings)
at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet)