i using extentreport.core [AfterTestRun] execute extent.flush() throw RazorEngine.Templating.TemplateCompilationException : Errors while compiling a Templat #76
OS: Windows
SDK Version: Dotnetcore 3.1
extentreport.core -> extent.flush() -> Is sucess.
but
OS: Mac_Jenkins
SDK Version: Dotnetcore 3.1
extentreport.core -> extent.flush() -> throw exception
TearDown : RazorEngine.Templating.TemplateCompilationException : Errors while compiling a Template.
Please try the following to solve the situation:
If the problem is about missing/invalid references or multiple defines either try to load
the missing references manually (in the compiling appdomain!) or
Specify your references manually by providing your own IReferenceResolver implementation.
See https://antaris.github.io/RazorEngine/ReferenceResolver.html for details.
Currently all references have to be available as files!
If you get 'class' does not contain a definition for 'member':
try another modelType (for example 'null' to make the model dynamic).
NOTE: You CANNOT use typeof(dynamic) to make the model dynamic!
Or try to use static instead of anonymous/dynamic types.
More details about the error:
warning: (7, 4) Unnecessary using directive.
warning: (8, 4) Unnecessary using directive.
warning: (6, 4) Unnecessary using directive.
warning: (12, 4) Unnecessary using directive.
warning: (5, 4) Unnecessary using directive.
warning: (11, 4) Unnecessary using directive.
error: (0, 0) Unexpected error writing debug information -- 'COM Interop is not supported on this platform.'
Temporary files of the compilation can be found in (please delete the folder): /var/folders/z1/0ll5jd8d5r37y0kjj19tjv9c0000gn/T/RazorEngine_0cusrtet.x12
The template we tried to compile is:
------------- START -----------
@using AventStack.ExtentReports
@using AventStack.ExtentReports.ViewDefs
@using RazorEngine
@using RazorEngine.Templating
<!DOCTYPE html>
@Include("Head")
@{
var isbdd = false;
var cls = "";
if (Model.TestList.Count > 0 && Model.TestList[0].IsBehaviorDrivenType)
{
isbdd = true;
cls = "bdd-report";
}
}
Hello - this package is not created by me, it is from the SimplyTest team: https://github.com/simplytest/extentreports-csharp. I am unaware of any changes/updates that were made in this release. It will help if you can share a small snippet to reproduce this issue so I can fix from the .NET Framework implemention. I do plan to support .NET Core but currently no ETA.
OS: Windows SDK Version: Dotnetcore 3.1 extentreport.core -> extent.flush() -> Is sucess.
but OS: Mac_Jenkins SDK Version: Dotnetcore 3.1 extentreport.core -> extent.flush() -> throw exception TearDown : RazorEngine.Templating.TemplateCompilationException : Errors while compiling a Template. Please try the following to solve the situation:
<!DOCTYPE html>
@Include("Head") @{ var isbdd = false; var cls = ""; if (Model.TestList.Count > 0 && Model.TestList[0].IsBehaviorDrivenType) { isbdd = true; cls = "bdd-report"; } }@if (Model.ContainsStatus(Status.Pass)) {Pass} @if (Model.ContainsStatus(Status.Fail)) {Fail} @if (Model.ContainsStatus(Status.Fatal)) {Fatal} @if (Model.ContainsStatus(Status.Error)) {Error} @if (Model.ContainsStatus(Status.Warning)) {Warning} @if (Model.ContainsStatus(Status.Skip)) {Skip} Clear
@foreach (var author in Model.AuthorContext.Context) { @author.Name }
@foreach (var category in Model.CategoryContext.Context) { @category.Name }
@foreach (var device in Model.DeviceContext.Context) { @device.Name }
@foreach (var test in Model.TestList) { string authors = "", devices = "", tags = ""; foreach (var author in test.AuthorContext.All()) { authors += author.Name + " "; } foreach (var device in test.DeviceContext.All()) { devices += device.Name + " "; } foreach (var tag in test.CategoryContext.All()) { tags += tag.Name + " "; }-
@if (test.HasAttributes)
{
@Include("Attributes", test)
}
@if (!string.IsNullOrEmpty(test.Description))
{
@test.Description
}
@if (!isbdd)
{
@Include("SparkStandard", test)
}
else
{
@Include("SparkBDD", test)
}
}
@test.Name
@test.RunDuration.ToString("''h'h:'m'm:'s's+'fff'ms'")
@test.StartTime.ToString("HH:mm:ss tt")@test.Name
@test.StartTime @test.EndTime @test.RunDuration.ToString("''h'h:'m'm:'s's+'fff'ms'")------------- END -----------
The generated source code is: ------------- START ----------- //
pragma warning disable 1591
namespace CompiledRazorTemplates.Dynamic {
line hidden
"); if (Model.ContainsStatus(Status.Pass)) {WriteLiteral("<a status=\"pass\" class=\"dropdown-item\" href=\"#\">Pass<span class=\"status success pull-right\">"); } WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t"); if (Model.ContainsStatus(Status.Fail)) {WriteLiteral("<a status=\"fail\" class=\"dropdown-item\" href=\"#\">Fail<span class=\"status danger pull-right\">"); } WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t"); if (Model.ContainsStatus(Status.Fatal)) {WriteLiteral("<a status=\"fatal\" class=\"dropdown-item\" href=\"#\">Fatal<span class=\"status danger pull-right\">"); } WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t"); if (Model.ContainsStatus(Status.Error)) {WriteLiteral("<a status=\"error\" class=\"dropdown-item\" href=\"#\">Error<span class=\"status warning pull-right\">"); } WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t"); if (Model.ContainsStatus(Status.Warning)) {WriteLiteral("<a status=\"warning\" class=\"dropdown-item\" href=\"#\">Warning<span class=\"status warning pull-right\">"); } WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t"); if (Model.ContainsStatus(Status.Skip)) {WriteLiteral("<a status=\"skip\" class=\"dropdown-item\" href=\"#\">Skip<span class=\"status warning pull-right\">"); } WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<div class=\"dropdown-divider\">