You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
I try to run simple code on mac with .net6 and get an RazorEngine.Templating.TemplateCompilationException on extent.Flush();
Code:
var extent = new ExtentReports();
var htmlReporter = new ExtentHtmlReporter("index.html");
extent.AttachReporter(htmlReporter);
extent.CreateTest("MyFirstTest").Pass("details");
extent.Flush();
It works fine on Windows. And it also work for .net framework4 on mac. But for some reason it fails for .net6 on mac. Any ideas how to deal with it?
Detailed exception:
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: (19, 5) The variable 'isbdd' is assigned but its value is never used
- warning: (6, 4) Unnecessary using directive.
- warning: (12, 4) Unnecessary using directive.
- warning: (5, 4) Unnecessary using directive.
- warning: (11, 4) Unnecessary using directive.
- warning: (10, 4) Unnecessary using directive.
- warning: (7, 4) Unnecessary using directive.
- warning: (9, 4) Unnecessary using directive.
- warning: (8, 4) Unnecessary using directive.
- error: (0, 0) Unexpected error writing debug information -- 'Value cannot be null. (Parameter 'type')'
Temporary files of the compilation can be found in (please delete the folder): /var/folders/jv/px1yw_fx1q5f3m8_xb_0j_tr0000gn/T/RazorEngine_opu01ae2.try
The template we tried to compile is:
------------- START -----------
@using AventStack.ExtentReports
@using AventStack.ExtentReports.ViewDefs
@using RazorEngine
@using RazorEngine.Templating
@{
var isbdd = false;
var cls = "";
if (Model.TestList.Count > 0 && Model.TestList[0].IsBehaviorDrivenType)
{
isbdd = true;
cls = "bdd-report";
}
}
<!DOCTYPE html>
<html>
@Include("Head")
<script src="https://cdn.rawgit.com/extent-framework/extent-github-cdn/7cc78ce/spark/js/jsontree.js"></script>
<body class="spa @cls @Model.MasterConfig.GetValue("theme")">
<div class="app header-dark side-nav-folded">
<div class="layout">
@Include("Navbar")
@Include("Sidenav")
<div class="page-container">
<div class="main-content">
@Include("SparkTestSPA")
@if (Model.CategoryContext.Context.Count > 0)
{
@Include("SparkTagSPA")
}
@if (Model.ExceptionInfoContext.Context.Count > 0)
{
@Include("SparkExceptionSPA")
}
@Include("SparkDashboardSPA")
</div>
</div>
</div>
</div>
@Include("Scripts")
</body>
</html>
------------- END -----------
The generated source code is:
------------- START -----------
// <auto-generated/>
#pragma warning disable 1591
namespace CompiledRazorTemplates.Dynamic
{
#line hidden
using System.Threading.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using AventStack.ExtentReports;
using AventStack.ExtentReports.ViewDefs;
using RazorEngine;
using RazorEngine.Templating;
internal class RazorEngine_d9d10667628d446a9365830c59621d34 : RazorEngine.Templating.TemplateBase<AventStack.ExtentReports.Reporter.ExtentHtmlReporter>
{
#pragma warning disable 1998
public async override global::System.Threading.Tasks.Task ExecuteAsync()
{
var isbdd = false;
var cls = "";
if (Model.TestList.Count > 0 && Model.TestList[0].IsBehaviorDrivenType)
{
isbdd = true;
cls = "bdd-report";
}
WriteLiteral("<!DOCTYPE html>\r\n<html>\r\n");
Write(Include("Head"));
WriteLiteral("\r\n<script src=\"https://cdn.rawgit.com/extent-framework/extent-github-cdn/7cc78ce/spark/js/jsontree.js\"></script>\r\n<body");
BeginWriteAttribute("class", " class=\"", 452, "\"", 506, 3);
WriteAttributeValue("", 460, "spa", 460, 3, true);
WriteAttributeValue(" ", 463, cls, 464, 4, false);
WriteAttributeValue(" ", 468, Model.MasterConfig.GetValue("theme"), 469, 37, false);
EndWriteAttribute();
WriteLiteral(">\r\n <div class=\"app header-dark side-nav-folded\">\r\n <div class=\"layout\">\r\n ");
Write(Include("Navbar"));
WriteLiteral("\r\n ");
Write(Include("Sidenav"));
WriteLiteral("\r\n <div class=\"page-container\">\r\n <div class=\"main-content\">\r\n ");
Write(Include("SparkTestSPA"));
WriteLiteral("\r\n");
if (Model.CategoryContext.Context.Count > 0)
{
Write(Include("SparkTagSPA"));
}
WriteLiteral("\t\t\t\t\t");
if (Model.ExceptionInfoContext.Context.Count > 0)
{
Write(Include("SparkExceptionSPA"));
}
WriteLiteral("\t\t\t\t\t");
Write(Include("SparkDashboardSPA"));
WriteLiteral("\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\t");
Write(Include("Scripts"));
WriteLiteral("\r\n</body>\r\n\r\n</html>");
}
#pragma warning restore 1998
}
}
#pragma warning restore 1591
------------- END -----------
List of loaded Assemblies:
/usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Private.CoreLib.dll
Loaded Assembly: /Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/netcoreapp3.0/ReSharperTestRunner.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Runtime.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Runtime.Loader.dll
Loaded Assembly: /Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/netcoreapp3.0/JetBrains.ReSharper.TestRunner.Merged.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/netstandard.dll
Loaded Assembly: /Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/netcoreapp3.0/JetBrains.ReSharper.TestRunner.Abstractions.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Console.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Threading.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/Microsoft.Win32.Primitives.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Collections.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Memory.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Linq.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Text.RegularExpressions.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.ComponentModel.TypeConverter.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Runtime.Extensions.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Runtime.InteropServices.RuntimeInformation.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Private.Uri.dll
Loaded Assembly: /Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/netcoreapp3.0/JetBrains.ReSharper.TestRunner.Utilities.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Diagnostics.Process.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.ComponentModel.Primitives.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Threading.ThreadPool.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Diagnostics.Debug.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Diagnostics.TraceSource.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.ComponentModel.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Collections.Concurrent.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Linq.Expressions.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Reflection.Emit.ILGeneration.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Reflection.Emit.Lightweight.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Reflection.Primitives.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.ObjectModel.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Net.Primitives.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Reflection.Emit.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Threading.Thread.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Net.Sockets.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Diagnostics.Tracing.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Runtime.InteropServices.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Collections.NonGeneric.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Threading.Tasks.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Runtime.Serialization.Formatters.dll
Loaded Assembly: /Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/Adapters/NUnit3/netstandard2.0/JetBrains.ReSharper.TestRunner.Adapters.NUnit3.Tasks.dll
Loaded Assembly: /Applications/Rider.app/Contents/lib/ReSharperHost/TestRunner/Adapters/NUnit3/netstandard2.0/JetBrains.ReSharper.TestRunner.Adapters.NUnit3.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.IO.FileSystem.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/nunit.engine.api.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/nunit.engine.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/nunit.engine.core.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Xml.ReaderWriter.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Private.Xml.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/testcentric.engine.metadata.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/TestsApi.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/nunit.framework.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Text.Encoding.Extensions.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Net.Http.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Framework.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/ExtentReports.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.Extensions.Configuration.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.Extensions.Configuration.Abstractions.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.Extensions.Configuration.FileExtensions.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.Extensions.Configuration.Json.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.Extensions.FileProviders.Physical.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.Extensions.FileProviders.Abstractions.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.Extensions.Primitives.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.IO.FileSystem.Watcher.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.Extensions.FileSystemGlobbing.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Newtonsoft.Json.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Runtime.Numerics.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Xml.XDocument.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Private.Xml.Linq.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/MongoDB.Bson.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/RazorEngine.NetCore.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.AspNetCore.Razor.Language.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Diagnostics.DiagnosticSource.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Net.Security.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Security.Cryptography.X509Certificates.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Net.NameResolution.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Security.Cryptography.Primitives.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Security.Cryptography.Encoding.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Formats.Asn1.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Net.Http.Json.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Text.Json.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Text.Encodings.Web.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Runtime.Intrinsics.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Numerics.Vectors.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Runtime.CompilerServices.Unsafe.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.CodeAnalysis.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Collections.Immutable.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/System.Security.Permissions.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.IO.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/Microsoft.CSharp.dll
Loaded Assembly: /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/bin/Debug/net6.0/Microsoft.CodeAnalysis.CSharp.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.ValueTuple.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Reflection.Metadata.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Threading.Tasks.Parallel.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Globalization.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Reflection.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Text.Encoding.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Security.Cryptography.Algorithms.dll
Loaded Assembly: /usr/local/share/dotnet/shared/Microsoft.NETCore.App/6.0.19/System.Resources.ResourceManager.dll
at RazorEngine.Roslyn.CSharp.RoslynCompilerServiceBase.CompileType(TypeContext context)
at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType)
at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType)
at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
at AventStack.ExtentReports.Reporter.ExtentHtmlReporter.Flush(ReportAggregates reportAggregates)
at AventStack.ExtentReports.Core.ReportObservable.<>c__DisplayClass59_0.<NotifyReporters>b__0(IExtentReporter x)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at AventStack.ExtentReports.Core.ReportObservable.NotifyReporters()
at AventStack.ExtentReports.Core.ReportObservable.Flush()
at AventStack.ExtentReports.ExtentReports.Flush()
at TestsApi.Tests.ApiTestsBase.Cleanup() in /Users/amelentyev/Documents/projects/One/git/wallet-autotests/TestsApi/Tests/ApiTestsBase.cs:line 35
The text was updated successfully, but these errors were encountered:
I haven't yet changed the Razor implementation but most of the beta1 code is built on MacOS. Can you give it a try and revert back if you continue to face this issue?
Please note: with version 5, ExtentHtmlReporter is deprecated and ExtentSparkReporter is the replacement. So the above code will change slightly:
using AventStack.ExtentReports;
using AventStack.ExtentReports.Reporter;
var extent = new ExtentReports();
var htmlReporter = new ExtentSparkReporter("index.html");
extent.AttachReporter(htmlReporter);
extent.CreateTest("MyFirstTest").Pass("details");
extent.Flush();
Hi!
I try to run simple code on mac with .net6 and get an RazorEngine.Templating.TemplateCompilationException on extent.Flush();
Code:
It works fine on Windows. And it also work for .net framework4 on mac. But for some reason it fails for .net6 on mac. Any ideas how to deal with it?
Detailed exception:
The text was updated successfully, but these errors were encountered: