You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have recently found that IJSInProcessObjectReference.Invoke<TValue> is attributed under [RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")]here.
However we have add [DynamicallyAccessedMembers(JsonSerialized)] for its TValue, so it seems unnecessary to use RequiresUnreferencedCode?
And we didn't do that in IJSObjectReference, so I believe it should be a mistake.
The text was updated successfully, but these errors were encountered:
yueyinqiu
changed the title
Blazor should IJSInProcessObjectReference.Invoke be attributed with RequiresUnreferencedCode?
Blazor IJSInProcessObjectReference.Invoke is attributed with RequiresUnreferencedCode
Oct 30, 2024
I'm not sure what the right thing to do here is. From what I know, I believe that both are required. The challenge with DynamicallyAccessedMembers is that it only "preserves" the first level, and not the entire "object graph".
You could say that DynamicallyAccessedMembers is then not enough to tell the linker what it needs to preserve, and it also only affects the return value itself, and not any other parameter that gets passed in.
RequiresUnreferencedCode provides a broader warning that when calling that API, you might need to ensure other types are preserved.
Based on that, I think the right thing to do would be to annotate the other APIs with [RequiresUnreferencedCode] too. I'm not sure why it wasn't done.
Hello, I have recently found that
IJSInProcessObjectReference.Invoke<TValue>
is attributed under[RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed.")]
here.However we have add
[DynamicallyAccessedMembers(JsonSerialized)]
for itsTValue
, so it seems unnecessary to useRequiresUnreferencedCode
?And we didn't do that in
IJSObjectReference
, so I believe it should be a mistake.The text was updated successfully, but these errors were encountered: