Skip to content

CredUIPromptForWindowsCredentials crashes in unpackaged app #4340

Open
@Balkoth

Description

@Balkoth

Describe the bug

Please see the attached solution, there are three projects, one packaged WASDK, one unpackaged WASDK and one WinForms project. All three projects use the same CredentialService file/class to display the credential ui. The unpackaged app crashes here:

image

Not Flagged		29672	1	Main Thread	Main Thread	UnpackagedWASDK.dll!TestCredPicker.CredentialService.NativeMethods.CredUIPromptForWindowsCredentials
Not Flagged		60556	4	Worker Thread	.NET Counter Poller	System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOneNoCheck
Not Flagged		31620	5	Worker Thread	.NET TP Worker	System.Private.CoreLib.dll!Interop.Kernel32.GetQueuedCompletionStatus
Not Flagged		18440	6	Worker Thread	.NET TP Gate	System.Private.CoreLib.dll!System.Threading.WaitHandle.WaitOneNoCheck
Not Flagged		31444	7	Worker Thread	.NET TP Worker	System.Private.CoreLib.dll!Interop.Kernel32.GetQueuedCompletionStatus
Not Flagged		62060	8	Worker Thread	.NET ThreadPool IO	System.Private.CoreLib.dll!System.Threading.PortableThreadPool.IOCompletionPoller.Poll
Not Flagged		67480	9	Worker Thread	.NET TP Worker	System.Private.CoreLib.dll!Interop.Kernel32.GetQueuedCompletionStatus
Not Flagged		39756	10	Worker Thread	.NET TP Worker	System.Private.CoreLib.dll!Interop.Kernel32.GetQueuedCompletionStatus
Not Flagged	>	57496	0	Worker Thread	<No Name>	UnpackagedWASDK.dll!UnpackagedWASDK.App.InitializeComponent.AnonymousMethod__4_2

UnpackagedWASDK.dll!UnpackagedWASDK.App.InitializeComponent.AnonymousMethod__4_2(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) Line 75	C#
Microsoft.WinUI.dll!WinRT._EventSource_global__Microsoft_UI_Xaml_UnhandledExceptionEventHandler.EventState.GetEventInvoke.AnonymousMethod__1_0(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)	Unknown
Microsoft.WinUI.dll!ABI.Microsoft.UI.Xaml.UnhandledExceptionEventHandler.Do_Abi_Invoke(nint thisPtr, nint sender, nint e)	Unknown

Steps to reproduce the bug

  • See the attached sample app: TestCredPicker.zip
  • Should display the credential dialog for the current logged on user:
    image

Expected behavior

I would expect that either all projects crash, because there may be something wrong with my PInvoke code, or none. But as both packaged and WinForms project run without problems, i suspect there is something wrong with the unpackaged nature of the project.

Screenshots

No response

NuGet package version

Windows App SDK 1.5.2: 1.5.240404000

Packaging type

Unpackaged

Windows version

Windows 10 version 22H2 (19045, 2022 Update)

IDE

Visual Studio 2022

Additional context

I don't know what version of WASDK introduced this problem, because at some point in time this code was developed and working with WASD (1.2.221116.1).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions