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

RazorEngine.Core.NetCore in a Linux docker container: 'COM Interop is not supported on this platform.' #65

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

zeeshankhan0330
Copy link

Running my selenium code on Linux docker container is giving me this error while generating report:
'COM Interop is not supported on this platform.'

@samuelkdavis
Copy link

samuelkdavis commented Nov 8, 2019

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 fouadmess/RazorEngine#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.

@RalucaGabrielaLupse
Copy link

@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!

@samuelkdavis
Copy link

@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);

@RalucaGabrielaLupse
Copy link

Hi, @samuelkdavis

Yes, you've been right.... the file has been saved to a different location than expected.

Thank you for your response, @samuelkdavis!

@namilkimfree
Copy link

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.

@samuelkdavis
Copy link

@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.

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

Successfully merging this pull request may close these issues.

6 participants