-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Using another option in the dotnet.runtimeconfig.json for the framework won't find coreclr.dll #212
Comments
I was not able to replicate this error using https://github.com/agracio/edge-js-quick-start. Try creating a GitHub repo that reproduces this problem. |
Just to clarify both this and #211 issues, if you want to override default config for |
The problem is related to setting the framework in the dotnet.runtimeconfig.json to Microsoft.AspNetCore.App instead of Microsoft.NETCore.App. About #211: I am using node 16.20.1 BTW. D:\RD\edge-js-quick-start>npm start > edge-js-quick-start@1.0.0 start CoreClrEmbedding::Initialize - Could not resolve CoreCLR path. For more details, enable tracing by setting COREHOST_TRACE environment variable to 1 D:\RD\edge-js-quick-start\node_modules\edge-js\lib\edge.js:178 TypeError: edge.initializeClrFunc is not a function |
Can you explain how you are modifying Maybe start by explaining what you are trying to achieve in the first place by modifying runtime config. If we take a step back from Edge.js and look at C# code only, how are you changing it in pure C# and making your project work? The article explains how to add runtime config to your project either via Unfortunately at this time I do not see Edge.js offering support for changed |
I am currently porting a large codebase from .Net Framework 4.7 to .NET 8. Part of the codebase uses edge-js. Changes involve using grpc in some places instead of WCF amongst other things. When I tried to run the modified code using edge-js, at some point it crashed because Microsoft.Extensions.Configuration.Abstractions could not be found.. |
Ok now the problem makes sense however I can offer an easier solution. if you set the following properties in your .csproj <PreserveCompilationContext>true</PreserveCompilationContext>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> C# compile will copy all required assemblies to the output directory, this will include This is not ideal solution since it will dump all the required dlls into the output folder but definitely solves the problem more elegantly than modifying system I am still surprised that it did not work correctly since Edge.js should have picked it up from process.env.EDGE_USE_CORECLR = 1;
process.env.EDGE_APP_ROOT = pathToMyOutput;
const edge = require('edge-js'); These parameter have to be set before you call |
All assemblies are in the .deps.json. The problem is that they are not in the output folder if you reference any project which has the AspNetCore framework set. When I started investigating I added dependencies one by one until this happened. I also tried the fixes you suggested. I was about to write a comment that I fixed the problem by separating the grpc client and server implementations. The aspnetcore is only required by the server, and was not used by part that is used in edge-js. The assemblies now load fine. But now I have another problem: |
Great at least one problem solved, let me look into e_sqlite3.dll. Unfortunately depending on dll PlatformNotSupported can either be resolved relatively easy or not resolved at all. The only other open issue in this repo is referring to the one that I was not able to resolve at all. |
What package are you using for SQLite, tried Microsoft.Data.Sqlite and it ran without any problems in QuickStart. |
It is used indirectly with EF Core. I will try to use Microsoft.Data.Sqlite. |
If you can give me package names and some code examples I will try to reproduce it, in some cases there is a relatively easy solution to this problem. EDIT: publishing project rather than just compiling it might solve the problem #191 (comment) The solution described in this link should fix the problem but you are unlikely to require additional package references so simply try publishing it with correct arch |
Another thing to consider is if something runs in QuickStart without PlatformNotSupported it is not always indicative that it will run in another project however it does mean that the issue can be resolved using This is not an issue specific to Edge.js but rather an issue with dynamically loaded assemblies as I learned while researching #191 |
After a long investigation it finally works. CoreClrEmbedding::Initialize - Failed to initialize CoreCLR, HRESULT: 0x80070057 0x80070057 being "invalid parameter" I have tried several things with EDGE_APP_ROOT, copying .deps files around etc. and each time got this error. When I opened the trace output from the with EDGE_APP_ROOT set to the bootstrap folder besides the one without EDGE_APP_ROOT I immediately spotted the difference: I have been a programmer for more than 40 years in Microsoft environments, and even in MS-DOS both variants were accepted as a path separator. I always use forward slashes because they are more portable. @agracio maybe you can mention this in the documentation. |
https://github.com/agracio/edge-js-quick-start has EDGE_APP_ROOT set, that is why I mentioned it earlier. Both default and EDGE_APP_ROOT set in https://github.com/agracio/edge-js-quick-start use forward slashes so not sure if you identified the problem correctly. The likely problem you are facing is that EDGE_APP_ROOT in QuickStart and default resolver use If you are looking for default resolver for C# interpreter it will be in https://github.com/agracio/edge-js-quick-start shows all the basics on how to run .NET Core app including EDGE_APP_ROOT setting. |
Did you manage to resolve all of the issues with project migration? |
The last step: changing the forward slashes to backslashes fixed it. There are more reports mentioning slash problems in dotnet BTW: Maybe this is some kind of regression in .NET 8. I will close the issue |
Try this dotnet.runtimeconfig.json :
{ "runtimeOptions": { "tfm": "net8.0", "framework": { "name": "Microsoft.AspNetCore.App", "version": "8.0.2" }, "configProperties": { "System.Reflection.Metadata.MetadataUpdater.IsSupported": false, "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false } } }
The initialization will fail with the message that coreclr.dll is not found.
The text was updated successfully, but these errors were encountered: