473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Getting NativeErrorCode from an System.Exception?

When I catch an exception I can see the NativeErrorCode when I'm debugging
through the code, but how do I get this programatically?
I need to check if the exception I catch is with
nativeErrorCode -1072824317 since this is the only error I'm interestet in.

Thanks in advance
Paw
Nov 16 '05 #1
5 6461
Hi,

It is a property of Win32Exception. So, you have to catch it explictly and
access the native error code.

HTH

"Paw Pedersen" <ne**@paws.dk> wrote in message
news:#T**************@TK2MSFTNGP11.phx.gbl...
When I catch an exception I can see the NativeErrorCode when I'm debugging
through the code, but how do I get this programatically?
I need to check if the exception I catch is with
nativeErrorCode -1072824317 since this is the only error I'm interestet in.

Thanks in advance
Paw

Nov 16 '05 #2
I'm not sure how to do that.
Now I catch it as a System.Messaging.MessageQueueException and there aren't
any NativeErrorCode property on that. I have tried to catch it as
Win32Exception, but it doesn't catch the exception then.
I have also tried to cast the MessageQueueException to a Win32Exception but
that gives an invalid cast exception.
Could you give an example?

Thanks Paw
"Shiva" <sh******@online.excite.com> wrote in message
news:eU**************@TK2MSFTNGP11.phx.gbl...
Hi,

It is a property of Win32Exception. So, you have to catch it explictly and
access the native error code.

HTH

"Paw Pedersen" <ne**@paws.dk> wrote in message
news:#T**************@TK2MSFTNGP11.phx.gbl...
When I catch an exception I can see the NativeErrorCode when I'm debugging
through the code, but how do I get this programatically?
I need to check if the exception I catch is with
nativeErrorCode -1072824317 since this is the only error I'm interestet in.
Thanks in advance
Paw

Nov 16 '05 #3
Paw,

MessageQueueException derived from ExternalException, which provides
an ErrorCode property that you can check.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #4
Ok, for MessageQueue, use the MessageQueueErrorCode property of the
MessageQueueException.

The error code -1072824317 is actually MessageQueueErrorCode.QueueNotFound.
So you can find this specific case as

if (MessageQueueException.MessageQueueErrorCode ==
MessageQueueErrorCode.QueueNotFound)
{
}

Or if you prefer numeric value comparison,

if (-1072824317 == (int)MessageQueueErrorCode.QueueNotFound)
{
}

"Paw Pedersen" <ne**@paws.dk> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
I'm not sure how to do that.
Now I catch it as a System.Messaging.MessageQueueException and there aren't
any NativeErrorCode property on that. I have tried to catch it as
Win32Exception, but it doesn't catch the exception then.
I have also tried to cast the MessageQueueException to a Win32Exception but
that gives an invalid cast exception.
Could you give an example?

Thanks Paw
"Shiva" <sh******@online.excite.com> wrote in message
news:eU**************@TK2MSFTNGP11.phx.gbl...
Hi,

It is a property of Win32Exception. So, you have to catch it explictly and
access the native error code.

HTH

"Paw Pedersen" <ne**@paws.dk> wrote in message
news:#T**************@TK2MSFTNGP11.phx.gbl...
When I catch an exception I can see the NativeErrorCode when I'm debugging
through the code, but how do I get this programatically?
I need to check if the exception I catch is with
nativeErrorCode -1072824317 since this is the only error I'm interestet in.
Thanks in advance
Paw


Nov 16 '05 #5
Thank you. That work.
Regards Paw

"Shiva" <sh******@online.excite.com> wrote in message
news:#T**************@TK2MSFTNGP09.phx.gbl...
Ok, for MessageQueue, use the MessageQueueErrorCode property of the
MessageQueueException.

The error code -1072824317 is actually MessageQueueErrorCode.QueueNotFound. So you can find this specific case as

if (MessageQueueException.MessageQueueErrorCode ==
MessageQueueErrorCode.QueueNotFound)
{
}

Or if you prefer numeric value comparison,

if (-1072824317 == (int)MessageQueueErrorCode.QueueNotFound)
{
}

"Paw Pedersen" <ne**@paws.dk> wrote in message
news:eZ**************@TK2MSFTNGP10.phx.gbl...
I'm not sure how to do that.
Now I catch it as a System.Messaging.MessageQueueException and there aren't any NativeErrorCode property on that. I have tried to catch it as
Win32Exception, but it doesn't catch the exception then.
I have also tried to cast the MessageQueueException to a Win32Exception but that gives an invalid cast exception.
Could you give an example?

Thanks Paw
"Shiva" <sh******@online.excite.com> wrote in message
news:eU**************@TK2MSFTNGP11.phx.gbl...
Hi,

It is a property of Win32Exception. So, you have to catch it explictly and access the native error code.

HTH

"Paw Pedersen" <ne**@paws.dk> wrote in message
news:#T**************@TK2MSFTNGP11.phx.gbl...
When I catch an exception I can see the NativeErrorCode when I'm debugging through the code, but how do I get this programatically?
I need to check if the exception I catch is with
nativeErrorCode -1072824317 since this is the only error I'm interestet

in.

Thanks in advance
Paw


Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jas Shultz | last post by:
I'm using Win2K3 Enterprise edition with the latest .NET framework installed. I have this problem with getting "out of disk space" errors. It doesn't happen all the time but it does happen. When...
0
by: Jas Shultz | last post by:
I'm using Win2K3 Enterprise edition with the latest .NET framework installed. I have this problem with getting "out of disk space" errors. It doesn't happen all the time but it does happen. When...
1
by: Gunjan Garg | last post by:
Hello All, I am working to create a generic datagrid which accepts a datasource(ListData - This is our own datatype) and depending on the calling program customizes itself for sorting,...
1
by: thangchan | last post by:
Hi all, i am getting SQL update problem. as below ======================error messages ======================= Server Error in '/CMS' Application....
2
by: athishay1 | last post by:
Invalid object name = 'tempdb.dbo.ASPStateTempApplications'. An unhandled exception was generated during the execution of the current = web request. Information regarding the origin and location of...
4
by: AshishMishra16 | last post by:
HI friends, I am using the Flex to upload files to server. I m getting all the details about the file, but I m not able to upload it to Server. Here is the code i m using for both flex & for...
7
by: - Electronic.HR - | last post by:
I have very strange and stupid problem with .NEt's webBrowser control... If I do this: ---------------------------------- private void btnGoogle_click(object sender, EventArgs e) { ...
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
1
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.