Skip to content

Fix #886: use default instead of null for optional struct ByRef parameters#1253

Open
GrahamTheCoder wants to merge 1 commit intoicsharpcode:masterfrom
GrahamTheCoder:claude/fix-issue-886-optional-struct-ref
Open

Fix #886: use default instead of null for optional struct ByRef parameters#1253
GrahamTheCoder wants to merge 1 commit intoicsharpcode:masterfrom
GrahamTheCoder:claude/fix-issue-886-optional-struct-ref

Conversation

@GrahamTheCoder
Copy link
Copy Markdown
Member

Fixes #886

When a VB optional ByRef parameter has a struct type with Nothing as default, Roslyn returns null from ExplicitDefaultValue. Generating a null literal causes a C# compile error since structs cannot be null. Use default instead when the parameter type is a value type and the default value is null.

https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX

…uct ByRef parameters

When a VB optional ByRef parameter has a struct type with `Nothing` as default,
Roslyn returns null from ExplicitDefaultValue. Generating a null literal causes
a C# compile error since structs cannot be null. Use `default` instead when the
parameter type is a value type and the default value is null.

https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
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

Successfully merging this pull request may close these issues.

VB -> C#: wrong conversion of optional struct or decimal ref parameter

2 participants