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

dotnet-svcutil generated C# type names are missing @ prefix when name is C# keyword too #5488

Open
hopix opened this issue Apr 4, 2024 · 0 comments · May be fixed by #5494
Open

dotnet-svcutil generated C# type names are missing @ prefix when name is C# keyword too #5488

hopix opened this issue Apr 4, 2024 · 0 comments · May be fixed by #5494
Assignees
Labels
enhancement Not a bug and not a new API, just a product improvement.

Comments

@hopix
Copy link

hopix commented Apr 4, 2024

Describe the bug
When WSDL contains complex type named file the dotnet-svcutil generates public partial class file { ..., which won't compile as the file is C# keyword.

To Reproduce
WSDL example for dotnet-svcutil tool with complex type named file:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.example.org/" targetNamespace="http://www.example.org/">
  <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.example.org/" elementFormDefault="qualified">
      <xs:element name="file">
        <xs:complexType>
        </xs:complexType>
      </xs:element>
      <xs:element name="ConversionRateResponse">
      </xs:element>
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="ConversionRateRequestMessage">
    <wsdl:part name="parameters" element="tns:file"/>
  </wsdl:message>
  <wsdl:portType name="CurrencyConverterPortType">
    <wsdl:operation name="GetConversionRate">
      <wsdl:input message="tns:ConversionRateRequestMessage"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="CurrencyConverterBinding" type="tns:CurrencyConverterPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="GetConversionRate">
      <soap:operation soapAction="http://www.example.org/GetConversionRate"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="CurrencyConverterService">
    <wsdl:port name="CurrencyConverterPort" binding="tns:CurrencyConverterBinding">
      <soap:address location="http://www.example.org/currencyconverter"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Expected behavior
Any dotnet-svcutil generated C# type/class name which conflicts with C# keyword should prefixed with @.
In case of provided WSDL it should correctly be public partial class **@**file { ....

@HongGit HongGit added the enhancement Not a bug and not a new API, just a product improvement. label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Not a bug and not a new API, just a product improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants