Skip to content

Fix Application.EnableVisualStyles in single file publishing mode#4149

Merged
JeremyKuhne merged 2 commits into
dotnet:masterfrom
JeremyKuhne:fix4145
Oct 26, 2020
Merged

Fix Application.EnableVisualStyles in single file publishing mode#4149
JeremyKuhne merged 2 commits into
dotnet:masterfrom
JeremyKuhne:fix4145

Conversation

@JeremyKuhne
Copy link
Copy Markdown
Member

@JeremyKuhne JeremyKuhne commented Oct 22, 2020

Fixes #4145

Customer Impact

  • Application.EnableVisualStyles gives Windows a manifest that enables the v6 common controls. We normally pull this manifest from a native resource in System.Windows.Forms.dll. In single file mode there is no "dll" to load from so this feature was not working as intended.
    In the case where we can't get a Win32 HMODULE we now fall back to pulling the manifest from a managed resource and dumping it to the temp folder.
  • Make ACTCTXW blittable.

Regression?

  • No, but makes the feature 'Self-contained + Produce Single File' virtually unsuitable for Windows Forms apps.

Risk

  • Minimal
Microsoft Reviewers: Open in CodeFlow

Application.EnableVisualStyles gives Windows a manifest that enables the v6 common controls. We normally pull this manifest from a native resource in System.Windows.Forms.dll. In single file mode there is no "dll" to load from so this feature was not working as intended.

In the case where we can't get a Win32 HMODULE we now fall back to pulling the manifest from a managed resource and dumping it to the temp folder.

Make ACTCTXW blittable.
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 22, 2020

Codecov Report

Merging #4149 into master will increase coverage by 0.00778%.
The diff coverage is 100.00000%.

@@                 Coverage Diff                 @@
##              master       #4149         +/-   ##
===================================================
+ Coverage   98.11665%   98.12443%   +0.00777%     
===================================================
  Files            494         494                 
  Lines         258422      258428          +6     
  Branches        4489        4489                 
===================================================
+ Hits          253555      253581         +26     
+ Misses          4105        4089         -16     
+ Partials         762         758          -4     
Flag Coverage Δ
#Debug 98.12443% <100.00000%> (+0.00777%) ⬆️
#production ?
#test 98.12443% <100.00000%> (+0.00777%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Application.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Application.cs Outdated
weltkante
weltkante previously approved these changes Oct 23, 2020
Copy link
Copy Markdown
Contributor

@weltkante weltkante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a few non-obvious things, I'm mentioning them so you can pay attention to them during review, but I don't think they are a problem.

Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Application.cs Outdated
Comment thread src/System.Windows.Forms/src/System/Windows/Forms/Application.cs Outdated
Copy link
Copy Markdown
Member

@dreddy-work dreddy-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JeremyKuhne
Copy link
Copy Markdown
Member Author

Validated that VB works as well. cc: @KlausLoeffelmann

@JeremyKuhne JeremyKuhne merged commit 082cbf2 into dotnet:master Oct 26, 2020
@ghost ghost added this to the 6.0 Preview1 milestone Oct 26, 2020
RussKie pushed a commit to RussKie/winforms that referenced this pull request Oct 30, 2020
…tnet#4149)

* Fix Application.EnableVisualStyles in single file publishing mode

Application.EnableVisualStyles gives Windows a manifest that enables the v6 common controls. We normally pull this manifest from a native resource in System.Windows.Forms.dll. In single file mode there is no "dll" to load from so this feature was not working as intended.

In the case where we can't get a Win32 HMODULE we now fall back to pulling the manifest from a managed resource and dumping it to the temp folder.

Make ACTCTXW blittable.

(cherry picked from commit 082cbf2)
@ghost ghost locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visual Styles not enabled when app published as 'Self-contained' + 'Produce Single File'

4 participants