Calls to comctl32.dll succeed in .NET 4.8, but fail in .NET 5 with System.EntryPointNotFoundException
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: **5.0.100** and **3.1.404**
* Windows version: **Windows 10** (18363.1139)
* Does the bug reproduce also in WPF for .NET Framework 4.8?: **No**
* Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? **No**
**Problem description:**
Calls to `comctl32.dll` succeed in .NET Framework 4.8, but fail in .NET 5 and also in .NET Core 3.1 with a `System.EntryPointNotFoundException`.
e.g.
```csharp
[DllImport("comctl32.dll", PreserveSig = false)]
private static extern void TaskDialogIndirect([In] ref TaskDialogConfig pTaskConfig, out int pnButton,
out int pnRadioButton, [MarshalAs(UnmanagedType.Bool)] out bool pfVerificationFlagChecked);
// ...
var config = new TaskDialogConfig
{
pszWindowTitle = "Task dialog title",
pszMainInstruction = "Task dialog main instruction",
dwCommonButtons = TaskDialogCommonButtonFlags.OkButton | TaskDialogCommonButtonFlags.CancelButton,
// ...
};
using (new ComCtlv6ActivationContext(enable: true))
{
TaskDialogIndirect(ref config, out _, out _, out _);
}
```
**Actual behavior:**

```
System.EntryPointNotFoundException: Unable to find an entry point named 'TaskDialogIndirect' in DLL 'comctl32.dll'.
at TaskDialogApi.TaskDialog.TaskDialogIndirect(TaskDialogConfig& pTaskConfig, Int32& pnButton, Int32& pnRadioButton, Boolean& pfVerificationFlagChecked)
```
**Expected behavior:**
Display the Task Dialog requested

**Minimal repro:**
- [repro-wpf-net5-comctl32-entrypointnotfoundexception](https://github.com/augustoproiete-repros/repro-wpf-net5-comctl32-entrypointnotfoundexception)
Contributor guide
Assessment
This issue has not been assessed yet.