C
C#4w ago
apoc

WPF App Issue With MSAL

I have a WPF app I am setting up using Microsoft AD/Entra for authentication. The app is only in production right now for 10 or so users ... will be hundreds over the next 12 months. Right now the problem is that about half of those 10 users are having issue when the app loads. The login screen, whether using WebView2 or Chrome/Edge, never loads. Or if it does load (which takes like 2-3 minutes) ... the screen is white. It has never happened to me ... but it is happening to 4-5 users. Any ideas?
32 Replies
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
apoc
apocOP4w ago
lol you're supposed to be a mind reader!!
apoc
apocOP4w ago
I finally reached out to see if ChatGPT could help ... no luck. Here is the test version that I am still having issues with
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
apoc
apocOP4w ago
Nope ... I cannot repo ... it starts happening to a user ... and doesn't stop.
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
apoc
apocOP4w ago
Like once it starts happening to them ... it will not stop happening. Windows 10 and 11 both (I can get the build if needed) .NET 9.0.7 Unable to repo on my own machine though ... I can remote into their machine and see it happen real time I am considering doing a Remote Debugger session to see if I can figure out what might be happening. What do you mean by - do you have a way to exflitrate log from the webview ?
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
apoc
apocOP4w ago
When the WebView window pops up it is a white screen ... normally we just close it because nothing shows up. I will see if I can start dev tool console from it
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
apoc
apocOP4w ago
thx ... i'm in the middle of adding a ton of traces to see if I can figure it out i think it might be network/DNS related personally
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
apoc
apocOP4w ago
thx ... i am using the most recent bits built on top of .NET 9 going to see how to add those command line flags what is really weird is this problem existed even before i started using webview ... at first they would authenticate using the system default browser but then ... the browser would never open up which is why i think it is network/DNS related somehow
leowest
leowest4w ago
silly question but have u ensure they did not deleted/removed the default browse? some people do that causing that issue for webview2 that would be edge also webview has method u should use before you start using it EnsureCoreWebView2Async which I assume u call before trying to load any resource to it?
apoc
apocOP4w ago
No silly questions! I was on their machine… they had Chrome/Edge both. I will check out that method tonight!!
leowest
leowest4w ago
https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.wpf.webview2?view=webview2-dotnet-1.0.3351.48#remarks
The control's CoreWebView2InitializationCompleted event will be invoked. If you need to perform one time setup operations on the CoreWebView2 prior to its use then you should do so in a handler for that event.
at the very least u can ensure the webview is being initialized and created
apoc
apocOP4w ago
No luck. And nothing pops up not using the embedded web view. The default browser doesn't even show up.
leowest
leowest4w ago
can u reproduce the issue in a new project u can possible post on github?
apoc
apocOP4w ago
i cannot reproduce at all ... this has been the hardest part i can hop on the machine with the user and watch it happen ... but I am not able to reproduce in any way i'm having them go into the office and travel to another site as well this will help me rule out a potential DNS / network issue
leowest
leowest4w ago
so if u make another app and test that on their pc it works? if not then something is definitively missing in their machine
apoc
apocOP4w ago
I tried another app ... same issue what's crazy is that their machine worked just fine for a few weeks ... and then started having problems I validated WebView2 is installed ... checked registry and program files And both Chrome and Edge are installed
leowest
leowest4w ago
well if u make a new app independent of the main and it still happens in their machine then its 100% something faulty/missing/corrupted or w/e in their machine I would check what was removed recently, if u have access to it or what has changed prior to when it was working maybe antivirus or something
apoc
apocOP4w ago
i have access to the machine ... no clue what might have been removed though ... good idea on the antivirus ... will see if it did something
leowest
leowest4w ago
set windows defender and / or av to whitelist the app folder for a start beyond that maybe reinstall/repair the edge installation how are u deploying the app self contained? or framework dependent...
apoc
apocOP4w ago
It works when he is within the network ... only failing when he is on the VPN. Now I gotta figure out what the hell is being blocked.
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
apoc
apocOP4w ago
Now it gets even better! He got home ... rebooted ... and it works with NO ISSUES!!
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
apoc
apocOP4w ago
Could have been ... he did reboot at home multiple times with me prior.
Unknown User
Unknown User4w ago
Message Not Public
Sign In & Join Server To View
apoc
apocOP4w ago
Good idea... I built a smaller app that only does authentication so I can troubleshoot faster/easier. The next time it happens hopefully I can pin point the issue. And I will try to the ipconfig /flushdns next time to see if it helps.

Did you find this page helpful?