Geeks With Blogs
Stefan Barrett blog

Currently working on a data transformation engine (yes I know you can buy things like this, but it takes less time to write it than to get the company to buy it), which involves a lot of xml. First step is to create the schema descriping the transformation which I do in VS2005. Got VS2005 to crash once (just closed down) while editing a complicated bit of schema, but unable to replicate for now. When I restarted it, it did give me a choice of recovering the schema file, but it was a 5 hour old one, however luckely I had saved everything less then 10 minutes beforehand.
Then it's a case of running xsd.exe over the file to generate the class files, using a DOS prompt (through I notice there's a custom tool property to look at later).
I then make good use of the fact that all the classes generated are partial classes, and since I'm also using inheritance (definied through the xml itself) this is getting to be quite powerful.
I then go into a different solution where I'm writing the actual xml and MDI application. I start it up, and it crashes. I look at the stack trace and notice that while I see the start of the stack trace, and the end, there's a section in the middle which I can't see. And it's were the xml generated classes would be. Of course I don't want to look at them, but since they have been extended (via partial classes), there is code I want to see there. It took me a little while to realise that VS2005 was hiding them because the 'Enable just my Code' option was checked (Tools/Options/Debugging/General). Because they were defined in another assembly, they were helpfully hidden by VS.
Ok, so I turn the option off, so I can see my code, except that I still can't see it. It turns out all the auto-generated code had a attribute on it which told VS not to show it. Which I'm sure is very usefull when using fully auto-generated code, but is a real pain if you have extended the classes via partial classes.

Posted on Friday, April 28, 2006 4:24 AM VS2005 | Back to top

Comments on this post: Having fun with VS2005, XML and partial classes.

Comments are closed.
Comments have been closed on this topic.
Copyright © Stefan Barrett | Powered by: