XmlDocument.Load()中的System.NullReferenceException [英] System.NullReferenceException in XmlDocument.Load()

查看:79
本文介绍了XmlDocument.Load()中的System.NullReferenceException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在加载XML文档时发生了一个奇怪的错误:

代码是:


//创建一个文件

XmlDocument myDoc = new XmlDocument();

//并从文件中加载
myDoc。加载(文件名);


.Load()内部我得到一个System.NullReferenceException大约1个

的10次运行(总是相同的xml文件)。


如果发生异常,堆栈似乎已损坏,因为我看不到

的callstack但有趣的是第二个线程(我的应用程序)这是一个例外的原因。

这是一个已知的错误或问题吗?


我在Visual Studio 2003下使用.NET Framework 1.1。


谢谢

doc

Hi,

I have a strange error that occurs on loading an XML document:
The code is:

// create a document
XmlDocument myDoc = new XmlDocument();
// and load it from file
myDoc.Load(filename);

Inside of .Load()I am getting a System.NullReferenceException in about 1 out
of 10 runs (always the same xml file).

If the exception occurs, the stack seems to be corrupt since I can not see
the callstack but interesting enough a second thread (my app is single
threaded) which seems the cause of the exception.

Is this a known bug or issue?

I am using .NET Framework 1.1 under Visual Studio 2003.

thanks
doc

推荐答案

我想补充一些细节:


主题列表:

3592< No Name> ** MyApp **。数据字典正常0
I''d like to add some details:

Threadlist:
3592 <No Name> **MyApp**.DataDictionary Normal 0

> 4028< No Name>最高0
>4028 <No Name> Highest 0



崩溃发生在4028线程中。


任何人都有任何想法吗?


谢谢

doc

The crash occurs in the 4028 thread.

Anyone any idea?

Thanks
doc


如何指定文件名。我的意思是完整路径或相对路径和

是否有相同代码中的任何其他文件访问。


docschnipp写道:
how do u specify the file name. i mean full path or relative path and
is there any other file access in the same code.

docschnipp wrote:

我想补充一些细节:


主题列表:

3592< No Name> ** MyApp **。数据字典正常0
I''d like to add some details:

Threadlist:
3592 <No Name> **MyApp**.DataDictionary Normal 0

4028< No Name>最高0
4028 <No Name> Highest 0



崩溃发生在4028线程中。


任何人都有任何想法吗?


谢谢

doc


The crash occurs in the 4028 thread.

Anyone any idea?

Thanks
doc


" knowdotnet"写道:
"knowdotnet" wrote:

你如何指定文件名。我的意思是完整路径或相对路径和

是否在同一代码中有任何其他文件访问权限。
how do u specify the file name. i mean full path or relative path and
is there any other file access in the same code.



这是一个字符串,只是名字,在同一目录中。

应用程序不是很复杂。

它总是一样的,但有时它只是崩溃。


XML文件本身总是一样的。


但是它有时会崩溃。


doc

It is a string, name only, in the same directory.
The app is not very complex.
It is just always the same, but sometimes it just crashes.

The XML file itself is always the same.

But it crashes sometimes.

doc


这篇关于XmlDocument.Load()中的System.NullReferenceException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆