Error Codes In .net
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. System.Net.Sockets SocketException Class SocketException Properties SocketException Properties ErrorCode Property ErrorCode Property ErrorCode Property ErrorCode Property Message Property SocketErrorCode Property TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. SocketException.ErrorCode Property .NET Framework (current version) Other Versions Visual Studio 2010 .NET Framework 4 Silverlight Visual Studio 2008 .NET Framework 3.5 .NET Framework 3.0 .NET Framework 2.0 .NET Framework 1.1 Gets the error code that is associated with this exception.Namespace: System.Net.SocketsAssembly: System (in System.dll)Syntax C#C++F#VB Copy public override int ErrorCode { get; } Property Value Type: System.Int32An integer error code that is associated with this exception.RemarksThe ErrorCode property contains the error code that is associated with the error that caused the exception.The default constructor for SocketException sets the ErrorCode property to the last operating system error that occurred. For more information about socket error codes, see the Windows Sockets version 2 API error code documentation in MSDN.Version Information.NET FrameworkAvailable since 1.1SilverlightAvailable since 2.0Windows Phone SilverlightAvailable since 7.1See AlsoSocketException ClassSystem.Net.Sockets NamespaceReturn to top Show: Inherited Protected Print Export (0) Print Export (0) Share IN THIS ARTICLE Is this page helpful? Yes No Additional feedback? 1500 characters remaining Submit Skip this Thank you! We appreciate your feedback. Dev centers Windows Office Visual Studio Microsoft Azure More... Learning resources Microsoft Virtual Academy Channel 9 MSDN Magazine Community Forums Blogs Codeplex Support Self support Programs BizSpark (for startups) Microsoft Imagine (for students) United States (English) Newsletter Privacy & cookies Terms of use Trademarks © 2016 Microsoft © 2016 Microsoft
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Exception Error https://msdn.microsoft.com/en-us/library/system.net.sockets.socketexception.errorcode(v=vs.110).aspx Codes in .NET up vote 3 down vote favorite Is there a list of .NET Exception error codes around? I get these error codes with a couple of HttpExceptions, 0x80070040 0x800703E3 And require to know the difference between the two errors. c# .net asp.net share|improve this question edited May 4 '11 at 21:02 John Saunders 138k20175321 asked Apr 26 '11 at 23:02 peter 4,3981152117 add http://stackoverflow.com/questions/5797478/exception-error-codes-in-net a comment| 2 Answers 2 active oldest votes up vote 11 down vote accepted Those are not .NET Exception Error codes. They are Windows HRESULT codes. 0x80070040 is "The specified network name is no longer available." 0x800703E3 is "The I/O operation has been aborted because of either a thread exit or an application request." You can find these by using Tools->Error Lookup in Visual Studio. share|improve this answer answered Apr 26 '11 at 23:06 John Saunders 138k20175321 and, as it happens, these specific codes aren't even listed in the link I provide. –Grant Thomas Apr 26 '11 at 23:13 Thanks guys. Realise it was an easy question. But appreciated. –peter Apr 26 '11 at 23:26 add a comment| up vote 2 down vote Here you go - these are in fact HRESULT error codes, which HttpException exposes. share|improve this answer answered Apr 26 '11 at 23:09 Grant Thomas 33.1k55791 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the http://stackoverflow.com/questions/6984959/is-there-an-enumeration-for-system-error-codes-in-net-framework workings and policies of this site About Us Learn more about Stack http://stackoverflow.com/questions/1650838/getting-the-windows-system-error-code-title-description-from-its-hex-number Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join error codes them; it only takes a minute: Sign up Is there an enumeration for system error codes in .Net framework? up vote 7 down vote favorite I have a library function that returns GetLastError codes (things like these). I need to compare them with specific errors, like ERROR_INVALID_HANDLE. However I don't feel comfortable to define the constants myself. So the error codes in question is, is there a predefined enumeration for this purpose? .net pinvoke share|improve this question asked Aug 8 '11 at 16:02 Yuxiu Li 2,0741018 pinvoke.net/default.aspx/Constants/WINERROR.html –Loathing Apr 9 '15 at 18:47 add a comment| 2 Answers 2 active oldest votes up vote 7 down vote accepted No, you'll have to make your own. share|improve this answer answered Aug 8 '11 at 16:03 Mehrdad 103k64310612 add a comment| up vote 1 down vote You can copy the code from http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx added by katmassage to your own class SystemErrorCodes. It contains the codes from 0 to 499. This is a good starter. If someone already has a class containing also all the codes his code would be appreciated. share|improve this answer answered Jan 7 '14 at 12:30 huha 1,405920 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answe
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Getting the Windows System Error Code title/description from it's hex number up vote 18 down vote favorite 6 I'm messing around with some windows functions using p/invoke. Occasionally, I get an error code that is not ERROR_SUCCESS (such an odd name). Is there a way to look these up within the program? Forexample, if I get error 1017. Can I tell the user The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format. (ERROR_NOT_REGISTRY_FILE: 0x3F9) Instead of Error Code: 1017 c# .net windows pinvoke share|improve this question asked Oct 30 '09 at 16:19 Malfist 13.5k43141248 add a comment| 4 Answers 4 active oldest votes up vote 58 down vote accepted I'm not sure if there's a niifty .NET wrapper, but you could call the FormatMessage API using P/Invoke. See this answer for how it would normally be called from native code. Though the question refers to grabbing error codes from HRESULTs, the answer also applies for retreiving codes from the regular OS error codes coming from GetLastError/GetLastWin32Error). EDIT: Thanks Malfist for pointing me to pinvoke.net, which includes alternative, managed API: using System.ComponentModel; string errorMessage = new Win32Exception(Marshal.GetLastWin32Error()).Message; Console.WriteLine(errorMessage); share|improve this answer edited Dec 16 '15 at 5:08 Mark Lakata 9,88035369 answered Oct 30 '09 at 16:23 Nick Meyer 19.8k94665 2 pinvoke.net/default.aspx/kernel32/FormatMessage.html Says never to use FormatMessage –Malfist Oct 30 '09 at 16:33 @Malfist, thanks for pointing that out. There is a reply there that says it's okay as long as you're using Marshal.GetLastWin32Error to retrieve the error code. Nonetheless, it looks like Win32Exception is a better solution. –Nick Meyer Oct 30 '09 at 16:41 1 Note, though, that both of these solutions only get the descriptive error