Fix first round of trim warnings#2451
Merged
NickCraver merged 2 commits intoStackExchange:mainfrom May 1, 2023
Merged
Conversation
- DefaultOptionsProvider.TryGetAzureRoleInstanceIdNoThrow use Type.GetType to check for Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment, so the trimmer knows to preserve this type, if it is in the app - ChannelMessage use the added public API for ChannelReader CanCount and Count, but fallback to reflection on netcoreapp3.1, since those APIs are not available on that runtime. Contributes to StackExchange#2449
Collaborator
|
Awesome! Not for this PR, but I'd be curious what a trim example looks like, and what it adds to test runtime overall. I'd like to ensure no breaks but when I last tried this the time cost was pretty high - can we do the check itself fairly quickly these days? |
Contributor
Author
There are 2 routes we can take to enable checking:
Any thoughts on those options? |
Contributor
Author
|
I'm not sure the CI failures are caused by me. But I can't really tell what failed. The Windows leg passed, so that makes me think it isn't my code. |
philon-msft
approved these changes
May 1, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to #2449
This at least removes the warnings from using
Microsoft.Extensions.Caching.StackExchangeRedis.We could also add a trimming test app as outlined in https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming#show-all-warnings-with-sample-application, along with a unit test that publishes the app and ensures there are no new warnings. LMK if you think this is valuable.
There are still these warnings left in this library:
Fixing those will require a bit more work, as the whole LuaScript functionality looks like it needs to be marked
RequiresUnreferencedCode.cc @mgravell @NickCraver