-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxies using Records derived from a base generic record broken using .NET 6 compiler #632
Comments
@stakx not sure if you were aware of this one. |
@CesarD, sorry for not getting back to you sooner. I'll try looking into this in the next few days. |
Thanks so much!! 🤩🤩 |
Finally found some time to look into this today. As suspected, the root cause for this issue is the same as in #601 (comment). We solved that other issue by adding the following logic inside Core/src/Castle.Core/DynamicProxy/Generators/MethodSignatureComparer.cs Lines 132 to 139 in 323c03f
But before code execution gets there, it has to go through several other checks, amongst them this one here:
This is why your scenario with a generic record base class fails: DynamicProxy compares the signatures of the |
Thanks a lot for taking care of this one!! <3 |
@CesarD, FYI, I've just pushed Moq 4.18.4 to NuGet, which now uses Castle.Core 5.1.1, which includes a fix for your issue. |
Thank you so much!!! 👏🏼🫶🏼 |
Similar to what occurred in #601, when trying to mock (with Moq) records derived from a base generic record, an exception is thrown.
Repro code:
Variable
a
holds the mocked object as expected, but when initializingb
, the following is thrown:Originally posted by @CesarD in #601 (comment)
The text was updated successfully, but these errors were encountered: