Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtentReport.flush throwing exception : Expression of type 'CompiledRazorTemplates.Dynamic.RazorEngine_b908e9946cfc452ba0c2ee97237ad0cf' cannot be used for return type 'RazorEngine.Templating.ITemplate #169

Open
mohitmaheshwari opened this issue Mar 14, 2023 · 1 comment

Comments

@mohitmaheshwari
Copy link

It was all working fine until .net6 and today when I upgraded my .net framework to .net 7
Extent.flush started throwing this issue

Exception Message :

`Expression of type 'CompiledRazorTemplates.Dynamic.RazorEngine_b9f52b03346147f1a44ad78178672b4f' cannot be used for return type 'RazorEngine.Templating.ITemplate'
`
Stack Trace : 
           at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression& body, ReadOnlyCollection`1 parameters, String paramName)
           at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, String name, Boolean tailCall, IEnumerable`1 parameters)
           at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, Boolean tailCall, IEnumerable`1 parameters)
           at RazorEngine.Templating.TypeLoader.GetConstructorInternal(Type type)
           at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
           at RazorEngine.Templating.TypeLoader.GetConstructor(Type type)
           at RazorEngine.Templating.TypeLoader.CreateInstance(Type type)
           at RazorEngine.Templating.DefaultActivator.CreateInstance(InstanceContext context)
           at RazorEngine.Templating.RazorEngineCore.CreateTemplate(ICompiledTemplate template, Object model, DynamicViewBag viewbag)
           at RazorEngine.Templating.RazorEngineCore.<RunTemplate>d__12.MoveNext()
           at RazorEngine.Templating.RazorEngineService.Run(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
           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.ExtentObservable.<>c__DisplayClass59_0.<NotifyReporters>b__0(IExtentReporter x)
           at System.Collections.Generic.List`1.ForEach(Action`1 action)
           at AventStack.ExtentReports.Core.ExtentObservable.NotifyReporters()
           at AventStack.ExtentReports.Core.ExtentObservable.Flush()
           at AventStack.ExtentReports.ExtentReports.Flush()
           at Everlight.UI.Test.Framework.Helpers.ReportHelper.Close()
           at ClinicalFeedback.Ui.AutoTests.Tests.TestCases.TestOneTimeSetUp.OneTimeTearDown() in C:\Users\mmaheshwari\source\repos\clinicalfeedback.ui.autotests\ClinicalFeedback.AutoTests.Ui.Tests\TestCases\TestOneTimeSetUp.cs:line 71
           at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
           at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
@SarahKeig84
Copy link

I'm also getting the same issue as of today. Worked fine Friday (10/03/2023) but not working now (14/03/2023).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants