Skip to content

AoT Linker Warning in Grpc.AspNetCore.Server.Reflection #2605

Open
@Simonl9l

Description

@Simonl9l

What version of gRPC and what language are you using?

<PackageVersion Include="Grpc.AspNetCore" Version="2.67.0" />
<PackageVersion Include="Grpc.AspNetCore.Server.Reflection" Version="2.67.0" />

What operating system (Linux, Windows,...) and version?

All

What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info)

dotnet --info
.NET SDK:
 Version:           9.0.101
 Commit:            eedb237549
 Workload version:  9.0.100-manifests.693890c1
 MSBuild version:   17.12.12+1cce77968

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  13.7
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/9.0.101/

.NET workloads installed:
 [wasi-experimental]
   Installation Source: SDK 9.0.100
   Manifest Version:    9.0.1/9.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/9.0.100/microsoft.net.workload.mono.toolchain.current/9.0.1/WorkloadManifest.json
   Install Type:        FileBased

 [aspire]
   Installation Source: SDK 9.0.100
   Manifest Version:    8.2.2/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.aspire/8.2.2/WorkloadManifest.json
   Install Type:        FileBased

Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0
  Architecture: arm64
  Commit:       9d5a6a9aa4

.NET SDKs installed:
  9.0.101 [/usr/local/share/dotnet/sdk]

.NET runtimes installed: 
  Microsoft.NETCore.App 9.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

What did you do?

If possible, provide a recipe for reproducing the error. Try being specific and include code snippets if helpful.

var builder = WebApplication.CreateSlimBuilder();
...
builder.Services.AddGrpcReflection();
...
 var web = builder.Build();

web.MapGrpcReflectionService();

What did you expect to see?

No IL Trim warnings

What did you see instead?

 /_/src/Grpc.AspNetCore.Server.Reflection/GrpcReflectionServiceExtensions.cs(129): Trim analysis warning IL2075: Microsoft.Extensions.DependencyInjection.GrpcReflectionServiceExtensions.GetDescriptorPropertyFallback(Type): 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String,BindingFlags,Binder,Type,Type[],ParameterModifier[])'. The return value of method 'System.Reflection.MemberInfo.DeclaringType.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. 

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

See TROUBLESHOOTING.md for how to diagnose problems better.

Anything else we should know about your project / environment?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions