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

I am not sure how to interpret this...

P: n/a
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.asp x 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.asp x:1185
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Jun 10 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.asp x 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.asp x: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
Jun 10 '06 #2

P: n/a
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" <hs****@onproject.com> wrote in message
news:ej**************@TK2MSFTNGP04.phx.gbl...
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.asp x 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.asp x:1185
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750

Jun 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.