Unhandled Exception

J

Jeff Gaines

On running an app from the IDE I get the following dialog appear just
after the form appears on screen:

*******
An unhandled exception of type 'System.NullReferenceException' occurred
in unknown module.

Additional Information: Object reference not set to an instance of an
object.
*******

If I press 'Break' I get the message 'There is no source code for the
current location' - and there is no line highlighted in my code.

If I press 'Continue' the app runs fine.

The last line in the debug output window is:

JExplorer.exe loaded 'r7he2kdw' No Symbols Loaded

All the other output windows are blank.

I have tried stepping through my code without being able to track this
down.

What do I need to do to to try and pin down where this is happening?
Does the 'r7he2kdw' in the output window give any clues?

I would appreciate any guidance.
 
G

Guest

Without any idea of what objects you are instantiating, I have no clue. What
are the lines of code at the time it breaks. If one hits an object method,
that is likely to be the issue.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
R

Robert Jordan

Hi Jeff,
What do I need to do to to try and pin down where this is happening?
Does the 'r7he2kdw' in the output window give any clues?

Are you using XML serialization?

bye
Rob
 
J

Jeff Gaines

Without any idea of what objects you are instantiating, I have no
clue. What are the lines of code at the time it breaks. If one hits
an object method, that is likely to be the issue.

I have no idea what the lines of code are, all the output windows are
empty and it does not break to any specific line, that's why I'm stuck
:)
 
A

Alvin Bruney [MVP]

run your application to the point before it fails, from the debugging
environment, press CTRL + ALT + E, choose break into debugger option then
click OK, let the application run. The debugger will attach at the line
where the exception is thrown assuming it is coming from managed code.
Remember to reset the option.
 
R

Robert Jordan

Hi Jeff,
Yes I am to load previous settings, tell me more :)

XML serialization generates C# source code at runtime
and tries to compile the code into assemblies with
those funny names.

You may disable the deletion of the temporary C# source code
from your TEMP folder using this app.config setting:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="XmlSerialization.Compilation" value="4" />
</switches>
</system.diagnostics>
</configuration>

Take a look at the generated files to find out which
classes cannot be properly handled by the XML serializer.

bye
Rob
 
R

Robert Jordan

Hi,
XML serialization generates C# source code at runtime
and tries to compile the code into assemblies with
those funny names.

You may disable the deletion of the temporary C# source code
from your TEMP folder using this app.config setting:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<switches>
<add name="XmlSerialization.Compilation" value="4" />
</switches>
</system.diagnostics>
</configuration>

Take a look at the generated files to find out which
classes cannot be properly handled by the XML serializer.

For additional infos:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/xsdcodegen.asp

bye
Rob
 
J

Jeff Gaines

run your application to the point before it fails, from the debugging
environment, press CTRL + ALT + E, choose break into debugger option
then click OK, let the application run. The debugger will attach at
the line where the exception is thrown assuming it is coming from
managed code. Remember to reset the option.

Alvin

I hadn't seen that before, I turned everything on and had a fascinating
time :)

I have re-written five functions since I was able to see exactly what
was triggering my try/catch blocks, I think I'll leave it on for now.

Due, presumably, to Murphy's Law the original exception has gone to
ground, I think it's probably the XML Serialisation issue raised by
Robert but I'll keep tracking.

Many thanks.
 
J

Jeff Gaines

Hi,
happening? >>>> Does the 'r7he2kdw' in the output window give any
clues?
[snipped]


bye
Rob

Rob

Many thanks for that, the settings class was one of the last things I
implemented before this issue started so I think you've hit the jackpot
:) As I said above to Alvin this issue has gone to ground for now but
I am more confident of finding it with your input and Alvin's.

At the worst I can go back to an ini file - this was my first attempt
to break the ini habit and use XML!

Thanks again.
 
A

Alvin Bruney [MVP]

well the only problem with leaving it on is that the CLR can throw a number
of internal exceptions before the application starts that can cause the app
to stop unnecessarily. It's more of a nuisance if you forget that you have
that option turned on. If you always remember it is on, then it is not a
problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top