473,699 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlException message disappears.

In a property i do this:
....
catch(XmlExcept ion e)
{
throw new XmlException("E rror processing configuration file!",e);
}

Then I catch it in another class:
catch(XmlExcept ion e)
{
MessageBox.Show (e.Message + e.InnerExceptio n.Message);
}

With the debugger I see that "Error processing configuration file!" is not
in Message property but in a private field called "args".
Why?
How can I obtain "Error processing configuration file!" being in e.Message
or how can I retrieve args content?
Apr 18 '07 #1
1 2158
Blue,

I'm not sure why this is happening to you; however, this:

using System.Xml;

class Program
{
static void Main(string[] args)
{
Class1 c1 = new Class1();
c1.DoIt();

Console.WriteLi ne("Hit enter to exit");
Console.ReadLin e();
}
}

public class Class1
{
public void DoIt()
{
try
{
Class2 c2 = new Class2();
c2.OneProperty = 0;
}
catch (XmlException e)
{
Console.WriteLi ne(e.Message + e.InnerExceptio n.Message);
}
}
}

public class Class2
{
private int _oneValue = 0;

public int OneProperty
{
get { return _oneValue; }
set
{
try
{
if (value 1)
_oneValue = 1;
else throw new XmlException("O riginal message");
}
catch(XmlExcept ion e)
{
throw new XmlException("E rror processing configuration file!",
e);
}
}
}
}

produces the text:
Error processing configuration file!Original message
Dave
Apr 19 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1206
by: George CK | last post by:
Hello, I tried to send an xml string got from XmlTextReader from a web service proxy to a web service. The type of the web method is simply "string" It's fine when the string length was small enough (probably < 1024), but when I send a longer one, I got an XmlException Exception on my client side.
3
22352
by: Todd | last post by:
Our ASP.NET (C#) application accepts form entry and saves inputed data in XML. We are finding that users are sometimes cutting and pasting special characters (from MS Word) into these forms. The data is saved successfuly, but when the XML is later read the following error is encountered depending on the invalid character found: This is a sample:
1
2638
by: George W. | last post by:
When attempting to validate an XML file, If the file is valid, it validates correctly, and it will catch most ValidationEvents without problem. However, I keep getting the following Exception: System.Xml.XmlException: The 'RDaaaa' start tag on line '4' doesn't match the end tag of 'RD' in file 'file:///C:/Work/WIMAR XML/WI_M_1.xml'. Line 4, position 475. at System.Xml.XmlTextReader.ParseTag() at...
1
1847
by: edi | last post by:
Hi, I have MS .Net Framework v1.1.4322. I have this XML file: <?xml version="1.0" ?> <!--here there are two spaces at the beginning--> <aaa> <a id="1"> <Dept>Finance</Dept>
1
1799
by: news.microsoft.com | last post by:
I am using the XmlReader to look at some xml data fragments. Many times the xml fragment is not readable by the XmlReader, since it isn't valid. For example, I may be looking at only the text </MyXmlNode>. If I try to read this, I get an exception because it is a closing node with no opening node. My problem is that there is no way for me to know what the exception is. The only exception that is thrown is "XmlException" which does not...
0
3338
by: Frederico Guimar?es via DotNetMonster.com | last post by:
Hi, I'm trying to use the Microsoft.Web.Services2.Messaging. ISoapFormatter but I receive this error: System.Xml.XmlException: The root element is missing. at System.Xml.XmlTextReader.Read() at Microsoft.Web.Services2.Xml.XmlSkipDTDReader.Read() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
1
2334
by: mohit | last post by:
Hi, I am making a web application in Web Matrix on .NET framework. I have a Login.aspx File and a Users.xml file.I am reading data from Users.xml file using FileStream.The Code is DataSet ds = new DataSet ( ); FileStream fs = new FileStream ( Server.MapPath ( "Users.xml" ),
1
5755
by: Tomas | last post by:
When I try to load my xslt i get an xml exception with the message "Root element is missing". The stylesheet works when I preview it in stylus studio, but apparently not in my application. Any ideas what may be wrong? The stylesheet: <?xml version="1.0" encoding="utf-8"?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output indent="yes"/>
3
3531
by: =?Utf-8?B?RWQgS3JhbWVy?= | last post by:
I thought this might be useful for someone... I was doing a little work earlier using an Xmldocument class to create & maintain a minor store of data in Xml format. I'd gotten the whole thing up and going and I decided to start testing 'disaster' scenarios. For example, you start up but your file has been deleted, or you try to save and the file is read only. Or you lack write permissions. Or you try to load
0
8686
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9173
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8911
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7748
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.