473,499 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with xsd codegen after installing .net framework srvice pa

I followed the excellent MSDN article "Code Generation in the .NET Framework
Using XML Schema" [1] to build a substitute for the limited xsd.exe. My code
works fine under .NET framework 1.1, but after installing .net framework
service pack 1, my code breaks.

Below are trivial example files that demonstrate the problem:

XSD FILE aaa.xsd
----------------------
<?xml version="1.0" encoding="UTF-8"?>

<schema targetNamespace="urn:ietf:params:xml:ns:aaa"
xmlns:aaa="urn:ietf:params:xml:ns:aaa"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">

<complexType name="aaa">
</complexType>

</schema>

XSD FILE bbb.xsd
----------------------
<?xml version="1.0" encoding="UTF-8"?>

<schema targetNamespace="urn:ietf:params:xml:ns:bbb"
xmlns:bbb="urn:ietf:params:xml:ns:bbb"
xmlns:aaa="urn:ietf:params:xml:ns:aaa"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">

<import namespace="urn:ietf:params:xml:ns:aaa"
schemaLocation="aaa.xsd"/>

<element name="test"/>

</schema>
And here is the code which I use to process the above schema files (taken
almost line for line from the MSDN article mentioned above [1], but with the
addition of the ability to read multiple xsd files):

xsdCodeGen.cs
----------------------
string[] xsdFiles = { "aaa.xsd", "bbb.xsd" };
XmlSchemas schemas = new XmlSchemas();

// Load the XmlSchema and its collection
foreach(string filename in xsdFiles)
{
XmlSchema xsd;
using(FileStream fs = new FileStream(filename, FileMode.Open,
FileAccess.Read))
{
xsd = XmlSchema.Read(fs, null);
xsd.Compile(null);
}
schemas.Add(xsd);
}

// Create the importer for these schemas
XmlSchemaImporter importer = new XmlSchemaImporter(schemas);

// System.CodeDom namespace for the XmlCodeExporter to put classes in
CodeNamespace ns = new CodeNamespace("testNamespace");
XmlCodeExporter exporter = new XmlCodeExporter(ns);

// Iterate schema top-level elements and export code for each
foreach(XmlSchema xsd in schemas)
{
foreach (XmlSchemaElement element in xsd.Elements.Values)
{
// Import the mapping, and export the code
XmlTypeMapping mapping = importer.ImportTypeMapping(element.QualifiedName);
exporter.ExportTypeMapping(mapping);
}
}
The above code works fine pre- service pack, but post- service pack the line:

XmlTypeMapping mapping = importer.ImportTypeMapping(element.QualifiedName);

will throw the following exception:

Exception: The datatype 'urn:ietf:params:xml:ns:bbb:aaa' is missing.
Any ideas why the different behaviour pre- and post- service pack, and how
to fix?

Many thanks in advance,

Ceri Williams

[1]
http://msdn.microsoft.com/XML/Buildi...xsdcodegen.asp
Nov 12 '05 #1
11 3354
Hi Ceri,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have .net framework installed
ImportTypeMapping throws an exception which says a datatype is missing. If
there is any misunderstanding, please feel free to let me know.

Thanks for providing me with the code you're using. I have tried it on my
machine, which I have .net framework 1.1 sp1 installed on it already.
However, I could not reproduce it. It works fine on my computer without any
exceptions. Could you try this code on another computer to see if it works?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #2
Hi Kevin,

Just to confirm:

I built a machine from scratch, Windows XP Professional, Visual Studio .NET
2003, .NET framework 1.1. Compiling and running the code sample I gave
earlier, everything works fine.

I then install the .NET framework 1.1 Service Pack 1 [1]. I rebuild the
code, compiles fine, but this time I get the runtime exception:
"The datatype 'urn:ietf:params:xml:ns:bbb:aaa' is missing."

I've done nothing else interesting to that machine, not installed anything
else, I set it up purely to test my example code.

Cheers,
Ceri

[1] http://msdn.microsoft.com/netframewo...s/default.aspx
"Kevin Yu [MSFT]" wrote:
Hi Ceri,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have .net framework installed
ImportTypeMapping throws an exception which says a datatype is missing. If
there is any misunderstanding, please feel free to let me know.

Thanks for providing me with the code you're using. I have tried it on my
machine, which I have .net framework 1.1 sp1 installed on it already.
However, I could not reproduce it. It works fine on my computer without any
exceptions. Could you try this code on another computer to see if it works?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #3
Hi Ceri,

Thanks for your comfirming. To avoid carelessness, I tried it again. I set
up a new computer and followed the steps you have provided. And then tried
with the code in your first post. However, I didn't reproduced it either
this time.

Here I have attached a zip file with a compiled exe file inside. Please try
to run it to see if the Form can be displayed without any exception.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #4
Hi Kevin,

Thanks for looking into this for me, much appreciated. Unfortunately I get
the same exception when I run your test app:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidOperationException: The datatype
'urn:ietf:params:xml:ns:bbb:aaa' is missing.
at
System.Xml.Serialization.XmlSchemaImporter.FindDat aType(XmlQualifiedName name)
at System.Xml.Serialization.XmlSchemaImporter.FindTyp e(XmlQualifiedName
name)
at System.Xml.Serialization.XmlSchemaImporter.ImportT ype(XmlQualifiedName
name, Type desiredMappingType, Type baseType)
at
System.Xml.Serialization.XmlSchemaImporter.ImportD erivedTypes(XmlQualifiedName baseName)
at
System.Xml.Serialization.XmlSchemaImporter.ImportE lementType(XmlSchemaElement
element, String identifier, Type desiredMappingType, Type baseType, String ns)
at
System.Xml.Serialization.XmlSchemaImporter.ImportE lement(XmlSchemaElement
element, String identifier, Type desiredMappingType, Type baseType, String
ns, Boolean topLevelElement)
at
System.Xml.Serialization.XmlSchemaImporter.ImportE lement(XmlQualifiedName
name, Type desiredMappingType, Type baseType)
at
System.Xml.Serialization.XmlSchemaImporter.ImportD erivedTypeMapping(XmlQualifiedName name, Type baseType, Boolean baseTypeCanBeIndirect)
at
System.Xml.Serialization.XmlSchemaImporter.ImportT ypeMapping(XmlQualifiedName
name)
at WindowsApplication2.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
WindowsApplication2
Assembly Version: 1.0.1734.28382
Win32 Version: 1.0.1734.28382
CodeBase:
file:///E:/Poptel/XSD%20Code%20Gen%20SP1%20Fix/Test%20App%20from%20Kevin%20Yu/WindowsApplication2.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase:
file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
Just to be clear, what steps did you follow when building your test machine?
Did you install the .NET framework (pre-patch) seperately, or did you just
work with the framework as installed by Visual Studio .NET 2003?
Let me know exactly what stages you carried out and I'll re-create it on a
fresh test machine, just to be sure we're following exactly the same steps.

Cheers,
Ceri
"Kevin Yu [MSFT]" wrote:
Hi Ceri,

Thanks for your comfirming. To avoid carelessness, I tried it again. I set
up a new computer and followed the steps you have provided. And then tried
with the code in your first post. However, I didn't reproduced it either
this time.

Here I have attached a zip file with a compiled exe file inside. Please try
to run it to see if the Form can be displayed without any exception.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #5
I just wanted to chime in and say that I am having the exact same problem.
I extended the same code sample and it has been working fine for months. I
installed sp1 an I get the same error.

I have tested it on another machine that also ran the SP with the same
results. But the code still run fine on a machine that does not have SP1.

Any help would be greatly appreciated since we rely heavily on this tool.

Thanks,
Mark
"Kevin Yu [MSFT]" wrote:
Hi Ceri,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you have .net framework installed
ImportTypeMapping throws an exception which says a datatype is missing. If
there is any misunderstanding, please feel free to let me know.

Thanks for providing me with the code you're using. I have tried it on my
machine, which I have .net framework 1.1 sp1 installed on it already.
However, I could not reproduce it. It works fine on my computer without any
exceptions. Could you try this code on another computer to see if it works?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #6
Hi Ceri,

I am working with the .net framework installed by Visual Studio .NET 2003.
I think the two packs are all the same with the version v1.1.4322.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #7
Hi Ceri,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #8
Hi Kevin,

Thanks again for helping look into this. Unfortunately the problem is still
occurring - I have tried again to build a machine from scratch using the
steps described in my previous post, and I still get the same problems. It
was interesting to see the other post from Mark Andrews, which suggests it
probably isn't a problem unique to my operating environment.

Since you have been unable to repeat the problem in your environment, what
do you think is the best way to proceed? Can I suggest I re-build my test
machine using Virtual PC, then send you the Virtual PC image on the machine
so you can mess around with it?

Let me know if you think this is a good idea,

Cheers,
Ceri
"Kevin Yu [MSFT]" wrote:
Hi Ceri,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #9
Hi Ceri,

Looking at the nature of this issue, it would require intensive
troubleshooting which would be done quickly and effectively with direct
assistance from a Microsoft Support Professional through Microsoft Product
Support Services. You can contact Microsoft Product Support directly to
discuss additional support options you may have available, by contacting us
at 1-(800)936-5800 or by choosing one of the options listed at
http://support.microsoft.com/default...d=sz;en-us;top. If this is not
an urgent issue and your would like us to create an incident for you and
have Microsoft Customer Service Representative contact you directly, please
send email to (remove "online." from this no Spam email address):
mailto:ds******@online.microsoft.com with the following information,

*Include "Followup: <Tomcat IssueID>" in the email Subject.
*Location of the post
*Subject Line
*First Name, Last Name
*MSDN Subscriber ID
*Company name (if any)
*Phone number
*e-mail address

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #10
Hi Kevin,

Thanks for your help with this. I have opened a technical support incident
now with Microsoft, hopefully get the problem fixed via that route.

Cheers,
Ceri
"Kevin Yu [MSFT]" wrote:
Hi Ceri,

Looking at the nature of this issue, it would require intensive
troubleshooting which would be done quickly and effectively with direct
assistance from a Microsoft Support Professional through Microsoft Product
Support Services. You can contact Microsoft Product Support directly to
discuss additional support options you may have available, by contacting us
at 1-(800)936-5800 or by choosing one of the options listed at
http://support.microsoft.com/default...d=sz;en-us;top. If this is not
an urgent issue and your would like us to create an incident for you and
have Microsoft Customer Service Representative contact you directly, please
send email to (remove "online." from this no Spam email address):
mailto:ds******@online.microsoft.com with the following information,

*Include "Followup: <Tomcat IssueID>" in the email Subject.
*Location of the post
*Subject Line
*First Name, Last Name
*MSDN Subscriber ID
*Company name (if any)
*Phone number
*e-mail address

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #11
You're welcome, Ceri.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #12

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

Similar topics

7
2813
by: Alex Ting | last post by:
Hi Everybody, I've upgraded the dot net framework from 1.0 to 1.1 onto the server and everything seemed fine when it comes to sending attachments etc . However just recently all emails that has...
2
3019
by: feman | last post by:
I'm trying to install the dotnet framework 1.1 on a Windows 2000 Pro, SP 4 box. I've downloaded dotnetfx.exe and am installing from c:\temp. This is the error message that I get: Error 1606....
1
1028
by: santhosh_176 | last post by:
:I Created a Pocket PC application for iPAQ 5450. Every thing went fine even installer creation. I could run the setup and install it into the actual device and worked fine. The application enables...
3
4835
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be...
1
1906
by: AspDotNetDeveloper | last post by:
Hello, I have Windows 2003 Server with .Net Framework 1.1 installed (part of the OS), and have used Windows Update to install the Service Pack 2 (the only way you can install it). The install...
11
1513
by: Magdelin | last post by:
Hi, I accidently uninstalled IIS 5.1 on my XP Pro workstation and I think I messed up my .Net framework. Then, I reinstalled IIS and ran aspnet_regiis -i. After this, all asp.net applications...
3
2324
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
3
4684
by: shreya | last post by:
While generating client jar files from ant command using build.xml I am getting following error generate-client: Generating client jar for click2pstn.wsdl ... ...
3
6325
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi all! I am having problems on installing .NET Framework 3.5 on some machines. In one machine the error is: '.NET Framework 3.5' RunCheck result: Install Needed Verifying file integrity of...
0
7128
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,...
0
7006
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7169
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,...
0
7215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5467
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,...
0
3096
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...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1425
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 ...
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.