TeamCity で NUnit テストを実行すると、次のエラーが発生し続けます。
Test(s) failed. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.Web.Razor.Parser.SyntaxTree.Block..ctor(BlockType type, IEnumerable`1 contents, String name)
at System.Web.Razor.Parser.SyntaxTree.Block..ctor(BlockType type, IEnumerable`1 contents)
at System.Web.Razor.Parser.SyntaxTree.SyntaxTreeBuilderVisitor.VisitEndBlock(BlockType type)
at System.Web.Razor.Parser.VisitorPair.VisitEndBlock(BlockType type)
at System.Web.Razor.Parser.ParserContext.EndBlock()
at System.Web.Razor.Utils.DisposableAction.Dispose(Boolean disposing)
at System.Web.Razor.Utils.DisposableAction.Dispose()
at System.Web.Razor.Parser.HtmlMarkupParser.ParseRootBlock(Tuple`2 nestingSequences, Boolean caseSensitive)
at System.Web.Razor.Parser.HtmlMarkupParser.ParseDocument()
at System.Web.Razor.Parser.RazorParser.Parse(LookaheadTextReader input, ParserVisitor visitor)
at System.Web.Razor.RazorTemplateEngine.GenerateCodeCore(LookaheadTextReader input, String className, String rootNamespace, String sourceFileName, Nullable`1 cancelToken)
at System.Web.Razor.RazorTemplateEngine.GenerateCode(TextReader input, String className, String rootNamespace, String sourceFileName, Nullable`1 cancelToken)
at System.Web.Razor.RazorTemplateEngine.GenerateCode(TextReader input)
at RazorEngine.Compilation.CompilerServiceBase.GetCodeCompileUnit(String className, String template, ISet`1 namespaceImports, Type templateType, Type modelType)
at RazorEngine.Compilation.DirectCompilerServiceBase.Compile(TypeContext context)
at RazorEngine.Compilation.DirectCompilerServiceBase.CompileType(TypeContext context)
at RazorEngine.Templating.TemplateService.CreateTemplate(String template, Type modelType)
at RazorEngine.Templating.TemplateService.GetTemplate(String template, Type modelType, String name)
at RazorEngine.Templating.TemplateService.Parse[T](String template, T model, String name)
at RazorEngine.Razor.Parse[T](String template, T model, String name)
at MyProject.CachedRazor.Parse[T](String aTemplateRazor, String aTemplateName, T aModel) in c:\TeamCity\buildAgent\work\5bb723c0e2c1dace\MyProject\CachedRazor.cs:line 62
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at UnitTests.Tests.EmailRazorParsingTests.EmailRazorTemplate_ParseSucceeded(EmailRazorTemplateNames aEmailRazorTemplateName, Type aEmailModelType) in c:\TeamCity\buildAgent\work\5bb723c0e2c1dace\UnitTests\Tests\EmailRazorParsingTests.cs:line 47
コード内の非常に長いメソッドに関連するいくつかの回答を見つけましたが、それらは関連していないようです。何か案は?