Replies: 1 comment 3 replies
-
|
In terms of ReactiveCommand it's likely a false positive. We went too and added those warnings when we got those warnings. RxApp though uses some reflection where the schedulers are by default in the past have been placed. We now have the I just need to probably this weekend go through and use that class instead, and see how many of these AOT warnings we can remove. ReactiveCommand itself doesn't use any reflection directly |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
When I update
ReactiveUIto 22.1.1 the build starts generate a lot of warnings because theReactiveCommand.Create...(...)methods have been annotated with the[RequiresUnreferencedCode]attribute. A warning might look like this:This is of course alarming. In my specific case I don't need AOT compatibility, but I do need trimming.
Nothing has actually changed in
ReactiveUI, the methods have apparently always been a risk, but now they are annotated to inform the caller of the situation.So now I'm migrating to
ReactiveUI.SourceGeneratorsand I was thinking that using the[ReactiveCommand]attributes would address this issue.But, when I use the
[ReactiveCommand]attribute to generate code, it appears that the source generator generates codes similar to the following, slightly abbreviated:The generated code does pretty much the same that my original code was doing, it calls
ReactiveCommand.CreateFromTask...which is now annotated with[RequiresUnreferencedCode].There's no warning though, since the whole generated code block is fenced by
#pragma warning disable. Notably, other generated code fromReactiveUI.SourceGeneratorsdisable some specific warnings, but here it's everything.So, finally, to my question:
Can I really trust that the code generator intentionally silences all warnings, because it knows that the use of the
ReactiveCommand.Create...methods are AOT and trimmer safe in the context where the code is generated?I have also been struggling to understand just under what circumstances
ReactiveCommand.Create...is safe to use, and when it's not. I have been trimming my app all the time, and have been usingReactiveCommand.Create...very much without any issues, but ignoring (or not having annotations to generate) trimming warnings works until it doesn't and I'd like to be very sure that it will work!Beta Was this translation helpful? Give feedback.
All reactions