Implementation and performance of xsd.exe? RRS feed

  • Question

  • Hello, 

    Is here any one who work on xsd.exe code?

    I do get "Circular reference" error on standard schema definition and try to find where is a problem.

    SchemaSet is for 3 schemas:

    - CSDL Schema v3.0.xsd

    - System.Data.Resources.AnnotationSchema.xsd

    - System.Data.Resources.CodeGenerationSchema.xsd

    and give "Circular reference" on compilation.

    The same schemas compiled with deprecated XmlSchema.Compile() - didn't give any trouble.

    I review a decompiled code... xmmm... I would be fired at once if I provide something similar as solution.

    Additional review show that some parts can be implemented to work  up to 6x faster.

    Is there any interest to review code and resolve problems in xsd.exe?

    Sincerely, Highly skilled coding monkey.

    Monday, March 25, 2019 11:14 AM

All replies

  • Hi Andrey,

    I doubt that you'll get any answer here on the forum directly from Microsoft.

    Microsoft dismantled its XML team years ago.

    I don't have access to the xsd.exe source code.

    Though I can check validity of the 3 *.xsd files you mentioned.

    Monday, March 25, 2019 2:30 PM
  • I don't have access to the xsd.exe source code.

    Code is not a problem - 105K for v2.* and 104K for v4.7* - can be obtained from any decompiler. I use Just Decompile from Telerick.

    Problem is that the code is a nightmare - everything are mixed together as static methods and almost impossible to find what they trying to do by each piece of code. :(

    3 simple operation:

    - find required schemas

    - build required parts from schemas

    - generate relevant code

    Each have unresolvable problem(s)...


    internal static void AddImports(CodeNamespace codeNamespace, string[] namespaces)
                string[] strArrays = namespaces;
                for (int i = 0; i < (int)strArrays.Length; i++)
                    string str = strArrays[i];
                    codeNamespace.Imports.Add(new CodeNamespaceImport(str));
            internal static string[] GetNamespacesForTypes(Type[] types)
                Hashtable hashtables = new Hashtable();
                for (int i = 0; i < (int)types.Length; i++)
                    string fullName = types[i].FullName;
                    int num = fullName.LastIndexOf('.');
                    if (num > 0)
                        hashtables[fullName.Substring(0, num)] = types;
                string[] strArrays = new string[hashtables.Keys.Count];
                hashtables.Keys.CopyTo(strArrays, 0);
                return strArrays;

    Why use Hashtable instead HashSet?

    Why parse each typename instead using provided Namespace and filter null's late?

    Didn't work with IEnumerable source - require only CodeNamespaceImport[]...

    Plus - errors. "Circular reference" in place where it not supposed to be - microsoft specification and microsoft tool... incompatible... nightmare...

    Sincerely, Highly skilled coding monkey.

    Monday, March 25, 2019 4:02 PM