Skip to content
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

WPF Applications require crash with System.TypeLoadException when VC++ redistributables are not present #37

Closed
vatsan-madhavan opened this issue Nov 30, 2018 · 1 comment
Assignees
Labels
Bug Product bug (most likely)
Milestone

Comments

@vatsan-madhavan
Copy link
Member

WPF Applications crash with System.TypeLoadException when Visual C++ Redistributable for Visual Studio 2017 is not installed. The latest version of VC++ redistributable can be obtained from here.

This dependency will be removed prior to .NET Core 3.0 final release.

@vatsan-madhavan vatsan-madhavan self-assigned this Nov 30, 2018
@vatsan-madhavan vatsan-madhavan added this to the 3.0 milestone Nov 30, 2018
@vatsan-madhavan vatsan-madhavan added the Bug Product bug (most likely) label Nov 30, 2018
@vatsan-madhavan vatsan-madhavan changed the title WPF Applications crash with System.TypeLoadException WPF Applications require crash with System.TypeLoadException when VC++ redistributables are not present May 13, 2019
@rladuca rladuca modified the milestones: 3.0, Preview May 20, 2019
@vatsan-madhavan
Copy link
Member Author

This has been fixed.

You'll notice that recent core-sdk builds contain the following new assemblies in the WindowsDesktop.App shared framework:

  • vcruntime140_cor3.dll
  • d3dcompiler_47_cor3.dll

WPF now carries along with it a privatized copy of vcruntime140.dll - renamed vcruntime140_cor3.dll.

All WPF assemblies are statically linked to VC++ restributables i.e., vcruntime140.dll. The exceptions are:

  • DirectWriteForwarder.dll
  • System.Printing.dll

The above two assemblies are C++/CLI assemblies built using /clr:pure switch. /clr:pure C++/CLI assemblies have an inherent dependency on vcruntime140.dll, which cannot be removed. In order to accommodate this limitation, we carry a privatized (and renamed) copy of vcruntime140.dll along with the shared framework. This is the copy that will be loaded and used by default.

This means that applications are free to link and redistribute vcruntime140.dll, and load those side-by-side. It is also possible that vcruntime140.dll could be loaded by WPF implicitly anyway - for e.g., printing related API's can load user-mode drivers that depend on vcruntime140.dll (and may fail/crash in its absence) - these problems would be limitations of applications/drivers etc. and not WPF (on .NET Core 3.0) itself.

==

In addition to removing the dependency on vcruntime140.dll, we have also introduced a private copy of d3dcompiler_47.dll (renamed as d3dcompiler_47_cor3.dll) to solve #189. WPF's renderer depends on this native (DirectX) assembly. This is a redistributable assembly that is always present in Windows starting Windows 8.1 It has also been shipped to older versions of Windows as an update. We have observed that systems aren't always guaranteed to have d3dcompiler_47.dll installed, and applications often choose to redistribute this assembly. We continue to receive occasional crash reports owing this this assembly missing from the system. Including a privatized copy of d3dcompiler_47.dll with the shared framework will improve overall robustness of applications.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Product bug (most likely)
Projects
None yet
Development

No branches or pull requests

2 participants