-
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
Turn on single-file analyzer and fix problems #5426
Conversation
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.
👍
src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlVersionInfo.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/Control.ControlVersionInfo.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Igor Velikorossov <[email protected]>
private static FileVersionInfo GetAppFileVersionInfo() | ||
{ | ||
lock (s_internalSyncObject) | ||
{ | ||
if (s_appFileVersion is null) | ||
{ | ||
Type t = GetAppMainType(); | ||
if (t is not null) | ||
if (t is not null && t.Assembly.Location.Length > 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.
What made to add this second condition here?
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.
If this is in a single-file, t.Module.FullyQualifiedName
will return <Unknown>
and GetVersionInfo
will fail. ExecutablePath
should be single-file safe, however.
Should fully fix dotnet/runtime#44488
Proposed changes
This change turns on the single-file analyzer in the winforms repo, fixes the few real problems that were encountered, and suppresses warnings when issues are addressed.
Customer Impact
Full support for single-file publishing in WinForms, with some confidence that all issues are addressed.
Regression?
Risk
Very low.
Microsoft Reviewers: Open in CodeFlow