468,301 Members | 1,430 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,301 developers. It's quick & easy.

Why Is Detail Hidden In Private Fields In AccessViolationException

I've written a test harness in C# to test one of our company's products,
which is written in C.

If the application crashes, the Instruction Address, Memory Address and the
Access Type are stored in the private fields _ip, _target and _accessType of
the AccessViolationException that is thrown. I want to be able to report
these errors to the user in the C# harness to assist in writing defect
reports for the development teams.

I can only access these fields using Reflection. My question is why is this
informative information kept in private fields in the exception, and not
available as a public Property? It would also seem to make sense for this
information to be reported in the Message property as well.

If the crash occurs when running the product directly, i.e. in C, this
information is reported by Windows, so it seems at first glance a step
backwards to not report this information when the AccessViolationException is
thrown from the P/Invoke.
Jul 9 '08 #1
2 1637
I dont have any code which generates one of these but have you tried looking
in the Data property. Its a dictionary which is sometimes used to give extra
information about the exception.

Let us know if its in there.

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Tristan MSDN Keen" wrote:
I've written a test harness in C# to test one of our company's products,
which is written in C.

If the application crashes, the Instruction Address, Memory Address and the
Access Type are stored in the private fields _ip, _target and _accessType of
the AccessViolationException that is thrown. I want to be able to report
these errors to the user in the C# harness to assist in writing defect
reports for the development teams.

I can only access these fields using Reflection. My question is why is this
informative information kept in private fields in the exception, and not
available as a public Property? It would also seem to make sense for this
information to be reported in the Message property as well.

If the crash occurs when running the product directly, i.e. in C, this
information is reported by Windows, so it seems at first glance a step
backwards to not report this information when the AccessViolationException is
thrown from the P/Invoke.
Jul 9 '08 #2
I've looked in the Data property, and it has a count of 0.

"Ciaran O''Donnell" wrote:
I dont have any code which generates one of these but have you tried looking
in the Data property. Its a dictionary which is sometimes used to give extra
information about the exception.

Let us know if its in there.

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Tristan MSDN Keen" wrote:
I've written a test harness in C# to test one of our company's products,
which is written in C.

If the application crashes, the Instruction Address, Memory Address and the
Access Type are stored in the private fields _ip, _target and _accessType of
the AccessViolationException that is thrown. I want to be able to report
these errors to the user in the C# harness to assist in writing defect
reports for the development teams.

I can only access these fields using Reflection. My question is why is this
informative information kept in private fields in the exception, and not
available as a public Property? It would also seem to make sense for this
information to be reported in the Message property as well.

If the crash occurs when running the product directly, i.e. in C, this
information is reported by Windows, so it seems at first glance a step
backwards to not report this information when the AccessViolationException is
thrown from the P/Invoke.
Jul 11 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Roshawn Dawson | last post: by
1 post views Thread by =?Utf-8?B?SmFzb24gUm9kbWFu?= | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.