PC Review


Reply
Thread Tools Rate Thread

I am not sure how to interpret this...

 
 
Henry
Guest
Posts: n/a
 
      10th Jun 2006
I am trying to work my way through a textbook on web services. I was
running a help page and got this error message. To me it is vague. Not
knowing the code well enough I am not sure which data element it is talking
about.... schemas? Context.items? I am not sure where that is
initialized.....

Any ideas about what I should be looking for?

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:


Line 1183:
Line 1184: schemas = new XmlSchemas();
Line 1185: foreach (XmlSchema schema in
(XmlSchemas)Context.Items["schemas"]) {
Line 1186: schemas.Add(schema);
Line 1187: }


Source File: G:\Software\Wrox Press\Professional ASP.NET Web
Services\Chapter02\wwwroot\MywsdlHelpGenerator.aspx Line: 1185

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an
object.]
ASP.MyWsdlHelpGenerator_aspx.Page_Load(Object sender, EventArgs e) in
G:\Software\Wrox Press\Professional ASP.NET Web
Services\Chapter02\wwwroot\MywsdlHelpGenerator.aspx:1185
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750



 
Reply With Quote
 
 
 
 
David Hogue
Guest
Posts: n/a
 
      10th Jun 2006
Henry wrote:
> I am trying to work my way through a textbook on web services. I was
> running a help page and got this error message. To me it is vague. Not
> knowing the code well enough I am not sure which data element it is talking
> about.... schemas? Context.items? I am not sure where that is
> initialized.....
>
> Any ideas about what I should be looking for?
>
> 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:
>
>
> Line 1183:
> Line 1184: schemas = new XmlSchemas();
> Line 1185: foreach (XmlSchema schema in
> (XmlSchemas)Context.Items["schemas"]) {
> Line 1186: schemas.Add(schema);
> Line 1187: }
>
>
> Source File: G:\Software\Wrox Press\Professional ASP.NET Web
> Services\Chapter02\wwwroot\MywsdlHelpGenerator.aspx Line: 1185
>
> Stack Trace:
>
>
> [NullReferenceException: Object reference not set to an instance of an
> object.]
> ASP.MyWsdlHelpGenerator_aspx.Page_Load(Object sender, EventArgs e) in
> G:\Software\Wrox Press\Professional ASP.NET Web
> Services\Chapter02\wwwroot\MywsdlHelpGenerator.aspx:1185
> System.Web.UI.Control.OnLoad(EventArgs e) +67
> System.Web.UI.Control.LoadRecursive() +35
> System.Web.UI.Page.ProcessRequestMain() +750


Hi Henry,

My guess is Context.Items["schemas"] is null and the cast is causing the
NullReferenceException. Not knowing the code I don't know how much I
can help. You might try searching the code for '["schemas"] = ' or
'Context.Add("schemas"' to see where schemas are added to the context.
You could add an if statement to it like so:

if(Context.Items["schemas"] != null) {
foreach(XmlSchema schema in (XmlSchemas)Context.Items["schemas"]) {
schemas.Add(schema);
}
}

Looking at the few lines of code I'm not sure what the purpose of
looping through the collection is when you could just do:

if(Context.Items["schemas"] != null)
schemas = (XmlSchemas)Context.Items["schemas"]);


--
David Hogue
 
Reply With Quote
 
chanmm
Guest
Posts: n/a
 
      10th Jun 2006
I believe your code did have some portion that is reading the XML file. Make
sure the path of the XML that you read is correct.

chanmm

"Henry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am trying to work my way through a textbook on web services. I was
>running a help page and got this error message. To me it is vague. Not
>knowing the code well enough I am not sure which data element it is talking
>about.... schemas? Context.items? I am not sure where that is
>initialized.....
>
> Any ideas about what I should be looking for?
>
> 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:
>
>
> Line 1183:
> Line 1184: schemas = new XmlSchemas();
> Line 1185: foreach (XmlSchema schema in
> (XmlSchemas)Context.Items["schemas"]) {
> Line 1186: schemas.Add(schema);
> Line 1187: }
>
>
> Source File: G:\Software\Wrox Press\Professional ASP.NET Web
> Services\Chapter02\wwwroot\MywsdlHelpGenerator.aspx Line: 1185
>
> Stack Trace:
>
>
> [NullReferenceException: Object reference not set to an instance of an
> object.]
> ASP.MyWsdlHelpGenerator_aspx.Page_Load(Object sender, EventArgs e) in
> G:\Software\Wrox Press\Professional ASP.NET Web
> Services\Chapter02\wwwroot\MywsdlHelpGenerator.aspx:1185
> System.Web.UI.Control.OnLoad(EventArgs e) +67
> System.Web.UI.Control.LoadRecursive() +35
> System.Web.UI.Page.ProcessRequestMain() +750
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to interpret my code =?Utf-8?B?QW5kcmVhcw==?= Microsoft Excel Programming 6 7th Aug 2007 01:24 PM
How does VBA interpret Dates? Greg Glynn Microsoft Excel Programming 2 10th Jul 2007 03:28 AM
Interpret code FIRSTROUNDKO via OfficeKB.com Microsoft Excel Programming 4 22nd Mar 2006 06:21 PM
Why does Excel interpret 2/29 as Feb 1st? =?Utf-8?B?Sm8=?= Microsoft Excel Misc 6 26th Feb 2005 06:06 PM
OH.exe how do I interpret the output? bender Microsoft Windows 2000 Applications 0 24th Mar 2004 07:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:43 AM.