Skip to content

Wrong code generated when passing a C# struct (custom scalar) as required argument #8205

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

Open
ravasior opened this issue Apr 1, 2025 · 1 comment

Comments

@ravasior
Copy link

ravasior commented Apr 1, 2025

Product

Strawberry Shake

Version

15.1.3

Link to minimal reproduction

https://github.com/ravasior/StrawberryShake_Struct

Steps to reproduce

open file 'TestProject\GetModelId.graphql' and uncomment the last two lines.

What is expected?

the generated code should compile.

What is actually happening?

the generated code fails with:
CS0037: Cannot convert null to 'ModelId' because it is a non-nullable value type

the reason being that the Format method contains code testing the argument for null which is not valid for type struct.

Image

Relevant log output

...\TestProject\obj\Debug\net9.0\berry\MyClient.Client.cs(1188,26,1188,30): error CS0037: Cannot convert null to 'ModelId' because it is a non-nullable value type

Additional context

No response

@s2quake
Copy link

s2quake commented Apr 2, 2025

I have the same issue.

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

No branches or pull requests

2 participants