extentreports-csharp
extentreports-csharp copied to clipboard
RazorEngine.Core.NetCore in a Linux docker container: 'COM Interop is not supported on this platform.'
Running my selenium code on Linux docker container is giving me this error while generating report: 'COM Interop is not supported on this platform.'
The 'COM Interop is not supported on this platform' is an error with the RazorEngine not supporting dotnetcore. This PR contains a potential fix to it https://github.com/fouadmess/RazorEngine/pull/3. I've managed to get Extent working with dotnetcore in a container with your PR's source code and the source code of the RazorEngine PR added to my project as direct project references.
My copy+pasted source code structure is: /src (my stuff) /Extent/DotnetCoreExtent (your PR) /Extent/RazorEnginePatch (the PR mentioned)
My project refers to your project, and I've updated your project to reference the RazorEngine patch instead of the nuget reference.
@SamuelKDavis, your OS inside docker was Linux? I'm trying to generate Reports inside Linux container using .Net Core 2.2, Selenium and ExtentReports.Core.
I did the same steps (FixedRazorEngine and added reference for it inside ExtentReportsCore), my application is running without any errors, but the file should be generated by ExtentReportsCore doesn't exist inside Results folder(Results folder was created).
If I'm running it without docker, the file is generated without any problems.
Thank you in advance!
@RalucaGabrielaLupse yep - linux docker container. If you aren't getting the COM Interop error, the file is likely being generated, but not where you're expecting it. Try fiddling with the paths.
I'm using the built-in temp path, which I believe in most linux distros is /tmp
var tempDirectory = Path.Combine(Path.GetTempPath(), "My.Project");
System.IO.Directory.CreateDirectory(tempDirectory);
var dateString = DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss");
// todo generate single html report
// https://stackoverflow.com/questions/57097328/extent-reports-generating-two-html-reports
var htmlReport = Path.Join(tempDirectory, $"Report-{dateString}.html");
var htmlReporter = new ExtentHtmlReporter(htmlReport);
htmlReporter.Config.ReportName = "Integration tests";
var extent = new AventStack.ExtentReports.ExtentReports();
extent.AttachReporter(htmlReporter);
Hi, @samuelkdavis
Yes, you've been right.... the file has been saved to a different location than expected.
Thank you for your response, @samuelkdavis!
My platform on mac i delete RazorEngine.Core extetnreports.core project and i add https://www.nuget.org/packages/RazorEngine.NetCore-LinuxDockerFix nuget package.
fouadmess/RazorEngine#3.
@namilkimfree awesome find! This nuget package didn't exist when I manually cloned the repo. I'm hoping these dependencies on PRs don't lock us into dotnetcore 2.2 forever. Having the nuget package at least seems to remove 1 layer of jankiness from our solution.