dotnet / dotnet/wcf

Imported WCF Reference ignores Enum values

Open
#4,105 16 comments 3 reactions 0 assignees View on GitHub
priority 1 tooling triaged
Dominant language
C#
Stars
1.8k
Forks
576
Avg merge
6d 9h
Merged PRs (30d)
2

Description

Imported WCF Reference ignores Enum values

When I add a Web Reference to a Core project, enum values are not imported.
I am importing a service with many enums, most are not simple zero indexed sequence, therefore do not match the WSDL.

Framework Service Reference uses correct enum values.

Core or Standard projects, Enum values are not set so do not match the WSDL service.
In a framework project, using advanced to add a "Web Service" results in the same unset enum values.

Unfortunately the WSDL is not publically accessable and I do not have permission to publish here, so edited snippet:
```xml

1

2

3

4

6

```

Edited example of the correct framework generated reference:

```c#
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="Constant.BobTypeEnum", Namespace="http://schemas.datacontract.org/2004/07/bob.Constants")]
public enum ConstantBobTypeEnum : int {

[System.Runtime.Serialization.EnumMemberAttribute()]
Bob = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
Bobob= 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
Bobobob= 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
Obobobob = 4,
[System.Runtime.Serialization.EnumMemberAttribute()]
Ob = 6,
}
```

And last the Reference.cs snippet from a new standard project
```c#
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
[System.Xml.Serialization.XmlTypeAttribute(TypeName="BobTypeEnum", Namespace="http://schemas.datacontract.org/2004/07/bob")]
public enum BobTypeEnum
{
///
Bob,
///
Bobob,
///
Bobobob,
///
Obobobob ,
///
Ob ,
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.