读取st时,XmlTextReader ReadChars可以进入infinate循环 [英] XmlTextReader ReadChars can enter an infinate loop when reading st

查看:214
本文介绍了读取st时,XmlTextReader ReadChars可以进入infinate循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码将在ReadChars中进入无限循环。我只能在读取Stream并使用这个特定的XML时才能实现
。如果我使用

ReadInnerXml调用而不是我自己的ReadElementBodyAsXml代码可以工作,

但是效率较低。我的应用程序需要ReadElementBodyAsXml
带有.Net Framework 1.1的



第二次使用内部xml调用ReadElementBodyAsXml时代码中断:

< / EGDConfigExtension>

< EGDConfigExtension Company =" http://pdweb.salem.ge.com"

ExtensionCode =" MasterHmiResources" >< HmiResources>

< HmiResource Name =" hgyugyg" />

< / HmiResources>< / EGDConfigExtension>

这是不好的行为,所以我觉得应该发布。也许已经

知道要修复SP1(希望即将推出)。


问候,

Rick


---破解的代码---

private void ReadXml()

{

FileStream fs = File.OpenRead(@" MasterSymbolTable.xml");

XmlTextReader reader = new XmlTextReader(fs,XmlNodeType.Element,null);

reader.MoveToContent();

reader.ReadToDescendant(" EGDConfigExtension");

string xml = ReadElementBodyAsXml(reader);

reader.Read();

xml = ReadElementBodyAsXml(读者);

}


私有字符串ReadElementBodyAsXml(XmlTextReader reader)

{

int startingLineNumber = reader.LineNumber;

int startingLinePosition = reader.LinePosition;

int startingDepth = reader.Depth;

bool startingElementIsEmpty = reader.IsEmptyElement;

string startingName = reader.Name;


系统.Diagnostics.Debug.Assert(reader.NodeType == XmlNodeType.Element,

节点类型必须是元素。,

" ReadElementBodyAsXml应该在调用时调用读者定位在

元素上。如果不是,它将返回null,但是用于读取元素内容的意图是

。);


char [ ] buffer = new char [512];

int totalRead = 0;

int i;

while((i = reader.ReadChars( buffer,totalRead,buffer.Length -

totalRead))0)

{

totalRead + = i;

if(reader.Depth< = startingDepth)

{

//即使我们读取字符,LineNumber和LinePosition也没有

更改

//除非我们读取一个节点。除非我们在子节点上使用
//否则我们不想再阅读了。但是我们还需要确保在我们开始使用的同一个节点上我们还不是b $ b //因为我们可以有一些非常好的
//大节点。很难判断ReadChars是否返回,因为它确实没有更多内容被缓冲或者是否已经到达节点的末尾。

//如果在节点的结尾,哪个节点?

//此代码修复了SCR 2923.

if(reader.NodeType!= XmlNodeType.Element)

休息; //我们不能在我们开始的节点上。

}

if(reader.NodeType == XmlNodeType.EndElement&& reader.Depth ==

startingDepth)

休息;

if(totalRead == buffer.Length)

{

char [] newBuf = new char [buffer.Length + 512];

Buffer.BlockCopy(buffer,0,newBuf,0,totalRead * 2); //每个字符是

2字节。

buffer = newBuf;

}

}


string innerXml = null;

if(totalRead 0)

innerXml = new string(buffer,0,totalRead);

else

innerXml = null;


返回innerXml;

}


----- XML文件MasterSymbolTable.Xml ---

<?xml version =" 1.0" encoding =" utf-8"?>

<?GeCssClass type =" GeIndsysNetworkCoe.EgdConfig.EgdMasterSymbol Table,

EgdCoeConfig"?>

< MasterEgdSymbolTable EGDSpecVersion =" 3.04" ConfigTimeSecs =" 1160762827"

ConfigTimeNSecs =" 704238500"的xmlns = QUOT; HTTP://geindustrial.com/EGD" Name =" Demo">

< EGDConfigExtension Company =" http://pdweb.salem.ge.com"

ExtensionCode =" MasterAlarms"> ;< AlarmClasses>

< AlarmClass Name =" Alarm" Description =" Process Alarms的默认类"

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"
AlarmBackgroundColor =" Red" AlarmForegroundColor =" White"

AckBackgroundColor =" White" AckForegroundColor = QUOT;红色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" Trip" Description ="转换器行程的默认类别"

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"

AlarmBackgroundColor =" Maroon" AlarmForegroundColor =" White"

AckBackgroundColor =" White" AckForegroundColor = QUOT;栗色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" System" Description =" WorkstationST的默认类

系统警报" DescAlt = QUOT;" NormalBackgroundColor =" White"

NormalForegroundColor =" Black" AlarmBackgroundColor =" Teal"

AlarmForegroundColor =" White" AckBackgroundColor =" White"

AckForegroundColor =" Teal" IsIntrinsic = QUOT;真" NormalSeverity =" 350"

ActiveSeverity =" 500" />

< AlarmClass Name =" Diagnostic" Description =" Process的默认类

Diagnostics" DescAlt = QUOT;" NormalBackgroundColor =" White"

NormalForegroundColor =" Black" AlarmBackgroundColor =" Red"

AlarmForegroundColor =" White" AckBackgroundColor =" White"

AckForegroundColor =" Red" IsIntrinsic = QUOT;真" NormalSeverity =" 350"

ActiveSeverity =" 500" />

< AlarmClass Name =" Hold" Description ="保留的默认类别 DescAlt =""

NormalBackgroundColor =" White" NormalForegroundColor =" Black"
AlarmBackgroundColor ="黄色" AlarmForegroundColor =" Black"

AckBackgroundColor =" Black" AckForegroundColor = QUOT;黄色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" Diag" Description =" Process Diagnostics的默认类"

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"
AlarmBackgroundColor =" Red" AlarmForegroundColor =" White"

AckBackgroundColor =" White" AckForegroundColor = QUOT;红色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" Sys" Description =" WorkstationST系统的默认类

alarm" DescAlt = QUOT;" NormalBackgroundColor =" White"

NormalForegroundColor =" Black" AlarmBackgroundColor =" Teal"

AlarmForegroundColor =" White" AckBackgroundColor =" White"

AckForegroundColor =" Teal" IsIntrinsic = QUOT;真" NormalSeverity =" 350"

ActiveSeverity =" 500" />

< AlarmClass Name =" TEST" Description =" Test Alarm Class" DescAlt =""

NormalBackgroundColor =" White" NormalForegroundColor =" Black"

AlarmBackgroundColor =" Maroon" AlarmForegroundColor =" White"

AckBackgroundColor =" White" AckForegroundColor = QUOT;栗色" NormalSeverity =" 350"

ActiveSeverity =" 500" />

< AlarmClass Name =" OpSet" Description ="操作员设定点的警报等级

事件" DescAlt = QUOT;" NormalBackgroundColor =" White"

NormalForegroundColor =" Black" AlarmBackgroundColor =" Yellow"

AlarmForegroundColor =" Black" AckBackgroundColor =" Black"

ActiveSeverity =" 500" />

< AlarmClass Name =" SOE" Description ="事件序列的默认类别

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"
AlarmBackgroundColor ="黄色" AlarmForegroundColor =" Black"

AckBackgroundColor =" Black" AckForegroundColor = QUOT;黄色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" Event" Description =" Process Events的默认类"

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"
AlarmBackgroundColor ="黄色" AlarmForegroundColor =" Black"

AckBackgroundColor =" Black" AckForegroundColor = QUOT;黄色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< / AlarmClasses>< / EGDConfigExtension>

< EGDConfigExtension Company =" http://pdweb.salem.ge.com"

ExtensionCode =" MasterHmiResources">< HmiResources>

< HmiResource Name =" hgyugyg" />

< / HmiResources>< / EGDConfigExtension>

< EGDConfigExtension Company =" http://pdweb.salem.ge.com"

ExtensionCode =" MasterPlantAreas">< PlantAreas>

< PlantAreaPath Path =" Plant" />

< PlantAreaPath Path =" Plant.PlantArea01" />

< PlantAreaPath Path =" Plant.PlantArea01.PlantArea21" />

< PlantAreaPath Path =" Plant.PlantArea02" />

< PlantAreaPath Path =" Plant.PlantArea04" />

< PlantAreaPath Path =" Plant.PlantArea14" />

< PlantAreaPath Path =" Plant.PlantArea15" />

< / PlantAreas>< / EGDConfigExtension>

< / MasterEgdSymbolTable>

The following code will enter an infinate loop when in ReadChars. I can only
make it happen when reading a Stream and with this particular XML. If I use
the ReadInnerXml call rather than my own ReadElementBodyAsXml the code works,
but is less efficent. ReadElementBodyAsXml is required by my application
with .Net Framework 1.1.

The code breaks on the second call to ReadElementBodyAsXml with the inner xml:
</EGDConfigExtension>
<EGDConfigExtension Company="http://pdweb.salem.ge.com"
ExtensionCode="MasterHmiResources"><HmiResources>
<HmiResource Name="hgyugyg" />
</HmiResources></EGDConfigExtension>
This is bad behavior, so I felt it should be posted. Maybe it is already
know to be fixed in SP1 (hopefully forthcoming).

Regards,
Rick

--- code that breaks ---
private void ReadXml()
{
FileStream fs = File.OpenRead(@"MasterSymbolTable.xml");
XmlTextReader reader = new XmlTextReader(fs, XmlNodeType.Element, null);
reader.MoveToContent();
reader.ReadToDescendant("EGDConfigExtension");
string xml = ReadElementBodyAsXml(reader);
reader.Read();
xml = ReadElementBodyAsXml(reader);
}

private string ReadElementBodyAsXml(XmlTextReader reader)
{
int startingLineNumber = reader.LineNumber;
int startingLinePosition = reader.LinePosition;
int startingDepth = reader.Depth;
bool startingElementIsEmpty = reader.IsEmptyElement;
string startingName = reader.Name;

System.Diagnostics.Debug.Assert(reader.NodeType == XmlNodeType.Element,
"Node type must be Element.",
"ReadElementBodyAsXml should be called when the reader is positioned on
an element. It will simply return null if it is not, but the intention is
for it to be used to read element content.");

char[] buffer = new char[512];
int totalRead = 0;
int i;
while ((i = reader.ReadChars(buffer, totalRead, buffer.Length -
totalRead)) 0)
{
totalRead += i;
if (reader.Depth <= startingDepth)
{
// Even though we read chars, the LineNumber and LinePosition do not
change
// unless we read a node. We don''t want to read any more unless we are
// on a child node. But we also need to make sure that we are not still
// on the same node that we started with, since we could have some very
// big nodes. It is hard to tell if ReadChars returned because it did
// not have any more content buffered or if it got to the end of a node.
// If at the end of a node, which node?
// This code fixes SCR 2923.
if (reader.NodeType != XmlNodeType.Element)
break; // We must not be on the node we started on.
}
if (reader.NodeType == XmlNodeType.EndElement && reader.Depth ==
startingDepth)
break;
if (totalRead == buffer.Length)
{
char[] newBuf = new char[buffer.Length + 512];
Buffer.BlockCopy(buffer, 0, newBuf, 0, totalRead * 2); // Each char is
2 bytes.
buffer = newBuf;
}
}

string innerXml = null;
if (totalRead 0)
innerXml = new string(buffer, 0, totalRead);
else
innerXml = null;

return innerXml;
}

----- XML file MasterSymbolTable.Xml ---
<?xml version="1.0" encoding="utf-8"?>
<?GeCssClass type="GeIndsysNetworkCoe.EgdConfig.EgdMasterSymbol Table,
EgdCoeConfig"?>
<MasterEgdSymbolTable EGDSpecVersion="3.04" ConfigTimeSecs="1160762827"
ConfigTimeNSecs="704238500" xmlns="http://geindustrial.com/EGD" Name="Demo">
<EGDConfigExtension Company="http://pdweb.salem.ge.com"
ExtensionCode="MasterAlarms"><AlarmClasses>
<AlarmClass Name="Alarm" Description="Default Class for Process Alarms"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Red" AlarmForegroundColor="White"
AckBackgroundColor="White" AckForegroundColor="Red" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="Trip" Description="Default Class for Convertor Trips"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Maroon" AlarmForegroundColor="White"
AckBackgroundColor="White" AckForegroundColor="Maroon" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="System" Description="Default Class for WorkstationST
System alarms" DescAlt="" NormalBackgroundColor="White"
NormalForegroundColor="Black" AlarmBackgroundColor="Teal"
AlarmForegroundColor="White" AckBackgroundColor="White"
AckForegroundColor="Teal" IsIntrinsic="true" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="Diagnostic" Description="Default Class for Process
Diagnostics" DescAlt="" NormalBackgroundColor="White"
NormalForegroundColor="Black" AlarmBackgroundColor="Red"
AlarmForegroundColor="White" AckBackgroundColor="White"
AckForegroundColor="Red" IsIntrinsic="true" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="Hold" Description="Default Class for Holds" DescAlt=""
NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Yellow" AlarmForegroundColor="Black"
AckBackgroundColor="Black" AckForegroundColor="Yellow" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="Diag" Description="Default Class for Process Diagnostics"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Red" AlarmForegroundColor="White"
AckBackgroundColor="White" AckForegroundColor="Red" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="Sys" Description="Default Class for WorkstationST System
alarms" DescAlt="" NormalBackgroundColor="White"
NormalForegroundColor="Black" AlarmBackgroundColor="Teal"
AlarmForegroundColor="White" AckBackgroundColor="White"
AckForegroundColor="Teal" IsIntrinsic="true" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="TEST" Description="Test Alarm Class" DescAlt=""
NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Maroon" AlarmForegroundColor="White"
AckBackgroundColor="White" AckForegroundColor="Maroon" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="OpSet" Description="Alarm Class for Operator Setpoint
Events" DescAlt="" NormalBackgroundColor="White"
NormalForegroundColor="Black" AlarmBackgroundColor="Yellow"
AlarmForegroundColor="Black" AckBackgroundColor="Black"
AckForegroundColor="Yellow" IsIntrinsic="true" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="SOE" Description="Default Class for Sequence of event"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Yellow" AlarmForegroundColor="Black"
AckBackgroundColor="Black" AckForegroundColor="Yellow" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="Event" Description="Default Class for Process Events"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Yellow" AlarmForegroundColor="Black"
AckBackgroundColor="Black" AckForegroundColor="Yellow" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
</AlarmClasses></EGDConfigExtension>
<EGDConfigExtension Company="http://pdweb.salem.ge.com"
ExtensionCode="MasterHmiResources"><HmiResources>
<HmiResource Name="hgyugyg" />
</HmiResources></EGDConfigExtension>
<EGDConfigExtension Company="http://pdweb.salem.ge.com"
ExtensionCode="MasterPlantAreas"><PlantAreas>
<PlantAreaPath Path="Plant" />
<PlantAreaPath Path="Plant.PlantArea01" />
<PlantAreaPath Path="Plant.PlantArea01.PlantArea21" />
<PlantAreaPath Path="Plant.PlantArea02" />
<PlantAreaPath Path="Plant.PlantArea04" />
<PlantAreaPath Path="Plant.PlantArea14" />
<PlantAreaPath Path="Plant.PlantArea15" />
</PlantAreas></EGDConfigExtension>
</MasterEgdSymbolTable>

推荐答案

我忘了提一下,infinate循环在.Net Framework 2.0中。我安装了

修补程序(KB924895和KB922271)(以及2个安全更新)。

-

Rick

< Rick"写道:
I forgot to mention, the infinate loop is in .Net Framework 2.0. I have the
hotfixes (KB924895 and KB922271) (as well as 2 security updates) installed.
--
Rick
"Rick" wrote:

以下代码将在ReadChars中进入无限循环。我只能在读取Stream并使用这个特定的XML时才能实现
。如果我使用

ReadInnerXml调用而不是我自己的ReadElementBodyAsXml代码可以工作,

但是效率较低。我的应用程序需要ReadElementBodyAsXml
带有.Net Framework 1.1的



第二次使用内部xml调用ReadElementBodyAsXml时代码中断:

< / EGDConfigExtension>

< EGDConfigExtension Company =" http://pdweb.salem.ge.com"

ExtensionCode =" MasterHmiResources" >< HmiResources>

< HmiResource Name =" hgyugyg" />

< / HmiResources>< / EGDConfigExtension>


这是不好的行为,所以我觉得应该发布。也许已经

知道要修复SP1(希望即将推出)。


问候,

Rick


---破解的代码---

private void ReadXml()

{

FileStream fs = File.OpenRead(@" MasterSymbolTable.xml");

XmlTextReader reader = new XmlTextReader(fs,XmlNodeType.Element,null);

reader.MoveToContent();

reader.ReadToDescendant(" EGDConfigExtension");

string xml = ReadElementBodyAsXml(reader);

reader.Read();

xml = ReadElementBodyAsXml(读者);

}


私有字符串ReadElementBodyAsXml(XmlTextReader reader)

{

int startingLineNumber = reader.LineNumber;

int startingLinePosition = reader.LinePosition;

int startingDepth = reader.Depth;

bool startingElementIsEmpty = reader.IsEmptyElement;

string startingN ame = reader.Name;


System.Diagnostics.Debug.Assert(reader.NodeType == XmlNodeType.Element,

"节点类型必须为元素当阅读器位于

元素上时,应调用ReadElementBodyAsXml。,

" ReadElementBodyAsXml。如果不是,它将返回null,但是用于读取元素内容的意图是

。);


char [ ] buffer = new char [512];

int totalRead = 0;

int i;

while((i = reader.ReadChars( buffer,totalRead,buffer.Length -

totalRead))0)

{

totalRead + = i;

if(reader.Depth< = startingDepth)

{

//即使我们读取字符,LineNumber和LinePosition也没有

更改

//除非我们读取一个节点。除非我们在子节点上使用
//否则我们不想再阅读了。但是我们还需要确保在我们开始使用的同一个节点上我们还不是b $ b //因为我们可以有一些非常好的
//大节点。很难判断ReadChars是否返回,因为它确实没有更多内容被缓冲或者是否已经到达节点的末尾。

//如果在节点的结尾,哪个节点?

//此代码修复了SCR 2923.

if(reader.NodeType!= XmlNodeType.Element)

休息; //我们不能在我们开始的节点上。

}

if(reader.NodeType == XmlNodeType.EndElement&& reader.Depth ==

startingDepth)

休息;

if(totalRead == buffer.Length)

{

char [] newBuf = new char [buffer.Length + 512];

Buffer.BlockCopy(buffer,0,newBuf,0,totalRead * 2); //每个字符是

2字节。

buffer = newBuf;

}

}


string innerXml = null;

if(totalRead 0)

innerXml = new string(buffer,0,totalRead);

else

innerXml = null;


返回innerXml;

}


----- XML文件MasterSymbolTable.Xml ---

<?xml version =" 1.0" encoding =" utf-8"?>

<?GeCssClass type =" GeIndsysNetworkCoe.EgdConfig.EgdMasterSymbol Table,

EgdCoeConfig"?>

< MasterEgdSymbolTable EGDSpecVersion =" 3.04" ConfigTimeSecs =" 1160762827"

ConfigTimeNSecs =" 704238500"的xmlns = QUOT; HTTP://geindustrial.com/EGD" Name =" Demo">

< EGDConfigExtension Company =" http://pdweb.salem.ge.com"

ExtensionCode =" MasterAlarms"> ;< AlarmClasses>

< AlarmClass Name =" Alarm" Description =" Process Alarms的默认类"

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"
AlarmBackgroundColor =" Red" AlarmForegroundColor =" White"

AckBackgroundColor =" White" AckForegroundColor = QUOT;红色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" Trip" Description ="转换器行程的默认类别"

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"

AlarmBackgroundColor =" Maroon" AlarmForegroundColor =" White"

AckBackgroundColor =" White" AckForegroundColor = QUOT;栗色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" System" Description =" WorkstationST的默认类

系统警报" DescAlt = QUOT;" NormalBackgroundColor =" White"

NormalForegroundColor =" Black" AlarmBackgroundColor =" Teal"

AlarmForegroundColor =" White" AckBackgroundColor =" White"

AckForegroundColor =" Teal" IsIntrinsic = QUOT;真" NormalSeverity =" 350"

ActiveSeverity =" 500" />

< AlarmClass Name =" Diagnostic" Description =" Process的默认类

Diagnostics" DescAlt = QUOT;" NormalBackgroundColor =" White"

NormalForegroundColor =" Black" AlarmBackgroundColor =" Red"

AlarmForegroundColor =" White" AckBackgroundColor =" White"

AckForegroundColor =" Red" IsIntrinsic = QUOT;真" NormalSeverity =" 350"

ActiveSeverity =" 500" />

< AlarmClass Name =" Hold" Description ="保留的默认类别 DescAlt =""

NormalBackgroundColor =" White" NormalForegroundColor =" Black"
AlarmBackgroundColor ="黄色" AlarmForegroundColor =" Black"

AckBackgroundColor =" Black" AckForegroundColor = QUOT;黄色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" Diag" Description =" Process Diagnostics的默认类"

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"
AlarmBackgroundColor =" Red" AlarmForegroundColor =" White"

AckBackgroundColor =" White" AckForegroundColor = QUOT;红色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" Sys" Description =" WorkstationST系统的默认类

alarm" DescAlt = QUOT;" NormalBackgroundColor =" White"

NormalForegroundColor =" Black" AlarmBackgroundColor =" Teal"

AlarmForegroundColor =" White" AckBackgroundColor =" White"

AckForegroundColor =" Teal" IsIntrinsic = QUOT;真" NormalSeverity =" 350"

ActiveSeverity =" 500" />

< AlarmClass Name =" TEST" Description =" Test Alarm Class" DescAlt =""

NormalBackgroundColor =" White" NormalForegroundColor =" Black"

AlarmBackgroundColor =" Maroon" AlarmForegroundColor =" White"

AckBackgroundColor =" White" AckForegroundColor = QUOT;栗色" NormalSeverity =" 350"

ActiveSeverity =" 500" />

< AlarmClass Name =" OpSet" Description ="操作员设定点的警报等级

事件" DescAlt = QUOT;" NormalBackgroundColor =" White"

NormalForegroundColor =" Black" AlarmBackgroundColor =" Yellow"

AlarmForegroundColor =" Black" AckBackgroundColor =" Black"

ActiveSeverity =" 500" />

< AlarmClass Name =" SOE" Description ="事件序列的默认类别

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"
AlarmBackgroundColor ="黄色" AlarmForegroundColor =" Black"

AckBackgroundColor =" Black" AckForegroundColor = QUOT;黄色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< AlarmClass Name =" Event" Description =" Process Events的默认类"

DescAlt ="" NormalBackgroundColor = QUOT;白色" NormalForegroundColor =" Black"
AlarmBackgroundColor ="黄色" AlarmForegroundColor =" Black"

AckBackgroundColor =" Black" AckForegroundColor = QUOT;黄色" IsIntrinsic =" true"

NormalSeverity =" 350" ActiveSeverity = QUOT; 500" />

< / AlarmClasses>< / EGDConfigExtension>

< EGDConfigExtension Company =" http://pdweb.salem.ge.com"

ExtensionCode =" MasterHmiResources">< HmiResources>

< HmiResource Name =" hgyugyg" />

< / HmiResources>< / EGDConfigExtension>

< EGDConfigExtension Company =" http://pdweb.salem.ge.com"

ExtensionCode =" MasterPlantAreas">< PlantAreas>

< PlantAreaPath Path =" Plant" />

< PlantAreaPath Path =" Plant.PlantArea01" />

< PlantAreaPath Path =" Plant.PlantArea01.PlantArea21" />

< PlantAreaPath Path =" Plant.PlantArea02" />

< PlantAreaPath Path =" Plant.PlantArea04" />

< PlantAreaPath Path =" Plant.PlantArea14" />

< PlantAreaPath Path =" Plant.PlantArea15" />

< / PlantAreas>< / EGDConfigExtension>

< / MasterEgdSymbolTable>
The following code will enter an infinate loop when in ReadChars. I can only
make it happen when reading a Stream and with this particular XML. If I use
the ReadInnerXml call rather than my own ReadElementBodyAsXml the code works,
but is less efficent. ReadElementBodyAsXml is required by my application
with .Net Framework 1.1.

The code breaks on the second call to ReadElementBodyAsXml with the inner xml:
</EGDConfigExtension>
<EGDConfigExtension Company="http://pdweb.salem.ge.com"
ExtensionCode="MasterHmiResources"><HmiResources>
<HmiResource Name="hgyugyg" />
</HmiResources></EGDConfigExtension>
This is bad behavior, so I felt it should be posted. Maybe it is already
know to be fixed in SP1 (hopefully forthcoming).

Regards,
Rick

--- code that breaks ---
private void ReadXml()
{
FileStream fs = File.OpenRead(@"MasterSymbolTable.xml");
XmlTextReader reader = new XmlTextReader(fs, XmlNodeType.Element, null);
reader.MoveToContent();
reader.ReadToDescendant("EGDConfigExtension");
string xml = ReadElementBodyAsXml(reader);
reader.Read();
xml = ReadElementBodyAsXml(reader);
}

private string ReadElementBodyAsXml(XmlTextReader reader)
{
int startingLineNumber = reader.LineNumber;
int startingLinePosition = reader.LinePosition;
int startingDepth = reader.Depth;
bool startingElementIsEmpty = reader.IsEmptyElement;
string startingName = reader.Name;

System.Diagnostics.Debug.Assert(reader.NodeType == XmlNodeType.Element,
"Node type must be Element.",
"ReadElementBodyAsXml should be called when the reader is positioned on
an element. It will simply return null if it is not, but the intention is
for it to be used to read element content.");

char[] buffer = new char[512];
int totalRead = 0;
int i;
while ((i = reader.ReadChars(buffer, totalRead, buffer.Length -
totalRead)) 0)
{
totalRead += i;
if (reader.Depth <= startingDepth)
{
// Even though we read chars, the LineNumber and LinePosition do not
change
// unless we read a node. We don''t want to read any more unless we are
// on a child node. But we also need to make sure that we are not still
// on the same node that we started with, since we could have some very
// big nodes. It is hard to tell if ReadChars returned because it did
// not have any more content buffered or if it got to the end of a node.
// If at the end of a node, which node?
// This code fixes SCR 2923.
if (reader.NodeType != XmlNodeType.Element)
break; // We must not be on the node we started on.
}
if (reader.NodeType == XmlNodeType.EndElement && reader.Depth ==
startingDepth)
break;
if (totalRead == buffer.Length)
{
char[] newBuf = new char[buffer.Length + 512];
Buffer.BlockCopy(buffer, 0, newBuf, 0, totalRead * 2); // Each char is
2 bytes.
buffer = newBuf;
}
}

string innerXml = null;
if (totalRead 0)
innerXml = new string(buffer, 0, totalRead);
else
innerXml = null;

return innerXml;
}

----- XML file MasterSymbolTable.Xml ---
<?xml version="1.0" encoding="utf-8"?>
<?GeCssClass type="GeIndsysNetworkCoe.EgdConfig.EgdMasterSymbol Table,
EgdCoeConfig"?>
<MasterEgdSymbolTable EGDSpecVersion="3.04" ConfigTimeSecs="1160762827"
ConfigTimeNSecs="704238500" xmlns="http://geindustrial.com/EGD" Name="Demo">
<EGDConfigExtension Company="http://pdweb.salem.ge.com"
ExtensionCode="MasterAlarms"><AlarmClasses>
<AlarmClass Name="Alarm" Description="Default Class for Process Alarms"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Red" AlarmForegroundColor="White"
AckBackgroundColor="White" AckForegroundColor="Red" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="Trip" Description="Default Class for Convertor Trips"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Maroon" AlarmForegroundColor="White"
AckBackgroundColor="White" AckForegroundColor="Maroon" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="System" Description="Default Class for WorkstationST
System alarms" DescAlt="" NormalBackgroundColor="White"
NormalForegroundColor="Black" AlarmBackgroundColor="Teal"
AlarmForegroundColor="White" AckBackgroundColor="White"
AckForegroundColor="Teal" IsIntrinsic="true" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="Diagnostic" Description="Default Class for Process
Diagnostics" DescAlt="" NormalBackgroundColor="White"
NormalForegroundColor="Black" AlarmBackgroundColor="Red"
AlarmForegroundColor="White" AckBackgroundColor="White"
AckForegroundColor="Red" IsIntrinsic="true" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="Hold" Description="Default Class for Holds" DescAlt=""
NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Yellow" AlarmForegroundColor="Black"
AckBackgroundColor="Black" AckForegroundColor="Yellow" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="Diag" Description="Default Class for Process Diagnostics"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Red" AlarmForegroundColor="White"
AckBackgroundColor="White" AckForegroundColor="Red" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="Sys" Description="Default Class for WorkstationST System
alarms" DescAlt="" NormalBackgroundColor="White"
NormalForegroundColor="Black" AlarmBackgroundColor="Teal"
AlarmForegroundColor="White" AckBackgroundColor="White"
AckForegroundColor="Teal" IsIntrinsic="true" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="TEST" Description="Test Alarm Class" DescAlt=""
NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Maroon" AlarmForegroundColor="White"
AckBackgroundColor="White" AckForegroundColor="Maroon" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="OpSet" Description="Alarm Class for Operator Setpoint
Events" DescAlt="" NormalBackgroundColor="White"
NormalForegroundColor="Black" AlarmBackgroundColor="Yellow"
AlarmForegroundColor="Black" AckBackgroundColor="Black"
AckForegroundColor="Yellow" IsIntrinsic="true" NormalSeverity="350"
ActiveSeverity="500" />
<AlarmClass Name="SOE" Description="Default Class for Sequence of event"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Yellow" AlarmForegroundColor="Black"
AckBackgroundColor="Black" AckForegroundColor="Yellow" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
<AlarmClass Name="Event" Description="Default Class for Process Events"
DescAlt="" NormalBackgroundColor="White" NormalForegroundColor="Black"
AlarmBackgroundColor="Yellow" AlarmForegroundColor="Black"
AckBackgroundColor="Black" AckForegroundColor="Yellow" IsIntrinsic="true"
NormalSeverity="350" ActiveSeverity="500" />
</AlarmClasses></EGDConfigExtension>
<EGDConfigExtension Company="http://pdweb.salem.ge.com"
ExtensionCode="MasterHmiResources"><HmiResources>
<HmiResource Name="hgyugyg" />
</HmiResources></EGDConfigExtension>
<EGDConfigExtension Company="http://pdweb.salem.ge.com"
ExtensionCode="MasterPlantAreas"><PlantAreas>
<PlantAreaPath Path="Plant" />
<PlantAreaPath Path="Plant.PlantArea01" />
<PlantAreaPath Path="Plant.PlantArea01.PlantArea21" />
<PlantAreaPath Path="Plant.PlantArea02" />
<PlantAreaPath Path="Plant.PlantArea04" />
<PlantAreaPath Path="Plant.PlantArea14" />
<PlantAreaPath Path="Plant.PlantArea15" />
</PlantAreas></EGDConfigExtension>
</MasterEgdSymbolTable>


嗨Rick,


感谢您提供xml文件和代码。根据您的

描述,我在我的机器上安装了两个修补程序,并试图在我的机器上重现它。但是,代码工作正常,我没有得到
infinate循环。我还在代码中设置了一些断点,并检查

LineNumber和LinePosition属性。他们正在推进。


你有没有在另一台机器上试过这个代码?如果它处于一个无限循环中,

线程是否挂起?


Kevin Yu

Microsoft在线社区支持

========================================= =========

通过电子邮件收到我的帖子通知?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。

注意:MSDN托管新闻组支持服务适用于非紧急问题

,可以在1个工作日内收到社区或Microsoft支持工程师的初步回复。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx

======================================== ==========


(此帖子按原样提供,不作任何保证,并且不授予

权利。 )

Hi Rick,

Thanks for providing me with the xml file and the code. According to your
description, I installed the two hotfixes on my machine and tried to
reproduce it on my machine. However, the code works fine and I didn''t get
an infinate loop. I also set some breakpoints in the code and check for the
LineNumber and LinePosition properties. They are advancing properly.

Have you tried this code on another machine? If it is in an infinate loop,
did the thread hang?

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)


嗨Kevin,


是的,这种情况发生在几台电脑上。如果你愿意的话,我可以从windbg获取转储



如果它有所不同,我正在运行Windows窗体中的代码

构造函数。这是VS2005 callstack:

System.Xml.dll!System.Xml.XmlTextReaderImpl.ParseQ Name(bool isQName =

true,int startOffset,out int colonPos = - 1)+ 0x10f字节

System.Xml.dll!System.Xml.XmlTextReaderImpl.Increm entalRead()+ 0x508 bytes

System.Xml.dll!System.Xml。 XmlTextReaderImpl.Increm entalRead(System.Array

数组,int索引,int计数)+ 0x79字节

System.Xml.dll!System.Xml.XmlTextReaderImpl.ReadCh ars( char [] buffer,int

index,int count)+ 0xbc bytes

System.Xml.dll!System.Xml.XmlTextReader.ReadChars(char [] buffer,int

index,int count)+ 0x15 bytes
Hi Kevin,

Yes, this is happening on several PCs. I could get you a dump from windbg
if you want.

If it makes a difference, I''m running the code from a Windows Form in the
constructor. Here is the VS2005 callstack:
System.Xml.dll!System.Xml.XmlTextReaderImpl.ParseQ Name(bool isQName =
true, int startOffset, out int colonPos = -1) + 0x10f bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.Increm entalRead() + 0x508 bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.Increm entalRead(System.Array
array, int index, int count) + 0x79 bytes
System.Xml.dll!System.Xml.XmlTextReaderImpl.ReadCh ars(char[] buffer, int
index, int count) + 0xbc bytes
System.Xml.dll!System.Xml.XmlTextReader.ReadChars( char[] buffer, int
index, int count) + 0x15 bytes

> ReadCharsSample.exe!ReadCharsSample.Form1.ReadElem entBodyAsXml(System.Xml.XmlTextReader reader = {Element,Name =" EGDConfigExtension"})第46行+ 0x15字节C#
> ReadCharsSample.exe!ReadCharsSample.Form1.ReadElem entBodyAsXml(System.Xml.XmlTextReader reader = {Element, Name="EGDConfigExtension"}) Line 46 + 0x15 bytes C#



ReadCharsSample.exe!ReadCharsSample.Form1.ReadXml()第29行+ 0x9字节C#

ReadCharsSample.exe!ReadCharsSample.Form1.Form1()第18行+ 0x7字节C#

ReadCharsSample.exe!ReadCharsSample.Program.Main()第17行+ 0x13字节C#

[本机到托管转换]

[管理到本机转换]

mscorlib.dll!System.AppDomain.ExecuteAssembly(stri ng assemblyFile,

System.Security.Policy.Evidence assemblySecurity,string [] args)+ 0x32 bytes

Microsoft.VisualStudio.HostingProcess.Utilities.dl l!Microsoft.VisualStudio.HostingProcess.HostProc.R unUsersAssembly()+ 0x2b bytes

mscorlib.dll!System.Threading.ThreadHelper.ThreadS tart_Context(对象

状态)+ 0x3b字节


mscorlib.dll!S ystem.Threading.ExecutionContext.Run(System.Threading.ExecutionContext

executionContext,System.Threading.ContextCallback回调,对象状态)+

0x81字节

mscorlib.dll!System.Threading.ThreadHelper.ThreadS tart()+ 0x40 bytes

加载的模块是:


''ReadCharsSample.vshost。 exe''(管理):已加载

''C:\ WINDOWS \assembly\GAC_32 \\\ n \\ n \\ n \\ n \\ n \\ n \\ n \\ n \\ r \\ n \\ logo \ 2.0.0 | 0577a 5c561934e089 \ mscn >
没有加载符号。

''ReadCharsSample.vshost.exe''(已管理):已加载

''C:\ WINDOWS \assembly \\ \\ GAC_MSIL \ Mysrosoft.VisualStud io.HostingProcess.Utilities\8.0.0.0__b03f5f7f11d50 a3a\Microsoft.VisualStudio.HostingProcess.Utilitie s.dll'',已加载符号。

''ReadCharsSample.vshost .exe''(Managed):已加载

''C:\ WINDOWS \assembly\GAC_MSIL \ System.Windows.Forms \\\。 0.0.0__b77a5c561934e089 \ System.Windows.Forms.dl l'',符号已加载。

''ReadCharsSample.vshost.exe''(已管理):已加载

' 'C:\ WINDOWS \assembly\GAC_MSIL \ System \2.0.0.0__b77a 5c561934e089 \System.dll'',

符号已加载。

' 'ReadCharsSample.vshost.exe''(已管理):已加载

''C:\ WINDOWS \assembly\GAC_MSIL \System.Drawing \ 2.0.0.0.03b03f5f7f11d50a3a \系统。 Drawing.dll'',已加载符号。

''ReadCharsSample.vshost.exe''(已管理):已加载

''C:\ WINDOWS \assembly \\ \\ GAC_MSIL \ Microsoft.VisualStud io.HostingProcess.Utilities.Sync\8.0.0.0__b03f5f7f 11d50a3a\Microsoft.VisualStudio.HostingProcess.Uti lities.Sync.dll'',已加载符号。

' 'ReadCharsSample.vshost.exe''(已管理):已加载

''C:\ReadCharsXmlIssue \ReadCharsSample \ bin \Debug \ Re adCharsSample.vshost.exe'',

已加载符号。

''ReadCharsSample.vshost.exe''(已管理):已加载

' 'C:\ WINDOWS \assembly\GAC_32 \System.Data \2.0.0.0__b 77a5c561934e089 \System.Data.dll'',符号已加载。

''ReadCharsSample.vshost .exe''(管理):已加载

''C:\ WINDOWS \assembly\GAC_MSIL \System.Deployment \\\。 0.0.0__b03f5f7f11d50a3a \ System.Deployment.dll'',已加载符号。

''ReadCharsSample.vshost.exe''(已管理):已加载

''C: \ WINDOWS \assembly\GAC_MSIL \ System.Xml \2.0.0.0__ b77a5c561934e089 \System.Xml.dll'',已加载符号。

线程0x60c已退出,代码为0 (0x0)。

线程0x1548已退出,代码为0(0x0)。

SRCSRV:模块

''C:\ ReadCharsXmlIssue\ReadCharsSample\bin\Debug\Re adCharsSample.exe''没有

包含源服务器信息。

''ReadCharsSample.vshost.exe'' (管理):已加载

''C:\ReadCharsXmlIssue \ReadCharsSample\bin\Debug \Re adCharsSample.exe'',符号

已加载。

SRCSRV:模块

''C:\ ReadCharsXmlIssue \ReadCharsSample\bin\Debug \Re adCharsSample.exe''没有

包含n源服务器信息。

''ReadCharsSample.vshost.exe''(管理):已加载

''C:\ WINDOWS \assembly\GAC_MSIL \ System.Configuration \2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dl l'',符号已加载。

SRCSRV:模块

''C:\ReadCharsXmlIssue \ ReadCharsSample\bin\Debug\Re adCharsSample.exe''没有

包含源服务器信息。

SRCSRV:模块

''C:\ ReadCharsXmlIssue \ReadCharsSample\bin\Debug \Re adCharsSample.exe''没有

包含源服务器信息。

SRCSRV :模块

''C:\ReadCharsXmlIssue \ReadCharsSample\bin\Debug \Re adCharsSample.exe''没有

包含源服务器信息。


-

Rick

" Kevin Yu [MSFT]"写道:

ReadCharsSample.exe!ReadCharsSample.Form1.ReadXml( ) Line 29 + 0x9 bytes C#
ReadCharsSample.exe!ReadCharsSample.Form1.Form1() Line 18 + 0x7 bytes C#
ReadCharsSample.exe!ReadCharsSample.Program.Main() Line 17 + 0x13 bytes C#
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.AppDomain.ExecuteAssembly(stri ng assemblyFile,
System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x32 bytes

Microsoft.VisualStudio.HostingProcess.Utilities.dl l!Microsoft.VisualStudio.HostingProcess.HostProc.R unUsersAssembly() + 0x2b bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadS tart_Context(object
state) + 0x3b bytes

mscorlib.dll!System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext
executionContext, System.Threading.ContextCallback callback, object state) +
0x81 bytes
mscorlib.dll!System.Threading.ThreadHelper.ThreadS tart() + 0x40 bytes
The loaded modules are:

''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a 5c561934e089\mscorlib.dll'',
No symbols loaded.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStud io.HostingProcess.Utilities\8.0.0.0__b03f5f7f11d50 a3a\Microsoft.VisualStudio.HostingProcess.Utilitie s.dll'', Symbols loaded.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms \2.0.0.0__b77a5c561934e089\System.Windows.Forms.dl l'', Symbols loaded.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a 5c561934e089\System.dll'',
Symbols loaded.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0 .0__b03f5f7f11d50a3a\System.Drawing.dll'', Symbols loaded.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStud io.HostingProcess.Utilities.Sync\8.0.0.0__b03f5f7f 11d50a3a\Microsoft.VisualStudio.HostingProcess.Uti lities.Sync.dll'', Symbols loaded.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\ReadCharsXmlIssue\ReadCharsSample\bin\Debug\Re adCharsSample.vshost.exe'',
Symbols loaded.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b 77a5c561934e089\System.Data.dll'', Symbols loaded.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_MSIL\System.Deployment\2. 0.0.0__b03f5f7f11d50a3a\System.Deployment.dll'', Symbols loaded.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__ b77a5c561934e089\System.Xml.dll'', Symbols loaded.
The thread 0x60c has exited with code 0 (0x0).
The thread 0x1548 has exited with code 0 (0x0).
SRCSRV: The module
''C:\ReadCharsXmlIssue\ReadCharsSample\bin\Debug\Re adCharsSample.exe'' does not
contain source server information.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\ReadCharsXmlIssue\ReadCharsSample\bin\Debug\Re adCharsSample.exe'', Symbols
loaded.
SRCSRV: The module
''C:\ReadCharsXmlIssue\ReadCharsSample\bin\Debug\Re adCharsSample.exe'' does not
contain source server information.
''ReadCharsSample.vshost.exe'' (Managed): Loaded
''C:\WINDOWS\assembly\GAC_MSIL\System.Configuration \2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dl l'', Symbols loaded.
SRCSRV: The module
''C:\ReadCharsXmlIssue\ReadCharsSample\bin\Debug\Re adCharsSample.exe'' does not
contain source server information.
SRCSRV: The module
''C:\ReadCharsXmlIssue\ReadCharsSample\bin\Debug\Re adCharsSample.exe'' does not
contain source server information.
SRCSRV: The module
''C:\ReadCharsXmlIssue\ReadCharsSample\bin\Debug\Re adCharsSample.exe'' does not
contain source server information.

--
Rick
"Kevin Yu [MSFT]" wrote:


嗨瑞克,


感谢您提供xml文件和代码。根据您的

描述,我在我的机器上安装了两个修补程序,并试图在我的机器上重现它。但是,代码工作正常,我没有得到
infinate循环。我还在代码中设置了一些断点,并检查

LineNumber和LinePosition属性。他们正在推进。


你有没有在另一台机器上试过这个代码?如果它处于一个无限循环中,

线程是否挂起?


Kevin Yu

Microsoft在线社区支持

========================================= =========

Get notification to my posts through email?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。

注意:MSDN托管新闻组支持服务适用于非紧急问题

,可以在1个工作日内收到社区或Microsoft支持工程师的初步回复。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。 Issues of this nature are best

handled working with a dedicated Microsoft Support Engineer by contacting

Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================


(This posting is provided "AS IS", with no warranties, and confers no

rights.)

Hi Rick,

Thanks for providing me with the xml file and the code. According to your
description, I installed the two hotfixes on my machine and tried to
reproduce it on my machine. However, the code works fine and I didn''t get
an infinate loop. I also set some breakpoints in the code and check for the
LineNumber and LinePosition properties. They are advancing properly.

Have you tried this code on another machine? If it is in an infinate loop,
did the thread hang?

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)


这篇关于读取st时,XmlTextReader ReadChars可以进入infinate循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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