-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
[Question] Trim Unused Code option #529
Comments
Trimming worked with this library and .NET 6 but not .NET 7 last I checked. Are you using .NET 7? |
I am using .Net 7 yes. |
Could you try .NET 6? You will get a warning, but it should work. It'll be interesting to see if it's a problem in .NET 8. @natemcmaster I understand the project is in maintenance mode, but would you be willing to address this at some point, particularly if it continues to be a problem in .NET 8? |
I'm willing to take pull requests. If someone is willing to investigate the problem and identify a solution, please let me know what it takes to fix this. I'm not planning to do that work myself. |
@natemcmaster #539 is related and explains the fix. It would be good to get this fixed as it's important for self-contained apps and affects .NET 8 as well as .NET 7. |
I have a console app taking an argument and several options which are passed in as settings.
As such the compiler is seeing the properties as unused because they are never changed only read.
Setting them as public prevents the warnings but not the compiler behaviour.
When I publish the application as a single file with the 'Trim Unused Code' option enable then run app.exe -? none of the options appear, just the basic help text. Running the app doesn't work as exceptions are thrown for the missing options.
When I publish the app without the option the help shows and the code works.
Is this expected behaviour, or am I setting this up wrong.
I can put together a sample app if required.
The text was updated successfully, but these errors were encountered: