corert icon indicating copy to clipboard operation
corert copied to clipboard

Generating native code with Grpc.Core

Open DenMpei opened this issue 5 years ago • 3 comments

Good day!

I hit the following issue: dotnet publish -r win-x64 leads to numerous compilation errors

image

Inside the package is used Grpc.Core 2.28.1

image

Сompile with Microsoft.DotNet.ILCompiler 1.0.0-alpha-29408-02

Adding code from this issue doesn't help

I ask to give advice to solve the problem. Regards.

DenMpei avatar Oct 09 '20 06:10 DenMpei

Adding code from this issue doesn't help

The attribute got renamed to UnmanagedCallersOnly. Try this definition:

https://github.com/dotnet/corert/blob/4ce1c21ac0d4d1a3b7f7a548214966f69ac9f199/samples/NativeLibrary/UnmanagedCallersOnly.cs#L6-L12

MichalStrehovsky avatar Oct 09 '20 08:10 MichalStrehovsky

Didn't work :( I will try to provide a minimal version of the project. But it won't be soon, because reference on Grpc.Core is very deep in real project. :(

DenMpei avatar Oct 12 '20 12:10 DenMpei

Didn't work :( I will try to provide a minimal version of the project. But it won't be soon, because reference on Grpc.Core is very deep in real project. :(

Make sure you put the UnmanagedCallersOnlyAttribute-annotated method in the entrypoint assembly (whatever assembly is the main executable). The compiler doesn't look elsewhere.

MichalStrehovsky avatar Oct 12 '20 17:10 MichalStrehovsky