Skip to content
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

Mock of interface or class that has method with struct parameter set to "default" results in compilation error #37

Closed
ssitwell opened this issue Jan 23, 2025 · 3 comments

Comments

@ssitwell
Copy link

When a mocked interface or class has a struct as a parameter that is set to default, as follows:

public class TestClass
{
  int TestMethod(TestStruct aTestStruct = default)
  {
    return 0;
  }
}

it results in a compilation error of the generated mock file:

CS1750 A value of type '<null>' cannot be used as a default parameter because there are no standard conversions to type 'TestStruct'

@HugoX104447
Copy link
Contributor

I have addressed the issue here: #35

@connorivy
Copy link
Owner

@ssitwell

Thanks for bringing this issue to my attention. @HugoX104447 is correct. He fixed this issue, and your code should work if you upgrade to the new 1.1.0 version. Please let me know if you have any other issues.

I'm going to close this issue because I think this is fixed. Feel free to reopen and ping me if it's not.

@ssitwell
Copy link
Author

Thanks. That was incredibly quick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants