By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,383 Members | 2,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

Null Reference Exception

P: n/a
We're getting following exception for the below piece of code. We're wondering how it is possible since we're having a null check for objGraphics and strokePen...



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



if (strokePen != null && objGraphics != null)

{

if (float.Parse(style["x1"])>=0 && float.Parse(style["y1"])>= 0 && float.Parse(style["x2"])>=0 && float.Parse(style["y2"])>=0 )

{

objGraphics.DrawLine(strokePen,

float.Parse(style["x1"]),

float.Parse(style["y1"]),

float.Parse(style["x2"]),

float.Parse(style["y2"]));

}

}



Stack Trace:



[NullReferenceException: Object reference not set to an instance of an object.] System.Drawing.SafeNativeMethods.GdipDrawLine(Hand leRef graphics, HandleRef pen, Single x1, Single y1, Single x2, Single y2) +0 System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single x2, Single y2) +121 Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.Render(Graphics& objGraphics, XmlNode containerNode) in d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:372 Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.RenderSVG(Graphics& objGraphics, Int32 width, Int32 height) in d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:178 Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.Render(Int32 width, Int32 height) in d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:148 Thomson.Financial.Thomlets.Datastream.Web.Core.Png RenderStream.Flush() in d:\economics\src\economics\datastream.web.core\svg \pngrenderstream.cs:73 System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) +169 System.IO.StreamWriter.Flush() +12 System.Xml.XmlTextWriter.Flush() +7 System.Xml.XmlDocument.Save(Stream outStream) +76 Thomson.Financial.Thomlets.Datastream.Web.Core.Cha rtWriter.WritePngChart(XmlDocument chartXml, SimpleHttpResponse httpResponse, Int32 width, Int32 height) in d:\economics\src\economics\datastream.web.core\cha rting\chartwriter.cs:49Thomson.Financial.Thomlets. Economics.Web.LineChartPNGRequest.GenerateChart() in d:\economics\src\economics\economics.web\linechart pngrequest.aspx.cs:87 Thomson.Financial.Thomlets.Economics.Web.LineChart PNGRequest.OnLoad(EventArgs e) in d:\economics\src\economics\economics.web\linechart pngrequest.aspx.cs:55 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032



Aug 2 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
snt
Did you check the values of style["n"]?

Ganesh Palaniappan wrote:
We're getting following exception for the below piece of code. We're wondering how it is possible since we're having a null check for objGraphics and strokePen...

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

if (strokePen != null && objGraphics != null)

{

if (float.Parse(style["x1"])>=0 && float.Parse(style["y1"])>= 0 && float.Parse(style["x2"])>=0 && float.Parse(style["y2"])>=0 )

{

objGraphics.DrawLine(strokePen,

float.Parse(style["x1"]),

float.Parse(style["y1"]),

float.Parse(style["x2"]),

float.Parse(style["y2"]));

}

}

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.] System.Drawing.SafeNativeMethods.GdipDrawLine(Hand leRef graphics, HandleRef pen, Single x1, Single y1, Single x2, Single y2) +0 System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single x2, Single y2) +121 Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.Render(Graphics& objGraphics, XmlNode containerNode) in d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:372 Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.RenderSVG(Graphics& objGraphics, Int32 width, Int32 height) in d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:178 Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.Render(Int32 width, Int32 height) in d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:148 Thomson.Financial.Thomlets.Datastream.Web.Core.Png RenderStream.Flush() in d:\economics\src\economics\datastream.web.core\svg \pngrenderstream.cs:73 System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) +169 System.IO.StreamWriter.Flush() +12 System.Xml.XmlTextWriter.Flush() +7 System.Xml.XmlDocument.Save(Stream outStream) +76 Thomson.Financial.Thomlets.Datastream.Web.Core.Cha rtWriter.WritePngChart(XmlDocument chartXml, SimpleHttpResponse httpResponse, Int32 width, Int32 height) in d:\economics\src\economics\datastream.web.core\cha rting\chartwriter.cs:49 Thomson.Financial.Thomlets.Economics.Web.LineChart PNGRequest.GenerateChart() in d:\economics\src\economics\economics.web\linechart pngrequest.aspx.cs:87 Thomson.Financial.Thomlets.Economics.Web.LineChart PNGRequest.OnLoad(EventArgs e) in d:\economics\src\economics\economics.web\linechart pngrequest.aspx.cs:55 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

------=_NextPart_000_0008_01C6B66C.7CF39820
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Google-AttachSize: 9218

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">We're&nbsp;getting following
exception for the below piece of code. We're wondering how it is possible since
we're having a null check for objGraphics and strokePen...</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" /><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p></o:p></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Exception: </SPAN><SPAN
style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: Arial">System.NullReferenceException:
Object reference not set to an instance of an object<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">if</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"(strokePen != <SPAN
style="COLOR: blue">null</SPAN&amp;&amp; objGraphics != <SPAN
style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">if</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"(<SPAN
style="COLOR: blue">float</SPAN>.Parse(style["x1"])&gt;=0 &amp;&amp; <SPAN
style="COLOR: blue">float</SPAN>.Parse(style["y1"])&gt;= 0 &amp;&amp; <SPAN
style="COLOR: blue">float</SPAN>.Parse(style["x2"])&gt;=0 &amp;&amp; <SPAN
style="COLOR: blue">float</SPAN>.Parse(style["y2"])&gt;=0
)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><EM><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
objGraphics.DrawLine(strokePen,<o:p></o:p></STRONG></EM></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;
<SPAN style="COLOR: blue">float</SPAN>.Parse(style["x1"]),<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;
<SPAN style="COLOR: blue">float</SPAN>.Parse(style["y1"]),<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;
<SPAN style="COLOR: blue">float</SPAN>.Parse(style["x2"]),<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;
<SPAN
style="COLOR: blue">float</SPAN>.Parse(style["y2"]));<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Stack
Trace:<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></P><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">[NullReferenceException: Object reference not set to an instance of an object.]<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; System.Drawing.SafeNativeMethods.GdipDrawLine(Hand leRef graphics, HandleRef pen, Single x1, Single y1, Single x2, Single y2) +0<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single x2, Single y2) +121<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.Render(Graphics&amp; objGraphics, XmlNode containerNode) in d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:372<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.RenderSVG(Graphics&amp; objGraphics, Int32 width, Int32 height) in d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:178<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.Render(Int32 width, Int32 height) in d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:148<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; Thomson.Financial.Thomlets.Datastream.Web.Core.Png RenderStream.Flush() in d:\economics\src\economics\datastream.web.core\svg \pngrenderstream.cs:73<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) +169<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; System.IO.StreamWriter.Flush() +12<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; System.Xml.XmlTextWriter.Flush() +7<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; System.Xml.XmlDocument.Save(Stream outStream) +76<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; Thomson.Financial.Thomlets.Datastream.Web.Core.Cha rtWriter.WritePngChart(XmlDocument chartXml, SimpleHttpResponse httpResponse, Int32 width, Int32 height) in d:\economics\src\economics\datastream.web.core\cha rting\chartwriter.cs:49<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; Thomson.Financial.Thomlets.Economics.Web.LineChart PNGRequest.GenerateChart() in d:\economics\src\economics\economics.web\linechart pngrequest.aspx.cs:87<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; Thomson.Financial.Thomlets.Economics.Web.LineChart PNGRequest.OnLoad(EventArgs e) in d:\economics\src\economics\economics.web\linechart pngrequest.aspx.cs:55<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; System.Web.UI.Control.LoadRecursive() +35<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp; System.Web.UI.Page.ProcessRequestMain() +750<o:p></o:p></FONT></SPAN></PRE>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B><SPAN
style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: Verdana">Version
Information:</SPAN></B><SPAN
style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: Arial">&nbsp;Microsoft .NET
Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032</SPAN><o:p></o:p></P>
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P></DIV></BODY></HTML>

------=_NextPart_000_0008_01C6B66C.7CF39820--
Aug 2 '06 #2

P: n/a
That's a tough one. Have you tried putting in a breakpoint?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Magician

A man, a plan, a canal.
a palindrome that has gone to s**t.
"Ganesh Palaniappan" <ju**@junk.comwrote in message
news:ey**************@TK2MSFTNGP05.phx.gbl...
We're getting following exception for the below piece of code. We're
wondering how it is possible since we're having a null check for objGraphics
and strokePen...

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

if (strokePen != null && objGraphics != null)

{

if (float.Parse(style["x1"])>=0 && float.Parse(style["y1"])>= 0 &&
float.Parse(style["x2"])>=0 && float.Parse(style["y2"])>=0 )

{

objGraphics.DrawLine(strokePen,

float.Parse(style["x1"]),

float.Parse(style["y1"]),

float.Parse(style["x2"]),

float.Parse(style["y2"]));

}

}

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.] System.Drawing.SafeNativeMethods.GdipDrawLine(Hand leRef graphics,
HandleRef pen, Single x1, Single y1, Single x2, Single y2) +0
System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single x2,
Single y2) +121
Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.Render(Graphics&
objGraphics, XmlNode containerNode) in
d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:372
Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.RenderSVG(Graphics&
objGraphics, Int32 width, Int32 height) in
d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:178
Thomson.Financial.Thomlets.Datastream.Web.Core.SVG Image.Render(Int32 width,
Int32 height) in
d:\economics\src\economics\datastream.web.core\svg \svgrenderer.cs:148
Thomson.Financial.Thomlets.Datastream.Web.Core.Png RenderStream.Flush() in
d:\economics\src\economics\datastream.web.core\svg \pngrenderstream.cs:73
System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) +169
System.IO.StreamWriter.Flush() +12 System.Xml.XmlTextWriter.Flush() +7
System.Xml.XmlDocument.Save(Stream outStream) +76
Thomson.Financial.Thomlets.Datastream.Web.Core.Cha rtWriter.WritePngChart(XmlDocument
chartXml, SimpleHttpResponse httpResponse, Int32 width, Int32 height) in
d:\economics\src\economics\datastream.web.core\cha rting\chartwriter.cs:49
Thomson.Financial.Thomlets.Economics.Web.LineChart PNGRequest.GenerateChart()
in d:\economics\src\economics\economics.web\linechart pngrequest.aspx.cs:87
Thomson.Financial.Thomlets.Economics.Web.LineChart PNGRequest.OnLoad(EventArgs
e) in
d:\economics\src\economics\economics.web\linechart pngrequest.aspx.cs:55
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032


Aug 2 '06 #3

P: n/a
Yes - have checked values of style["n"] - no issues with that...

Thanks.

"snt" <sn******@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
Did you check the values of style["n"]?

Ganesh Palaniappan wrote:
>We're getting following exception for the below piece of code. We're
wondering how it is possible since we're having a null check for
objGraphics and strokePen...

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

if (strokePen != null && objGraphics != null)

{

if (float.Parse(style["x1"])>=0 && float.Parse(style["y1"])>= 0 &&
float.Parse(style["x2"])>=0 && float.Parse(style["y2"])>=0 )

{

objGraphics.DrawLine(strokePen,

float.Parse(style["x1"]),

float.Parse(style["y1"]),

float.Parse(style["x2"]),

float.Parse(style["y2"]));

}

}

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.] System.Drawing.SafeNativeMethods.GdipDrawLine(Hand leRef
graphics, HandleRef pen, Single x1, Single y1, Single x2, Single y2) +0
System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single
x2, Single y2) +121
Thomson.Financial.Thomlets.Datastream.Web.Core.SV GImage.Render(Graphics&
objGraphics, XmlNode containerNode) in
d:\economics\src\economics\datastream.web.core\sv g\svgrenderer.cs:372
Thomson.Financial.Thomlets.Datastream.Web.Core.SV GImage.RenderSVG(Graphics&
objGraphics, Int32 width, Int32 height) in
d:\economics\src\economics\datastream.web.core\sv g\svgrenderer.cs:178
Thomson.Financial.Thomlets.Datastream.Web.Core.SV GImage.Render(Int32
width, Int32 height) in
d:\economics\src\economics\datastream.web.core\sv g\svgrenderer.cs:148
Thomson.Financial.Thomlets.Datastream.Web.Core.Pn gRenderStream.Flush() in
d:\economics\src\economics\datastream.web.core\sv g\pngrenderstream.cs:73
System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
+169 System.IO.StreamWriter.Flush() +12
System.Xml.XmlTextWriter.Flush() +7 System.Xml.XmlDocument.Save(Stream
outStream) +76
Thomson.Financial.Thomlets.Datastream.Web.Core.Ch artWriter.WritePngChart(XmlDocument
chartXml, SimpleHttpResponse httpResponse, Int32 width, Int32 height) in
d:\economics\src\economics\datastream.web.core\ch arting\chartwriter.cs:49
Thomson.Financial.Thomlets.Economics.Web.LineChar tPNGRequest.GenerateChart()
in
d:\economics\src\economics\economics.web\linechar tpngrequest.aspx.cs:87
Thomson.Financial.Thomlets.Economics.Web.LineChar tPNGRequest.OnLoad(EventArgs
e) in
d:\economics\src\economics\economics.web\linechar tpngrequest.aspx.cs:55
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Version Information: Microsoft .NET Framework Version:1.1.4322.2032;
ASP.NET Version:1.1.4322.2032

------=_NextPart_000_0008_01C6B66C.7CF39820
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Google-AttachSize: 9218

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">We're&nbsp;getting following
exception for the below piece of code. We're wondering how it is possible
since
we're having a null check for objGraphics and strokePen...</SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><?xml:namespace prefix = o ns
=
"urn:schemas-microsoft-com:office:office" /><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p></o:p></SPAN>&nbsp;</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Exception: </SPAN><SPAN
style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY:
Arial">System.NullReferenceException:
Object reference not set to an instance of an
object<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY:
Arial"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier
New'">if</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"(strokePen != <SPAN
style="COLOR: blue">null</SPAN&amp;&amp; objGraphics != <SPAN
style="COLOR: blue">null</SPAN>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'">{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0.5in"><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier
New'">if</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"(<SPAN
style="COLOR: blue">float</SPAN>.Parse(style["x1"])&gt;=0 &amp;&amp;
<SPAN
style="COLOR: blue">float</SPAN>.Parse(style["y1"])&gt;= 0 &amp;&amp;
<SPAN
style="COLOR: blue">float</SPAN>.Parse(style["x2"])&gt;=0 &amp;&amp;
<SPAN
style="COLOR: blue">float</SPAN>.Parse(style["y2"])&gt;=0
)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'"><EM><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
objGraphics.DrawLine(strokePen,<o:p></o:p></STRONG></EM></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;
<SPAN style="COLOR:
blue">float</SPAN>.Parse(style["x1"]),<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;
<SPAN style="COLOR:
blue">float</SPAN>.Parse(style["y1"]),<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;
<SPAN style="COLOR:
blue">float</SPAN>.Parse(style["x2"]),<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;
<SPAN
style="COLOR:
blue">float</SPAN>.Parse(style["y2"]));<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'">}<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Stack
Trace:<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'"><o:p>&nbsp;</o:p></SPAN></P><PRE><SPAN style="FONT-SIZE: 9pt;
COLOR: black"><FONT face="Lucida Console">[NullReferenceException: Object
reference not set to an instance of an
object.]<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt;
COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp;
System.Drawing.SafeNativeMethods.GdipDrawLine(Han dleRef graphics,
HandleRef pen, Single x1, Single y1, Single x2, Single y2)
+0<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR:
black"><FONT face="Lucida Console">&nbsp;&nbsp;
System.Drawing.Graphics.DrawLine(Pen pen, Single x1, Single y1, Single
x2, Single y2) +121<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN
style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida
Console">&nbsp;&nbsp;
Thomson.Financial.Thomlets.Datastream.Web.Core.SV GImage.Render(Graphics&amp;
objGraphics, XmlNode containerNode) in
d:\economics\src\economics\datastream.web.core\sv g\svgrenderer.cs:372<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN
style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida
Console">&nbsp;&nbsp;
Thomson.Financial.Thomlets.Datastream.Web.Core.SV GImage.RenderSVG(Graphics&amp;
objGraphics, Int32 width, Int32 height) in
d:\economics\src\economics\datastream.web.core\sv g\svgrenderer.cs:178<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN
style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida
Console">&nbsp;&nbsp;
Thomson.Financial.Thomlets.Datastream.Web.Core.SV GImage.Render(Int32
width, Int32 height) in
d:\economics\src\economics\datastream.web.core\sv g\svgrenderer.cs:148<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN
style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida
Console">&nbsp;&nbsp;
Thomson.Financial.Thomlets.Datastream.Web.Core.Pn gRenderStream.Flush() in
d:\economics\src\economics\datastream.web.core\sv g\pngrenderstream.cs:73<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN
style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida
Console">&nbsp;&nbsp; System.IO.StreamWriter.Flush(Boolean flushStream,
Boolean flushEncoder) +169<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN
style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida
Console">&nbsp;&nbsp; System.IO.StreamWriter.Flush()
+12<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt;
COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp;
System.Xml.XmlTextWriter.Flush()
+7<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt; COLOR:
black"><FONT face="Lucida Console">&nbsp;&nbsp;
System.Xml.XmlDocument.Save(Stream outStream)
+76<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt;
COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp;
Thomson.Financial.Thomlets.Datastream.Web.Core.Ch artWriter.WritePngChart(XmlDocument
chartXml, SimpleHttpResponse httpResponse, Int32 width, Int32 height) in
d:\economics\src\economics\datastream.web.core\ch arting\chartwriter.cs:49<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN
style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida
Console">&nbsp;&nbsp;
Thomson.Financial.Thomlets.Economics.Web.LineChar tPNGRequest.GenerateChart()
in
d:\economics\src\economics\economics.web\linechar tpngrequest.aspx.cs:87<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN
style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida
Console">&nbsp;&nbsp;
Thomson.Financial.Thomlets.Economics.Web.LineChar tPNGRequest.OnLoad(EventArgs
e) in
d:\economics\src\economics\economics.web\linechar tpngrequest.aspx.cs:55<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN
style="FONT-SIZE: 9pt; COLOR: black"><FONT face="Lucida
Console">&nbsp;&nbsp; System.Web.UI.Control.LoadRecursive()
+35<o:p></o:p></FONT></SPAN></PRE><PRE><SPAN style="FONT-SIZE: 9pt;
COLOR: black"><FONT face="Lucida Console">&nbsp;&nbsp;
System.Web.UI.Page.ProcessRequestMain()
+750<o:p></o:p></FONT></SPAN></PRE>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier
New'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B><SPAN
style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY: Verdana">Version
Information:</SPAN></B><SPAN
style="FONT-SIZE: 8.5pt; COLOR: black; FONT-FAMILY:
Arial">&nbsp;Microsoft .NET
Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032</SPAN><o:p></o:p></P>
<P class=MsoNormal
style="MARGIN: 0in 0in 0pt"><o:p>&nbsp;</o:p></P></DIV></BODY></HTML>

------=_NextPart_000_0008_01C6B66C.7CF39820--

Aug 3 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.