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
Version 8 introduced a change in #1879 where the IApiResponse<out T> interface applies the new keyword on certain properties like StatusCode and ContentHeaders.
If you have a method that uses the non-generic IApiResponse as parameter, the base interface properties will be used which will then not be set. This is especially difficult when mocking these interfaces where we now have to setup both the properties of the generic and non-generic interface.
This is a breaking change which is not mentioned in the release notes of release 8.0.0. This works perfectly in version 7.2.2
Step to reproduce
Have a method that uses the non-generic IApiResponse:
timosnel
changed the title
[Bug]: new keyword for properties on generic IApiResponse
[Bug]: new keyword for properties on generic IApiResponse breaks inheritance
Nov 21, 2024
Describe the bug 🐞
Version 8 introduced a change in #1879 where the
IApiResponse<out T>
interface applies thenew
keyword on certain properties likeStatusCode
andContentHeaders
.If you have a method that uses the non-generic
IApiResponse
as parameter, the base interface properties will be used which will then not be set. This is especially difficult when mocking these interfaces where we now have to setup both the properties of the generic and non-generic interface.This is a breaking change which is not mentioned in the release notes of release 8.0.0. This works perfectly in version 7.2.2
Step to reproduce
Have a method that uses the non-generic
IApiResponse
:Create a unit test that mocks the generic
IApiResponse<out T>
interface and calls the method:This results in
null
values for the non-generic interface, making the test fail:Reproduction repository
No response
Expected behavior
Setting properties on the generic interface should result in being able to use it as the non-generic interface (not breaking inheritance)
Screenshots 🖼️
No response
IDE
No response
Operating system
No response
Version
.NET >6
Device
No response
Refit Version
8.0.0
Additional information ℹ️
No response
The text was updated successfully, but these errors were encountered: