Skip to content

ArgumentNullException when showing TaskDialog is self-contained app #58

@VladimirKhil

Description

@VladimirKhil

The reason is that for self-contained apps Assembly.Location is empty here (https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=cli#api-incompatibility):

CoreCLR Version: 6.0.2123.36311
.NET Version: 6.0.21
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentNullException: Value cannot be null. (Parameter 'path1')
   at System.IO.Path.Combine(String path1, String path2)
   at Microsoft.WindowsAPICodePack.Dialogs.EnableThemingInScope.EnsureActivateContextCreated()
   at Microsoft.WindowsAPICodePack.Dialogs.EnableThemingInScope..ctor(Boolean enable)
   at Microsoft.WindowsAPICodePack.Dialogs.NativeTaskDialog.NativeShow()
   at Microsoft.WindowsAPICodePack.Dialogs.TaskDialog.ShowCore()

In the same Microsoft doc it is recommended to use AppContext.BaseDirectory instead of Assembly.Location for such cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions