मैं निम्नलिखित सरल एक्सएमएल serializable प्रकार है:लापता SecurityProtocolType.Ssl3 enum मूल्य
[XmlType]
public class TestType
{
public System.Net.SecurityProtocolType ProtocolType { get; set; }
}
var instanceToSerialize = new TestType { ProtocolType = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 };
मैं इस वस्तु अपने कंप्यूटर और कई कंप्यूटरों पर ठीक की आवृत्ति को क्रमानुसार कर सकते हैं।
System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: Instance validation error: '4080' is not a valid value for System.Net.SecurityProtocolType.
at System.Xml.Serialization.XmlCustomFormatter.FromEnum(Int64 val, String[] vals, Int64[] ids, String typeName)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterTestType.Write1_SecurityProtocolType(SecurityProtocolType v)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterTestType.Write3_TestType(String n, String ns, TestType o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterTestType.Write4_TestType(Object o)
मैं काम कर रहा है और मामलों नाकाम रहने के लिए sgen.exe
उत्पन्न कोड की तुलना में है: लेकिन कंप्यूटर मैं परीक्षण किया है में से एक पर, मैं निम्नलिखित अपवाद हो रही है। काम करने के मामले पर मैं इस कोड उत्पन्न होते हैं:
string Write1_SecurityProtocolType(global::System.Net.SecurityProtocolType v) {
string s = null;
switch (v) {
case global::[email protected]: s = @"Tls"; break;
case global::[email protected]: s = @"Tls11"; break;
case global::[email protected]: s = @"Tls12"; break;
default: s = FromEnum(((System.Int64)v), new string[] {@"Tls",
@"Tls11",
@"Tls12"}, new System.Int64[] {(long)global::[email protected],
(long)global::[email protected],
(long)global::[email protected]}, @"System.Net.SecurityProtocolType"); break;
}
return s;
}
आप देख सकते हैं कि Ssl3
enum सदस्य के लिए कोड जेनरेट नहीं है:
string Write1_SecurityProtocolType(global::System.Net.SecurityProtocolType v) {
string s = null;
switch (v) {
case global::[email protected]: s = @"Ssl3"; break;
case global::[email protected]: s = @"Tls"; break;
case global::[email protected]: s = @"Tls11"; break;
case global::[email protected]: s = @"Tls12"; break;
default: s = FromEnum(((System.Int64)v), new string[] {@"Ssl3",
@"Tls",
@"Tls11",
@"Tls12"}, new System.Int64[] {(long)global::[email protected],
(long)global::[email protected],
(long)global::[email protected],
(long)global::[email protected]}, @"System.Net.SecurityProtocolType"); break;
}
return s;
}
में नाकाम रहने के कोड पर जबकि, इस उत्पन्न कोड है असफल मामला क्या आपको कोई विचार है कि वह कोड क्यों गुम है?
पीसी पर स्थापित .NET के संस्करणों की जांच करें। मेरा मानना है कि नवीनतम संस्करण 4.6 ने उस विकल्प को हटा दिया होगा। –
@Brianfromstatefarm nope, मेरे पास 4.6.1 और 4.6.2 स्थापित है और 4.6.x में अभी भी एसएसएल 3 एनम सदस्य है। – huseyint