-
-
Notifications
You must be signed in to change notification settings - Fork 568
Fix CodeMatch.Calls to match Newobj opcode and add ConstructorInfo overload #759
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
|
@copilot We changed a few areas of the code so I want you to think general and find uses we missed. Something that would make sense and would keep things in symmetry function-wise. I want to avoid adding features that only solve part of the problem they touch. Do not edit code but just work out what we might have been overlooking related to the context this PR and its original Issue is about. |
Here's my analysis of potential gaps and related areas: 1. 2. Dead code: 3. Missing 4. Expression-based constructors 5. The priority should be #1 (the extension method) as it has the same documentation/behavior mismatch as the original issue. |
Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
CodeMatch.Calls(MethodInfo)only matchedCall/Callvirtopcodes, notNewobj, contradicting XML docs that claimed constructor support. No API existed to match constructors byConstructorInfo.Changes
Opcode matching
opcodesCallingwithopcodesCallingOrNewobj(Call,Callvirt,Newobj)Callsmethods and expression-basedCodeMatchconstructorsNew overloads
CodeMatch.Calls(ConstructorInfo)CodeMatch.Calls(MethodBase)CodeInstruction.Calls(ConstructorInfo)extensionDocumentation
Callsmethods now explicitly document matched opcodes and null behaviorBinary compatibility
Original
Calls(MethodInfo)signature preserved. New overloads are purely additive—existing compiled code works without recompilation.Usage
Original prompt
CodeMatch.Calls(MethodInfo)does not match constructors despite XML docs/summary claiming it does #758💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.