-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Enable nullability in DesignerActionMethodItem #12676
base: main
Are you sure you want to change the base?
Conversation
909d588
to
e03833e
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12676 +/- ##
===================================================
- Coverage 76.05370% 76.04200% -0.01171%
===================================================
Files 3269 3269
Lines 643544 643572 +28
Branches 47429 47430 +1
===================================================
- Hits 489439 489385 -54
- Misses 150545 150622 +77
- Partials 3560 3565 +5
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
||
public virtual bool IncludeAsDesignerVerb { get; } | ||
|
||
public virtual void Invoke() | ||
{ | ||
_methodInfo ??= _actionList?.GetType()?.GetMethod(MemberName, BindingFlags.Default | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); | ||
_methodInfo ??= _actionList?.GetType()?.GetMethod(MemberName!, BindingFlags.Default | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining in detail why MemberName!
can never be null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can actually be null, but I did not want to add an extra exception to it.
@lonitra should I throw an exception instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's appropriate to add a more descriptive exception in this case. InvalidOperationException with message "Could not find method '{0}'."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
Files not reviewed (1)
- src/System.Windows.Forms.Design/src/PublicAPI.Shipped.txt: Language not supported
e03833e
to
6688d48
Compare
6688d48
to
092797c
Compare
System.ComponentModel.Design.Tests.DesignerActionMethodItemTests.Invoke_NullMemberName_ThrowsArgumentNullException Assert.Throws() Failure: Exception type was not an exact match\r\nExpected: typeof(System.ArgumentNullException)\r\nActual: typeof(System.InvalidOperationException)\r\n---- System.InvalidOperationException : Operation is not valid due to the current state of the object. Stack trace |
092797c
to
cc9a3d1
Compare
Proposed changes
Microsoft Reviewers: Open in CodeFlow