-
Notifications
You must be signed in to change notification settings - Fork 334
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
WindowsPackageType=None in a class library includes the bootstrapper #2456
Comments
Interesting. Yes I think you're right. Narrowing the default to also check for I've added this to my queue. I suspect the change itself is simple but some of our test projects happened to rely on this and will fail (spectacularly) until patched to compensate e.g. by adding And yes, a workaround until fixed is to add to your *proj file This has been a complicated space to date so I did some spelunking (below) to verify this conclusion. Please speak up if you see a flaw in the analysis. +@Scottj1s sound good to you too? Detailed Spelunking... The default's been selected this way since 1.0-preview2, revising an earlier implementation in 1.0-preview1 which had its issues (see below). Per Common MSBuild project properties
Clearly we do want the Bootstrapper when
Case #1: It's probably wrong if it's a Library or Module. I suspect there's some oddball case where a DLL is loaded by a generic exe (a la regsvr32.exe, dllhost.exe, te.exe or litany of others) but that's unusual enough and ambiguous enough that we can ignore it for the default (those who truly want it to explicitly set Case #2: What if BTW the docs note a caveat about
but that has to do with As to why the Bootstrapper default is the way it is today we need to do a little software archaeology... The default is defined in <PropertyGroup Condition="'$(WindowsAppSdkBootstrapInitialize)'=='' and '$(WindowsAppSDKSelfContained)'!='true' and '$(WindowsPackageType)'=='None'">
<!--Allows GenerateBootstrapCS/GenerateBootstrapCpp to run-->
<WindowsAppSdkBootstrapInitialize>true</WindowsAppSdkBootstrapInitialize>
</PropertyGroup> which actually dates back to <Import Project="$(MSBuildThisFileDirectory)Microsoft.WindowsAppSDK.Bootstrap.targets" Condition="'$(MSBuildProjectExtension)' != '.wapproj'" /> which was an overly broad target and led to the refinments on Oct'14 in commit 1459372 for 1.0-preview2. |
…ssembly()) { return; }' shortcircuit as it catches loading for reflection AND for common test cases e.g. 'te.exe foo.dll' as auto-initialization isn't restricted to exes (i.e. it gets compiled into foo.dll) and then Entry!=Executing. Revert this for now and restore later when #2456 is addressed (by restrcting auto-init to only compile into exes)
See the related PR Remove C# auto-initialization check for reflection#2500 |
* Remove the 'if (Assembly.GetEntryAssembly() != Assembly.GetExecutingAssembly()) { return; }' shortcircuit as it catches loading for reflection AND for common test cases e.g. 'te.exe foo.dll' as auto-initialization isn't restricted to exes (i.e. it gets compiled into foo.dll) and then Entry!=Executing. Revert this for now and restore later when #2456 is addressed (by restrcting auto-init to only compile into exes) * Fix typo
* Remove the 'if (Assembly.GetEntryAssembly() != Assembly.GetExecutingAssembly()) { return; }' shortcircuit as it catches loading for reflection AND for common test cases e.g. 'te.exe foo.dll' as auto-initialization isn't restricted to exes (i.e. it gets compiled into foo.dll) and then Entry!=Executing. Revert this for now and restore later when #2456 is addressed (by restrcting auto-init to only compile into exes) * Fix typo
…elf-contained (#2502) * Fix UndockedRegFreeWinRT auto-initializer issues (#2476) * Fix bad filename * No precompiledheaders when compiling the auto-initializer * Some refinements on the UndockedRegFreeWinRT self-contained and auto-initialization support (#2493) * UrfwInitialize() didn't report if ExtRoLoadCatalog() errored and returned a failing HRESULT (only trapped thrown exceptions, but the implementation does both) (#2498) * Remove C# auto-initialization check for reflection (#2500) * Remove the 'if (Assembly.GetEntryAssembly() != Assembly.GetExecutingAssembly()) { return; }' shortcircuit as it catches loading for reflection AND for common test cases e.g. 'te.exe foo.dll' as auto-initialization isn't restricted to exes (i.e. it gets compiled into foo.dll) and then Entry!=Executing. Revert this for now and restore later when #2456 is addressed (by restrcting auto-init to only compile into exes) * Fix typo * Fix URFW auto-init reference to EnsureIsLoaded() (#2501) Co-authored-by: Howard Kapustein <howardk@microsoft.com>
Given the nature of the impact this is probably something we should not service to 1.1. Tee'd up for 1.2 => #2775 |
This has been resolved in 1.2 |
Describe the bug
If you set the the package type in a class library, then the build adds the bootstrapper to the class library:
This is because the condition to include the bootstrapper is very loose:
A workaround is to also set the
WindowsAppSdkBootstrapInitialize
property:Steps to reproduce the bug
WindowsPackageType=None
Expected behavior
No bootstrapper
Screenshots
No response
NuGet package version
1.0.0
Packaging type
No response
Windows version
No response
IDE
No response
Additional context
I noticed this when several libraries referenced each other:
The text was updated successfully, but these errors were encountered: