Skip to content

Commit

Permalink
Remove the 'if (Assembly.GetEntryAssembly() != Assembly.GetExecutingA…
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
DrusTheAxe committed May 12, 2022
1 parent 9385767 commit 9263b92
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ class AutoInitialize
[global::System.Runtime.CompilerServices.ModuleInitializer]
internal static void AccessWindowsAppSDK()
{
// Do nothing if we're being loaded for reflection (rather than execcution)
if (Assembly.GetEntryAssembly() != Assembly.GetExecutingAssembly())
{
return;
}

// No error handling needed as the target function does nothing (just {return S_OK}).
// It's the act of calling the function causing the DllImport to load the DLL that
// matters. This provides the moral equivalent of a native DLL's Import Address
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ class AutoInitialize
[global::System.Runtime.CompilerServices.ModuleInitializer]
internal static void AccessWindowsAppSDK()
{
// Do nothing if we're being loaded for reflection (rather than execcution)
if (Assembly.GetEntryAssembly() != Assembly.GetExecutingAssembly())
{
return;
}

uint majorMinorVersion = global::Microsoft.WindowsAppSDK.Release.MajorMinor;
string versionTag = global::Microsoft.WindowsAppSDK.Release.VersionTag;
var minVersion = new PackageVersion(global::Microsoft.WindowsAppSDK.Runtime.Version.UInt64);
Expand Down

0 comments on commit 9263b92

Please sign in to comment.