-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Analyzer: Replace occurrences of TypeInfo with Type and GetTypeInfo() with GetType() #61122
Comments
Tagging subscribers to this area: @buyaa-n Issue DetailsRelated to #53217 (comment) Category: Reliability
|
Suggested severity: Suggestion FlagMemoryStream ms = new MemoryStream();
Type type = ms.GetType();
MemberInfo[] members1 = type.GetMembers();
// Before
TypeInfo typeInfo1 = type.GetTypeInfo();
MemberInfo[] members2 = typeInfo1.GetMembers();
// After
Type typeInfo1 = type;
MemberInfo[] members2 = typeInfo1.GetMembers(); Edit: The main description contains all the cases to address. |
Category: Maintainability |
Related to #53217 (comment)
For obsoleting
TypeInfo/GetTypeInfo
we need an analyzer/code fixer that replaces GetTypeInfo() with calls to GetType(), and occurrences of TypeInfo with Type. A heavy reflection code base that migrated to Windows 8/was written for the Windows 8 era, would have had widely used both. The key would be making it easier for folks to replace them when the type is obsolete.Category: Maintainability or Design
Severity: Info
cc @terrajobst @carlossanlop
The text was updated successfully, but these errors were encountered: