Wpf: PresentationNative_cor3.dll causes mscoree.dll to load

Created on 28 Jun 2019  路  11Comments  路  Source: dotnet/wpf

  • .NET Core Version: (e.g. 3.0 Preview1, or daily build number, use dotnet --info)
    .NET Core SDK (reflecting any global.json):
    Version: 3.0.100-preview7-012633
    Commit: 8990e07707

  • Windows version: (winver)
    1903

  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes/No
    doesn't matter for this.

    Problem description:
    .NET core should not have any dependency on inbox .NET dlls including the shim.

    Actual behavior:
    mscoree.dll loads

    Expected behavior:
    No inbox .NET dlls are used.

    Minimal repro:
    dotnet new wpf
    Run app under debugger with 'sxe ld mscoree'

Also:

Dump of file C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.0.0-preview7-27826-04\PresentationNative_cor3.dll

<snip>

    mscoree.dll
             1800EC2E0 Import Address Table
             18011C240 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                           0 CLRCreateInstance

issue-type-bug

All 11 comments

This looks like vestigial code from XBAP hosting, we should remove it. It's only called via XBAP code from PresentationFramework.

XappLauncher.cs is not included in the build (PresentationFramework).

The P/Invoke to PresentationNative_cor3!TryGetRequestedCLRRuntime would never have been called. How would mscoree have been loaded by us?

CLRHostWrapper includes <metahost.h> in the build and calls functions from it.

the loader is eagerly pulling in mscoree because PresentationNative_cor3 has an import.

I did just notice the commented out compile includes in PFramework. Not sure why we're keeping that code around at this point (from a repo tidiness standpoint). But that's not that important.

the loader is eagerly pulling in mscoree because PresentationNative_cor3 has an import.

yeah - that's what i'm noticing. as soon as presentationnative_cor3 loads, mscoree also loads for no good reason except for the loader's whim...

the loader is eagerly pulling in mscoree because PresentationNative_cor3 has an import.

yeah - that's what i'm noticing. as soon as presentationnative_cor3 loads, mscoree also loads for no good reason except for the loader's whim...

i think my assessment is hasty -/. i believe there is a hard-linkage to mscoree.. in presentationnative_cor3's import table, i see this:

mscoree.dll
             1800EC2E0 Import Address Table
             18011C240 Import Name Table
                     0 time date stamp
                     0 Index of first forwarder reference

                           0 CLRCreateInstance

image

We link mscoree.lib in the vcxproj.

I am removing everything right now in dotnet-wpf-int.

Yeah, let's remove CLRHostWrapper entirely and the linkage to mscoree.lib + the corresponding export; and XpsLauncher.cs from PresentationFramework's sources.

There is a chain of code we can remove from PresentationFramework in relation to this. I think, generally, we should just have someone go through and evaluate the commented out compile includes and clean them.

This internal PR should address the immediate issue.

Internal PR completed and merged. Setting GitHub PR to close this as fixed, even though, it's not really the fix (just an easier way to associate all the work).

Was this page helpful?
0 / 5 - 0 ratings