Wednesday, 28 August 2013

Mono Linq to XML throwing SIGSEGV

Mono Linq to XML throwing SIGSEGV

I have been banging my head against the wall on this one and I'm hoping
that somebody can be kind enough give some advice about what might be
going wrong with the code below.
I've got a project that I'm developing with Mono 3.0.7 in MonoDevelop
4.0.9 on Linux and the project is targeting .NET 3.5.
I need to process an XML file so I want to use Linq to XML to make it
easier to work with the XML file. I'm not having any problems generating
the XML and writing it out to a file. However, when I try to read things
from the file, Mono is crashing with a SIGSEGV error.
For example, I'd like to try something like this:
//Load the document
XDocument indexFile = XDocument.Load(indexFilePath);
foreach (XElement acctElement in indexFile.Descendants("Account"))
{
AcctCls acct = new AcctCls(acctElement.Attribute("AcctID").Value);
AcctsList.Add(acct);
foreach (XElement regionElement in acctElement.Descendants("Region"))
{
RegionCls region = new
RegionCls(regionElement.Attribute("Region").Value);
acct.RegionsList.Add(region);
}
}
I have tried running this with the .NET Framework and it seems to run
fine. However, when I run this with Mono, I get the following error
message:
Stacktrace:
at <unknown> <0xffffffff>
...My own libraries...
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
Native stacktrace:
/usr/bin/mono() [0x4ae331]
/usr/bin/mono() [0x503b8b]
/usr/bin/mono() [0x4226b2]
/usr/lib/libpthread.so.0(+0xf830) [0x7f4f68629830]
/usr/bin/mono() [0x4d00d9]
/usr/bin/mono() [0x4d5049]
/usr/bin/mono() [0x4d5741]
/usr/bin/mono() [0x4d583f]
/usr/bin/mono() [0x4d67b5]
/usr/bin/mono() [0x4d75fc]
/usr/bin/mono() [0x4caeea]
/usr/bin/mono() [0x4cb03e]
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
I even get the same error when I do something as simple as this:
IEnumerable acctsList = indexFile.Descendants("Account");
foreach(XElement acctElmnt in acctsList)
{
string test = acctElmnt.Attribute("AcctID").Value;
}
I've tried putting the XMLReader in a using statement and passing that
XMLReader to the XDocument.Load method but that doesn't help either. I
don't know if this is relevant or not, but this is happening while I'm
debugging the code and stepping through it.
I've been Googling for a few hours now and racking my brains trying
everything, but I can't figure out how to get this to work. The Mono
website says that it supports all of Linq to XML and other people on
various forums and sites that I'm reading seem to have this working fine
so I'm wondering what it is that I'm missing. Can anybody help?

No comments:

Post a Comment