Closed TimothyMakkison closed 2 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 84.94%. Comparing base (
6ebeda5
) to head (9cec517
). Report is 163 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I am thinking that raising a diagnostic would be the best, accepting a null token may cause more harm further down the line.
I am thinking that raising a diagnostic would be the best, accepting a null token may cause more harm further down the line.
👍 What severity level should the diagnostic be? Should I also add a runtime exception if it a warning?
So it seems that CancellationToken = default gets turned into CancellationToken.None by the internal workings. However a completely unset value would result in a null reference exception. So I am thinking that a nullable unset token should raise a Error level diagnostic and the use of nullable Tokens should have a warning diagnostic. I have not run any tests on these scenarios yet, and there may be some checks within HttpClient to replace the null value with None.
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
CancellationToken?
being serialized.Tests/RestService
, includingNullableCancellationTokenShouldBeIgnored
I'm not sure how Refit should handle nullable Cancellation token, it's a struct so it isn't nullable by default. My two ideas:
CancellationToken
parameter should throw an exception or emit a diagnostic.CancellationToken?
, check these tokens for nullability. If they are null then substitute it with a default token.See #1915