diff --git a/src/dotnet-svcutil/lib/src/CodeDomFixup/VisitorFixup.cs b/src/dotnet-svcutil/lib/src/CodeDomFixup/VisitorFixup.cs index c1cf8550dd8..080f8856564 100644 --- a/src/dotnet-svcutil/lib/src/CodeDomFixup/VisitorFixup.cs +++ b/src/dotnet-svcutil/lib/src/CodeDomFixup/VisitorFixup.cs @@ -12,7 +12,11 @@ internal class VisitorFixup : CodeFixup { private static CodeDomVisitor[] GetVisitors(ServiceContractGenerator generator, CommandProcessorOptions options) { - ArrayOfXElementTypeHelper arrayOfXElementTypeHelper = new ArrayOfXElementTypeHelper((generator.Options & ServiceContractGenerationOptions.InternalTypes) == ServiceContractGenerationOptions.InternalTypes, generator.TargetCompileUnit); + // Keep the ArrayOfXElement helper public even under --internal. + // WCF's XmlSerializer operation behavior generates serializer assemblies at runtime; those assemblies cannot + // reference internal types, so internal schema/message types can fail at runtime. Keeping this helper public + // avoids inconsistent accessibility without breaking XmlSerializer runtime behavior. + ArrayOfXElementTypeHelper arrayOfXElementTypeHelper = new ArrayOfXElementTypeHelper(isInternal: false, generator.TargetCompileUnit); bool isVisualBasic = IsVisualBasicLanguage(options?.Language); CodeDomVisitor[] visitors = new CodeDomVisitor[] diff --git a/src/dotnet-svcutil/lib/src/ImportModule.cs b/src/dotnet-svcutil/lib/src/ImportModule.cs index eb517fdda18..9d16b29dcb1 100644 --- a/src/dotnet-svcutil/lib/src/ImportModule.cs +++ b/src/dotnet-svcutil/lib/src/ImportModule.cs @@ -16,6 +16,7 @@ using System.Linq; using System.ServiceModel.Channels; using System.ServiceModel.Description; +using System.Threading; using DcNS = System.Runtime.Serialization; using WsdlNS = System.Web.Services.Description; @@ -24,6 +25,8 @@ namespace Microsoft.Tools.ServiceModel.Svcutil { internal partial class ImportModule { + private static int s_internalWithXmlSerializerWarningEmitted; + private readonly CodeCompileUnit _codeCompileUnit; private readonly WsdlImporter _wsdlImporter; private readonly ServiceContractGenerator _contractGenerator; @@ -125,6 +128,11 @@ public bool AfterImportMetadata(ServiceDescriptor serviceDescriptor) { try { + if (_options.InternalTypeAccess == true && UsesXmlSerializer(serviceDescriptor, _options)) + { + EmitInternalWithXmlSerializerWarningOnce(); + } + // Convert errors to warnings to workaround the issue that many validation errors from XSD compiler // can be ignored. for (int idx = _wsdlImporter.Errors.Count - 1; idx >= _nonWsdlImportErrors; idx--) @@ -176,6 +184,46 @@ public bool AfterImportMetadata(ServiceDescriptor serviceDescriptor) return contractsResolved; } + private static bool UsesXmlSerializer(ServiceDescriptor serviceDescriptor, CommandProcessorOptions options) + { + if (options?.SerializerMode == SerializerMode.XmlSerializer) + { + return true; + } + + if (serviceDescriptor?.Contracts == null) + { + return false; + } + + foreach (ContractDescription contract in serviceDescriptor.Contracts) + { + if (contract?.Operations == null) + { + continue; + } + + foreach (OperationDescription operation in contract.Operations) + { + // Presence of this behavior indicates the operation will use XmlSerializer at runtime. + if (operation?.Behaviors?.Find() != null) + { + return true; + } + } + } + + return false; + } + + private static void EmitInternalWithXmlSerializerWarningOnce() + { + if (Interlocked.Exchange(ref s_internalWithXmlSerializerWarningEmitted, 1) == 0) + { + ToolConsole.WriteWarning(SR.WrnInternalOptionPartiallyAppliedWithXmlSerializer); + } + } + private static bool ContractsResolved(ServiceDescriptor serviceDescriptor, CodeCompileUnit codeCompileUnit) { if (serviceDescriptor != null && codeCompileUnit != null) @@ -339,9 +387,9 @@ private static void AddStateForXmlSerializerImport(CommandProcessorOptions optio if (options.EnableDataBinding == true) importOptions.WebReferenceOptions.CodeGenerationOptions |= CodeGenerationOptions.EnableDataBinding; - // Right now System.Data API not available in DNX. If it comes available we could consider uncommenting these. - // importOptions.WebReferenceOptions.SchemaImporterExtensions.Add(typeof(TypedDataSetSchemaImporterExtensionFx35).AssemblyQualifiedName); - // importOptions.WebReferenceOptions.SchemaImporterExtensions.Add(typeof(DataSetSchemaImporterExtension).AssemblyQualifiedName); + // Enable a minimal schema importer extension for DataSet/DataTable. + // This avoids generating placeholder IXmlSerializable + ArrayOfXElement types for common DataSet wrapper patterns. + importOptions.WebReferenceOptions.SchemaImporterExtensions.Add(typeof(DataSetSchemaImporterExtension).AssemblyQualifiedName); importOptions.CodeProvider = options.CodeProvider; diff --git a/src/dotnet-svcutil/lib/src/SR.resx b/src/dotnet-svcutil/lib/src/SR.resx index 39db9b0038e..4bb86359434 100644 --- a/src/dotnet-svcutil/lib/src/SR.resx +++ b/src/dotnet-svcutil/lib/src/SR.resx @@ -549,6 +549,9 @@ Your credentials will be sent to the server in clear text. Could not generate contract operations using the '{0}' type, attempting with the '{1}' type. + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + This tool collects information about how it is used in order to improve the tool. This functionality can be disabled by setting the environment variable "DOTNET_SVCUTIL_TELEMETRY_OPTOUT" to 1. diff --git a/src/dotnet-svcutil/lib/src/SchemaImporterExtensions/DataSetSchemaImporterExtension.cs b/src/dotnet-svcutil/lib/src/SchemaImporterExtensions/DataSetSchemaImporterExtension.cs new file mode 100644 index 00000000000..f7bd0f154e0 --- /dev/null +++ b/src/dotnet-svcutil/lib/src/SchemaImporterExtensions/DataSetSchemaImporterExtension.cs @@ -0,0 +1,394 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.CodeDom; +using Microsoft.CodeDom.Compiler; +using Microsoft.Xml; +using Microsoft.Xml.Schema; +using Microsoft.Xml.Serialization; +using Microsoft.Xml.Serialization.Advanced; + +using System; + +namespace Microsoft.Tools.ServiceModel.Svcutil +{ + /// + /// Minimal schema importer extension that recognizes the common msdata annotations used to represent + /// ADO.NET DataSet/DataTable in WSDL/XSD and maps them to System.Data types. + /// + /// This intentionally avoids any dependency on System.Data internals and does not attempt to generate + /// typed datasets; it only returns the CLR type name to use. + /// + internal sealed class DataSetSchemaImporterExtension : SchemaImporterExtension + { + private const string MsDataNamespace = "urn:schemas-microsoft-com:xml-msdata"; + private const string DiffgramNamespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; + + // Common msdata attributes seen in DataSet/DataTable schema exports. + private const string AttrIsDataSet = "IsDataSet"; + private const string AttrDataType = "DataType"; + private static readonly string[] s_dataTableHints = + { + // Typed DataTable hints (a subset; we only need a signal, not full fidelity). + "GeneratorDataTableName", + "GeneratorUserTableName", + "GeneratorTableClassName", + "GeneratorTableVarName", + }; + + // Keep strings to avoid compile-time references to System.Data assemblies. + private const string DataSetClrTypeName = "System.Data.DataSet"; + private const string DataTableClrTypeName = "System.Data.DataTable"; + + // Note: SchemaImporterExtensionCollection creates extensions via Activator.CreateInstance(type), + // so we keep a public parameterless constructor even though the type itself is internal. + public DataSetSchemaImporterExtension() + { + } + + public override string ImportSchemaType( + string name, + string ns, + XmlSchemaObject context, + XmlSchemas schemas, + XmlSchemaImporter importer, + CodeCompileUnit compileUnit, + CodeNamespace mainNamespace, + CodeGenerationOptions options, + CodeDomProvider codeProvider) + { + // Some import paths call this overload. We can still decide based on the schema context annotations. + if (LooksLikeDataSetWrapperType(null, context)) + { + return DataSetClrTypeName; + } + + if (IsDataSetAnnotated(context)) + { + return DataSetClrTypeName; + } + + if (IsDataTableAnnotated(context)) + { + return DataTableClrTypeName; + } + + return null; + } + + public override string ImportSchemaType( + XmlSchemaType type, + XmlSchemaObject context, + XmlSchemas schemas, + XmlSchemaImporter importer, + CodeCompileUnit compileUnit, + CodeNamespace mainNamespace, + CodeGenerationOptions options, + CodeDomProvider codeProvider) + { + // Heuristic fallback for schemas that don't include msdata annotations but use the classic + // "xsd:schema" + "xsd:any" wrapper pattern produced by DataSet exports. + // Example: + // + // + // + // + if (LooksLikeDataSetWrapperType(type, context)) + { + return DataSetClrTypeName; + } + + // Prefer context (often an element) and fall back to the type itself. + if (IsDataSetAnnotated(context) || IsDataSetAnnotated(type)) + { + return DataSetClrTypeName; + } + + if (IsDataTableAnnotated(context) || IsDataTableAnnotated(type)) + { + return DataTableClrTypeName; + } + + return null; + } + + public override string ImportAnyElement( + XmlSchemaAny any, + bool mixed, + XmlSchemas schemas, + XmlSchemaImporter importer, + CodeCompileUnit compileUnit, + CodeNamespace mainNamespace, + CodeGenerationOptions options, + CodeDomProvider codeProvider) + { + // Some WSDLs carry msdata annotations directly on xs:any. + if (IsDataSetAnnotated(any)) + { + return DataSetClrTypeName; + } + + if (IsDataTableAnnotated(any)) + { + return DataTableClrTypeName; + } + + return null; + } + + private static bool LooksLikeDataSetWrapperType(XmlSchemaType type, XmlSchemaObject context) + { + // First, try the provided type. + XmlSchemaComplexType complexType = type as XmlSchemaComplexType; + + // If the type isn't directly provided (or isn't complex), try deriving it from the context. + if (complexType == null) + { + XmlSchemaElement element = context as XmlSchemaElement; + if (element != null) + { + complexType = element.SchemaType as XmlSchemaComplexType; + } + } + + if (complexType == null) + { + return false; + } + + XmlSchemaSequence sequence = complexType.Particle as XmlSchemaSequence; + if (sequence == null || sequence.Items == null || sequence.Items.Count == 0) + { + return false; + } + + bool hasSchemaRef = false; + bool hasSchemaAny = false; + bool hasAny = false; + + // Ensure we only match the narrow "schema + any" wrapper pattern. + // If there are other particles, bail out. + for (int i = 0; i < sequence.Items.Count; i++) + { + XmlSchemaObject item = sequence.Items[i]; + + XmlSchemaElement itemElement = item as XmlSchemaElement; + if (itemElement != null) + { + if (!itemElement.RefName.IsEmpty && + itemElement.RefName.Name == "schema" && + itemElement.RefName.Namespace == XmlSchema.Namespace) + { + hasSchemaRef = true; + continue; + } + + // Another common wrapper uses an explicit diffgram element reference instead of xs:any. + // + if (!itemElement.RefName.IsEmpty && + itemElement.RefName.Name == "diffgram" && + itemElement.RefName.Namespace == DiffgramNamespace) + { + hasAny = true; + continue; + } + + // Any other element means it's not the standard DataSet wrapper. + return false; + } + + XmlSchemaAny itemAny = item as XmlSchemaAny; + if (itemAny != null) + { + // Another common DataSet wrapper is: + // + // + // (or a second without explicit namespace) + if (itemAny.Namespace == XmlSchema.Namespace) + { + hasSchemaAny = true; + } + else + { + hasAny = true; + } + + continue; + } + + // Unknown particle. + return false; + } + + return (hasSchemaRef || hasSchemaAny) && hasAny; + } + + private static bool IsDataSetAnnotated(XmlSchemaObject schemaObject) + { + var value = GetMsDataValue(schemaObject, AttrIsDataSet); + if (value != null && value.Equals("true", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + // Some schemas use msdata:DataType="System.Data.DataSet" instead. + var dataType = GetMsDataValue(schemaObject, AttrDataType); + if (dataType != null && + (dataType.Equals(DataSetClrTypeName, StringComparison.OrdinalIgnoreCase) || + dataType.EndsWith(".DataSet", StringComparison.OrdinalIgnoreCase))) + { + return true; + } + + return false; + } + + private static bool IsDataTableAnnotated(XmlSchemaObject schemaObject) + { + // DataTable does not have a single canonical marker, so we use a small set of common hints. + // We also explicitly avoid mapping to DataTable when IsDataSet==true. + if (IsDataSetAnnotated(schemaObject)) + { + return false; + } + + // Some schemas use msdata:DataType="System.Data.DataTable". + var dataType = GetMsDataValue(schemaObject, AttrDataType); + if (dataType != null && + (dataType.Equals(DataTableClrTypeName, StringComparison.OrdinalIgnoreCase) || + dataType.EndsWith(".DataTable", StringComparison.OrdinalIgnoreCase))) + { + return true; + } + + foreach (var hint in s_dataTableHints) + { + if (GetMsDataValue(schemaObject, hint) != null) + { + return true; + } + } + + return false; + } + + private static string GetMsDataValue(XmlSchemaObject schemaObject, string localName) + { + var fromAttributes = GetMsDataUnhandledAttributeValue(schemaObject, localName); + if (fromAttributes != null) + { + return fromAttributes; + } + + return GetMsDataAppInfoValue(schemaObject, localName); + } + + private static string GetMsDataUnhandledAttributeValue(XmlSchemaObject schemaObject, string localName) + { + XmlSchemaAnnotated annotated = schemaObject as XmlSchemaAnnotated; + if (annotated == null) + return null; + + XmlAttribute[] attributes = annotated.UnhandledAttributes; + if (attributes == null || attributes.Length == 0) + { + return null; + } + + for (int i = 0; i < attributes.Length; i++) + { + XmlAttribute attr = attributes[i]; + if (attr == null) + { + continue; + } + + if (attr.NamespaceURI == MsDataNamespace && attr.LocalName == localName) + { + return attr.Value; + } + } + + return null; + } + + private static string GetMsDataAppInfoValue(XmlSchemaObject schemaObject, string localName) + { + XmlSchemaAnnotated annotated = schemaObject as XmlSchemaAnnotated; + if (annotated == null) + { + return null; + } + + XmlSchemaAnnotation annotation = annotated.Annotation; + if (annotation == null) + { + return null; + } + + if (annotation.Items == null) + { + return null; + } + + for (int i = 0; i < annotation.Items.Count; i++) + { + XmlSchemaAppInfo appInfo = annotation.Items[i] as XmlSchemaAppInfo; + if (appInfo == null || appInfo.Markup == null) + { + continue; + } + + for (int j = 0; j < appInfo.Markup.Length; j++) + { + XmlNode node = appInfo.Markup[j]; + if (node == null) + { + continue; + } + + // Match element form: true + XmlElement element = node as XmlElement; + if (element != null) + { + if (element.NamespaceURI == MsDataNamespace && element.LocalName == localName) + { + return element.InnerText; + } + + // Some appinfo blocks put msdata annotations as attributes on arbitrary elements. + if (element.Attributes != null) + { + for (int k = 0; k < element.Attributes.Count; k++) + { + XmlAttribute attr = element.Attributes[k]; + if (attr != null && attr.NamespaceURI == MsDataNamespace && attr.LocalName == localName) + { + return attr.Value; + } + } + } + } + else + { + // Generic fallback: scan attributes, if any. + if (node.Attributes != null) + { + for (int k = 0; k < node.Attributes.Count; k++) + { + XmlAttribute attr = node.Attributes[k]; + if (attr != null && attr.NamespaceURI == MsDataNamespace && attr.LocalName == localName) + { + return attr.Value; + } + } + } + } + } + } + + return null; + } + } +} diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.cs.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.cs.xlf index 53fd7857951..2d0e81a727f 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.cs.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.cs.xlf @@ -827,6 +827,11 @@ Pokud jste se pokoušeli vygenerovat klienta, může k tomuto dojít v případ Koncový bod {0} na adrese {1} obsahuje nejméně jednu vazbu, která není kompatibilní s aplikacemi .NET Core. Přeskakování... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. Cílová architektura {0} se nepodporuje a v budoucnu už nebude dostávat aktualizace zabezpečení. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.de.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.de.xlf index 31775ab3fe7..c050f793868 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.de.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.de.xlf @@ -827,6 +827,11 @@ Wenn Sie versucht haben, einen Client zu generieren, könnte die Ursache hierfü Der Endpunkt "{0}" an der Adresse "{1}" enthält mindestens eine Bindung, die nicht mit .NET Core-Apps kompatibel ist. Wird übersprungen... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. Das Zielframework "{0}" wird nicht mehr unterstützt und erhält in Zukunft keine Sicherheitsupdates mehr. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.es.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.es.xlf index 10d1a0dd041..b4bbc991109 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.es.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.es.xlf @@ -827,6 +827,11 @@ Si intentaba generar un cliente, es posible que se deba a que los documentos de El punto de conexión "{0}" en la dirección "{1}" contiene uno o varios enlaces no compatibles con las aplicaciones de .Net Core, omitiendo... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. La plataforma de destino "{0}" no es compatible y no recibirá actualizaciones de seguridad en el futuro. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.fr.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.fr.xlf index 66db4c81738..c6217db1f8a 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.fr.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.fr.xlf @@ -827,6 +827,11 @@ Si vous avez tenté de générer un client, cela peut être dû au fait que les Le point de terminaison '{0}' à l'adresse '{1}' contient une ou plusieurs liaisons non compatibles avec les applications .Net Core. Il va être ignoré... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. Le framework cible «{0}» n’est pas pris en charge et ne recevra pas de mises à jour de sécurité à l’avenir. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.it.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.it.xlf index 16d90b20e4c..8c039dfba9a 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.it.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.it.xlf @@ -827,6 +827,11 @@ Se si stava provando a creare un client, il problema può dipendere dal fatto ch L'endpoint '{0}' all'indirizzo '{1}' contiene uno o più binding non compatibili con le app .NET Core. Verrà ignorato... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. Il supporto per il framework di destinazione '{0}' non è più disponibile e non riceverà gli aggiornamenti della sicurezza in futuro. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.ja.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.ja.xlf index c9233a0e974..0e83c3b8ca5 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.ja.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.ja.xlf @@ -827,6 +827,11 @@ If you were trying to generate a client, this could be because the metadata docu アドレス '{1}' のエンドポイント '{0}' に、.Net Core アプリと互換性のないバインドが 1 つ以上含まれています。スキップしています... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. ターゲット フレームワーク '{0}' はサポート対象外で、今後、セキュリティ更新プログラムは受け取ることはありません。 diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.ko.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.ko.xlf index 485c6dc756e..df79c3b67ce 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.ko.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.ko.xlf @@ -827,6 +827,11 @@ If you were trying to generate a client, this could be because the metadata docu 주소 '{1}'의 엔드포인트 '{0}'에 .NET Core 앱과 호환되지 않는 바인딩이 하나 이상 있습니다. 건너뜁니다. + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. 대상 프레임워크 '{0}'은(는) 지원되지 않으며 향후 보안 업데이트를 받지 않습니다. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.pl.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.pl.xlf index 840f98a138f..f761c161994 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.pl.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.pl.xlf @@ -827,6 +827,11 @@ Jeśli próbowano wygenerować klienta, może być to spowodowane przez dokument Punkt końcowy „{0}” pod adresem „{1}” zawiera co najmniej jedno powiązanie, które nie jest zgodne z aplikacjami .Net Core. Są one pomijane... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. Platforma docelowa „{0}” nie jest obsługiwana i w przyszłości nie będzie otrzymywać aktualizacji zabezpieczeń. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.pt-BR.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.pt-BR.xlf index 343a85ffdc5..01a14cfc559 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.pt-BR.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.pt-BR.xlf @@ -827,6 +827,11 @@ Se você estava tentando gerar um cliente, isso pode ter acontecido porque os do O ponto de extremidade '{0}' no endereço '{1}' contém uma ou mais associações não compatíveis com os aplicativos .Net Core. Ignorando... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. A estrutura de destino '{0}' está sem suporte e não receberá atualizações de segurança no futuro. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.ru.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.ru.xlf index 02186b1bccc..8b35a8f61d5 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.ru.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.ru.xlf @@ -827,6 +827,11 @@ If you were trying to generate a client, this could be because the metadata docu Конечная точка "{0}" по адресу "{1}" содержит одну или несколько привязок, несовместимых с приложениями .Net Core. Пропуск... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. Требуемая версия .NET Framework "{0}" больше не поддерживается и не будет получать обновления для системы безопасности. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.tr.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.tr.xlf index e5baaaa661c..4e7fff2fd33 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.tr.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.tr.xlf @@ -827,6 +827,11 @@ If you were trying to generate a client, this could be because the metadata docu '{1}' adresindeki '{0}' uç noktası, .Net Core uygulamalarıyla uyumsuz bir veya daha fazla bağlama içerdiğinden atlanıyor... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. '{0}' hedef çerçevesi destek kapsamı dışında olduğu için gelecekte güvenlik güncelleştirmeleri almayacak. diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.zh-Hans.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.zh-Hans.xlf index ae4d13d4f51..1cdfb2d92f4 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.zh-Hans.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.zh-Hans.xlf @@ -827,6 +827,11 @@ If you were trying to generate a client, this could be because the metadata docu 地址“{1}”处的终结点“{0}”包含一个或多个与 .Net Core 应用不兼容的绑定,正在跳过... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. 目标框架“{0}”已失去支持,并且将来不会收到安全更新。 diff --git a/src/dotnet-svcutil/lib/src/xlf/SR.zh-Hant.xlf b/src/dotnet-svcutil/lib/src/xlf/SR.zh-Hant.xlf index 0f3492fbcf7..5603b618e15 100644 --- a/src/dotnet-svcutil/lib/src/xlf/SR.zh-Hant.xlf +++ b/src/dotnet-svcutil/lib/src/xlf/SR.zh-Hant.xlf @@ -827,6 +827,11 @@ If you were trying to generate a client, this could be because the metadata docu 位於位址 '{1}' 的端點 '{0}' 包含一或多個與 .Net Core 應用程式不相容的繫結,將會跳過... + + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + --internal may be only partially applied when using XmlSerializer; some schema wrapper types are generated as public for runtime compatibility. + + The target framework '{0}' is out of support and will not receive security updates in the future. 已不支援目標 Framework '{0}',未來將不會收到安全性更新。 diff --git a/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper.csproj b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper.csproj new file mode 100644 index 00000000000..c2d91e178fd --- /dev/null +++ b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper.csproj @@ -0,0 +1,14 @@ + + + + Exe + N.N + enable + enable + + + + + + + \ No newline at end of file diff --git a/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper/Reference.cs b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper/Reference.cs new file mode 100644 index 00000000000..85520ebabe1 --- /dev/null +++ b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper/Reference.cs @@ -0,0 +1,189 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace InternalTypes_DataSetWrapper_NS +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")] + [System.ServiceModel.ServiceContractAttribute(Namespace="http://tempuri.org", ConfigurationName="InternalTypes_DataSetWrapper_NS.MyServiceSoap")] + internal interface MyServiceSoap + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/GetData", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task GetDataAsync(); + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org")] + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute()] + public partial class Data + { + + private int dataIdField; + + private System.Data.DataSet dataRecordsField; + + private string noteField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=0)] + public int DataId + { + get + { + return this.dataIdField; + } + set + { + this.dataIdField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=1)] + public System.Data.DataSet DataRecords + { + get + { + return this.dataRecordsField; + } + set + { + this.dataRecordsField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=2)] + public string Note + { + get + { + return this.noteField; + } + set + { + this.noteField = value; + } + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")] + internal interface MyServiceSoapChannel : InternalTypes_DataSetWrapper_NS.MyServiceSoap, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")] + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute()] + internal partial class MyServiceSoapClient : System.ServiceModel.ClientBase, InternalTypes_DataSetWrapper_NS.MyServiceSoap + { + + /// + /// Implement this partial method to configure the service endpoint. + /// + /// The endpoint to configure + /// The client credentials + static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials); + + public MyServiceSoapClient() : + base(MyServiceSoapClient.GetDefaultBinding(), MyServiceSoapClient.GetDefaultEndpointAddress()) + { + this.Endpoint.Name = EndpointConfiguration.MyServiceSoap.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public MyServiceSoapClient(EndpointConfiguration endpointConfiguration) : + base(MyServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), MyServiceSoapClient.GetEndpointAddress(endpointConfiguration)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public MyServiceSoapClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : + base(MyServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public MyServiceSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : + base(MyServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public MyServiceSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public System.Threading.Tasks.Task GetDataAsync() + { + return base.Channel.GetDataAsync(); + } + + public virtual System.Threading.Tasks.Task OpenAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndOpen)); + } + + #if !NET6_0_OR_GREATER + public virtual System.Threading.Tasks.Task CloseAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndClose)); + } + #endif + + private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.MyServiceSoap)) + { + System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding(); + result.MaxBufferSize = int.MaxValue; + result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; + result.MaxReceivedMessageSize = int.MaxValue; + result.AllowCookies = true; + result.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport; + return result; + } + throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); + } + + private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.MyServiceSoap)) + { + return new System.ServiceModel.EndpointAddress("https://contoso.com/MyService.svc"); + } + throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); + } + + private static System.ServiceModel.Channels.Binding GetDefaultBinding() + { + return MyServiceSoapClient.GetBindingForEndpoint(EndpointConfiguration.MyServiceSoap); + } + + private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() + { + return MyServiceSoapClient.GetEndpointAddress(EndpointConfiguration.MyServiceSoap); + } + + public enum EndpointConfiguration + { + + MyServiceSoap, + } + } +} \ No newline at end of file diff --git a/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper/dotnet-svcutil.params.json b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper/dotnet-svcutil.params.json new file mode 100644 index 00000000000..e95476218a9 --- /dev/null +++ b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper/dotnet-svcutil.params.json @@ -0,0 +1,16 @@ +{ + "providerId": "Microsoft.Tools.ServiceModel.Svcutil", + "version": "99.99.99", + "options": { + "inputs": [ + "../../../../../src/dotnet-svcutil/lib/tests/TestCases/wsdl/InternalTypes_DataSetWrapper.wsdl" + ], + "internalTypeAccess": true, + "namespaceMappings": [ + "*, InternalTypes_DataSetWrapper_NS" + ], + "outputFile": "Reference.cs", + "targetFramework": "N.N", + "typeReuseMode": "None" + } +} \ No newline at end of file diff --git a/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper_NoInternal/InternalTypes_DataSetWrapper_NoInternal.csproj b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper_NoInternal/InternalTypes_DataSetWrapper_NoInternal.csproj new file mode 100644 index 00000000000..c2d91e178fd --- /dev/null +++ b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper_NoInternal/InternalTypes_DataSetWrapper_NoInternal.csproj @@ -0,0 +1,14 @@ + + + + Exe + N.N + enable + enable + + + + + + + \ No newline at end of file diff --git a/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper_NoInternal/Reference.cs b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper_NoInternal/Reference.cs new file mode 100644 index 00000000000..3c202141076 --- /dev/null +++ b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper_NoInternal/Reference.cs @@ -0,0 +1,189 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace InternalTypes_DataSetWrapper_NoInternal_NS +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")] + [System.ServiceModel.ServiceContractAttribute(Namespace="http://tempuri.org", ConfigurationName="InternalTypes_DataSetWrapper_NoInternal_NS.MyServiceSoap")] + public interface MyServiceSoap + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/GetData", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task GetDataAsync(); + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org")] + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute()] + public partial class Data + { + + private int dataIdField; + + private System.Data.DataSet dataRecordsField; + + private string noteField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=0)] + public int DataId + { + get + { + return this.dataIdField; + } + set + { + this.dataIdField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=1)] + public System.Data.DataSet DataRecords + { + get + { + return this.dataRecordsField; + } + set + { + this.dataRecordsField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=2)] + public string Note + { + get + { + return this.noteField; + } + set + { + this.noteField = value; + } + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")] + public interface MyServiceSoapChannel : InternalTypes_DataSetWrapper_NoInternal_NS.MyServiceSoap, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "99.99.99")] + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute()] + public partial class MyServiceSoapClient : System.ServiceModel.ClientBase, InternalTypes_DataSetWrapper_NoInternal_NS.MyServiceSoap + { + + /// + /// Implement this partial method to configure the service endpoint. + /// + /// The endpoint to configure + /// The client credentials + static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials); + + public MyServiceSoapClient() : + base(MyServiceSoapClient.GetDefaultBinding(), MyServiceSoapClient.GetDefaultEndpointAddress()) + { + this.Endpoint.Name = EndpointConfiguration.MyServiceSoap.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public MyServiceSoapClient(EndpointConfiguration endpointConfiguration) : + base(MyServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), MyServiceSoapClient.GetEndpointAddress(endpointConfiguration)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public MyServiceSoapClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : + base(MyServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public MyServiceSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : + base(MyServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public MyServiceSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public System.Threading.Tasks.Task GetDataAsync() + { + return base.Channel.GetDataAsync(); + } + + public virtual System.Threading.Tasks.Task OpenAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndOpen)); + } + + #if !NET6_0_OR_GREATER + public virtual System.Threading.Tasks.Task CloseAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndClose)); + } + #endif + + private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.MyServiceSoap)) + { + System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding(); + result.MaxBufferSize = int.MaxValue; + result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; + result.MaxReceivedMessageSize = int.MaxValue; + result.AllowCookies = true; + result.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport; + return result; + } + throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); + } + + private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.MyServiceSoap)) + { + return new System.ServiceModel.EndpointAddress("https://contoso.com/MyService.svc"); + } + throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration)); + } + + private static System.ServiceModel.Channels.Binding GetDefaultBinding() + { + return MyServiceSoapClient.GetBindingForEndpoint(EndpointConfiguration.MyServiceSoap); + } + + private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() + { + return MyServiceSoapClient.GetEndpointAddress(EndpointConfiguration.MyServiceSoap); + } + + public enum EndpointConfiguration + { + + MyServiceSoap, + } + } +} \ No newline at end of file diff --git a/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper_NoInternal/dotnet-svcutil.params.json b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper_NoInternal/dotnet-svcutil.params.json new file mode 100644 index 00000000000..229a16d2d76 --- /dev/null +++ b/src/dotnet-svcutil/lib/tests/Baselines/InternalTypes_DataSetWrapper/InternalTypes_DataSetWrapper_NoInternal/dotnet-svcutil.params.json @@ -0,0 +1,15 @@ +{ + "providerId": "Microsoft.Tools.ServiceModel.Svcutil", + "version": "99.99.99", + "options": { + "inputs": [ + "../../../../../src/dotnet-svcutil/lib/tests/TestCases/wsdl/InternalTypes_DataSetWrapper.wsdl" + ], + "namespaceMappings": [ + "*, InternalTypes_DataSetWrapper_NoInternal_NS" + ], + "outputFile": "Reference.cs", + "targetFramework": "N.N", + "typeReuseMode": "None" + } +} \ No newline at end of file diff --git a/src/dotnet-svcutil/lib/tests/TestCases/wsdl/InternalTypes_DataSetWrapper.wsdl b/src/dotnet-svcutil/lib/tests/TestCases/wsdl/InternalTypes_DataSetWrapper.wsdl new file mode 100644 index 00000000000..23933f63f57 --- /dev/null +++ b/src/dotnet-svcutil/lib/tests/TestCases/wsdl/InternalTypes_DataSetWrapper.wsdl @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/dotnet-svcutil/lib/tests/src/GlobalToolTests.cs b/src/dotnet-svcutil/lib/tests/src/GlobalToolTests.cs index 6485d77a416..14cfa85e46f 100644 --- a/src/dotnet-svcutil/lib/tests/src/GlobalToolTests.cs +++ b/src/dotnet-svcutil/lib/tests/src/GlobalToolTests.cs @@ -4,6 +4,7 @@ using System; using System.IO; +using System.Linq; using Microsoft.Tools.ServiceModel.Svcutil; using System.Threading; using Xunit; @@ -13,6 +14,14 @@ namespace SvcutilTest { public partial class E2ETest { + private static int CountInternalXmlSerializerWarningLines(string outputText) + { + return outputText + .Split(new[] { "\r\n", "\n" }, StringSplitOptions.None) + .Count(l => l.IndexOf("--internal", StringComparison.OrdinalIgnoreCase) >= 0 && + l.IndexOf("XmlSerializer", StringComparison.OrdinalIgnoreCase) >= 0); + } + private void TestGlobalSvcutil(string options, bool expectSuccess = true) { Assert.False(string.IsNullOrWhiteSpace(this_TestCaseName), $"{nameof(this_TestCaseName)} not initialized!"); @@ -57,6 +66,42 @@ public void LanguageOption(string lang) TestGlobalSvcutil(options); } + [Trait("Category", "Test")] + [Theory] + [InlineData("InternalTypes_DataSetWrapper_NoInternal", false, 0)] + [InlineData("InternalTypes_DataSetWrapper", true, 1)] + public void InternalTypes_DataSetWrapper_Variations(string testCaseName, bool useInternal, int expectedWarningCount) + { + // Validate both default (public) and --internal flows for the same WSDL. + // Note: this test will require baselines for both variations. + const string groupName = "InternalTypes_DataSetWrapper"; + this_TestCaseName = groupName; + TestFixture(); + + this_TestCaseName = testCaseName; + InitializeGlobal(testCaseName); + + var wsdlFile = Path.Combine(g_TestCasesDir, "wsdl", "InternalTypes_DataSetWrapper.wsdl"); + + // Do not force a serializer. This matches real user behavior and validates the default code path. + var options = useInternal + ? $"\"{wsdlFile}\" -i -nl" + : $"\"{wsdlFile}\" -nl"; + + options = AppendCommonOptions(options); + var processResult = this_TestCaseProject.RunSvcutil(options, expectSuccess: true, this_TestCaseLogger, globalTool: true); + + Assert.True(processResult.ExitCode == 0 || processResult.ExitCode == 6, processResult.OutputText); + + // Assert on invariant tokens so the test is resilient to localization. + var warningCount = CountInternalXmlSerializerWarningLines(processResult.OutputText); + Assert.True( + warningCount == expectedWarningCount, + $"Expected {expectedWarningCount} warning(s) mentioning both '--internal' and 'XmlSerializer', found {warningCount}. Output was:{Environment.NewLine}{processResult.OutputText}"); + + ValidateTest(options, this_TestCaseProject.DirectoryPath, processResult.ExitCode, processResult.OutputText, expectSuccess: true); + } + [Theory] [Trait("Category", "BVT")] [InlineData("Project", "--toolContext Project -ntr -tf netcoreapp2.0 -nb")]