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•4w ago
Message Not Public
Sign In & Join Server To View
lol
you're supposed to be a mind reader!!
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•4w ago
Message Not Public
Sign In & Join Server To View
Nope ... I cannot repo ... it starts happening to a user ... and doesn't stop.
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
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•4w ago
Message Not Public
Sign In & Join Server To View
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•4w ago
Message Not Public
Sign In & Join Server To View
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•4w ago
Message Not Public
Sign In & Join Server To View
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
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?No silly questions!
I was on their machine… they had Chrome/Edge both.
I will check out that method tonight!!
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
No luck.
And nothing pops up not using the embedded web view.
The default browser doesn't even show up.
can u reproduce the issue in a new project u can possible post on github?
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
so if u make another app and test that on their pc it works?
if not then something is definitively missing in their machine
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
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
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
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...
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•4w ago
Message Not Public
Sign In & Join Server To View
Now it gets even better!
He got home ... rebooted ... and it works with NO ISSUES!!
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
Could have been ... he did reboot at home multiple times with me prior.
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
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.