473,398 Members | 2,380 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,398 software developers and data experts.

Null Reference Exception

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
3 2050
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
5
by: Boniek | last post by:
Hi I define a public property in a new form and I can see this property in table of Properties in Visual. How I can hide this property to see only in code ? Thank's Boniek
0
by: Matt | last post by:
Hi all, I'm having a very strange problem. The third line in the following code gives me a null reference exception when used in an ASP.Net web page. The code is called on the click of a...
2
by: I am Sam | last post by:
I keep getting the following exception error: Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request....
0
by: webbsk | last post by:
I keep getting an exception when I call the DataAdapter Update method. I have been trying to figure out what is causing the null reference exception for this code for what seems like forever: ...
18
by: Denis Petronenko | last post by:
Hello, in the following code i have segmentaion fault instead of exception. Why? What i must to do to catch exceptions in such situation? Used compiler: gcc version 3.3.6 (Debian 1:3.3.6-13) ...
2
by: Weeble | last post by:
Back in C++, I had a type that looked something like this (entering from memory so this might not quite compile): template <class T> class NotNull { private: T* value; public: NotNull(T*...
11
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
76
by: valentin tihomirov | last post by:
As explained in "Using pointers vs. references" http://groups.google.ee/group/borland.public.delphi.objectpascal/browse_thread/thread/683c30f161fc1e9c/ab294c7b02e8faca#ab294c7b02e8faca , the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.