Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

speeding up a massive wsdl #3002

Closed
ctaggart opened this issue Jul 6, 2018 · 11 comments
Closed

speeding up a massive wsdl #3002

ctaggart opened this issue Jul 6, 2018 · 11 comments
Assignees
Labels
tooling An issues related to any tool shipped from this repo.

Comments

@ctaggart
Copy link

ctaggart commented Jul 6, 2018

When I use dotnet svcutil on https://github.com/vmware/vsphere-automation-sdk-.net/blob/master/wsdl/vim-service/vimService.wsdl , it generates a source file that is 105 MB and has some performance problems. Any suggestion for speeding things up?

@ctaggart
Copy link
Author

ctaggart commented Jul 6, 2018

There are thousands of lines that have ServiceKnownTypeAttribute and look like:

[System.ServiceModel.ServiceKnownTypeAttribute(typeof(StampAllRulesWithUuidRequestType))]

I tried to use XmlSerializer instead of the default DataContractSerializer, but this had no impact on the code generation:

dotnet svcutil --serializer XmlSerializer ..\wsdl\vim-service\vimService.wsdl -n "*,VMware.vSphere.Management"

I thought it was the correct setting.

--serializer Auto                   - Automatically select the serializer. This tries to use the Data Contract serializer and uses the XmlSerializer if that
                                       fails. (Short Form: -ser)
 --serializer DataContractSerializer - Generate data types that use the Data Contract Serializer for serialization and deserialization
 --serializer XmlSerializer          - Generate data types that use the XmlSerializer for serialization and deserialization

Does ServiceKnownTypeAttribute apply to XmlSerializer or just DataContractSerializer?

@ctaggart
Copy link
Author

ctaggart commented Jul 6, 2018

Okay, it looks like it is using the XmlSerializer since the DataContractSerializer fails.

I installed:

<DotNetCliToolReference Include="dotnet-svcutil.xmlserializer" Version="1.0.0-preview1" />

but I'm getting an Operation is not supported on this platform. error:

PS C:\Users\taggac\coreservices\vsphere-automation-sdk-.net\VMware.vSphere.Management> dotnet svcutil.xmlserializer bin\release\netcoreapp2.1\VMware.vSphere.Management.dll
Microsoft (R) Service Model Metadata Tool\r\n[Microsoft (R) Windows (R) Communication Foundation, Version 1.0.0-preview1]\r\nCopyright (c) Microsoft Corporation.  All rights reserved.\r\n
Microsoft (R) Service Model Metadata Tool\r\n[Microsoft (R) Windows (R) Communication Foundation, Version 1.0.0-preview1]\r\nCopyright (c) Microsoft Corporation.  All rights reserved.\r\n
Error: Cannot read bin\release\netcoreapp2.1\VMware.vSphere.Management.dll.

    Operation is not supported on this platform.

If you would like more help, type "svcutil /?"

I tried with both TargetFramework of netstandard2.0 and netcoreapp2.1.

@ctaggart
Copy link
Author

ctaggart commented Jul 7, 2018

Some reason that error means that I'm missing and /out:Blah.cs.

dotnet svcutil.xmlserializer
Microsoft (R) Service Model Metadata Tool\r\n[Microsoft (R) Windows (R) Communication Foundation, Version 1.0.0-preview1]\r\nCopyright (c) Microsoft Corporation.  All rights reserved.\r\n
USES:

  - Pre-generate serialization code.


                                                -= COMMON OPTIONS =-

Options:

 /directory:<directory> - Directory to create files in (default: current directory) (Short Form: /d)
 /noLogo                - Suppress the copyright and banner message.
 /help                  - Display command syntax and options for the tool. (Short Form: /?)



                                         -= XMLSERIALIZER TYPE GENERATION =-

Description: dotnet-svcutil.xmlserializer can pre-generate C# serialization code that is required for types that can be serialized using the XmlSerializer.
    dotnet-svcutil.xmlserializer will only generate code for types used by Service Contracts found in the input assemblies.

Syntax: dotnet-svcutil.xmlserializer <assemblyPath>*

 <assemblyPath> - The path to an assembly containing Service Contract types. Serialization types will be generated for all Xml Serializable types in each contract

Options:

 /reference:<file path> - Add the specified assembly to the set of assemblies used for resolving type references. (Short Form: /r)
 /excludeType:<type>    - Fully-qualified or assembly-qualified type name to exclude from export or validation. This option can be used when exporting metadata for a service
                          or a set of service contracts to exclude types from being exported. (Short Form: /et)
 /out:<file>            - Filename for the generated code. This option will be ignored when multiple assemblies are passed as input to the tool. Default: derived from the
                          assembly name. (Short Form: /o)



                                                   -= EXAMPLES =-

 svcutil myContractLibrary.exe
    - Generate serialization types for XmlSerializer types used by any Service Contracts in the assembly

This generates a cs files and does not error:

dotnet svcutil.xmlserializer bin\release\netstandard2.0\VMware.vSphere.Management.dll /out:XmlSerializers

Must the generated code be in namespace Microsoft.Xml.Serialization.GeneratedAssembly?
Is there any way to just make this an option of svcutil and skip the two step process?

@ctaggart
Copy link
Author

ctaggart commented Jul 8, 2018

I'm making a single SOAP call to test out performance and 922 MB is being allocated. 👎
I was expecting the creating a dotnet svcutil.xmlserializer was going to eliminate most of these allocations.

image

image

@ctaggart
Copy link
Author

ctaggart commented Jul 9, 2018

@huanwu, thanks for introducing dotnet-svcutil.xmlserializer for .NET Core #2927 last week. How do I know if it is working? It is expected to work when the library and serialization library target netstandard2.0, but the final project targets netcoreapp2.1? Is there a minimum version of System.ServiceModel libraries that must be used? I'm trying to use 4.4 since the 4.5 is broken.

@mlacouture mlacouture added the tooling An issues related to any tool shipped from this repo. label Jul 9, 2018
@mlacouture
Copy link
Member

Hi @ctaggart! thank you for reporting this issue. We will look at it as soon as we have a chance.

@mlacouture mlacouture self-assigned this Jul 9, 2018
@mlacouture
Copy link
Member

@ctaggart, I looked at the metadata for this service and noticed that it has more than 800 operations and that it requires Xml serialization as some types cannot be serialized with the DataContractSerializer, that explains the size of the generated code and unfortunately there's nothing we can do about it.

@ctaggart
Copy link
Author

@mlacouture What is the purpose of dotnet svcutil.xmlserializer then?

@mlacouture
Copy link
Member

@ctaggart, can you follow up about the dotnet-svcutil.xmlserializer with a separate issue? maybe you can use #3004 for this purpose. It is good to track issues individually to make it easier for others with similar problems to find the information in the right place. I'm closing this issue in the meantime as there's no further action required for the original problem with dotnet-svcutil. Please let us know if you need any additional assistance.

Thank you!

@mlacouture
Copy link
Member

BTW: I'm following up with co-workers about the dotnet-svcutil.xmlserializer and will update issue #3004 accordingly. Thanks!

@mlacouture
Copy link
Member

cc @huanwu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling An issues related to any tool shipped from this repo.
Projects
None yet
Development

No branches or pull requests

2 participants