obsolete code

  • Thread starter Thread starter Vincent
  • Start date Start date
V

Vincent

Hi, I have this code that the framework tells me that is obsolete(underlined), but I don't know how to replace it.
Can any1 help?

private void CreateIssuePage()

{

// This code created the HTML page displayed in the

// browser window

// Create the writer and serializer to save to disk

StreamWriter sw = new StreamWriter(System.Windows.Forms.Application.StartupPath + @"\Policy.xml");

XmlSerializer ser = new XmlSerializer(policy.GetType());

ser.Serialize(sw, policy);

sw.Close();

try

{// Transform the XML

XPathDocument xpd = new XPathDocument(System.Windows.Forms.Application.StartupPath + @"\Policy.xml");

XslTransform xslTrans = new XslTransform();


XsltArgumentList xsltArgList = new XsltArgumentList();

XmlTextWriter xtw = new XmlTextWriter(System.Windows.Forms.Application.StartupPath + @"\Policy.htm", null);

xslTrans.Load(System.Windows.Forms.Application.StartupPath + @"\Policy.xsl");

DateParser parser = new DateParser();

xsltArgList.AddExtensionObject("urn:DateParser", parser);

// This code has the obsolete attribute, will work with 1.0 and 1.1 FCL

xslTrans.Transform(xpd, xsltArgList, xtw);

xtw.Close();

}

catch(Exception exception)

{

ExceptionManager.Publish(exception);

}

// Load the newly created HTML file into the browser control

wb.Navigate("file://" + System.Windows.Forms.Application.StartupPath + @"/Policy.htm");

}
 
I assume you are using the 2.0 framework, since you are getting type
obsoletions. In the 2.0 framework, XslTransform has been obsoleted in favor
of the XslCompiledTransform class(as of beta 2 I think, if you are using a
previous beta I believe it was...XslProcessor or XslCommand or something...)

XsltArgumentList isn't obsoleted as best I can tell.

Also note that the error message that the compiler spits out should tell you
what action you should take to replace it.


Hi, I have this code that the framework tells me that is
obsolete(underlined), but I don't know how to replace it.
Can any1 help?

private void CreateIssuePage()
{
// This code created the HTML page displayed in the
// browser window
// Create the writer and serializer to save to disk
StreamWriter sw = new
StreamWriter(System.Windows.Forms.Application.StartupPath + @"\Policy.xml");
XmlSerializer ser = new XmlSerializer(policy.GetType());
ser.Serialize(sw, policy);
sw.Close();
try
{// Transform the XML
XPathDocument xpd = new
XPathDocument(System.Windows.Forms.Application.StartupPath +
@"\Policy.xml");
XslTransform xslTrans = new XslTransform();
XsltArgumentList xsltArgList = new XsltArgumentList();
XmlTextWriter xtw = new
XmlTextWriter(System.Windows.Forms.Application.StartupPath + @"\Policy.htm",
null);
xslTrans.Load(System.Windows.Forms.Application.StartupPath +
@"\Policy.xsl");
DateParser parser = new DateParser();
xsltArgList.AddExtensionObject("urn:DateParser", parser);
// This code has the obsolete attribute, will work with 1.0 and 1.1 FCL
xslTrans.Transform(xpd, xsltArgList, xtw);
xtw.Close();
}
catch(Exception exception)
{
ExceptionManager.Publish(exception);
}
// Load the newly created HTML file into the browser control
wb.Navigate("file://" + System.Windows.Forms.Application.StartupPath +
@"/Policy.htm");
}
 
Actually the messages that were shipping with the decemmber ctp were
extremely unhelpful merely pointing to a place to download a massive IE
document which barely explained what was outdated and what it was
replaced with if you google for the error messags there is 1 or 2
helpful blog posts that shed some light. I would post some sample code
but I do not heave readily immediate access to it and I am not sure
whether the stuff that I use accept XsltArgumentLists
 
Actually the messages that were shipping with the decemmber ctp were
extremely unhelpful merely pointing to a place to download a massive IE
document which barely explained what was outdated and what it was
replaced with if you google for the error messags there is 1 or 2
helpful blog posts that shed some light. I would post some sample code
but I do not heave readily immediate access to it and I am not sure
whether the stuff that I use accept XsltArgumentLists


Hmm...I seem to recall better error messages in the december CTP(atleast as
far as the compiler and exceptions went), but alas I no longer have it
installed and cannot check. This is not one I personally ran into, so that
may be why I can't recall there being a bad error message. Have you
determined if the fault lies with the compiler not emitting the information
in the obsolete attribute properly or the framework not having the correct
information stored?

Regardless, the Feb CTP ObsoleteAttribute on XslTransform has the error
message quite clearly defined, redirecting you to XslCompiledTransform
class. Hopefully all other instances of bad obsolecence messages have been
repaired.
 
Yes, I finally saw the Feb CTP up there last night. I will have to try
to make some time this weekend to reformat my test box and put it on
there.
 
Yes, I finally saw the Feb CTP up there last night. I will have to try
to make some time this weekend to reformat my test box and put it on
there.

Ya, I just went through the whole reinstall process a couple days ago. VS
Feb CTP, SQL Server Feb CTP, and the WinFX March CTP.

Things look good in all of them, however.
 
Did they finally sync up the WinFX SDK up with the right .NET Framework
and VS.NET?
I was trying to look at that this december and the vs.net and .net
framework and the one winfx required did not match up.
 
Did they finally sync up the WinFX SDK up with the right .NET Framework
and VS.NET?
I was trying to look at that this december and the vs.net and .net
framework and the one winfx required did not match up.

The new CTP is linked with the Feburary CTP of VS.NET and the framework. It
is not supposed to work with any other version, including beta 2 of VS when
it is released(whenever that will be)
 
Back
Top