Open Vitala opened 5 years ago
I got same problem on macos 10.13.2
me too...
+1
I got the same problem on macos 10.14.3
+1 macos 10.14.3
Blocking my tool development. :(
Workaround :
I had to fork and changed :
RazorEngine.Roslyn.CSharp.RoslynCompilerServiceBase.cs:
using (var assemblyStream = File.Open(assemblyFile, FileMode.Create, FileAccess.ReadWrite))
using (var pdbStream = File.Open(assemblyPdbFile, FileMode.Create, FileAccess.ReadWrite))
{
var opts = new EmitOptions()
.WithPdbFilePath(assemblyPdbFile);
var pdbStreamHelper = pdbStream;
if (IsMono()) {
opts = opts.WithDebugInformationFormat(DebugInformationFormat.PortablePdb);
}
EmitResult result = null;
if (Debugger.IsAttached) {
result = compilation.Emit(assemblyStream, pdbStreamHelper, options: opts);
} else {
result = compilation.Emit(assemblyStream);
}
//var result = compilation.Emit(assemblyStream, pdbStreamHelper, options: opts);
//var result = compilation.Emit(assemblyStream);
if (!result.Success)
{
var errors =
result.Diagnostics.Select(diag => {
var lineSpan = diag.Location.GetLineSpan();
return new Templating.RazorEngineCompilerError(
string.Format("{0}", diag.GetMessage()),
lineSpan.Path,
lineSpan.StartLinePosition.Line,
lineSpan.StartLinePosition.Character,
diag.Id,
diag.Severity != DiagnosticSeverity.Error);
});
throw new Templating.TemplateCompilationException(errors, compilationData, context.TemplateContent);
}
}
compilation.Emit(assemblyStream, pdbStreamHelper, options: opts)
is the part that fails.
Be aware that I think you wont get error details in case of a template error.
And of course requires more testing...
Works in a Docker container hosted in kubernetes.
Still not working :( Need a fix for this.
Did you implemented the changes above?
Basically you only need to change (line#242) :
compilation.Emit(assemblyStream, pdbStreamHelper, options: opts)
to
compilation.Emit(assemblyStream)
I forked this version : https://github.com/fouadmess/RazorEngine
You get the same error?
Just got the same error on ubuntu when using:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RazorEngine.NetCore" Version="2.2.2" />
</ItemGroup>
</Project>
When using dotnet add package RazorEngine --version 4.5.1-alpha001
, i get "Could not load file or assembly 'System.Configuration.ConfigurationManager ...." https://github.com/Antaris/RazorEngine/issues/515
@Antaris is it that RazorEngine
has never worked on netcoreapp
?
Did you implemented the changes above?
Basically you only need to change (line#242) :
compilation.Emit(assemblyStream, pdbStreamHelper, options: opts)
tocompilation.Emit(assemblyStream)
I forked this version : https://github.com/fouadmess/RazorEngine
You get the same error?
Unfortunately I didnt hesitate and switched the library to get rid of the problem, because I didn't want to fork it and package it myself. I am on RazorLight now. It has other downsides, but it atleast fixed my problem for the moment.
What is the current status of this error? Any updates? Is there any way to run this package on Linux?
any fix on this?
still getting the same error in docker
did you guys use any alternative plugin aside from razor engine that works in container
See my previous comment. :)
I am on RazorLight now. It has other downsides, but it atleast fixed my problem for the moment.
I switched to a different template engine (not Razor).
the same problem. .net core 2.2 on linux
- error: (0, 0) Unexpected error writing debug information -- 'COM Interop is not supported on this platform.'
the same problem. .net core 2.1 ~ 3.1 on mac
I switched to a different template engine (not Razor).
What did you change to?
I think as of today, you got 2 options (without changing your existing templates):
Personally, I switched to RazorLight
One interesting observation on MacOS using Rider. If running the project with a debugger attached, I get this error. If the debugger isn't attached, no error.
Can you give me a slight insight what's happening here and why it tries to use Interop?
The template itself is quite simple:
However when I run it on a remote Linux machine in a docker container I got the following error:
I'm using 4.6.0-rc1 version btw.