UWP: Unspecified Error - Exception from HRESULT: 0x80004005
Asked Answered
Z

2

10

I am developing a UWP app in C# and I have attached a handler for Unhandled exceptions that sends us the unhandled exceptions so that we can diagnose them).

I am receiving a large amount of

System.Exception - Unspecified error (Exception from HRESULT: 0x80004005)

without any stacktrace nor other additional information.

This has never happened locally in debug, but only in production for real users, that never complained about this problem, so I guess this seems to be a silent error that may not affect the users.

Anyway, I am a little bit uneasy about leaving this issue unsolved.

How can I find the culprit of this issue?

Has anyone ever bumped into this issue before?

Thanks!

Zodiac answered 28/7, 2020 at 18:32 Comment(23)
Did you check Windows event log?Flagon
Hi @PavelAnikhouski, I checked and apparently no events are detected that can be related to this problemZodiac
Could you please provide more detailed error information? Is it possible to build logs internally?Gerber
@Faywang-MSFT: that's exactly the problem!!! The exception doesn't give any other information, not details, and happens sporadically only in production in the machines of the users! So we don't have any clue at all...Zodiac
If you test your project in release mode, will you receive the same issue?Gerber
Apparently, this problem happens only in the installations from the Store. Not locally when running from Visual Studio (neither in Debug nor Release).Zodiac
@CristianoGhersi Umh - how have you attached the handler - this or something else because I've experienced a lot of exception going on in my UWP app which seems to be handled internally. And I assume using the linked method will ignore those exceptions.Turkish
I am actually using a third-party library called Logifyto check the unhandled exceptions in production.Zodiac
If you do not use this third-party libary, can you still catch these exceptions? In addition, did users see these exceptions? If not, it will have no affect.Gerber
I have no way to check these exceptions without Logify, because these exceptions happen sporadically on the field in the instances of our users. I also can't check with those users, because I don't have a way to identify the specific source of the exception.Zodiac
I have tried also with another service, named RayGun. Same result. Plenty of those exceptions with no stack trace.Zodiac
Is there a pattern to those exceptions? Are they logged at the same time or at different times? Are they coming from the same or same type of user? Could these be related to data - which you will see only in a specific scenario OR could it be that they are related to logging etc. some task that you do on the backend but do not return any result to user? Could it be that there is some missing config from user's machine that is needed for your application to function?Canonical
When I encounter issues on production machines that do not replicate in dev/test environments, I usually give SysInternals procmon a try on the production machine. Run proc mon and set it to filter on your app. You will get a ton of messages; just start filtering to hide what you want to ignore. If this exception is related to a missing unmanaged component reference, depends can also be useful to diagnose.Loaf
@BarkhaJain there is not apparent pattern, at every time of the day and night, coming from any kind of user. Any kind of nationality. Both users with heavy loads and users with minimal loads. Unfortuantely we do not have access to the machines of the users to have a relevant statistic of those configurations, plus I don't even know what to start looking for!Zodiac
@Loaf thanks for the hints! Unfortunately even in the machines where the problem happened, is it absolutely not deterministic, and there is no way to reproduce easily those problems. So we cannot expect a user to run procmon forever waiting for an error to happen. The frequency of such errors could be like 10 errors in an year for a user, at maximum. So I need an a-posteriori way to debug the issue :(Zodiac
@CristianoGhersi What are the dependencies used in your project? The SDK version? Also, any external libraries that you are using? Could you give a little more info on the application itself?Canonical
@BarkhaJain the app is pretty complex and contains a lot of dependencies and external libraries, both open source and with commercial licenses. We use always the latest versions of every NuGet package. It is a productivity app, with a large amount of graphical management (a lot of graphical nice effects, heavy usage of touch gestures, inking, animations, etc.), pretty much everything in code behind. There is a very small portion of XAML for a couple of components. What other specific aspects you would like to know? If needed I can show you the app in use over a private chat.Zodiac
0x80004005 is the most generic error you can find. Can be coming from anything. Difficult to say w/o more information or reproducing code.Bushelman
@SimonMourier unfortunately, as I said in the comments and in the description of the issue, this problem cannot be easily reproduced locally: it just comes out from a few users in production on their clients, which we cannot reach. Therefore I cannot provide any repro not additional details :( This is way the issue is so difficult to tackle!Zodiac
As it is an UWP app, your users are mainly on mobile device ? In that case, i suspect the roaming and a library which "defects" every time the network interface is down. Have you a way to check what happens with the app when 4G/5G is shortly down ?Scrambler
Hi @Zilog80, thanks for the hint, great idea! Actually, the majority of devices that reported this error are PCs, with Wifi / Ethernet connection. Moreover, our app basically does not have any internet connection need, it can perfectly work even when the PC is offline (tested a zillion times, also by a lot of users). Any other idea?Zodiac
@CristianoGhersi I thought app sleeping mode on mobile device could also be the root of your troubles, but if the majority of related devices are PCs with wifi, we can discard that. I suggest to check all the network bindings of your app and trace back the associated libraries. You can also check which libraires could be susceptible to use network connections (directly or indirectly, like XML headers/XSD validation and the sort of like...).Scrambler
@CristianoGhersi The "network trouble" hypothesis could also fit non Wifi PCs. DSL links aren't perfects (provider failure, DSN failure, hardware update, etc.). It could be useful, if possible from your side, to check with non Wifi PCs if their internet link is up when the exception pop.Scrambler
S
0

Checking it on the Microsoft Support, i found 2 references that are very distinct about the 0x80004005.

The first was about Windows XP Ativation, that would indicate that the Windows was not activated properly - that message could still be the same on Windows 10, but the microsoft page was not enought to accert that.

Another reference though was about a security release from Windows Update (on Windows 10) that had the same error code (for PC's without the update KB3087040); seems to be more likely.

Saran answered 16/3, 2021 at 19:9 Comment(5)
thanks for the info, when this update KB3087040 has been released? is there any documentation about this update?Zodiac
see, yes there is - on microsoft.com (the problem right now is that i'm from Brazil, so everytime i go to microsoft.com i get links in portuguese, so i don't know how will the show up to you, but here it is: support.microsoft.com/pt-br/topic/…)Saran
I see. That's an update of 2015: I am not sure it will relate to our problem in 2021... Moreover our app to work requires Windows 10 ver 2019+, so I assume this update is already available in the major update of Windows.Zodiac
understood - i'll see if i find anything else, but usually the 0xNNNNNNNN errors have some description on Microsoft support relating to why, and sometimes the error is just not specific enought - this one in particular i found only this 2 references (for Win XP and Win 10 Flash security), but may be others that just don't have proper documentation or error posts on the support site. I'll keep looking.Saran
One mention outside of microsoft forums (from appuals.com/solved-how-to-fix-error-0x80004005) is that this error is a generic error as, and i quote here: "Error 0x80004005 is translated as an unspecified error and is usually seen when the user cannot access Shared Folders, Drives, Virtual Machines and also when the Windows Updates fails to install.", so, is really any error on windows files, updates and other system dependencies that are corrupted or unaccessable.Saran
O
0

Without a proper error or exception it will be close to impossible to resolve or attempt to answer.

In the past when faced with a similar issue (local ok, dev ok but production fails) my solution and that of many other developers is to narrow it down and assert where is the exception being thrown in the app.

hypothesis: If the exception wasn't handle we should have seen the app failing - potentially it is encapsulated in a catch statement.

To begin we need to add some logging you could use log4net

If the hypothesis is correct - add a logging in each and every catch statement in your app. Depends on the scale of your app - this will take some time to debug.

Hopefully the catching and logging will give you an insight and resolve your issue.

Also could add logging where a resource its been accessed.

Oestrogen answered 18/3, 2021 at 15:42 Comment(1)
Thanks Alex. We already use log4net and also 2 remote crash report tools called Raygun and Logify. The problem is that the exception is a stowed exception, which means it comes from the XAML engine or some other unmanaged code. Therefore we cannot catch it in a normal try-catch. Moreover, we already track the exception, but it doesn't give any stacktrace nor any additional message, hence my request.Zodiac

© 2022 - 2024 — McMap. All rights reserved.