dotnet / dotnet/linker

[Question] Does trim analyzer emit warnings for the inaccessible code?

Open
#3,239 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
392
Forks
128
Avg merge
2d 10h
Merged PRs (30d)
2

Description

I want to share data contracts between backend and frontend, including API definition.

I use Refit and I see it generates private classes which are not used in assembly anywhere. These classes are instantiated with reflection. So there's no chance they are going to be ever rooted by static code.

When I set data contract library as trim compatible my BlazorWasm application fails to start because Refit cannot find the generated implementation. Obviously 🤣

Should not linker produce a warning when it detects an isolated set of private dependencies which are 100% will be inaccessible by any non-reflection code?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.