XmlTextWriter function that used to work isn't on new system

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have this piece of code I am using to save settings in my app. A check is done when the program is loading to see if the settings file exists and if not it writes default values and tries to save them using the following code. Ive used
this exact code before without problems in a couple apps in an older version of C# Express on an XP 32 bit system. Now when executing the underlined line, it jumps to displaying the main form and skips the rest of the initialization code without signaling
any kind of error. New system is Windows 7 64 bit using C# Express 2010 SP1. Tried disabling antivirus. Anyone have any ideas on a fix?
public void Save_Settings()<br/>
{<br/>
XmlSerializer serializer = new XmlSerializer(typeof(LTSettings)); // Formats data.<br/>
<span style="text-decoration:underline XmlTextWriter writer = new XmlTextWriter(SETTINGS_FILE, null); // Writes file.<br/>
try<br/>
{<br/>
serializer.Serialize(writer, this);<br/>
}<br/>
finally<br/>
{<br/>
writer.Close();<br/>
}<br/>
}

View the full article
 
Back
Top