error when compiled in release mode works in debug mode.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Control throws error when compiled in release mode. but works nicely when compiled in debug mode.

I have created class library which has several user controls, now one of the control is throwing null reference error.(object reference not set to instance of object).

To trap exact place of error I recompiled this dll with debug option . to my surprise control works with out error when I compile with debug option.

I tried switching .net frame work version 1.0 & 1.1 same thing happens with both.

How I can trap error if I can not get error in debug mode? and what could be reason for this behavior
 
Jigar,

Look at this article -

http://www.ftponline.com/vsm/2003_11/magazine/features/dollard/

It's got a downloadable code thing that will let you trap the exact stack
trace etc. (if you are not doing that already), that will point you to the
exact line the error is happening at. Maybe that'll help ya a bit !! :)

- Sahil Malik
Independent Consultant
You can reach me thru my blog at -
http://www.dotnetjunkies.com/weblog/sahilmalik/



Jigar said:
Control throws error when compiled in release mode. but works nicely when compiled in debug mode.

I have created class library which has several user controls, now one of
the control is throwing null reference error.(object reference not set to
instance of object).
To trap exact place of error I recompiled this dll with debug option .
to my surprise control works with out error when I compile with debug
option.
I tried switching .net frame work version 1.0 & 1.1 same thing happens with both.

How I can trap error if I can not get error in debug mode? and what could
be reason for this behavior
 
I do not think that code can help me.

I am already getting stack trace which we normally get while running web applications. i beleave when my webcontrol (dll) is compiled in release mode i can not get more information then what i am getting. so i need to compile same application with debug mode, and when i compile same application in debug mode error disappears.


Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
myapp.getDrawData() +1371
myapp..ctor(Data Data) +639
mycontrol.Render(HtmlTextWriter output) +223
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
.....
...
..
 
Hmmm .. I didn't know it was web based.

See the stack trace does help you still narrow down where the error might
be. Then you know it is an Object reference not set to an instance of an
object kind of error.

Check and see the existence of the object being used at that very point (the
line giving you the error) .. that might throw some ideas.

- Sahil Malik
Independent Consultant
You can reach me thru my blog at -
http://www.dotnetjunkies.com/weblog/sahilmalik/



Jigar said:
I do not think that code can help me.

I am already getting stack trace which we normally get while running web
applications. i beleave when my webcontrol (dll) is compiled in release mode
i can not get more information then what i am getting. so i need to compile
same application with debug mode, and when i compile same application in
debug mode error disappears.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.
Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
myapp.getDrawData() +1371
myapp..ctor(Data Data) +639
mycontrol.Render(HtmlTextWriter output) +223
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
....
..
.




Sahil Malik said:
Jigar,

Look at this article -

http://www.ftponline.com/vsm/2003_11/magazine/features/dollard/

It's got a downloadable code thing that will let you trap the exact stack
trace etc. (if you are not doing that already), that will point you to the
exact line the error is happening at. Maybe that'll help ya a bit !! :)

- Sahil Malik
Independent Consultant
You can reach me thru my blog at -
http://www.dotnetjunkies.com/weblog/sahilmalik/



when
compiled in debug mode. of
the control is throwing null reference error.(object reference not set to
instance of object). ..
to my surprise control works with out error when I compile with debug
option. could
be reason for this behavior
 
<i>Check and see the existence of the object being used at that very point (the
line giving you the error) .. that might throw some ideas.</i>

This line is Method call , there are lot of objects created in that method.Unless i compile my library in debug mode i can not get details of where actual problem is.

If its really null reference error (due to coding error ) then why that code is working when i compile with debug mode?

some more information about component.


This Control has several modes

1) Databinding which works nicely
2) Load Data through object directly which also works correctly.
3) And third one when use can define data like we do in dropdownlist

<Items>
<items:myitems .....
...........
</Items>

error occours only when i use this code, and what i really do not understand is that it throws error only in release mode. how can this happen?

I have five more controls in same assembly and all works fine. in all modes.

Sahil Malik said:
Hmmm .. I didn't know it was web based.

See the stack trace does help you still narrow down where the error might
be. Then you know it is an Object reference not set to an instance of an
object kind of error.

Check and see the existence of the object being used at that very point (the
line giving you the error) .. that might throw some ideas.

- Sahil Malik
Independent Consultant
You can reach me thru my blog at -
http://www.dotnetjunkies.com/weblog/sahilmalik/



Jigar said:
I do not think that code can help me.

I am already getting stack trace which we normally get while running web
applications. i beleave when my webcontrol (dll) is compiled in release mode
i can not get more information then what i am getting. so i need to compile
same application with debug mode, and when i compile same application in
debug mode error disappears.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the exception
can be identified using the exception stack trace below.
Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
myapp.getDrawData() +1371
myapp..ctor(Data Data) +639
mycontrol.Render(HtmlTextWriter output) +223
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
....
..
.




Sahil Malik said:
Jigar,

Look at this article -

http://www.ftponline.com/vsm/2003_11/magazine/features/dollard/

It's got a downloadable code thing that will let you trap the exact stack
trace etc. (if you are not doing that already), that will point you to the
exact line the error is happening at. Maybe that'll help ya a bit !! :)

- Sahil Malik
Independent Consultant
You can reach me thru my blog at -
http://www.dotnetjunkies.com/weblog/sahilmalik/



Control throws error when compiled in release mode. but works nicely when
compiled in debug mode.

I have created class library which has several user controls, now one of
the control is throwing null reference error.(object reference not set to
instance of object).

To trap exact place of error I recompiled this dll with debug option ..
to my surprise control works with out error when I compile with debug
option.

I tried switching .net frame work version 1.0 & 1.1 same thing happens
with both.

How I can trap error if I can not get error in debug mode? and what could
be reason for this behavior
 
Back
Top