Skip to content

Compilation errors not helpful #50

@mtausig

Description

@mtausig

Whenever a template document is parsed using the DocumentFactory.Create() method and the parser find an issue with one of the expressions it the following exception is thrown:

Unhandled exception. SharpDocx.SharpDocxCompilationException: Exception of type 'SharpDocx.SharpDocxCompilationException' was thrown.
   at SharpDocx.DocumentCompiler.Compile(String sourceCode, List`1 referencedAssemblies)
   at SharpDocx.DocumentCompiler.Compile(String viewPath, String className, String baseClassName, Type modelType, List`1 usingDirectives, List`1 referencedAssemblies)
   at SharpDocx.DocumentAssembly..ctor(String viewPath, Type baseClass, Type modelType)
   at SharpDocx.DocumentFactory.Create(String viewPath, Object model, Type baseClassType, Boolean forceCompile)
   at SharpDocx.DocumentFactory.Create[TBaseClass](String viewPath, Object model, Boolean forceCompile)
   at SharpDocxTest.Program.Main(String[] args) in C:\Users\foo\Code\SharpDocxTest\Program.cs:line 104

This error message is completely generic. Debugging would be a lot easier, if the exception would contain some hint, which statement caused the compilation error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions