Repository navigation
Convert omitted VB parameter lists to empty C# parameter lists consis… - #1311
Merged
GrahamTheCoder merged 1 commit intoNov 10, 2026
Conversation
…tently VB allows parentheses to be omitted for parameterless delegates and RaiseEvent accessors, leaving a null ParameterList. Delegates crashed with a null parameterList and RaiseEvent accessors silently lost their On<Event> method. Add AcceptParameterListAsync and use it everywhere a VB parameter list is converted (methods, delegates, accessors, Declare, operators, constructors, lambdas) instead of ad-hoc null fallbacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019FEr8FVAmHV9bscZ82CChg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1298
Summary
VB lets the parentheses be omitted when there are no parameters, leaving a null
ParameterList.Delegate Sub Callback/Delegate Function Provider As Integercrashed with "Value cannot be null (parameterList)".RaiseEventaccessor without parentheses silently lost its generatedOn<Event>()method.Root cause: each call site handled the null parameter list on its own, and some did not handle it at all. Fix: a shared
AcceptParameterListAsyncextension (inSyntaxNodeVisitorExtensions) that returns an empty C# parameter list for null. It is now used at every VB parameter list conversion: delegates, methods, Declare, constructors, operators, lambdas and the property/RaiseEvent accessor paths. The existing ad-hoc?? ParameterList()fallbacks were replaced by it.Tests added
Delegate Sub Callback,Delegate Function Provider As Integer, and the generic form without parentheses.RaiseEventaccessor without parentheses:OnMyEvent()is now emitted and called.Declare Sub/Declare Function,Sub New,SubandFunctionwithout parentheses.The delegate and RaiseEvent tests were confirmed red for the right reason before the fix.
For the reviewer
Full suite
1429 passed, 0 failed, 5 skipped. The master baseline file was empty, so there was nothing to compare against, but there were no failures.
Generated by Claude Code