Questions tagged [hresult]

HRESULT is used as a return value to determine the success or failure of a function.

168 questions
116
votes
19 answers

An error occurred while validating. HRESULT = '8000000A'

I have been receiving this error for a while when using devenv on an automatic build. I have gone through every website I can find, and the usual answers mention refreshing dependencies (Which I believe fixes it for manual deployment, but not for…
Chris C.
  • 1,217
  • 2
  • 10
  • 6
79
votes
4 answers

Is there a way to get the string representation of HRESULT value using win API?

Is there a function in win API which can be used to extract the string representation of HRESULT value? The problem is that not all return values are documented in MSDN, for example ExecuteInDefaultAppDomain() function is not documented to return…
khkarens
  • 1,305
  • 1
  • 11
  • 16
42
votes
4 answers

Decode HResult = -2147467259

Can someone help me decode this HResult? What does it mean? I know the negative stands for a failure. How about the rest of the 10 bits? I referenced MSDN HResult article here, but I am not sure how to determine what my facility and code bits are.…
CYC0616
  • 645
  • 3
  • 9
  • 14
37
votes
6 answers

How do I determine the HResult for a System.IO.IOException?

The System.Exception.HResult property is protected. How can I peek inside an exception and get the HResult without resorting to reflection or other ugly hacks? Here's the situation: I want to write a backup tool, which opens and reads files on a…
Cheeso
  • 189,189
  • 101
  • 473
  • 713
33
votes
7 answers

Exception from HRESULT: 0x80131047

I am having this problem whenever I try to debug my project: It's in French, here is my translation: "Error while trying to run project: Failed Loading assembly "DBZ buu's Fury Text Editor" or one of it's dependencies. The given assembly name …
Omarrrio
  • 1,075
  • 1
  • 16
  • 34
18
votes
1 answer

Creating your own HRESULT?

I already have a project that uses a lot of COM, and HRESULTS. Anyways I was wondering if it's possible to define your own HRESULT, AND be able to use the FormatMessage() for our own HRESULT? I dug around and can't find anything. Any…
UberJumper
  • 20,245
  • 19
  • 69
  • 87
17
votes
2 answers

How can I throw an Exception with a certain HResult?

I want to test the following code: private bool TestException(Exception ex) { if ((Marshal.GetHRForException(ex) & 0xFFFF) == 0x4005) { return true; } return false; } I'd like to set up the Exception object somehow to return…
g t
  • 7,287
  • 7
  • 50
  • 85
16
votes
4 answers

Why is the windows return code called HRESULT?

The standard return type for functions in Windows C/C++ APIs is called HRESULT. What does the H mean?
numerodix
  • 876
  • 7
  • 20
10
votes
1 answer

How to distinguish programmatically between different IOExceptions?

I am doing some exception handling for code which is writing to the StandardInput stream of a Process object. The Process is kind of like the unix head command; it reads only part of it's input stream. When the process dies, the writing thread fails…
ChaseMedallion
  • 20,860
  • 17
  • 88
  • 152
8
votes
1 answer

Microsoft.Office.Interop.Excel doesn't work on 64 bit

I've encountered a problem when developing on MS Visual Web Developer 2008 Express Ed. Developing ASP.NET C# on Windows7 64 bit OS. I'm trying to open an Excel document, but it gives me Old format or invalid type library. (Exception from HRESULT:…
Bush
  • 2,433
  • 5
  • 34
  • 57
8
votes
1 answer

Does .NET Standard normalize HResult values across every platform it supports?

I am creating a simple function that creates a random file. To be thread safe, it creates the file in a retry loop and if the file exists it tries again. while (true) { fileName = NewTempFileName(prefix, suffix, directory); if…
NightOwl888
  • 55,572
  • 24
  • 139
  • 212
8
votes
1 answer

How do I create a module defined function in a COM Type Library

The VBE7.dll type library used by VBA, has the following MIDL for the Conversion module: [ dllname("VBE7.DLL"), uuid(36785f40-2bcc-1069-82d6-00dd010edfaa), helpcontext(0x000f6ebe) ] module Conversion { [helpcontext(0x000f6ea2)] BSTR…
ThunderFrame
  • 9,352
  • 2
  • 29
  • 60
7
votes
1 answer

COM `HRESULT` is wrapped into an Exception in .NET

(preliminary note: I'm not yet fully up to speed with the whole 'interop' thing...) When using a COM library from within .NET, all HRESULT methods are wrapped into something that throws when the return code is not SUCCEEDED. //ATL magic…
xtofl
  • 40,723
  • 12
  • 105
  • 192
7
votes
3 answers

Explaining the declaration/definition of HRESULT

I just looked at the definition of HRESULT in VS2008. WinNT.h has the following line: typedef __success(return >= 0) long HRESULT; What exactly does it mean? It doesn't even look like C or C++ to my untrained eye
Agnel Kurian
  • 57,975
  • 43
  • 146
  • 217
7
votes
1 answer

How to handle WinRT exceptions that result in Exception?

If a Windows runtime type raises a COM error .NET seems to wrap this error often (or always?) just into an Exception instance. The error message includes the COM HRESULT error code. When using the new Cryptographic API with AES-CBC for example a…
Jürgen Bayer
  • 2,993
  • 3
  • 26
  • 51
1
2 3
11 12