repo_name
stringclasses
6 values
pr_number
int64
512
78.9k
pr_title
stringlengths
3
144
pr_description
stringlengths
0
30.3k
author
stringlengths
2
21
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
17
30.4k
filepath
stringlengths
9
210
before_content
stringlengths
0
112M
after_content
stringlengths
0
112M
label
int64
-1
1
dotnet/roslyn
55,696
Have inheritance-margin hold onto data that does *not* point back at Solution instances.
Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
CyrusNajmabadi
2021-08-18T16:22:09Z
2021-08-20T04:50:45Z
16efcb29a0cb8be060ab3bfd9e60c9192c6604bf
6ce4dc34664b63672aeac58683ed9c9e73fa2102
Have inheritance-margin hold onto data that does *not* point back at Solution instances.. Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
./src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="fr" original="../VBResources.resx"> <body> <trans-unit id="ERR_AssignmentInitOnly"> <source>Init-only property '{0}' can only be assigned by an object member initializer, or on 'Me', 'MyClass` or 'MyBase' in an instance constructor.</source> <target state="translated">La propriété d'initialisation uniquement '{0}' peut uniquement être affectée par un initialiseur de membre d'objet, ou sur 'Me', 'MyClass` ou 'MyBase' dans un constructeur d'instance.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSwitchValue"> <source>Command-line syntax error: '{0}' is not a valid value for the '{1}' option. The value must be of the form '{2}'.</source> <target state="translated">Erreur de syntaxe de ligne de commande : '{0}' est une valeur non valide pour l'option '{1}'. La valeur doit se présenter sous la forme '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CommentsAfterLineContinuationNotAvailable1"> <source>Please use language version {0} or greater to use comments after line continuation character.</source> <target state="translated">Utilisez la version de langage {0} ou une version ultérieure pour utiliser des commentaires après le caractère de continuation de la ligne.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultInterfaceImplementationInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Impossible d'incorporer le type '{0}', car il a un membre non abstrait. Affectez la valeur false à la propriété 'Incorporer les types interop'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleAnalyzerConfigsInSameDir"> <source>Multiple analyzer config files cannot be in the same directory ('{0}').</source> <target state="translated">Plusieurs fichiers config d'analyseur ne peuvent pas figurer dans le même répertoire ('{0}').</target> <note /> </trans-unit> <trans-unit id="ERR_OverridingInitOnlyProperty"> <source>'{0}' cannot override init-only '{1}'.</source> <target state="translated">'{0}' ne peut pas substituer le '{1}' d'initialisation uniquement.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyDoesntImplementInitOnly"> <source>Init-only '{0}' cannot be implemented.</source> <target state="translated">Impossible d'implémenter le '{0}' d'initialisation uniquement.</target> <note /> </trans-unit> <trans-unit id="ERR_ReAbstractionInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a re-abstraction of a member from base interface. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Impossible d'incorporer le type '{0}', car il a une nouvelle abstraction d'un membre de l'interface de base. Affectez la valeur false à la propriété 'Incorporer les types interop'.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation"> <source>Target runtime doesn't support default interface implementation.</source> <target state="translated">Le runtime cible ne prend pas en charge l'implémentation d'interface par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportProtectedAccessForInterfaceMember"> <source>Target runtime doesn't support 'Protected', 'Protected Friend', or 'Private Protected' accessibility for a member of an interface.</source> <target state="translated">Le runtime cible ne prend pas en charge l'accessibilité 'Protected', 'Protected Friend' ou 'Private Protected' pour un membre d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedEventNeedsHandlerInTheSameType"> <source>Events of shared WithEvents variables cannot be handled by methods in a different type.</source> <target state="translated">Les événements des variables WithEvents partagées ne peuvent pas être pris en charge par des méthodes dans un autre type.</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyNotSupported"> <source>'UnmanagedCallersOnly' attribute is not supported.</source> <target state="translated">L'attribut 'UnmanagedCallersOnly' n'est pas pris en charge.</target> <note /> </trans-unit> <trans-unit id="FEATURE_CallerArgumentExpression"> <source>caller argument expression</source> <target state="new">caller argument expression</target> <note /> </trans-unit> <trans-unit id="FEATURE_CommentsAfterLineContinuation"> <source>comments after line continuation</source> <target state="translated">commentaires après la continuation de la ligne</target> <note /> </trans-unit> <trans-unit id="FEATURE_InitOnlySettersUsage"> <source>assigning to or passing 'ByRef' properties with init-only setters</source> <target state="translated">affectation ou passage de propriétés 'ByRef' avec des méthodes setter d'initialisation uniquement</target> <note /> </trans-unit> <trans-unit id="FEATURE_UnconstrainedTypeParameterInConditional"> <source>unconstrained type parameters in binary conditional expressions</source> <target state="translated">paramètres de type sans contrainte dans les expressions conditionnelles binaires</target> <note /> </trans-unit> <trans-unit id="IDS_VBCHelp"> <source> Visual Basic Compiler Options - OUTPUT FILE - -out:&lt;file&gt; Specifies the output file name. -target:exe Create a console application (default). (Short form: -t) -target:winexe Create a Windows application. -target:library Create a library assembly. -target:module Create a module that can be added to an assembly. -target:appcontainerexe Create a Windows application that runs in AppContainer. -target:winmdobj Create a Windows Metadata intermediate file -doc[+|-] Generates XML documentation file. -doc:&lt;file&gt; Generates XML documentation file to &lt;file&gt;. -refout:&lt;file&gt; Reference assembly output to generate - INPUT FILES - -addmodule:&lt;file_list&gt; Reference metadata from the specified modules -link:&lt;file_list&gt; Embed metadata from the specified interop assembly. (Short form: -l) -recurse:&lt;wildcard&gt; Include all files in the current directory and subdirectories according to the wildcard specifications. -reference:&lt;file_list&gt; Reference metadata from the specified assembly. (Short form: -r) -analyzer:&lt;file_list&gt; Run the analyzers from this assembly (Short form: -a) -additionalfile:&lt;file list&gt; Additional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings. - RESOURCES - -linkresource:&lt;resinfo&gt; Links the specified file as an external assembly resource. resinfo:&lt;file&gt;[,&lt;name&gt;[,public|private]] (Short form: -linkres) -nowin32manifest The default manifest should not be embedded in the manifest section of the output PE. -resource:&lt;resinfo&gt; Adds the specified file as an embedded assembly resource. resinfo:&lt;file&gt;[,&lt;name&gt;[,public|private]] (Short form: -res) -win32icon:&lt;file&gt; Specifies a Win32 icon file (.ico) for the default Win32 resources. -win32manifest:&lt;file&gt; The provided file is embedded in the manifest section of the output PE. -win32resource:&lt;file&gt; Specifies a Win32 resource file (.res). - CODE GENERATION - -optimize[+|-] Enable optimizations. -removeintchecks[+|-] Remove integer checks. Default off. -debug[+|-] Emit debugging information. -debug:full Emit full debugging information (default). -debug:pdbonly Emit full debugging information. -debug:portable Emit cross-platform debugging information. -debug:embedded Emit cross-platform debugging information into the target .dll or .exe. -deterministic Produce a deterministic assembly (including module version GUID and timestamp) -refonly Produce a reference assembly in place of the main output -instrument:TestCoverage Produce an assembly instrumented to collect coverage information -sourcelink:&lt;file&gt; Source link info to embed into PDB. - ERRORS AND WARNINGS - -nowarn Disable all warnings. -nowarn:&lt;number_list&gt; Disable a list of individual warnings. -warnaserror[+|-] Treat all warnings as errors. -warnaserror[+|-]:&lt;number_list&gt; Treat a list of warnings as errors. -ruleset:&lt;file&gt; Specify a ruleset file that disables specific diagnostics. -errorlog:&lt;file&gt;[,version=&lt;sarif_version&gt;] Specify a file to log all compiler and analyzer diagnostics in SARIF format. sarif_version:{1|2|2.1} Default is 1. 2 and 2.1 both mean SARIF version 2.1.0. -reportanalyzer Report additional analyzer information, such as execution time. -skipanalyzers[+|-] Skip execution of diagnostic analyzers. - LANGUAGE - -define:&lt;symbol_list&gt; Declare global conditional compilation symbol(s). symbol_list:name=value,... (Short form: -d) -imports:&lt;import_list&gt; Declare global Imports for namespaces in referenced metadata files. import_list:namespace,... -langversion:? Display the allowed values for language version -langversion:&lt;string&gt; Specify language version such as `default` (latest major version), or `latest` (latest version, including minor versions), or specific versions like `14` or `15.3` -optionexplicit[+|-] Require explicit declaration of variables. -optioninfer[+|-] Allow type inference of variables. -rootnamespace:&lt;string&gt; Specifies the root Namespace for all type declarations. -optionstrict[+|-] Enforce strict language semantics. -optionstrict:custom Warn when strict language semantics are not respected. -optioncompare:binary Specifies binary-style string comparisons. This is the default. -optioncompare:text Specifies text-style string comparisons. - MISCELLANEOUS - -help Display this usage message. (Short form: -?) -noconfig Do not auto-include VBC.RSP file. -nologo Do not display compiler copyright banner. -quiet Quiet output mode. -verbose Display verbose messages. -parallel[+|-] Concurrent build. -version Display the compiler version number and exit. - ADVANCED - -baseaddress:&lt;number&gt; The base address for a library or module (hex). -checksumalgorithm:&lt;alg&gt; Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default). -codepage:&lt;number&gt; Specifies the codepage to use when opening source files. -delaysign[+|-] Delay-sign the assembly using only the public portion of the strong name key. -publicsign[+|-] Public-sign the assembly using only the public portion of the strong name key. -errorreport:&lt;string&gt; Specifies how to handle internal compiler errors; must be prompt, send, none, or queue (default). -filealign:&lt;number&gt; Specify the alignment used for output file sections. -highentropyva[+|-] Enable high-entropy ASLR. -keycontainer:&lt;string&gt; Specifies a strong name key container. -keyfile:&lt;file&gt; Specifies a strong name key file. -libpath:&lt;path_list&gt; List of directories to search for metadata references. (Semi-colon delimited.) -main:&lt;class&gt; Specifies the Class or Module that contains Sub Main. It can also be a Class that inherits from System.Windows.Forms.Form. (Short form: -m) -moduleassemblyname:&lt;string&gt; Name of the assembly which this module will be a part of. -netcf Target the .NET Compact Framework. -nostdlib Do not reference standard libraries (system.dll and VBC.RSP file). -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Specify a mapping for source path names output by the compiler. -platform:&lt;string&gt; Limit which platforms this code can run on; must be x86, x64, Itanium, arm, arm64 AnyCPU32BitPreferred or anycpu (default). -preferreduilang Specify the preferred output language name. -nosdkpath Disable searching the default SDK path for standard library assemblies. -sdkpath:&lt;path&gt; Location of the .NET Framework SDK directory (mscorlib.dll). -subsystemversion:&lt;version&gt; Specify subsystem version of the output PE. version:&lt;number&gt;[.&lt;number&gt;] -utf8output[+|-] Emit compiler output in UTF8 character encoding. @&lt;file&gt; Insert command-line settings from a text file -vbruntime[+|-|*] Compile with/without the default Visual Basic runtime. -vbruntime:&lt;file&gt; Compile with the alternate Visual Basic runtime in &lt;file&gt;. </source> <target state="translated"> Options du compilateur Visual Basic - FICHIER DE SORTIE - -out:&lt;fichier&gt; Spécifie le nom du fichier de sortie. -target:exe Créer une application console (par défaut). (Forme abrégée : -t) -target:winexe Créer une application Windows. -target:library Créer un assembly de bibliothèque. -target:module Créer un module qui peut être ajouté à un assembly. -target:appcontainerexe Créer une application Windows qui s'exécute dans AppContainer. -target:winmdobj Créer un fichier intermédiaire de métadonnées Windows -doc[+|-] Génère un fichier de documentation XML. -doc:&lt;fichier&gt; Génère un fichier de documentation XML dans &lt;fichier&gt;. -refout:&lt;fichier&gt; Sortie de l'assembly de référence à générer - FICHIERS D'ENTRÉE - -addmodule:&lt;liste_fichiers&gt; Référencer les métadonnées à partir des modules spécifiés -link:&lt;liste_fichiers&gt; Incorporer les métadonnées à partir de l'assembly d'interopérabilité spécifié. (Forme abrégée : -l) -recurse:&lt;générique&gt; Inclure tous les fichiers dans le répertoire et les sous-répertoires actifs en fonction des spécifications des caractères génériques. -reference:&lt;liste_fichiers&gt; Référencer les métadonnées à partir de l'assembly spécifié. (Forme abrégée : -r) -analyzer:&lt;liste_fichiers&gt; Exécuter les analyseurs à partir de cet assembly (Forme abrégée : -a) -additionalfile:&lt;liste_fichiers&gt; Fichiers supplémentaires qui n'affectent pas directement la génération de code mais qui peuvent être utilisés par les analyseurs pour produire des erreurs ou des avertissements. - RESSOURCES - -linkresource:&lt;resinfo&gt; Lie le fichier spécifié sous forme de ressource d'assembly externe. resinfo:&lt;fichier&gt;[,&lt;nom&gt;[,public|private]] (Forme abrégée : -linkres) -nowin32manifest Le manifeste par défaut ne doit pas être incorporé dans la section manifest du PE de sortie. -resource:&lt;resinfo&gt; Ajoute le fichier spécifié en tant que ressource d'assembly incorporée. resinfo:&lt;fichier&gt;[,&lt;nom&gt;[,public|private]] (Forme abrégée : -res) -win32icon:&lt;fichier&gt; Spécifie un fichier icône Win32 (.ico) pour les ressources Win32 par défaut. -win32manifest:&lt;fichier&gt; Le fichier fourni est incorporé dans la section manifest du PE de sortie. -win32resource:&lt;fichier&gt; Spécifie un fichier de ressources Win32 (.res). - GÉNÉRATION DE CODE - -optimize[+|-] Activer les optimisations. -removeintchecks[+|-] Supprimer les contrôles sur les entiers. La valeur par défaut est off. -debug[+|-] Émettre des informations de débogage. -debug:full Émettre des informations de débogage complètes (par défaut). -debug:pdbonly Émettre des informations de débogage complètes. -debug:portable Émettre des informations de débogage multiplateformes. -debug:embedded Émettre des informations de débogage multiplateformes dans le fichier .dll ou .exe cible. -deterministic Produire un assembly déterministe (en incluant le GUID et l'horodatage de la version du module) -refonly Produire un assembly de référence à la place de la sortie principale -instrument:TestCoverage Produire un assembly instrumenté pour collecter les informations de couverture -sourcelink:&lt;fichier&gt; Informations du lien source à incorporer dans le fichier PDB. - ERREURS ET AVERTISSEMENTS - -nowarn Désactiver tous les avertissements. -nowarn:&lt;liste_numéros&gt; Désactiver une liste d'avertissements individuels. -warnaserror[+|-] Traiter tous les avertissements comme des erreurs. -warnaserror[+|-]:&lt;liste_numéros&gt; Traiter une liste d'avertissements comme des erreurs. -ruleset:&lt;fichier&gt; Spécifier un fichier ruleset qui désactive des diagnostics spécifiques. -errorlog:&lt;fichier&gt;[,version=&lt;version_sarif&gt;] Spécifier un fichier pour journaliser tous les diagnostics du compilateur et de l'analyseur au format SARIF. version_sarif :{1|2|2.1} La valeur par défaut est 1. 2 et 2.1 Les deux signifient SARIF version 2.1.0. -reportanalyzer Signaler des informations supplémentaires sur l'analyseur, par exemple la durée d'exécution. -skipanalyzers[+|-] Ignorer l'exécution des analyseurs de diagnostic. - LANGAGE - -define:&lt;liste_symboles&gt; Déclarer des symboles de compilation conditionnelle globale. liste_symboles:name=value,... (Forme abrégée : -d) -imports:&lt;liste_importations&gt; Déclarer des importations globales pour les espaces de noms dans les fichiers de métadonnées référencés. liste_importations:namespace,... -langversion:? Afficher les valeurs autorisées pour la version du langage -langversion:&lt;chaîne&gt; Spécifier la version du langage, par exemple 'default' (dernière version principale) ou 'latest' (dernière version, en incluant les versions mineures), ou des versions spécifiques comme '14' ou '15.3' -optionexplicit[+|-] Imposer une déclaration explicite des variables. -optioninfer[+|-] Autoriser l'inférence de type des variables. -rootnamespace:&lt;chaîne&gt; Spécifie l'espace de noms racine pour toutes les déclarations de type. -optionstrict[+|-] Appliquer une sémantique stricte du langage. -optionstrict:custom Avertir quand la sémantique stricte du langage n'est pas respectée. -optioncompare:binary Spécifie des comparaisons de chaînes de style binaire. Il s'agit de la valeur par défaut. -optioncompare:text Spécifie des comparaisons de chaînes de style texte. - DIVERS - -help Afficher ce message d'utilisation. (Forme abrégée : -?) -noconfig Ne pas inclure automatiquement un fichier VBC.RSP. -nologo Ne pas afficher la bannière de copyright du compilateur. -quiet Mode de sortie silencieux. -verbose Afficher des messages documentés. -parallel[+|-] Build simultanée. -version Afficher le numéro de version du compilateur et quitter le processus. - AVANCÉ - -baseaddress:&lt;numéro&gt; Adresse de base d'une bibliothèque ou d'un module (en hexadécimal). -checksumalgorithm:&lt;alg&gt; Spécifier l'algorithme de calcul de la somme de contrôle de fichier source stockée dans le fichier PDB. Valeurs prises en charge : SHA1 ou SHA256 (par défaut). -codepage:&lt;numéro&gt; Spécifie la page de codes à utiliser à l'ouverture des fichiers sources. -delaysign[+|-] Différer la signature de l'assembly en utilisant uniquement la partie publique de la clé de nom fort. -publicsign[+|-] Signer publiquement l'assembly en utilisant uniquement la partie publique de la clé de nom fort. -errorreport:&lt;chaîne&gt; Spécifie comment prendre en charge les erreurs internes du compilateur ; doit avoir la valeur prompt, send, none ou queue (par défaut). -filealign:&lt;numéro&gt; Spécifier l'alignement utilisé pour les sections du fichier de sortie. -highentropyva[+|-] Activer la randomisation du format d'espace d'adresse d'entropie élevée. -keycontainer:&lt;chaîne&gt; Spécifie un conteneur de clé de nom fort. -keyfile:&lt;fichier&gt; Spécifie un fichier de clé de nom fort. -libpath:&lt;liste_chemins&gt; Liste de répertoires où rechercher des références de métadonnées. (Valeurs délimitées par des points-virgules.) -main:&lt;classe&gt; Spécifie la classe ou le module qui contient Sub Main. Il peut également s'agir d'une classe qui hérite de System.Windows.Forms.Form. (Forme abrégée : -m) -moduleassemblyname:&lt;chaîne&gt; Nom de l'assembly dont ce module doit faire partie. -netcf Cibler le .NET Compact Framework. -nostdlib Ne pas référencer les bibliothèques standard (fichiers system.dll et VBC.RSP). -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Spécifier un mappage pour les noms de chemins sources sortis par le compilateur. -platform:&lt;chaîne&gt; Limiter les plateformes sur lesquelles ce code peut s'exécuter ; doit correspondre à x86, x64, Itanium, arm, arm64 AnyCPU32BitPreferred ou anycpu (par défaut). -preferreduilang Spécifier le nom du langage de sortie préféré. -nosdkpath Désactivez la recherche du chemin du kit SDK par défaut pour les assemblys de bibliothèque standard. -sdkpath:&lt;chemin&gt; Emplacement du répertoire du SDK .NET Framework (mscorlib.dll). -subsystemversion:&lt;version&gt; Spécifier la version du sous-système du PE de sortie. version:&lt;numéro&gt;[.&lt;numéro&gt;] -utf8output[+|-] Émettre la sortie du compilateur au format d'encodage de caractères UTF8. @&lt;fichier&gt; Insérer les paramètres de ligne de commande à partir d'un fichier texte -vbruntime[+|-|*] Compiler avec/sans le runtime Visual Basic par défaut. -vbruntime:&lt;fichier&gt; Compiler avec le runtime Visual Basic de remplacement dans &lt;fichier&gt;. </target> <note /> </trans-unit> <trans-unit id="ThereAreNoFunctionPointerTypesInVB"> <source>There are no function pointer types in VB.</source> <target state="translated">Il n'existe aucun type de pointeur de fonction en VB.</target> <note /> </trans-unit> <trans-unit id="ThereAreNoNativeIntegerTypesInVB"> <source>There are no native integer types in VB.</source> <target state="translated">Il n'existe aucun type d'entier natif dans VB.</target> <note /> </trans-unit> <trans-unit id="Trees0"> <source>trees({0})</source> <target state="translated">arborescences({0})</target> <note /> </trans-unit> <trans-unit id="TreesMustHaveRootNode"> <source>trees({0}) must have root node with SyntaxKind.CompilationUnit.</source> <target state="translated">les arborescences({0}) doivent avoir un nœud racine avec SyntaxKind.CompilationUnit.</target> <note /> </trans-unit> <trans-unit id="CannotAddCompilerSpecialTree"> <source>Cannot add compiler special tree</source> <target state="translated">Impossible d'ajouter une arborescence spéciale du compilateur</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeAlreadyPresent"> <source>Syntax tree already present</source> <target state="translated">Arborescence de syntaxe déjà présente</target> <note /> </trans-unit> <trans-unit id="SubmissionCanHaveAtMostOneSyntaxTree"> <source>Submission can have at most one syntax tree.</source> <target state="translated">Une soumission peut avoir au plus une arborescence de syntaxe.</target> <note /> </trans-unit> <trans-unit id="CannotRemoveCompilerSpecialTree"> <source>Cannot remove compiler special tree</source> <target state="translated">Impossible de supprimer l'arborescence spéciale du compilateur</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeNotFoundToRemove"> <source>SyntaxTree '{0}' not found to remove</source> <target state="translated">SyntaxTree '{0}' à supprimer introuvable</target> <note /> </trans-unit> <trans-unit id="TreeMustHaveARootNodeWithCompilationUnit"> <source>Tree must have a root node with SyntaxKind.CompilationUnit</source> <target state="translated">L'arborescence doit avoir un nœud racine avec SyntaxKind.CompilationUnit</target> <note /> </trans-unit> <trans-unit id="CompilationVisualBasic"> <source>Compilation (Visual Basic): </source> <target state="translated">Compilation (Visual Basic) : </target> <note /> </trans-unit> <trans-unit id="NodeIsNotWithinSyntaxTree"> <source>Node is not within syntax tree</source> <target state="translated">Le nœud ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="CantReferenceCompilationFromTypes"> <source>Can't reference compilation of type '{0}' from {1} compilation.</source> <target state="translated">Impossible de référencer la compilation de type '{0}' à partir de la compilation {1}.</target> <note /> </trans-unit> <trans-unit id="PositionOfTypeParameterTooLarge"> <source>position of type parameter too large</source> <target state="translated">position du paramètre de type trop large</target> <note /> </trans-unit> <trans-unit id="AssociatedTypeDoesNotHaveTypeParameters"> <source>Associated type does not have type parameters</source> <target state="translated">Le type associé n'a pas de paramètres de type</target> <note /> </trans-unit> <trans-unit id="IDS_FunctionReturnType"> <source>function return type</source> <target state="translated">type de retour de la fonction</target> <note /> </trans-unit> <trans-unit id="TypeArgumentCannotBeNothing"> <source>Type argument cannot be Nothing</source> <target state="translated">L'argument de type ne peut pas être Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework"> <source>The assembly '{0}' containing type '{1}' references .NET Framework, which is not supported.</source> <target state="translated">L'assembly '{0}' contenant le type '{1}' référence le .NET Framework, ce qui n'est pas pris en charge.</target> <note>{1} is the type that was loaded, {0} is the containing assembly.</note> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework_Title"> <source>The loaded assembly references .NET Framework, which is not supported.</source> <target state="translated">L'assembly chargé référence le .NET Framework, ce qui n'est pas pris en charge.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration"> <source>Generator '{0}' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Le générateur '{0}' n'a pas pu générer la source. Dans la mesure où il ne va pas contribuer à la sortie, des erreurs de compilation peuvent se produire. Exception levée de type '{1}' avec le message '{2}'</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Le générateur a levé l'exception suivante : '{0}'.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Title"> <source>Generator failed to generate source.</source> <target state="translated">Le générateur n'a pas pu générer la source.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization"> <source>Generator '{0}' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Échec de l'initialisation du générateur '{0}'. Dans la mesure où il ne va pas contribuer à la sortie, des erreurs de compilation peuvent se produire. Exception levée de type '{1}' avec le message '{2}'</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Le générateur a levé l'exception suivante : '{0}'.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Title"> <source>Generator failed to initialize.</source> <target state="translated">Échec de l'initialisation du générateur.</target> <note /> </trans-unit> <trans-unit id="WrongNumberOfTypeArguments"> <source>Wrong number of type arguments</source> <target state="translated">Nombre incorrect d'arguments de type</target> <note /> </trans-unit> <trans-unit id="ERR_FileNotFound"> <source>file '{0}' could not be found</source> <target state="translated">le fichier '{0}' est introuvable</target> <note /> </trans-unit> <trans-unit id="ERR_NoResponseFile"> <source>unable to open response file '{0}'</source> <target state="translated">impossible d'ouvrir le fichier réponse '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentRequired"> <source>option '{0}' requires '{1}'</source> <target state="translated">l'option '{0}' requiert '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchNeedsBool"> <source>option '{0}' can be followed only by '+' or '-'</source> <target state="translated">l'option '{0}' ne peut être suivie que de '+' ou '-'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSwitchValue"> <source>the value '{1}' is invalid for option '{0}'</source> <target state="translated">la valeur '{1}' n'est pas valide pour l'option '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_MutuallyExclusiveOptions"> <source>Compilation options '{0}' and '{1}' can't both be specified at the same time.</source> <target state="translated">Les options de compilation '{0}' et '{1}' ne peuvent pas être spécifiées toutes les deux en même temps.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang"> <source>The language name '{0}' is invalid.</source> <target state="translated">Le nom de langue '{0}' n'est pas valide.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang_Title"> <source>The language name for /preferreduilang is invalid</source> <target state="translated">Le nom de langue pour /preferreduilang n’est pas valide</target> <note /> </trans-unit> <trans-unit id="ERR_VBCoreNetModuleConflict"> <source>The options /vbruntime* and /target:module cannot be combined.</source> <target state="translated">Les options /vbruntime* et /target:module ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatForGuidForOption"> <source>Command-line syntax error: Invalid Guid format '{0}' for option '{1}'</source> <target state="translated">Erreur de syntaxe de ligne de commande : format de Guid '{0}' non valide pour l'option '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MissingGuidForOption"> <source>Command-line syntax error: Missing Guid for option '{1}'</source> <target state="translated">Erreur de syntaxe de ligne de commande : Guid manquant pour l'option '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadChecksumAlgorithm"> <source>Algorithm '{0}' is not supported</source> <target state="translated">Algorithme '{0}' non pris en charge</target> <note /> </trans-unit> <trans-unit id="WRN_BadSwitch"> <source>unrecognized option '{0}'; ignored</source> <target state="translated">option '{0}' non reconnue ; ignorée</target> <note /> </trans-unit> <trans-unit id="WRN_BadSwitch_Title"> <source>Unrecognized command-line option</source> <target state="translated">Option de ligne de commande non reconnue</target> <note /> </trans-unit> <trans-unit id="ERR_NoSources"> <source>no input sources specified</source> <target state="translated">aucune source d'entrée spécifiée</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded"> <source>source file '{0}' specified multiple times</source> <target state="translated">fichier source '{0}' indiqué plusieurs fois</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded_Title"> <source>Source file specified multiple times</source> <target state="translated">Le fichier source a été spécifié plusieurs fois</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenFileWrite"> <source>can't open '{0}' for writing: {1}</source> <target state="translated">impossible d'ouvrir '{0}' en écriture : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadCodepage"> <source>code page '{0}' is invalid or not installed</source> <target state="translated">la page de '{0}' n'est pas correcte ou n'est pas installée</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryFile"> <source>the file '{0}' is not a text file</source> <target state="translated">le fichier '{0}' n'est pas un fichier texte</target> <note /> </trans-unit> <trans-unit id="ERR_LibNotFound"> <source>could not find library '{0}'</source> <target state="translated">impossible de trouver la bibliothèque '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataReferencesNotSupported"> <source>Metadata references not supported.</source> <target state="translated">Références de métadonnées non prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_IconFileAndWin32ResFile"> <source>cannot specify both /win32icon and /win32resource</source> <target state="translated">impossible de spécifier à la fois /win32icon et /win32resource</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigInResponseFile"> <source>ignoring /noconfig option because it was specified in a response file</source> <target state="translated">Option /noconfig ignorée, car elle était spécifiée dans un fichier réponse</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigInResponseFile_Title"> <source>Ignoring /noconfig option because it was specified in a response file</source> <target state="translated">Option /noconfig ignorée, car elle était spécifiée dans un fichier réponse</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidWarningId"> <source>warning number '{0}' for the option '{1}' is either not configurable or not valid</source> <target state="translated">le numéro d'avertissement '{0}' pour l'option '{1}' n'est pas configurable ou n'est pas valide</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidWarningId_Title"> <source>Warning number is either not configurable or not valid</source> <target state="translated">Le numéro d’avertissement n’est pas configurable ou valide</target> <note /> </trans-unit> <trans-unit id="ERR_NoSourcesOut"> <source>cannot infer an output file name from resource only input files; provide the '/out' option</source> <target state="translated">impossible de déduire le nom d'un fichier de sortie à partir de fichiers d'entrée de ressource uniquement ; fournissez l'option '/out'</target> <note /> </trans-unit> <trans-unit id="ERR_NeedModule"> <source>the /moduleassemblyname option may only be specified when building a target of type 'module'</source> <target state="translated">l'option /moduleassemblyname ne peut être spécifiée que lors de la génération d'une cible de type 'module'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyName"> <source>'{0}' is not a valid value for /moduleassemblyname</source> <target state="translated">'{0}' n'est pas une valeur valide pour /moduleassemblyname</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingManifestSwitches"> <source>Error embedding Win32 manifest: Option /win32manifest conflicts with /nowin32manifest.</source> <target state="translated">Erreur d'incorporation du manifeste Win32 : l'option /win32manifest est en conflit avec /nowin32manifest.</target> <note /> </trans-unit> <trans-unit id="WRN_IgnoreModuleManifest"> <source>Option /win32manifest ignored. It can be specified only when the target is an assembly.</source> <target state="translated">Option /win32manifest ignorée. Elle ne peut être spécifiée que lorsque la cible est un assembly.</target> <note /> </trans-unit> <trans-unit id="WRN_IgnoreModuleManifest_Title"> <source>Option /win32manifest ignored</source> <target state="translated">Option /win32manifest ignorée</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInNamespace"> <source>Statement is not valid in a namespace.</source> <target state="translated">Instruction non valide dans un espace de noms.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedType1"> <source>Type '{0}' is not defined.</source> <target state="translated">Le type '{0}' n'est pas défini.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNext"> <source>'Next' expected.</source> <target state="translated">'Next' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCharConstant"> <source>Character constant must contain exactly one character.</source> <target state="translated">Une constante caractère doit contenir exactement un caractère.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedAssemblyEvent3"> <source>Reference required to assembly '{0}' containing the definition for event '{1}'. Add one to your project.</source> <target state="translated">Une référence à l'assembly '{0}' contenant la définition de l'événement '{1}' est requise. Ajoutez-en une à votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedModuleEvent3"> <source>Reference required to module '{0}' containing the definition for event '{1}'. Add one to your project.</source> <target state="translated">Une référence au module '{0}' contenant la définition pour l'événement '{1}' est requise. Ajoutez-en une à votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_LbExpectedEndIf"> <source>'#If' block must end with a matching '#End If'.</source> <target state="translated">'Le bloc '#If' doit se terminer par un '#End If' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_LbNoMatchingIf"> <source>'#ElseIf', '#Else', or '#End If' must be preceded by a matching '#If'.</source> <target state="translated">'#ElseIf', '#Else' ou '#End If' doit être précédé d'un '#If' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_LbBadElseif"> <source>'#ElseIf' must be preceded by a matching '#If' or '#ElseIf'.</source> <target state="translated">'#ElseIf' doit être précédé d'un '#If' ou '#ElseIf' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromRestrictedType1"> <source>Inheriting from '{0}' is not valid.</source> <target state="translated">L'héritage de '{0}' n'est pas valide.</target> <note /> </trans-unit> <trans-unit id="ERR_InvOutsideProc"> <source>Labels are not valid outside methods.</source> <target state="translated">Les étiquettes ne sont pas valides en dehors des méthodes.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateCantImplement"> <source>Delegates cannot implement interface methods.</source> <target state="translated">Les délégués ne peuvent pas implémenter des méthodes d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateCantHandleEvents"> <source>Delegates cannot handle events.</source> <target state="translated">Les délégués ne peuvent pas gérer les événements.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorRequiresReferenceTypes1"> <source>'Is' operator does not accept operands of type '{0}'. Operands must be reference or nullable types.</source> <target state="translated">'L'opérateur 'Is' n'accepte pas d'opérandes de type '{0}'. Les opérandes doivent être de types référence ou Nullable.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOfRequiresReferenceType1"> <source>'TypeOf ... Is' requires its left operand to have a reference type, but this operand has the value type '{0}'.</source> <target state="translated">'TypeOf ... Is' requiert un opérande gauche ayant un type référence, mais cet opérande a le type valeur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyHasSet"> <source>Properties declared 'ReadOnly' cannot have a 'Set'.</source> <target state="translated">Les propriétés déclarées 'ReadOnly' ne peuvent pas avoir de 'Set'.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyHasGet"> <source>Properties declared 'WriteOnly' cannot have a 'Get'.</source> <target state="translated">Les propriétés déclarées 'WriteOnly' ne peuvent pas avoir de 'Get'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideProc"> <source>Statement is not valid inside a method.</source> <target state="translated">Instruction non valide dans une méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideBlock"> <source>Statement is not valid inside '{0}' block.</source> <target state="translated">Instruction non valide dans un bloc '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedExpressionStatement"> <source>Expression statement is only allowed at the end of an interactive submission.</source> <target state="translated">L'instruction d'expression est autorisée uniquement à la fin d'un envoi interactif.</target> <note /> </trans-unit> <trans-unit id="ERR_EndProp"> <source>Property missing 'End Property'.</source> <target state="translated">End Property' manquant dans la propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSubExpected"> <source>'End Sub' expected.</source> <target state="translated">'End Sub' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_EndFunctionExpected"> <source>'End Function' expected.</source> <target state="translated">'End Function' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_LbElseNoMatchingIf"> <source>'#Else' must be preceded by a matching '#If' or '#ElseIf'.</source> <target state="translated">'#Else' doit être précédé d'un '#If' ou '#ElseIf' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_CantRaiseBaseEvent"> <source>Derived classes cannot raise base class events.</source> <target state="translated">Les classes dérivées ne peuvent pas déclencher les événements de la classe de base.</target> <note /> </trans-unit> <trans-unit id="ERR_TryWithoutCatchOrFinally"> <source>Try must have at least one 'Catch' or a 'Finally'.</source> <target state="translated">Try doit utiliser au moins un 'Catch' ou 'Finally'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventsCantBeFunctions"> <source>Events cannot have a return type.</source> <target state="translated">Les événements ne peuvent pas avoir de type de retour.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndBrack"> <source>Bracketed identifier is missing closing ']'.</source> <target state="translated">Crochet fermant manquant (']') pour l'identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_Syntax"> <source>Syntax error.</source> <target state="translated">Erreur de syntaxe.</target> <note /> </trans-unit> <trans-unit id="ERR_Overflow"> <source>Overflow.</source> <target state="translated">Dépassement de capacité.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalChar"> <source>Character is not valid.</source> <target state="translated">Caractère non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_StdInOptionProvidedButConsoleInputIsNotRedirected"> <source>stdin argument '-' is specified, but input has not been redirected from the standard input stream.</source> <target state="translated">L'argument stdin '-' est spécifié, mais l'entrée n'a pas été redirigée à partir du flux d'entrée standard.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsObjectOperand1"> <source>Option Strict On prohibits operands of type Object for operator '{0}'.</source> <target state="translated">Option Strict On interdit les opérandes de type Object pour l'opérateur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopControlMustNotBeProperty"> <source>Loop control variable cannot be a property or a late-bound indexed array.</source> <target state="translated">Une variable de contrôle de boucle ne peut pas être une propriété ni un tableau indexé à liaison tardive.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodBodyNotAtLineStart"> <source>First statement of a method body cannot be on the same line as the method declaration.</source> <target state="translated">La première instruction d'un corps de méthode ne peut pas se trouver sur la même ligne que la déclaration de la méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_MaximumNumberOfErrors"> <source>Maximum number of errors has been exceeded.</source> <target state="translated">Le nombre maximal d'erreurs est dépassé.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordNotInInstanceMethod1"> <source>'{0}' is valid only within an instance method.</source> <target state="translated">'{0}' est valide uniquement dans une méthode d'instance.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordFromStructure1"> <source>'{0}' is not valid within a structure.</source> <target state="translated">'{0}' n'est pas valide dans une structure.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeConstructor1"> <source>Attribute constructor has a parameter of type '{0}', which is not an integral, floating-point or Enum type or one of Object, Char, String, Boolean, System.Type or 1-dimensional array of these types.</source> <target state="translated">Le constructeur d'attribut a un paramètre de type '{0}', qui n'est pas un type intégral, virgule flottante ni Enum, ni encore Object, Char, String, Boolean, System.Type ou un tableau unidimensionnel de ces types.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayWithOptArgs"> <source>Method cannot have both a ParamArray and Optional parameters.</source> <target state="translated">La méthode ne peut pas comporter simultanément des paramètres ParamArray et Optional.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedArray1"> <source>'{0}' statement requires an array.</source> <target state="translated">'L'instruction '{0}' requiert un tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayNotArray"> <source>ParamArray parameter must be an array.</source> <target state="translated">Le paramètre ParamArray doit être un tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayRank"> <source>ParamArray parameter must be a one-dimensional array.</source> <target state="translated">Le paramètre ParamArray doit être un tableau unidimensionnel.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayRankLimit"> <source>Array exceeds the limit of 32 dimensions.</source> <target state="translated">Le tableau dépasse le nombre de 32 dimensions autorisées.</target> <note /> </trans-unit> <trans-unit id="ERR_AsNewArray"> <source>Arrays cannot be declared with 'New'.</source> <target state="translated">Les tableaux ne peuvent pas être déclarés avec 'New'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs1"> <source>Too many arguments to '{0}'.</source> <target state="translated">Arguments trop nombreux pour '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedCase"> <source>Statements and labels are not valid between 'Select Case' and first 'Case'.</source> <target state="translated">Instructions et étiquettes non valides entre 'Select Case' et la première occurrence de 'Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredConstExpr"> <source>Constant expression is required.</source> <target state="translated">Une expression constante est requise.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredConstConversion2"> <source>Conversion from '{0}' to '{1}' cannot occur in a constant expression.</source> <target state="translated">Une conversion de '{0}' en '{1}' ne peut pas avoir lieu dans une expression constante.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMe"> <source>'Me' cannot be the target of an assignment.</source> <target state="translated">'Me' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyAssignment"> <source>'ReadOnly' variable cannot be the target of an assignment.</source> <target state="translated">'Une variable 'ReadOnly' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitSubOfFunc"> <source>'Exit Sub' is not valid in a Function or Property.</source> <target state="translated">'Exit Sub' n'est pas valide dans un Function ni un Property.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitPropNot"> <source>'Exit Property' is not valid in a Function or Sub.</source> <target state="translated">'Exit Property' n'est pas valide dans un Function ni un Sub.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitFuncOfSub"> <source>'Exit Function' is not valid in a Sub or Property.</source> <target state="translated">'Exit Function' n'est pas valide dans un Sub ni un Property.</target> <note /> </trans-unit> <trans-unit id="ERR_LValueRequired"> <source>Expression is a value and therefore cannot be the target of an assignment.</source> <target state="translated">Cette expression est une valeur et ne peut donc pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_ForIndexInUse1"> <source>For loop control variable '{0}' already in use by an enclosing For loop.</source> <target state="translated">Variable de contrôle de boucle For '{0}' déjà utilisée par une boucle For englobante.</target> <note /> </trans-unit> <trans-unit id="ERR_NextForMismatch1"> <source>Next control variable does not match For loop control variable '{0}'.</source> <target state="translated">La variable de contrôle Next ne correspond pas à la variable de contrôle de boucle For '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseElseNoSelect"> <source>'Case Else' can only appear inside a 'Select Case' statement.</source> <target state="translated">'Case Else' ne peut apparaître qu'à l'intérieur d'une instruction 'Select Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseNoSelect"> <source>'Case' can only appear inside a 'Select Case' statement.</source> <target state="translated">'Case' ne peut apparaître qu'à l'intérieur d'une instruction 'Select Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantAssignToConst"> <source>Constant cannot be the target of an assignment.</source> <target state="translated">Une constante ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedSubscript"> <source>Named arguments are not valid as array subscripts.</source> <target state="translated">Les arguments nommés ne sont pas valides en tant qu'indices de tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndIf"> <source>'If' must end with a matching 'End If'.</source> <target state="translated">'If' doit se terminer par un 'End If' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndWhile"> <source>'While' must end with a matching 'End While'.</source> <target state="translated">'While' doit se terminer par un 'End While' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLoop"> <source>'Do' must end with a matching 'Loop'.</source> <target state="translated">'Do' doit se terminer par un 'Loop' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNext"> <source>'For' must end with a matching 'Next'.</source> <target state="translated">'For' doit se terminer par un 'Next' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndWith"> <source>'With' must end with a matching 'End With'.</source> <target state="translated">'With' doit se terminer par un 'End With' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseNoMatchingIf"> <source>'Else' must be preceded by a matching 'If' or 'ElseIf'.</source> <target state="translated">'Else' doit être précédé d'un 'If' ou 'ElseIf' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndIfNoMatchingIf"> <source>'End If' must be preceded by a matching 'If'.</source> <target state="translated">'End If' doit être précédé d'un 'If' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSelectNoSelect"> <source>'End Select' must be preceded by a matching 'Select Case'.</source> <target state="translated">'End Select' doit être précédé d'un 'Select Case' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitDoNotWithinDo"> <source>'Exit Do' can only appear inside a 'Do' statement.</source> <target state="translated">'Exit Do' ne peut s'utiliser qu'à l'intérieur d'une instruction 'Do'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndWhileNoWhile"> <source>'End While' must be preceded by a matching 'While'.</source> <target state="translated">'End While' doit être précédé d'un 'While' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopNoMatchingDo"> <source>'Loop' must be preceded by a matching 'Do'.</source> <target state="translated">'Loop' doit être précédé d'un 'Do' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NextNoMatchingFor"> <source>'Next' must be preceded by a matching 'For'.</source> <target state="translated">'Next' doit être précédé d'un 'For' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndWithWithoutWith"> <source>'End With' must be preceded by a matching 'With'.</source> <target state="translated">'End With' doit être précédé d'un 'With' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefined1"> <source>Label '{0}' is already defined in the current method.</source> <target state="translated">L'étiquette '{0}' est déjà définie dans la méthode actuelle.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndSelect"> <source>'Select Case' must end with a matching 'End Select'.</source> <target state="translated">'Select Case' doit se terminer par un 'End Select' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitForNotWithinFor"> <source>'Exit For' can only appear inside a 'For' statement.</source> <target state="translated">'Exit For' ne peut apparaître qu'à l'intérieur d'une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitWhileNotWithinWhile"> <source>'Exit While' can only appear inside a 'While' statement.</source> <target state="translated">'Exit While' ne peut apparaître qu'à l'intérieur d'une instruction 'While'.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyProperty1"> <source>'ReadOnly' property '{0}' cannot be the target of an assignment.</source> <target state="translated">'La propriété 'ReadOnly' '{0}' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitSelectNotWithinSelect"> <source>'Exit Select' can only appear inside a 'Select' statement.</source> <target state="translated">'Exit Select' ne peut apparaître qu'à l'intérieur d'une instruction 'Select'.</target> <note /> </trans-unit> <trans-unit id="ERR_BranchOutOfFinally"> <source>Branching out of a 'Finally' is not valid.</source> <target state="translated">La création d'une branche en dehors d'un 'Finally' n'est pas valide.</target> <note /> </trans-unit> <trans-unit id="ERR_QualNotObjectRecord1"> <source>'!' requires its left operand to have a type parameter, class or interface type, but this operand has the type '{0}'.</source> <target state="translated">'!' requiert un opérande gauche ayant un paramètre de type, un type de classe ou d'interface, mais cet opérande a le type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewIndices"> <source>Number of indices is less than the number of dimensions of the indexed array.</source> <target state="translated">Le nombre d'index est inférieur au nombre de dimensions du tableau indexé.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyIndices"> <source>Number of indices exceeds the number of dimensions of the indexed array.</source> <target state="translated">Le nombre d'index est supérieur au nombre de dimensions du tableau indexé.</target> <note /> </trans-unit> <trans-unit id="ERR_EnumNotExpression1"> <source>'{0}' is an Enum type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type Enum et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeNotExpression1"> <source>'{0}' is a type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassNotExpression1"> <source>'{0}' is a class type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type classe et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureNotExpression1"> <source>'{0}' is a structure type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type structure et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNotExpression1"> <source>'{0}' is an interface type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type interface et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotExpression1"> <source>'{0}' is a namespace and cannot be used as an expression.</source> <target state="translated">'{0}' est un espace de noms et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamespaceName1"> <source>'{0}' is not a valid name and cannot be used as the root namespace name.</source> <target state="translated">'{0}' n'est pas un nom valide et ne peut pas être utilisé comme nom d'espace de noms racine.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlPrefixNotExpression"> <source>'{0}' is an XML prefix and cannot be used as an expression. Use the GetXmlNamespace operator to create a namespace object.</source> <target state="translated">'{0}' est un préfixe XML et ne peut pas être utilisé comme expression. Utilisez l'opérateur GetXmlNamespace pour créer un objet namespace.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleExtends"> <source>'Inherits' can appear only once within a 'Class' statement and can only specify one class.</source> <target state="translated">'Inherits' ne peut apparaître qu'une seule fois dans une instruction 'Class' et ne peut spécifier qu'une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_PropMustHaveGetSet"> <source>Property without a 'ReadOnly' or 'WriteOnly' specifier must provide both a 'Get' and a 'Set'.</source> <target state="translated">Une propriété sans spécificateur 'ReadOnly' ou 'WriteOnly' doit fournir un 'Get' et un 'Set'.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyHasNoWrite"> <source>'WriteOnly' property must provide a 'Set'.</source> <target state="translated">'Une propriété 'WriteOnly' doit fournir un 'Set'.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyHasNoGet"> <source>'ReadOnly' property must provide a 'Get'.</source> <target state="translated">'Une propriété 'ReadOnly' doit fournir un 'Get'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttribute1"> <source>Attribute '{0}' is not valid: Incorrect argument value.</source> <target state="translated">L'attribut '{0}' n'est pas valide : valeur d'argument incorrecte.</target> <note /> </trans-unit> <trans-unit id="ERR_LabelNotDefined1"> <source>Label '{0}' is not defined.</source> <target state="translated">L'étiquette '{0}' n'est pas définie.</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorCreatingWin32ResourceFile"> <source>Error creating Win32 resources: {0}</source> <target state="translated">Erreur lors de la création de ressources Win32 : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToCreateTempFile"> <source>Cannot create temporary file: {0}</source> <target state="translated">Impossible de créer le fichier temporaire : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNewCall2"> <source>First statement of this 'Sub New' must be a call to 'MyBase.New' or 'MyClass.New' because base class '{0}' of '{1}' does not have an accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel à 'MyBase.New' ou 'MyClass.New', car la classe de base '{0}' de '{1}' n'a pas de 'Sub New' accessible qu'il est possible d'appeler sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedMember3"> <source>{0} '{1}' must implement '{2}' for interface '{3}'.</source> <target state="translated">{0} '{1}' doit implémenter '{2}' pour l'interface '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWithRef"> <source>Leading '.' or '!' can only appear inside a 'With' statement.</source> <target state="translated">Un '.' ou '!' de début ne peut apparaître que dans une instruction 'With'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAccessCategoryUsed"> <source>Only one of 'Public', 'Private', 'Protected', 'Friend', 'Protected Friend', or 'Private Protected' can be specified.</source> <target state="translated">Vous pouvez spécifier uniquement une instance de type 'Public', 'Private', 'Protected', 'Friend', 'Protected Friend' ou 'Private Protected'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateModifierCategoryUsed"> <source>Only one of 'NotOverridable', 'MustOverride', or 'Overridable' can be specified.</source> <target state="translated">Vous pouvez spécifier uniquement une instance de type 'NotOverridable', 'MustOverride' ou 'Overridable'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateSpecifier"> <source>Specifier is duplicated.</source> <target state="translated">Spécificateur en double.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeConflict6"> <source>{0} '{1}' and {2} '{3}' conflict in {4} '{5}'.</source> <target state="translated">{0} '{1}' et {2} '{3}' sont en conflit dans {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedTypeKeyword"> <source>Keyword does not name a type.</source> <target state="translated">Le mot clé ne désigne pas un type.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtraSpecifiers"> <source>Specifiers valid only at the beginning of a declaration.</source> <target state="translated">Les spécificateurs sont valides uniquement au début d'une déclaration.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedType"> <source>Type expected.</source> <target state="translated">Type attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUseOfKeyword"> <source>Keyword is not valid as an identifier.</source> <target state="translated">Mot clé non valide en tant qu'identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndEnum"> <source>'End Enum' must be preceded by a matching 'Enum'.</source> <target state="translated">'End Enum' doit être précédé d'un 'Enum' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndEnum"> <source>'Enum' must end with a matching 'End Enum'.</source> <target state="translated">'Enum' doit se terminer par un 'End Enum' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDeclaration"> <source>Declaration expected.</source> <target state="translated">Déclaration attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayMustBeLast"> <source>End of parameter list expected. Cannot define parameters after a paramarray parameter.</source> <target state="translated">Fin de liste de paramètres attendue. Impossible de définir des paramètres après un paramètre paramarray.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecifiersInvalidOnInheritsImplOpt"> <source>Specifiers and attributes are not valid on this statement.</source> <target state="translated">Les spécificateurs et les attributs ne sont pas valides pour cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSpecifier"> <source>Expected one of 'Dim', 'Const', 'Public', 'Private', 'Protected', 'Friend', 'Shadows', 'ReadOnly' or 'Shared'.</source> <target state="translated">Dim', 'Const', 'Public', 'Private', 'Protected', 'Friend', 'Shadows', 'ReadOnly' ou 'Shared' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedComma"> <source>Comma expected.</source> <target state="translated">Virgule attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAs"> <source>'As' expected.</source> <target state="translated">'As' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRparen"> <source>')' expected.</source> <target state="translated">')' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLparen"> <source>'(' expected.</source> <target state="translated">'(' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNewInType"> <source>'New' is not valid in this context.</source> <target state="translated">'New' n'est pas valide dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedExpression"> <source>Expression expected.</source> <target state="translated">Expression attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOptional"> <source>'Optional' expected.</source> <target state="translated">'Optional' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIdentifier"> <source>Identifier expected.</source> <target state="translated">Identificateur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIntLiteral"> <source>Integer constant expected.</source> <target state="translated">Constante Integer attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEOS"> <source>End of statement expected.</source> <target state="translated">Fin d'instruction attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedForOptionStmt"> <source>'Option' must be followed by 'Compare', 'Explicit', 'Infer', or 'Strict'.</source> <target state="translated">'Option' doit être suivi de 'Compare', 'Explicit', 'Infer' ou 'Strict'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionCompare"> <source>'Option Compare' must be followed by 'Text' or 'Binary'.</source> <target state="translated">'Option Compare' doit être suivi de 'Text' ou 'Binary'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOptionCompare"> <source>'Compare' expected.</source> <target state="translated">'Compare' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowImplicitObject"> <source>Option Strict On requires all variable declarations to have an 'As' clause.</source> <target state="translated">Toutes les déclarations de variable de Option Strict On requièrent une clause 'As'.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsImplicitProc"> <source>Option Strict On requires all Function, Property, and Operator declarations to have an 'As' clause.</source> <target state="translated">Toutes les déclarations Function, Property et Operator de Option Strict On requièrent une clause 'As'.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsImplicitArgs"> <source>Option Strict On requires that all method parameters have an 'As' clause.</source> <target state="translated">Tous les paramètres de méthode de Option Strict On requièrent une clause 'As'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidParameterSyntax"> <source>Comma or ')' expected.</source> <target state="translated">Virgule ou ')' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSubFunction"> <source>'Sub' or 'Function' expected.</source> <target state="translated">'Sub' ou 'Function' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedStringLiteral"> <source>String constant expected.</source> <target state="translated">Constante de chaîne attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingLibInDeclare"> <source>'Lib' expected.</source> <target state="translated">'Lib' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateNoInvoke1"> <source>Delegate class '{0}' has no Invoke method, so an expression of this type cannot be the target of a method call.</source> <target state="translated">La classe déléguée '{0}' n'a pas de méthode Invoke, c'est pourquoi une expression de ce type ne peut pas être la cible d'un appel de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingIsInTypeOf"> <source>'Is' expected.</source> <target state="translated">'Is' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateOption1"> <source>'Option {0}' statement can only appear once per file.</source> <target state="translated">'Une instruction 'Option {0}' ne peut apparaître qu'une seule fois par fichier.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantInherit"> <source>'Inherits' not valid in Modules.</source> <target state="translated">'Inherits' n'est pas valide dans les modules.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantImplement"> <source>'Implements' not valid in Modules.</source> <target state="translated">'Implements' n'est pas valide dans les modules.</target> <note /> </trans-unit> <trans-unit id="ERR_BadImplementsType"> <source>Implemented type must be an interface.</source> <target state="translated">Le type implémenté doit être une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstFlags1"> <source>'{0}' is not valid on a constant declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de constante.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWithEventsFlags1"> <source>'{0}' is not valid on a WithEvents declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration WithEvents.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDimFlags1"> <source>'{0}' is not valid on a member variable declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de variable membre.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParamName1"> <source>Parameter already declared with name '{0}'.</source> <target state="translated">Paramètre déjà déclaré avec le nom '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopDoubleCondition"> <source>'Loop' cannot have a condition if matching 'Do' has one.</source> <target state="translated">'Loop' ne peut pas avoir de condition si le 'Do' correspondant en a une.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRelational"> <source>Relational operator expected.</source> <target state="translated">Opérateur relationnel attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedExitKind"> <source>'Exit' must be followed by 'Sub', 'Function', 'Property', 'Do', 'For', 'While', 'Select', or 'Try'.</source> <target state="translated">'Exit' doit être suivi de 'Sub', 'Function', 'Property', 'Do', 'For', 'While', 'Select' ou 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNamedArgumentInAttributeList"> <source>Named argument expected.</source> <target state="translated">Argument nommé attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentSpecificationBeforeFixedArgumentInLateboundInvocation"> <source>Named argument specifications must appear after all fixed arguments have been specified in a late bound invocation.</source> <target state="translated">Les spécifications d'argument nommé doivent s'afficher après la spécification de tous les arguments fixes dans un appel avec liaison tardive.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNamedArgument"> <source>Named argument expected. Please use language version {0} or greater to use non-trailing named arguments.</source> <target state="translated">Argument nommé attendu. Utilisez la version de langage {0} ou une version ultérieure pour permettre l'emploi d'arguments nommés non placés en position de fin.</target> <note /> </trans-unit> <trans-unit id="ERR_BadMethodFlags1"> <source>'{0}' is not valid on a method declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEventFlags1"> <source>'{0}' is not valid on an event declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration event.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDeclareFlags1"> <source>'{0}' is not valid on a Declare.</source> <target state="translated">'{0}' n'est pas valide dans un Declare.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLocalConstFlags1"> <source>'{0}' is not valid on a local constant declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de constante locale.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLocalDimFlags1"> <source>'{0}' is not valid on a local variable declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de variable locale.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedConditionalDirective"> <source>'If', 'ElseIf', 'Else', 'Const', 'Region', 'ExternalSource', 'ExternalChecksum', 'Enable', 'Disable', 'End' or 'R' expected.</source> <target state="translated">'If', 'ElseIf', 'Else', 'Const', 'Region', 'ExternalSource', 'ExternalChecksum', 'Enable', 'Disable', 'End' ou 'R' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEQ"> <source>'=' expected.</source> <target state="translated">'=' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorNotFound1"> <source>Type '{0}' has no constructors.</source> <target state="translated">Le type '{0}' n'a aucun constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndInterface"> <source>'End Interface' must be preceded by a matching 'Interface'.</source> <target state="translated">'End Interface' doit être précédé d'un 'Interface' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndInterface"> <source>'Interface' must end with a matching 'End Interface'.</source> <target state="translated">'Interface' doit se terminer par un 'End Interface' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFrom2"> <source> '{0}' inherits from '{1}'.</source> <target state="translated"> '{0}' hérite de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNestedIn2"> <source> '{0}' is nested in '{1}'.</source> <target state="translated"> '{0}' est imbriqué dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceCycle1"> <source>Class '{0}' cannot inherit from itself: {1}</source> <target state="translated">La classe '{0}' ne peut pas hériter d'elle-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromNonClass"> <source>Classes can inherit only from other classes.</source> <target state="translated">Les classes ne peuvent hériter que d'autres classes.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefinedType3"> <source>'{0}' is already declared as '{1}' in this {2}.</source> <target state="translated">'{0}' est déjà déclaré en tant que '{1}' dans ce {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadOverrideAccess2"> <source>'{0}' cannot override '{1}' because they have different access levels.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car elles ont des niveaux d'accès différents.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNotOverridable2"> <source>'{0}' cannot override '{1}' because it is declared 'NotOverridable'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car il est déclaré 'NotOverridable'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateProcDef1"> <source>'{0}' has multiple definitions with identical signatures.</source> <target state="translated">'{0}' a plusieurs définitions comportant des signatures identiques.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateProcDefWithDifferentTupleNames2"> <source>'{0}' has multiple definitions with identical signatures with different tuple element names, including '{1}'.</source> <target state="translated">'{0}' a plusieurs définitions comportant des signatures identiques avec des noms d'éléments tuples différents, notamment '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceMethodFlags1"> <source>'{0}' is not valid on an interface method declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de méthode d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound2"> <source>'{0}' is not a parameter of '{1}'.</source> <target state="translated">'{0}' n'est pas un paramètre de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfacePropertyFlags1"> <source>'{0}' is not valid on an interface property declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de propriété d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice2"> <source>Parameter '{0}' of '{1}' already has a matching argument.</source> <target state="translated">Le paramètre '{0}' de '{1}' a déjà un argument correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceCantUseEventSpecifier1"> <source>'{0}' is not valid on an interface event declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration event d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_TypecharNoMatch2"> <source>Type character '{0}' does not match declared data type '{1}'.</source> <target state="translated">Le caractère de type '{0}' ne correspond pas au type de données déclaré '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSubOrFunction"> <source>'Sub' or 'Function' expected after 'Delegate'.</source> <target state="translated">'Sub' ou 'Function' attendu après 'Delegate'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmptyEnum1"> <source>Enum '{0}' must contain at least one member.</source> <target state="translated">Enum '{0}' doit contenir au moins un membre.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidConstructorCall"> <source>Constructor call is valid only as the first statement in an instance constructor.</source> <target state="translated">Un appel à un constructeur est valide uniquement en tant que première instruction dans un constructeur d'instance.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideConstructor"> <source>'Sub New' cannot be declared 'Overrides'.</source> <target state="translated">'Sub New' ne peut pas être déclaré 'Overrides'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorCannotBeDeclaredPartial"> <source>'Sub New' cannot be declared 'Partial'.</source> <target state="translated">'Sub New' ne peut pas être déclaré 'Partial'.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleEmitFailure"> <source>Failed to emit module '{0}': {1}</source> <target state="translated">Échec de l'émission du module '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_EncUpdateFailedMissingAttribute"> <source>Cannot update '{0}'; attribute '{1}' is missing.</source> <target state="translated">Impossible de mettre à jour '{0}' ; l'attribut '{1}' est manquant.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideNotNeeded3"> <source>{0} '{1}' cannot be declared 'Overrides' because it does not override a {0} in a base class.</source> <target state="translated">{0} '{1}' ne peut pas être déclaré 'Overrides', car il ne se substitue pas à un {0} dans une classe de base.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDot"> <source>'.' expected.</source> <target state="translated">'.' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocals1"> <source>Local variable '{0}' is already declared in the current block.</source> <target state="translated">La variable locale '{0}' est déjà déclarée dans le bloc actuel.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsProc"> <source>Statement cannot appear within a method body. End of method assumed.</source> <target state="translated">Cette instruction ne peut pas apparaître dans le corps de méthode. Elle est interprétée comme la fin de la méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalSameAsFunc"> <source>Local variable cannot have the same name as the function containing it.</source> <target state="translated">Une variable locale ne peut pas avoir le même nom que la fonction qui la contient.</target> <note /> </trans-unit> <trans-unit id="ERR_RecordEmbeds2"> <source> '{0}' contains '{1}' (variable '{2}').</source> <target state="translated"> '{0}' contient '{1}' (variable '{2}').</target> <note /> </trans-unit> <trans-unit id="ERR_RecordCycle2"> <source>Structure '{0}' cannot contain an instance of itself: {1}</source> <target state="translated">La structure '{0}' ne peut pas contenir une instance d'elle-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceCycle1"> <source>Interface '{0}' cannot inherit from itself: {1}</source> <target state="translated">L'interface '{0}' ne peut pas hériter d'elle-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SubNewCycle2"> <source> '{0}' calls '{1}'.</source> <target state="translated"> '{0}' appelle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SubNewCycle1"> <source>Constructor '{0}' cannot call itself: {1}</source> <target state="translated">Le constructeur '{0}' ne peut pas s'appeler lui-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromCantInherit3"> <source>'{0}' cannot inherit from {2} '{1}' because '{1}' is declared 'NotInheritable'.</source> <target state="translated">'{0}' ne peut pas hériter de {2} '{1}', car '{1}' est déclaré 'NotInheritable'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithOptional2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by optional parameters.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seuls les paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithReturnType2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by return types.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seuls les types de retour les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharWithType1"> <source>Type character '{0}' cannot be used in a declaration with an explicit type.</source> <target state="translated">Le caractère de type '{0}' ne peut pas être utilisé dans une déclaration avec un type explicite.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnSub"> <source>Type character cannot be used in a 'Sub' declaration because a 'Sub' doesn't return a value.</source> <target state="translated">Un caractère de type ne peut pas être utilisé dans une déclaration 'Sub', car un 'Sub' ne retourne pas de valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithDefault2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by the default values of optional parameters.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seules les valeurs par défaut des paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingSubscript"> <source>Array subscript expression missing.</source> <target state="translated">Expression d'indice de tableau manquante.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithDefault2"> <source>'{0}' cannot override '{1}' because they differ by the default values of optional parameters.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car seules les valeurs par défaut des paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithOptional2"> <source>'{0}' cannot override '{1}' because they differ by optional parameters.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car les paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldOfValueFieldOfMarshalByRef3"> <source>Cannot refer to '{0}' because it is a member of the value-typed field '{1}' of class '{2}' which has 'System.MarshalByRefObject' as a base class.</source> <target state="translated">Impossible de faire référence à '{0}', car il est membre du champ de valeurs '{1}' de la classe '{2}', qui a 'System.MarshalByRefObject' comme classe de base.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMismatch2"> <source>Value of type '{0}' cannot be converted to '{1}'.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseAfterCaseElse"> <source>'Case' cannot follow a 'Case Else' in the same 'Select' statement.</source> <target state="translated">'Case' ne peut pas suivre 'Case Else' dans la même instruction 'Select'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertArrayMismatch4"> <source>Value of type '{0}' cannot be converted to '{1}' because '{2}' is not derived from '{3}'.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}', car '{2}' n'est pas dérivé de '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertObjectArrayMismatch3"> <source>Value of type '{0}' cannot be converted to '{1}' because '{2}' is not a reference type.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}', car '{2}' n'est pas un type référence.</target> <note /> </trans-unit> <trans-unit id="ERR_ForLoopType1"> <source>'For' loop control variable cannot be of type '{0}' because the type does not support the required operators.</source> <target state="translated">'La variable de contrôle de boucle 'For' ne peut pas être de type '{0}', car le type ne prend pas en charge les opérateurs requis.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithByref2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by parameters declared 'ByRef' or 'ByVal'.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seuls les paramètres déclarés 'ByRef' ou 'ByVal' les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromNonInterface"> <source>Interface can inherit only from another interface.</source> <target state="translated">Une interface ne peut hériter que d'une autre interface.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceOrderOnInherits"> <source>'Inherits' statements must precede all declarations in an interface.</source> <target state="translated">'Les instructions 'Inherits' doivent précéder toutes les déclarations dans une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateDefaultProps1"> <source>'Default' can be applied to only one property name in a {0}.</source> <target state="translated">'Default' ne peut être appliqué qu'à un seul nom de propriété dans un {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMissingFromProperty2"> <source>'{0}' and '{1}' cannot overload each other because only one is declared 'Default'.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seul l'un d'entre eux est déclaré 'Default'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverridingPropertyKind2"> <source>'{0}' cannot override '{1}' because they differ by 'ReadOnly' or 'WriteOnly'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car 'ReadOnly' ou 'WriteOnly' les différencie.</target> <note /> </trans-unit> <trans-unit id="ERR_NewInInterface"> <source>'Sub New' cannot be declared in an interface.</source> <target state="translated">'Sub New' ne peut pas être déclaré dans une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnNew1"> <source>'Sub New' cannot be declared '{0}'.</source> <target state="translated">'Sub New' ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadingPropertyKind2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by 'ReadOnly' or 'WriteOnly'.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seul 'ReadOnly' ou 'WriteOnly' les différencie.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDefaultNotExtend1"> <source>Class '{0}' cannot be indexed because it has no default property.</source> <target state="translated">La classe '{0}' ne peut pas être indexée, car elle n'a pas de propriété par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithArrayVsParamArray2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by parameters declared 'ParamArray'.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seuls les paramètres déclarés 'ParamArray' les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInstanceMemberAccess"> <source>Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.</source> <target state="translated">Impossible de faire référence à un membre instance d'une classe à partir d'une méthode partagée ou d'un initialiseur de membre partagé sans une instance explicite de la classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRbrace"> <source>'}' expected.</source> <target state="translated">'}' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleAsType1"> <source>Module '{0}' cannot be used as a type.</source> <target state="translated">Le module '{0}' ne peut pas être utilisé en tant que type.</target> <note /> </trans-unit> <trans-unit id="ERR_NewIfNullOnNonClass"> <source>'New' cannot be used on an interface.</source> <target state="translated">'Impossible d'utiliser 'New' pour une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchAfterFinally"> <source>'Catch' cannot appear after 'Finally' within a 'Try' statement.</source> <target state="translated">'Catch' ne peut pas apparaître après 'Finally' dans une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchNoMatchingTry"> <source>'Catch' cannot appear outside a 'Try' statement.</source> <target state="translated">'Catch' ne peut pas apparaître en dehors d'une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_FinallyAfterFinally"> <source>'Finally' can only appear once in a 'Try' statement.</source> <target state="translated">'Finally' ne peut apparaître qu'une seule fois dans une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_FinallyNoMatchingTry"> <source>'Finally' cannot appear outside a 'Try' statement.</source> <target state="translated">'Finally' ne peut pas apparaître en dehors d'une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndTryNoTry"> <source>'End Try' must be preceded by a matching 'Try'.</source> <target state="translated">'End Try' doit être précédé d'un 'Try' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndTry"> <source>'Try' must end with a matching 'End Try'.</source> <target state="translated">'Try' doit se terminer par un 'End Try' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelegateFlags1"> <source>'{0}' is not valid on a Delegate declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration Delegate.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstructorOnBase2"> <source>Class '{0}' must declare a 'Sub New' because its base class '{1}' does not have an accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car sa classe de base '{1}' n'a pas de 'Sub New' accessible qu'il est possible d'appeler sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleSymbol2"> <source>'{0}' is not accessible in this context because it is '{1}'.</source> <target state="translated">'{0}' n'est pas accessible dans ce contexte, car il est '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleMember3"> <source>'{0}.{1}' is not accessible in this context because it is '{2}'.</source> <target state="translated">'{0}.{1}' n'est pas accessible dans ce contexte, car il est '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchNotException1"> <source>'Catch' cannot catch type '{0}' because it is not 'System.Exception' or a class that inherits from 'System.Exception'.</source> <target state="translated">'Catch' ne peut pas intercepter le type '{0}', car il n'est pas 'System.Exception' ou une classe qui hérite de 'System.Exception'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitTryNotWithinTry"> <source>'Exit Try' can only appear inside a 'Try' statement.</source> <target state="translated">'Exit Try' ne peut apparaître qu'à l'intérieur d'une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadRecordFlags1"> <source>'{0}' is not valid on a Structure declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEnumFlags1"> <source>'{0}' is not valid on an Enum declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration Enum.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceFlags1"> <source>'{0}' is not valid on an Interface declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration Interface.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithByref2"> <source>'{0}' cannot override '{1}' because they differ by a parameter that is marked as 'ByRef' versus 'ByVal'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car un paramètre marqué comme 'ByRef' pour l'une et 'ByVal' pour l'autre les différencie.</target> <note /> </trans-unit> <trans-unit id="ERR_MyBaseAbstractCall1"> <source>'MyBase' cannot be used with method '{0}' because it is declared 'MustOverride'.</source> <target state="translated">'MyBase' ne peut pas être utilisé avec la méthode '{0}', car il est déclaré 'MustOverride'.</target> <note /> </trans-unit> <trans-unit id="ERR_IdentNotMemberOfInterface4"> <source>'{0}' cannot implement '{1}' because there is no matching {2} on interface '{3}'.</source> <target state="translated">'{0}' ne peut pas implémenter '{1}', car il n'existe pas de {2} correspondant pour l'interface '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementingInterfaceWithDifferentTupleNames5"> <source>'{0}' cannot implement {1} '{2}' on interface '{3}' because the tuple element names in '{4}' do not match those in '{5}'.</source> <target state="translated">'{0}' ne peut pas implémenter {1} '{2}' sur l'interface '{3}', car les noms d'éléments tuples dans '{4}' ne correspondent pas à ceux dans '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_WithEventsRequiresClass"> <source>'WithEvents' variables must have an 'As' clause.</source> <target state="translated">'Les variables 'WithEvents' doivent comporter une clause 'As'.</target> <note /> </trans-unit> <trans-unit id="ERR_WithEventsAsStruct"> <source>'WithEvents' variables can only be typed as classes, interfaces or type parameters with class constraints.</source> <target state="translated">'Les variables 'WithEvents' peuvent seulement être de type classe, interface ou paramètre de type avec des contraintes de classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertArrayRankMismatch2"> <source>Value of type '{0}' cannot be converted to '{1}' because the array types have different numbers of dimensions.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}', car les types tableau ont des nombres de dimensions différents.</target> <note /> </trans-unit> <trans-unit id="ERR_RedimRankMismatch"> <source>'ReDim' cannot change the number of dimensions of an array.</source> <target state="translated">'ReDim' ne peut pas changer le nombre de dimensions d'un tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_StartupCodeNotFound1"> <source>'Sub Main' was not found in '{0}'.</source> <target state="translated">'Sub Main' est introuvable dans '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstAsNonConstant"> <source>Constants must be of an intrinsic or enumerated type, not a class, structure, type parameter, or array type.</source> <target state="translated">Les constantes doivent être de type intrinsèque ou énuméré, et non de type classe, structure, paramètre de type ou tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndSub"> <source>'End Sub' must be preceded by a matching 'Sub'.</source> <target state="translated">'End Sub' doit être précédé d'un 'Sub' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndFunction"> <source>'End Function' must be preceded by a matching 'Function'.</source> <target state="translated">'End Function' doit être précédé d'un 'Function' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndProperty"> <source>'End Property' must be preceded by a matching 'Property'.</source> <target state="translated">'End Property' doit être précédé d'un 'Property' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseMethodSpecifier1"> <source>Methods in a Module cannot be declared '{0}'.</source> <target state="translated">Les méthodes d'un module ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseEventSpecifier1"> <source>Events in a Module cannot be declared '{0}'.</source> <target state="translated">Les événements d'un module ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantUseVarSpecifier1"> <source>Members in a Structure cannot be declared '{0}'.</source> <target state="translated">Les membres d'une structure ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOverrideDueToReturn2"> <source>'{0}' cannot override '{1}' because they differ by their return types.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car leurs types de retour ne sont pas identiques.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidOverrideDueToTupleNames2"> <source>'{0}' cannot override '{1}' because they differ by their tuple element names.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}' car leurs noms d'éléments tuples sont différents.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidOverrideDueToTupleNames2_Title"> <source>Member cannot override because it differs by its tuple element names.</source> <target state="translated">Le membre ne peut pas procéder à la substitution car ses noms d'éléments tuples sont différents.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantWithNoValue"> <source>Constants must have a value.</source> <target state="translated">Les constantes doivent avoir une valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionOverflow1"> <source>Constant expression not representable in type '{0}'.</source> <target state="translated">L'expression constante n'est pas représentable dans le type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertyGet"> <source>'Get' is already declared.</source> <target state="translated">'Get' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertySet"> <source>'Set' is already declared.</source> <target state="translated">'Set' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotDeclared1"> <source>'{0}' is not declared. It may be inaccessible due to its protection level.</source> <target state="translated">'{0}' n'est pas déclaré. Il peut être inaccessible en raison de son niveau de protection.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryOperands3"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'.</source> <target state="translated">L'opérateur '{0}' n'est pas défini pour les types '{1}' et '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedProcedure"> <source>Expression is not a method.</source> <target state="translated">L'expression n'est pas une méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument2"> <source>Argument not specified for parameter '{0}' of '{1}'.</source> <target state="translated">Argument non spécifié pour le paramètre '{0}' de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotMember2"> <source>'{0}' is not a member of '{1}'.</source> <target state="translated">'{0}' n'est pas un membre de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndClassNoClass"> <source>'End Class' must be preceded by a matching 'Class'.</source> <target state="translated">'End Class' doit être précédé d'un 'Class' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_BadClassFlags1"> <source>Classes cannot be declared '{0}'.</source> <target state="translated">Les classes ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportsMustBeFirst"> <source>'Imports' statements must precede any declarations.</source> <target state="translated">'Des instructions 'Imports' doivent précéder toutes les déclarations.</target> <note /> </trans-unit> <trans-unit id="ERR_NonNamespaceOrClassOnImport2"> <source>'{1}' for the Imports '{0}' does not refer to a Namespace, Class, Structure, Enum or Module.</source> <target state="translated">'{1}' pour les Imports '{0}' ne fait pas référence à un Namespace, Class, Structure, Enum ou Module.</target> <note /> </trans-unit> <trans-unit id="ERR_TypecharNotallowed"> <source>Type declaration characters are not valid in this context.</source> <target state="translated">Les caractères de déclaration de type ne sont pas valides dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectReferenceNotSupplied"> <source>Reference to a non-shared member requires an object reference.</source> <target state="translated">Une référence à un membre non partagé requiert une référence d'objet.</target> <note /> </trans-unit> <trans-unit id="ERR_MyClassNotInClass"> <source>'MyClass' cannot be used outside of a class.</source> <target state="translated">'MyClass' ne peut pas être utilisé à l'extérieur d'une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_IndexedNotArrayOrProc"> <source>Expression is not an array or a method, and cannot have an argument list.</source> <target state="translated">L'expression n'est pas un tableau ni une méthode et ne peut pas avoir de liste d'arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_EventSourceIsArray"> <source>'WithEvents' variables cannot be typed as arrays.</source> <target state="translated">'Les variables 'WithEvents' ne peuvent pas être de type tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedConstructorWithParams"> <source>Shared 'Sub New' cannot have any parameters.</source> <target state="translated">Un 'Sub New' partagé ne peut pas avoir de paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedConstructorIllegalSpec1"> <source>Shared 'Sub New' cannot be declared '{0}'.</source> <target state="translated">Un 'Sub New' partagé ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndClass"> <source>'Class' statement must end with a matching 'End Class'.</source> <target state="translated">'Une instruction 'Class' doit se terminer par un 'End Class' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_UnaryOperand2"> <source>Operator '{0}' is not defined for type '{1}'.</source> <target state="translated">L'opérateur '{0}' n'est pas défini pour le type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsWithDefault1"> <source>'Default' cannot be combined with '{0}'.</source> <target state="translated">'Default' ne peut pas être combiné avec '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidValue"> <source>Expression does not produce a value.</source> <target state="translated">Cette expression ne produit pas de valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorFunction"> <source>Constructor must be declared as a Sub, not as a Function.</source> <target state="translated">Le constructeur doit être déclaré en tant que Sub, et non Function.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLiteralExponent"> <source>Exponent is not valid.</source> <target state="translated">Exposant non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_NewCannotHandleEvents"> <source>'Sub New' cannot handle events.</source> <target state="translated">'Sub New' ne peut pas gérer d'événements.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularEvaluation1"> <source>Constant '{0}' cannot depend on its own value.</source> <target state="translated">La constante '{0}' ne peut pas dépendre de sa propre valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnSharedMeth1"> <source>'Shared' cannot be combined with '{0}' on a method declaration.</source> <target state="translated">'Shared' ne peut pas être combiné avec '{0}' pour une déclaration de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnSharedProperty1"> <source>'Shared' cannot be combined with '{0}' on a property declaration.</source> <target state="translated">'Shared' ne peut pas être combiné avec '{0}' pour une déclaration de propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnStdModuleProperty1"> <source>Properties in a Module cannot be declared '{0}'.</source> <target state="translated">Les propriétés d'un module ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedOnProcThatImpl"> <source>Methods or events that implement interface members cannot be declared 'Shared'.</source> <target state="translated">Les méthodes ou événements qui implémentent des membres d'interface ne peuvent pas être déclarés 'Shared'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoWithEventsVarOnHandlesList"> <source>Handles clause requires a WithEvents variable defined in the containing type or one of its base types.</source> <target state="translated">La clause Handles requiert une variable WithEvents définie dans le type conteneur ou l'un de ses types de base.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceAccessMismatch5"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of the base {1} to {3} '{4}'.</source> <target state="translated">'{0}' ne peut pas hériter de {1} '{2}', car il étend l'accès du {1} de base à {3} '{4}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NarrowingConversionDisallowed2"> <source>Option Strict On disallows implicit conversions from '{0}' to '{1}'.</source> <target state="translated">Option Strict On interdit les conversions implicites de '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoArgumentCountOverloadCandidates1"> <source>Overload resolution failed because no accessible '{0}' accepts this number of arguments.</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible n'accepte ce nombre d'arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_NoViableOverloadCandidates1"> <source>Overload resolution failed because no '{0}' is accessible.</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' n'est accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_NoCallableOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called with these arguments:{1}</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible ne peut être appelé avec ces arguments : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called:{1}</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible ne peut être appelé : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonNarrowingOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called without a narrowing conversion:{1}</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible ne peut être appelé sans conversion restrictive : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNarrowing3"> <source>Argument matching parameter '{0}' narrows from '{1}' to '{2}'.</source> <target state="translated">Le paramètre de correspondance d'arguments '{0}' passe de '{1}' à '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoMostSpecificOverload2"> <source>Overload resolution failed because no accessible '{0}' is most specific for these arguments:{1}</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible n'est plus spécifique pour ces arguments : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NotMostSpecificOverload"> <source>Not most specific.</source> <target state="translated">Pas plus spécifique.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadCandidate2"> <source> '{0}': {1}</source> <target state="translated"> '{0}': {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NoGetProperty1"> <source>Property '{0}' is 'WriteOnly'.</source> <target state="translated">La propriété '{0}' est 'WriteOnly'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSetProperty1"> <source>Property '{0}' is 'ReadOnly'.</source> <target state="translated">La propriété '{0}' est 'ReadOnly'.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamTypingInconsistency"> <source>All parameters must be explicitly typed if any of them are explicitly typed.</source> <target state="translated">Tous les paramètres doivent être explicitement typés, si l'un d'eux est explicitement typé.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamNameFunctionNameCollision"> <source>Parameter cannot have the same name as its defining function.</source> <target state="translated">Un paramètre ne peut pas avoir le même nom que sa fonction de définition.</target> <note /> </trans-unit> <trans-unit id="ERR_DateToDoubleConversion"> <source>Conversion from 'Date' to 'Double' requires calling the 'Date.ToOADate' method.</source> <target state="translated">Pour convertir 'Date' en 'Double', vous devez appeler la méthode 'Date.ToOADate'.</target> <note /> </trans-unit> <trans-unit id="ERR_DoubleToDateConversion"> <source>Conversion from 'Double' to 'Date' requires calling the 'Date.FromOADate' method.</source> <target state="translated">Pour convertir 'Double' en 'Date', vous devez appeler la méthode 'Date.FromOADate'.</target> <note /> </trans-unit> <trans-unit id="ERR_ZeroDivide"> <source>Division by zero occurred while evaluating this expression.</source> <target state="translated">Une division par zéro s'est produite lors de l'évaluation de cette expression.</target> <note /> </trans-unit> <trans-unit id="ERR_TryAndOnErrorDoNotMix"> <source>Method cannot contain both a 'Try' statement and an 'On Error' or 'Resume' statement.</source> <target state="translated">Une méthode ne peut pas contenir à la fois une instruction 'Try' et une instruction 'On Error' ou 'Resume'.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyAccessIgnored"> <source>Property access must assign to the property or use its value.</source> <target state="translated">Un accès à la propriété doit assigner la propriété ou utiliser sa valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNoDefault1"> <source>'{0}' cannot be indexed because it has no default property.</source> <target state="translated">'{0}' ne peut pas être indexé, car il n'a pas de propriété par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyAttribute1"> <source>Attribute '{0}' cannot be applied to an assembly.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à un assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidModuleAttribute1"> <source>Attribute '{0}' cannot be applied to a module.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à un module.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInUnnamedNamespace1"> <source>'{0}' is ambiguous.</source> <target state="translated">'{0}' est ambigu.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMemberNotProperty1"> <source>Default member of '{0}' is not a property.</source> <target state="translated">Le membre '{0}' par défaut n'est pas une propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInNamespace2"> <source>'{0}' is ambiguous in the namespace '{1}'.</source> <target state="translated">'{0}' est ambigu dans l'espace de noms '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInImports2"> <source>'{0}' is ambiguous, imported from the namespaces or types '{1}'.</source> <target state="translated">'{0}' est ambigu, importé des espaces de noms ou des types '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInModules2"> <source>'{0}' is ambiguous between declarations in Modules '{1}'.</source> <target state="translated">'{0}' est ambigu entre les déclarations des modules '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInNamespaces2"> <source>'{0}' is ambiguous between declarations in namespaces '{1}'.</source> <target state="translated">'{0}' est ambigu entre les déclarations dans les espaces de noms '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerTooFewDimensions"> <source>Array initializer has too few dimensions.</source> <target state="translated">L'initialiseur de tableau n'utilise pas suffisamment de dimensions.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerTooManyDimensions"> <source>Array initializer has too many dimensions.</source> <target state="translated">L'initialiseur de tableau utilise trop de dimensions.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerTooFewElements1"> <source>Array initializer is missing {0} elements.</source> <target state="translated">Il manque {0} éléments à l'initialiseur de tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerTooManyElements1"> <source>Array initializer has {0} too many elements.</source> <target state="translated">L'initialiseur de tableau utilise {0} élément(s) de trop.</target> <note /> </trans-unit> <trans-unit id="ERR_NewOnAbstractClass"> <source>'New' cannot be used on a class that is declared 'MustInherit'.</source> <target state="translated">'New' ne peut pas être utilisé dans une classe déclarée 'MustInherit'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNamedImportAlias1"> <source>Alias '{0}' is already declared.</source> <target state="translated">L'alias '{0}' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePrefix"> <source>XML namespace prefix '{0}' is already declared.</source> <target state="translated">Le préfixe de l'espace de noms XML '{0}' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsLateBinding"> <source>Option Strict On disallows late binding.</source> <target state="translated">Option Strict On rejette toute liaison tardive.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfOperandNotMethod"> <source>'AddressOf' operand must be the name of a method (without parentheses).</source> <target state="translated">'L'opérande 'AddressOf' doit être le nom d'une méthode (sans parenthèses).</target> <note /> </trans-unit> <trans-unit id="ERR_EndExternalSource"> <source>'#End ExternalSource' must be preceded by a matching '#ExternalSource'.</source> <target state="translated">'#End ExternalSource' doit être précédé d'un '#ExternalSource' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndExternalSource"> <source>'#ExternalSource' statement must end with a matching '#End ExternalSource'.</source> <target state="translated">'L'instruction '#ExternalSource' doit se terminer par un '#End ExternalSource' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedExternalSource"> <source>'#ExternalSource' directives cannot be nested.</source> <target state="translated">'Les directives '#ExternalSource' ne peuvent pas être imbriquées.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNotDelegate1"> <source>'AddressOf' expression cannot be converted to '{0}' because '{0}' is not a delegate type.</source> <target state="translated">'Une expression 'AddressOf' ne peut pas être convertie en '{0}', car '{0}' n'est pas un type délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_SyncLockRequiresReferenceType1"> <source>'SyncLock' operand cannot be of type '{0}' because '{0}' is not a reference type.</source> <target state="translated">'L'opérande 'SyncLock' ne peut pas être de type '{0}', car '{0}' n'est pas un type référence.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodAlreadyImplemented2"> <source>'{0}.{1}' cannot be implemented more than once.</source> <target state="translated">'{0}.{1}' ne peut pas être implémenté plus d'une fois.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInInherits1"> <source>'{0}' cannot be inherited more than once.</source> <target state="translated">'{0}' ne peut pas être hérité plus d'une fois.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamArrayArgument"> <source>Named argument cannot match a ParamArray parameter.</source> <target state="translated">L'argument nommé ne peut pas correspondre à un paramètre ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedParamArrayArgument"> <source>Omitted argument cannot match a ParamArray parameter.</source> <target state="translated">L'argument omis ne peut pas correspondre à un paramètre ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayArgumentMismatch"> <source>Argument cannot match a ParamArray parameter.</source> <target state="translated">L'argument ne peut pas correspondre à un paramètre ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_EventNotFound1"> <source>Event '{0}' cannot be found.</source> <target state="translated">L'événement '{0}' est introuvable.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseVariableSpecifier1"> <source>Variables in Modules cannot be declared '{0}'.</source> <target state="translated">Les variables des modules ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedEventNeedsSharedHandler"> <source>Events of shared WithEvents variables cannot be handled by non-shared methods.</source> <target state="translated">Les événements des variables WithEvents partagées ne peuvent pas être gérés par des méthodes non partagées.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedMinus"> <source>'-' expected.</source> <target state="translated">'-' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceMemberSyntax"> <source>Interface members must be methods, properties, events, or type definitions.</source> <target state="translated">Les membres d'interface doivent être des méthodes, des propriétés, des événements ou des définitions de types.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideInterface"> <source>Statement cannot appear within an interface body.</source> <target state="translated">L'instruction ne peut pas apparaître dans le corps d'une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsInterface"> <source>Statement cannot appear within an interface body. End of interface assumed.</source> <target state="translated">L'instruction ne peut pas apparaître dans le corps d'une interface. Elle est interprétée comme la fin de l'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsInNotInheritableClass1"> <source>'NotInheritable' classes cannot have members declared '{0}'.</source> <target state="translated">'Les classes 'NotInheritable' ne peuvent pas avoir de membres déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseOnlyClassesMustBeExplicit2"> <source>Class '{0}' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): {1}.</source> <target state="translated">La classe '{0}' doit être déclarée 'MustInherit' ou se substituer aux membres 'MustOverride' hérités suivants : {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_MustInheritEventNotOverridden"> <source>'{0}' is a MustOverride event in the base class '{1}'. Visual Basic does not support event overriding. You must either provide an implementation for the event in the base class, or make class '{2}' MustInherit.</source> <target state="translated">'{0}' est un événement MustOverride dans la classe de base '{1}'. Visual Basic ne prend pas en charge pas la surcharge des événements. Vous devez fournir une implémentation pour l'événement dans la classe de base ou bien rendre la classe '{2}' MustInherit.</target> <note /> </trans-unit> <trans-unit id="ERR_NegativeArraySize"> <source>Array dimensions cannot have a negative size.</source> <target state="translated">Les dimensions d'un tableau ne peuvent pas être de taille négative.</target> <note /> </trans-unit> <trans-unit id="ERR_MyClassAbstractCall1"> <source>'MustOverride' method '{0}' cannot be called with 'MyClass'.</source> <target state="translated">'La méthode 'MustOverride' '{0}' ne peut pas être appelée par 'MyClass'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndDisallowedInDllProjects"> <source>'End' statement cannot be used in class library projects.</source> <target state="translated">'L'instruction 'End' ne peut pas être utilisée dans les projets de bibliothèque de classes.</target> <note /> </trans-unit> <trans-unit id="ERR_BlockLocalShadowing1"> <source>Variable '{0}' hides a variable in an enclosing block.</source> <target state="translated">La variable '{0}' masque une variable dans un bloc englobant.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleNotAtNamespace"> <source>'Module' statements can occur only at file or namespace level.</source> <target state="translated">'Les instructions 'Module' ne peuvent intervenir qu'au niveau du fichier ou de l'espace de noms.</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAtNamespace"> <source>'Namespace' statements can occur only at file or namespace level.</source> <target state="translated">'Les instructions 'Namespace' ne peuvent intervenir qu'au niveau du fichier ou de l'espace de noms.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEnum"> <source>Statement cannot appear within an Enum body.</source> <target state="translated">L'instruction ne peut pas apparaître dans le corps d'un Enum.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsEnum"> <source>Statement cannot appear within an Enum body. End of Enum assumed.</source> <target state="translated">Cette instruction ne peut pas apparaître dans le corps d'un Enum. Elle est interprétée comme la fin de l'Enum.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionStrict"> <source>'Option Strict' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Option Strict' ne peut être suivi que de 'On' ou 'Off'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndStructureNoStructure"> <source>'End Structure' must be preceded by a matching 'Structure'.</source> <target state="translated">'End Structure' doit être précédé d'un 'Structure' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndModuleNoModule"> <source>'End Module' must be preceded by a matching 'Module'.</source> <target state="translated">'End Module' doit être précédé d'un 'Module' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndNamespaceNoNamespace"> <source>'End Namespace' must be preceded by a matching 'Namespace'.</source> <target state="translated">'End Namespace' doit être précédé d'un 'Namespace' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndStructure"> <source>'Structure' statement must end with a matching 'End Structure'.</source> <target state="translated">'L'instruction 'Structure' doit se terminer par un 'End Structure' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndModule"> <source>'Module' statement must end with a matching 'End Module'.</source> <target state="translated">'L'instruction 'Module' doit se terminer par un 'End Module' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndNamespace"> <source>'Namespace' statement must end with a matching 'End Namespace'.</source> <target state="translated">'L'instruction 'Namespace' doit se terminer par un 'End Namespace' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionStmtWrongOrder"> <source>'Option' statements must precede any declarations or 'Imports' statements.</source> <target state="translated">'Toutes les déclarations et instructions 'Imports' doivent être précédées d'instructions 'Option'.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantInherit"> <source>Structures cannot have 'Inherits' statements.</source> <target state="translated">Les structures ne peuvent pas utiliser d'instructions 'Inherits'.</target> <note /> </trans-unit> <trans-unit id="ERR_NewInStruct"> <source>Structures cannot declare a non-shared 'Sub New' with no parameters.</source> <target state="translated">Les structures ne peuvent pas déclarer un 'Sub New' non partagé sans aucun paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndGet"> <source>'End Get' must be preceded by a matching 'Get'.</source> <target state="translated">'End Get' doit être précédé d'un 'Get' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndGet"> <source>'Get' statement must end with a matching 'End Get'.</source> <target state="translated">'Une instruction 'Get' doit se terminer par un 'End Get' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndSet"> <source>'End Set' must be preceded by a matching 'Set'.</source> <target state="translated">'End Set' doit être précédé d'un 'Set' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndSet"> <source>'Set' statement must end with a matching 'End Set'.</source> <target state="translated">'Une instruction 'Set' doit se terminer par un 'End Set' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsProperty"> <source>Statement cannot appear within a property body. End of property assumed.</source> <target state="translated">Cette instruction ne peut pas apparaître dans le corps d'une propriété. Elle est interprétée comme la fin de la propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateWriteabilityCategoryUsed"> <source>'ReadOnly' and 'WriteOnly' cannot be combined.</source> <target state="translated">'Impossible de combiner 'ReadOnly' et 'WriteOnly'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedGreater"> <source>'&gt;' expected.</source> <target state="translated">'&gt;' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeStmtWrongOrder"> <source>Assembly or Module attribute statements must precede any declarations in a file.</source> <target state="translated">Les instructions d'attribut Assembly ou Module doivent précéder toutes les déclarations dans un fichier.</target> <note /> </trans-unit> <trans-unit id="ERR_NoExplicitArraySizes"> <source>Array bounds cannot appear in type specifiers.</source> <target state="translated">Les limites d'index de tableau ne peuvent pas figurer dans les spécificateurs de type.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyFlags1"> <source>Properties cannot be declared '{0}'.</source> <target state="translated">Les propriétés ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionExplicit"> <source>'Option Explicit' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Option Explicit' ne peut être suivi que de 'On' ou 'Off'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleParameterSpecifiers"> <source>'ByVal' and 'ByRef' cannot be combined.</source> <target state="translated">'Impossible de combiner 'ByVal' et 'ByRef'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleOptionalParameterSpecifiers"> <source>'Optional' and 'ParamArray' cannot be combined.</source> <target state="translated">'Impossible de combiner 'Optional' et 'ParamArray'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedProperty1"> <source>Property '{0}' is of an unsupported type.</source> <target state="translated">La propriété '{0}' est d'un type non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionalParameterUsage1"> <source>Attribute '{0}' cannot be applied to a method with optional parameters.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à une méthode avec des paramètres optionnels.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnFromNonFunction"> <source>'Return' statement in a Sub or a Set cannot return a value.</source> <target state="translated">'L'instruction 'Return' dans un Sub ou un Set ne peut pas retourner de valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_UnterminatedStringLiteral"> <source>String constants must end with a double quote.</source> <target state="translated">Les constantes de chaîne doivent se terminer par un guillemet.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedType1"> <source>'{0}' is an unsupported type.</source> <target state="translated">'{0}' est un type non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEnumBase"> <source>Enums must be declared as an integral type.</source> <target state="translated">Les enums doivent être déclarés en tant que type intégral.</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefIllegal1"> <source>{0} parameters cannot be declared 'ByRef'.</source> <target state="translated">Les paramètres {0} ne peuvent pas être déclarés 'ByRef'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedAssembly3"> <source>Reference required to assembly '{0}' containing the type '{1}'. Add one to your project.</source> <target state="translated">Une référence à l'assembly '{0}' contenant le type '{1}' est requise. Ajoutez-en une à votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedModule3"> <source>Reference required to module '{0}' containing the type '{1}'. Add one to your project.</source> <target state="translated">Une référence au module '{0}' contenant le type '{1}' est requise. Ajoutez-en une à votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnWithoutValue"> <source>'Return' statement in a Function, Get, or Operator must return a value.</source> <target state="translated">'L'instruction 'Return' dans un Function, Get ou Operator doit retourner une valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedField1"> <source>Field '{0}' is of an unsupported type.</source> <target state="translated">Le champ '{0}' est d'un type non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedMethod1"> <source>'{0}' has a return type that is not supported or parameter types that are not supported.</source> <target state="translated">'{0}' a un type de retour ou des types de paramètres non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonIndexProperty1"> <source>Property '{0}' with no parameters cannot be found.</source> <target state="translated">Impossible de trouver la propriété '{0}' sans paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributePropertyType1"> <source>Property or field '{0}' does not have a valid attribute type.</source> <target state="translated">La propriété ou le champ '{0}' n'utilise pas un type d'attribut valide.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalsCannotHaveAttributes"> <source>Attributes cannot be applied to local variables.</source> <target state="translated">Les attributs ne peuvent pas être appliqués aux variables locales.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyOrFieldNotDefined1"> <source>Field or property '{0}' is not found.</source> <target state="translated">Le champ ou la propriété '{0}' est introuvable.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeUsage2"> <source>Attribute '{0}' cannot be applied to '{1}' because the attribute is not valid on this declaration type.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à '{1}', car il n'est pas valide dans ce type de déclaration.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeUsageOnAccessor"> <source>Attribute '{0}' cannot be applied to '{1}' of '{2}' because the attribute is not valid on this declaration type.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à '{1}' de '{2}', car il n'est pas valide dans ce type de déclaration.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedTypeInInheritsClause2"> <source>Class '{0}' cannot reference its nested type '{1}' in Inherits clause.</source> <target state="translated">La classe '{0}' ne peut pas faire référence à son type incorporé '{1}' dans la clause Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInItsInheritsClause1"> <source>Class '{0}' cannot reference itself in Inherits clause.</source> <target state="translated">La classe '{0}' ne peut pas se référencer elle-même dans une clause Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseTypeReferences2"> <source> Base type of '{0}' needs '{1}' to be resolved.</source> <target state="translated"> Le type de base de '{0}' a besoin de '{1}' pour être résolu.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalBaseTypeReferences3"> <source>Inherits clause of {0} '{1}' causes cyclic dependency: {2}</source> <target state="translated">La clause Inherits de {0} '{1}' provoque une dépendance cyclique : {2}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMultipleAttributeUsage1"> <source>Attribute '{0}' cannot be applied multiple times.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué plusieurs fois.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMultipleAttributeUsageInNetModule2"> <source>Attribute '{0}' in '{1}' cannot be applied multiple times.</source> <target state="translated">L'attribut '{0}' dans '{1}' ne peut pas être appliqué plusieurs fois.</target> <note /> </trans-unit> <trans-unit id="ERR_CantThrowNonException"> <source>'Throw' operand must derive from 'System.Exception'.</source> <target state="translated">'L'opérande 'Throw' doit dériver de 'System.Exception'.</target> <note /> </trans-unit> <trans-unit id="ERR_MustBeInCatchToRethrow"> <source>'Throw' statement cannot omit operand outside a 'Catch' statement or inside a 'Finally' statement.</source> <target state="translated">'L'instruction 'Throw' ne peut pas omettre l'opérande en dehors d'une instruction 'Catch' ou dans une instruction 'Finally'.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayMustBeByVal"> <source>ParamArray parameters must be declared 'ByVal'.</source> <target state="translated">Les paramètres ParamArray doivent être déclarés 'ByVal'.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoleteSymbol2"> <source>'{0}' is obsolete: '{1}'.</source> <target state="translated">'{0}' est obsolète : '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RedimNoSizes"> <source>'ReDim' statements require a parenthesized list of the new bounds of each dimension of the array.</source> <target state="translated">'Les instructions 'ReDim' requièrent une liste entre parenthèses des nouvelles limites de chaque dimension du tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_InitWithMultipleDeclarators"> <source>Explicit initialization is not permitted with multiple variables declared with a single type specifier.</source> <target state="translated">Une initialisation explicite n'est pas autorisée avec plusieurs variables déclarées avec un spécificateur de type unique.</target> <note /> </trans-unit> <trans-unit id="ERR_InitWithExplicitArraySizes"> <source>Explicit initialization is not permitted for arrays declared with explicit bounds.</source> <target state="translated">Une initialisation explicite n'est pas autorisée pour les tableaux déclarés avec des limites explicites.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSyncLockNoSyncLock"> <source>'End SyncLock' must be preceded by a matching 'SyncLock'.</source> <target state="translated">'End SyncLock' doit être précédé d'un 'SyncLock' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndSyncLock"> <source>'SyncLock' statement must end with a matching 'End SyncLock'.</source> <target state="translated">'L'instruction 'SyncLock' doit se terminer par un 'End SyncLock' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotEvent2"> <source>'{0}' is not an event of '{1}'.</source> <target state="translated">'{0}' n'est pas un événement de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AddOrRemoveHandlerEvent"> <source>'AddHandler' or 'RemoveHandler' statement event operand must be a dot-qualified expression or a simple name.</source> <target state="translated">'L'opérande d'événement d'instruction 'AddHandler' ou 'RemoveHandler' doit être une expression qualifiée par un point ou un nom simple.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedEnd"> <source>'End' statement not valid.</source> <target state="translated">'Instruction 'End' non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitForNonArray2"> <source>Array initializers are valid only for arrays, but the type of '{0}' is '{1}'.</source> <target state="translated">Les initialiseurs de tableau ne sont valides que pour les tableaux, mais le type de '{0}' est '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndRegionNoRegion"> <source>'#End Region' must be preceded by a matching '#Region'.</source> <target state="translated">'#End Region' doit être précédé d'un '#Region' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndRegion"> <source>'#Region' statement must end with a matching '#End Region'.</source> <target state="translated">'L'instruction '#Region' doit se terminer par un '#End Region' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsStmtWrongOrder"> <source>'Inherits' statement must precede all declarations in a class.</source> <target state="translated">'L'instruction 'Inherits' doit précéder toutes les déclarations dans une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousAcrossInterfaces3"> <source>'{0}' is ambiguous across the inherited interfaces '{1}' and '{2}'.</source> <target state="translated">'{0}' est ambigu entre les interfaces héritées '{1}' et '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPropertyAmbiguousAcrossInterfaces4"> <source>Default property access is ambiguous between the inherited interface members '{0}' of interface '{1}' and '{2}' of interface '{3}'.</source> <target state="translated">L'accès à la propriété par défaut est ambigu entre les membres '{0}' de l'interface héritée '{1}' et '{2}' de l'interface '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceEventCantUse1"> <source>Events in interfaces cannot be declared '{0}'.</source> <target state="translated">Les événements des interfaces ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExecutableAsDeclaration"> <source>Statement cannot appear outside of a method body.</source> <target state="translated">Cette instruction ne peut pas apparaître en dehors du corps de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureNoDefault1"> <source>Structure '{0}' cannot be indexed because it has no default property.</source> <target state="translated">La structure '{0}' ne peut pas être indexée, car elle n'a pas de propriété par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_MustShadow2"> <source>{0} '{1}' must be declared 'Shadows' because another member with this name is declared 'Shadows'.</source> <target state="translated">{0} '{1}' doit être déclaré 'Shadows', car un autre membre avec ce nom est déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithOptionalTypes2"> <source>'{0}' cannot override '{1}' because they differ by the types of optional parameters.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car les types des paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndOfExpression"> <source>End of expression expected.</source> <target state="translated">Fin d'expression attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_StructsCannotHandleEvents"> <source>Methods declared in structures cannot have 'Handles' clauses.</source> <target state="translated">Les méthodes déclarées dans des structures ne peuvent pas comporter de clauses 'Handles'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverridesImpliesOverridable"> <source>Methods declared 'Overrides' cannot be declared 'Overridable' because they are implicitly overridable.</source> <target state="translated">Les méthodes déclarées 'Overrides' ne peuvent pas être déclarées 'Overridable', car elles sont implicitement substituables.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalNamedSameAsParam1"> <source>'{0}' is already declared as a parameter of this method.</source> <target state="translated">'{0}' est déjà déclaré en tant que paramètre de cette méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalNamedSameAsParamInLambda1"> <source>Variable '{0}' is already declared as a parameter of this or an enclosing lambda expression.</source> <target state="translated">La variable '{0}' est déjà déclarée en tant que paramètre de cet élément ou en tant qu'expression lambda englobante.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseTypeSpecifier1"> <source>Type in a Module cannot be declared '{0}'.</source> <target state="translated">Un type dans un module ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InValidSubMainsFound1"> <source>No accessible 'Main' method with an appropriate signature was found in '{0}'.</source> <target state="translated">Aucune méthode 'Main' accessible avec une signature appropriée n'a été trouvée dans '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MoreThanOneValidMainWasFound2"> <source>'Sub Main' is declared more than once in '{0}': {1}</source> <target state="translated">'Sub Main' est déclaré plusieurs fois dans '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_CannotConvertValue2"> <source>Value '{0}' cannot be converted to '{1}'.</source> <target state="translated">Impossible de convertir la valeur '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnErrorInSyncLock"> <source>'On Error' statements are not valid within 'SyncLock' statements.</source> <target state="translated">'Les instructions 'On Error' ne sont pas valides dans les instructions 'SyncLock'.</target> <note /> </trans-unit> <trans-unit id="ERR_NarrowingConversionCollection2"> <source>Option Strict On disallows implicit conversions from '{0}' to '{1}'; the Visual Basic 6.0 collection type is not compatible with the .NET Framework collection type.</source> <target state="translated">Option Strict On interdit les conversions implicites de '{0}' en '{1}' ; le type de collection de Visual Basic 6.0 n'est pas compatible avec le type de collection du .NET Framework.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoTryHandler"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'Try', 'Catch' or 'Finally' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve à l'intérieur d'une instruction 'Try', 'Catch' ou 'Finally' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoSyncLock"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'SyncLock' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve à l'intérieur d'une instruction 'SyncLock' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoWith"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'With' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve à l'intérieur d'une instruction 'With' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoFor"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'For' or 'For Each' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve à l'intérieur d'une instruction 'For' ou 'For Each' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicConstructor"> <source>Attribute cannot be used because it does not have a Public constructor.</source> <target state="translated">Impossible d'utiliser cet attribut, car il n'a pas de constructeur public.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultEventNotFound1"> <source>Event '{0}' specified by the 'DefaultEvent' attribute is not a publicly accessible event for this class.</source> <target state="translated">L'événement '{0}' spécifié par l'attribut 'DefaultEvent' n'est pas un événement accessible publiquement pour cette classe.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNonSerializedUsage"> <source>'NonSerialized' attribute will not have any effect on this member because its containing class is not exposed as 'Serializable'.</source> <target state="translated">'L'attribut 'NonSerialized' n'aura pas d'effet sur ce membre, car sa classe conteneur n'est pas exposée comme 'Serializable'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContinueKind"> <source>'Continue' must be followed by 'Do', 'For' or 'While'.</source> <target state="translated">'Continue' doit être suivi par 'Do', 'For' ou 'While'.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueDoNotWithinDo"> <source>'Continue Do' can only appear inside a 'Do' statement.</source> <target state="translated">'Continue Do' ne peut être utilisé qu'à l'intérieur d'une instruction 'Do'.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueForNotWithinFor"> <source>'Continue For' can only appear inside a 'For' statement.</source> <target state="translated">'Continue For' ne peut être utilisé qu'à l'intérieur d'une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueWhileNotWithinWhile"> <source>'Continue While' can only appear inside a 'While' statement.</source> <target state="translated">'Continue While' ne peut apparaître que dans une instruction 'While'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParameterSpecifier"> <source>Parameter specifier is duplicated.</source> <target state="translated">Le spécificateur de paramètre est en double.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseDLLDeclareSpecifier1"> <source>'Declare' statements in a Module cannot be declared '{0}'.</source> <target state="translated">'Les instructions 'Declare' d'un module ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantUseDLLDeclareSpecifier1"> <source>'Declare' statements in a structure cannot be declared '{0}'.</source> <target state="translated">'Les instructions 'Declare' dans une structure ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TryCastOfValueType1"> <source>'TryCast' operand must be reference type, but '{0}' is a value type.</source> <target state="translated">'L'opérande 'TryCast' doit être un type référence, mais '{0}' est un type valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_TryCastOfUnconstrainedTypeParam1"> <source>'TryCast' operands must be class-constrained type parameter, but '{0}' has no class constraint.</source> <target state="translated">'L'opérande 'TryCast' doit être un paramètre de type contraint par classe, mais '{0}' n'a pas de contrainte de classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousDelegateBinding2"> <source>No accessible '{0}' is most specific: {1}</source> <target state="translated">Aucun '{0}' accessible n'est plus spécifique : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SharedStructMemberCannotSpecifyNew"> <source>Non-shared members in a Structure cannot be declared 'New'.</source> <target state="translated">Les membres non partagés dans une Structure ne peuvent pas être déclarés 'New'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericSubMainsFound1"> <source>None of the accessible 'Main' methods with the appropriate signatures found in '{0}' can be the startup method since they are all either generic or nested in generic types.</source> <target state="translated">Aucune des méthodes 'Main' accessibles avec les signatures appropriées ayant été trouvées dans '{0}' ne peut être la méthode de démarrage, car elles sont toutes génériques ou imbriquées dans des types génériques.</target> <note /> </trans-unit> <trans-unit id="ERR_GeneralProjectImportsError3"> <source>Error in project-level import '{0}' at '{1}' : {2}</source> <target state="translated">Erreur dans l'importation au niveau du projet '{0}' à '{1}' : {2}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidTypeForAliasesImport2"> <source>'{1}' for the Imports alias to '{0}' does not refer to a Namespace, Class, Structure, Interface, Enum or Module.</source> <target state="translated">'{1}' utilisé pour l'alias Imports de '{0}' ne fait pas référence à un Namespace, Class, Structure, Interface, Enum ou Module.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedConstant2"> <source>Field '{0}.{1}' has an invalid constant value.</source> <target state="translated">Le champ '{0}.{1}' a une valeur constante non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteArgumentsNeedParens"> <source>Method arguments must be enclosed in parentheses.</source> <target state="translated">Les arguments de méthode doivent être mis entre parenthèses.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteLineNumbersAreLabels"> <source>Labels that are numbers must be followed by colons.</source> <target state="translated">Les étiquettes qui sont des nombres doivent être suivies du signe deux-points.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteStructureNotType"> <source>'Type' statements are no longer supported; use 'Structure' statements instead.</source> <target state="translated">'Les instructions 'Type' ne sont plus prises en charge ; utilisez les instructions 'Structure' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteObjectNotVariant"> <source>'Variant' is no longer a supported type; use the 'Object' type instead.</source> <target state="translated">'Variant' n'est plus un type pris en charge ; utilisez le type 'Object' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteLetSetNotNeeded"> <source>'Let' and 'Set' assignment statements are no longer supported.</source> <target state="translated">'Les instructions d'assignation 'Let' et 'Set' ne sont plus prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoletePropertyGetLetSet"> <source>Property Get/Let/Set are no longer supported; use the new Property declaration syntax.</source> <target state="translated">Property Get/Let/Set ne sont plus pris en charge ; utilisez la nouvelle syntaxe de déclaration Property.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteWhileWend"> <source>'Wend' statements are no longer supported; use 'End While' statements instead.</source> <target state="translated">'Les instructions 'Wend' ne sont plus prises en charge ; utilisez les instructions 'End While' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteRedimAs"> <source>'ReDim' statements can no longer be used to declare array variables.</source> <target state="translated">'Les instructions 'ReDim' ne peuvent plus être utilisées pour déclarer des variables tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteOptionalWithoutValue"> <source>Optional parameters must specify a default value.</source> <target state="translated">Les paramètres optionnels doivent spécifier une valeur par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteGosub"> <source>'GoSub' statements are no longer supported.</source> <target state="translated">'Les instructions 'GoSub' ne sont plus prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteOnGotoGosub"> <source>'On GoTo' and 'On GoSub' statements are no longer supported.</source> <target state="translated">'Les instructions 'On GoTo' et 'On GoSub' ne sont plus prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteEndIf"> <source>'EndIf' statements are no longer supported; use 'End If' instead.</source> <target state="translated">'Les instructions 'EndIf' ne sont plus prises en charge ; utilisez 'End If' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteExponent"> <source>'D' can no longer be used to indicate an exponent, use 'E' instead.</source> <target state="translated">'D' ne peut plus être utilisé pour indiquer un exposant ; utilisez 'E' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteAsAny"> <source>'As Any' is not supported in 'Declare' statements.</source> <target state="translated">'As Any' n'est pas pris en charge dans les instructions 'Declare'.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteGetStatement"> <source>'Get' statements are no longer supported. File I/O functionality is available in the 'Microsoft.VisualBasic' namespace.</source> <target state="translated">'Les instructions 'Get' ne sont plus prises en charge. La fonctionnalité d'E/S de fichier est disponible dans l'espace de noms 'Microsoft.VisualBasic'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithArrayVsParamArray2"> <source>'{0}' cannot override '{1}' because they differ by parameters declared 'ParamArray'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car les paramètres déclarés 'ParamArray' les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularBaseDependencies4"> <source>This inheritance causes circular dependencies between {0} '{1}' and its nested or base type '{2}'.</source> <target state="translated">Cet héritage provoque des dépendances circulaires entre {0} '{1}' et son '{2}' incorporé ou type de base.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedBase2"> <source>{0} '{1}' cannot inherit from a type nested within it.</source> <target state="translated">{0} '{1}' ne peut pas hériter d'un type imbriqué.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchOutsideAssembly4"> <source>'{0}' cannot expose type '{1}' outside the project through {2} '{3}'.</source> <target state="translated">'{0}' ne peut pas exposer le type '{1}' en dehors du projet via {2} '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceAccessMismatchOutside3"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of the base {1} outside the assembly.</source> <target state="translated">'{0}' ne peut pas hériter de {1} '{2}', car il étend l'accès du {1} de base en dehors de l'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoletePropertyAccessor3"> <source>'{0}' accessor of '{1}' is obsolete: '{2}'.</source> <target state="translated">'L'accesseur '{0}' de '{1}' est obsolète : '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoletePropertyAccessor2"> <source>'{0}' accessor of '{1}' is obsolete.</source> <target state="translated">'L'accesseur '{0}' de '{1}' est obsolète.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchImplementedEvent6"> <source>'{0}' cannot expose the underlying delegate type '{1}' of the event it is implementing to {2} '{3}' through {4} '{5}'.</source> <target state="translated">'{0}' ne peut pas exposer le type de délégué sous-jacent '{1}' de l'événement qu'il implémente à {2} '{3}' via {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchImplementedEvent4"> <source>'{0}' cannot expose the underlying delegate type '{1}' of the event it is implementing outside the project through {2} '{3}'.</source> <target state="translated">'{0}' ne peut pas exposer le type de délégué sous-jacent '{1}' de l'événement qu'il implémente en dehors du projet via {2} '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceCycleInImportedType1"> <source>Type '{0}' is not supported because it either directly or indirectly inherits from itself.</source> <target state="translated">Le type '{0}' n'est pas pris en charge, car il hérite directement ou indirectement de lui-même.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonObsoleteConstructorOnBase3"> <source>Class '{0}' must declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car le '{1}' dans sa classe de base '{2}' est marqué comme obsolète.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonObsoleteConstructorOnBase4"> <source>Class '{0}' must declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete: '{3}'.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car le '{1}' dans sa classe de base '{2}' est marqué comme obsolète. '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNonObsoleteNewCall3"> <source>First statement of this 'Sub New' must be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le '{0}' dans la classe de base '{1}' de '{2}' est marquée comme obsolète.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNonObsoleteNewCall4"> <source>First statement of this 'Sub New' must be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete: '{3}'.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le '{0}' dans la classe de base '{1}' de '{2}' est marquée comme obsolète : '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsTypeArgAccessMismatch7"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of type '{3}' to {4} '{5}'.</source> <target state="translated">'{0}' ne peut pas hériter de {1} '{2}', car il étend l'accès du '{3}' de type à {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsTypeArgAccessMismatchOutside5"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of type '{3}' outside the assembly.</source> <target state="translated">'{0}' ne peut pas hériter de {1} '{2}', car il étend l'accès du '{3}' de type en dehors de l'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeAccessMismatch3"> <source>Specified access '{0}' for '{1}' does not match the access '{2}' specified on one of its other partial types.</source> <target state="translated">L'accès spécifié '{0}' pour '{1}' ne correspond pas à l'accès '{2}' spécifié pour l'un de ses autres types partiels.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeBadMustInherit1"> <source>'MustInherit' cannot be specified for partial type '{0}' because it cannot be combined with 'NotInheritable' specified for one of its other partial types.</source> <target state="translated">'MustInherit' ne peut pas être spécifié pour le type partiel '{0}', car il ne peut pas être combiné avec 'NotInheritable' spécifié pour l'un de ses autres types partiels.</target> <note /> </trans-unit> <trans-unit id="ERR_MustOverOnNotInheritPartClsMem1"> <source>'MustOverride' cannot be specified on this member because it is in a partial type that is declared 'NotInheritable' in another partial definition.</source> <target state="translated">'MustOverride' ne peut pas être spécifié pour ce membre, car il est dans un type partiel déclaré 'NotInheritable' dans une autre définition partielle.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseMismatchForPartialClass3"> <source>Base class '{0}' specified for class '{1}' cannot be different from the base class '{2}' of one of its other partial types.</source> <target state="translated">La classe de base '{0}' spécifiée pour la classe '{1}' ne peut pas être différente de la classe de base '{2}' de l'un de ses autres types partiels.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeTypeParamNameMismatch3"> <source>Type parameter name '{0}' does not match the name '{1}' of the corresponding type parameter defined on one of the other partial types of '{2}'.</source> <target state="translated">Le nom du paramètre de type '{0}' ne correspond pas au nom '{1}' du paramètre de type correspondant défini pour l'un des autres types partiels de '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeConstraintMismatch1"> <source>Constraints for this type parameter do not match the constraints on the corresponding type parameter defined on one of the other partial types of '{0}'.</source> <target state="translated">Les contraintes pour ce paramètre de type ne correspondent pas aux contraintes du paramètre de type correspondant défini pour l'un des autres types partiels de '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LateBoundOverloadInterfaceCall1"> <source>Late bound overload resolution cannot be applied to '{0}' because the accessing instance is an interface type.</source> <target state="translated">La résolution de surcharge à liaison tardive ne peut pas être appliquée à '{0}', car l'instance d'accès est un type interface.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredAttributeConstConversion2"> <source>Conversion from '{0}' to '{1}' cannot occur in a constant expression used as an argument to an attribute.</source> <target state="translated">La conversion de '{0}' en '{1}' ne peut pas se produire dans une expression constante utilisée en tant qu'argument d'un attribut.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousOverrides3"> <source>Member '{0}' that matches this signature cannot be overridden because the class '{1}' contains multiple members with this same name and signature: {2}</source> <target state="translated">Le membre '{0}' qui correspond à cette signature ne peut pas être remplacé, car la classe '{1}' contient plusieurs membres avec ce nom et cette signature : {2}</target> <note /> </trans-unit> <trans-unit id="ERR_OverriddenCandidate1"> <source> '{0}'</source> <target state="translated"> '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousImplements3"> <source>Member '{0}.{1}' that matches this signature cannot be implemented because the interface '{2}' contains multiple members with this same name and signature: '{3}' '{4}'</source> <target state="translated">Le membre '{0}.{1}' qui correspond à cette signature ne peut pas être implémenté, car l'interface '{2}' contient plusieurs membres avec ce nom et cette signature : '{3}' '{4}'</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNotCreatableDelegate1"> <source>'AddressOf' expression cannot be converted to '{0}' because type '{0}' is declared 'MustInherit' and cannot be created.</source> <target state="translated">'Une expression 'AddressOf' ne peut pas être convertie en '{0}', car le type '{0}' est déclaré 'MustInherit' et ne peut pas être créé.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassGenericMethod"> <source>Generic methods cannot be exposed to COM.</source> <target state="translated">Les méthodes génériques ne peuvent pas être exposées à COM.</target> <note /> </trans-unit> <trans-unit id="ERR_SyntaxInCastOp"> <source>Syntax error in cast operator; two arguments separated by comma are required.</source> <target state="translated">Erreur de syntaxe dans l'opérateur de cast ; deux arguments séparés par une virgule sont requis.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerForNonConstDim"> <source>Array initializer cannot be specified for a non constant dimension; use the empty initializer '{}'.</source> <target state="translated">Un initialiseur de tableau ne peut pas être spécifié pour une dimension non constante ; utilisez l'initialiseur vide '{}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingFailure3"> <source>No accessible method '{0}' has a signature compatible with delegate '{1}':{2}</source> <target state="translated">Aucune méthode accessible '{0}' n'a de signature compatible avec le délégué '{1}':{2}</target> <note /> </trans-unit> <trans-unit id="ERR_StructLayoutAttributeNotAllowed"> <source>Attribute 'StructLayout' cannot be applied to a generic type.</source> <target state="translated">L'attribut 'StructLayout' ne peut pas être appliqué à un type générique.</target> <note /> </trans-unit> <trans-unit id="ERR_IterationVariableShadowLocal1"> <source>Range variable '{0}' hides a variable in an enclosing block or a range variable previously defined in the query expression.</source> <target state="translated">La variable de portée '{0}' masque une variable dans un bloc englobant ou une variable de portée précédemment définie dans l'expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionInfer"> <source>'Option Infer' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Option Infer' ne peut être suivi que par 'On' ou 'Off'.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularInference1"> <source>Type of '{0}' cannot be inferred from an expression containing '{0}'.</source> <target state="translated">Le type de '{0}' ne peut pas être déduit à partir d'une expression contenant '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InAccessibleOverridingMethod5"> <source>'{0}' in class '{1}' cannot override '{2}' in class '{3}' because an intermediate class '{4}' overrides '{2}' in class '{3}' but is not accessible.</source> <target state="translated">'{0}' dans la classe '{1}' ne peut pas se substituer à '{2}' dans la classe '{3}', car une classe intermédiaire '{4}' se substitue à '{2}' dans la classe '{3}', mais n'est pas accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuitableWidestType1"> <source>Type of '{0}' cannot be inferred because the loop bounds and the step clause do not convert to the same type.</source> <target state="translated">Le type de '{0}' ne peut pas être déduit, car les limites de la boucle et la clause step ne sont pas converties en un même type.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousWidestType3"> <source>Type of '{0}' is ambiguous because the loop bounds and the step clause do not convert to the same type.</source> <target state="translated">Le type de '{0}' est ambigu, car les limites de la boucle et la clause step ne sont pas converties dans un type identique.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAssignmentOperatorInInit"> <source>'=' expected (object initializer).</source> <target state="translated">'=' attendu (initialiseur d'objet).</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQualifiedNameInInit"> <source>Name of field or property being initialized in an object initializer must start with '.'.</source> <target state="translated">Le nom du champ ou de la propriété initialisé dans un initialiseur d'objet doit commencer par '.'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLbrace"> <source>'{' expected.</source> <target state="translated">'{' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedTypeOrWith"> <source>Type or 'With' expected.</source> <target state="translated">Type ou 'With' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAggrMemberInit1"> <source>Multiple initializations of '{0}'. Fields and properties can be initialized only once in an object initializer expression.</source> <target state="translated">Plusieurs initialisations de '{0}'. Les champs et les propriétés ne peuvent être initialisés qu'une seule fois dans une expression d'initialiseur d'objet.</target> <note /> </trans-unit> <trans-unit id="ERR_NonFieldPropertyAggrMemberInit1"> <source>Member '{0}' cannot be initialized in an object initializer expression because it is not a field or property.</source> <target state="translated">Le membre '{0}' ne peut pas être initialisé dans une expression d'initialiseur d'objet, car il ne s'agit pas d'un champ ou d'une propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedMemberAggrMemberInit1"> <source>Member '{0}' cannot be initialized in an object initializer expression because it is shared.</source> <target state="translated">Le membre '{0}' ne peut pas être initialisé dans une expression d'initialiseur d'objet, car il est partagé.</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterizedPropertyInAggrInit1"> <source>Property '{0}' cannot be initialized in an object initializer expression because it requires arguments.</source> <target state="translated">La propriété '{0}' ne peut pas être initialisée dans une expression d'initialiseur d'objet, car elle requiert des arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_NoZeroCountArgumentInitCandidates1"> <source>Property '{0}' cannot be initialized in an object initializer expression because all accessible overloads require arguments.</source> <target state="translated">La propriété '{0}' ne peut pas être initialisée dans une expression d'initialiseur d'objet, car toutes les surcharges accessibles nécessitent des arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_AggrInitInvalidForObject"> <source>Object initializer syntax cannot be used to initialize an instance of 'System.Object'.</source> <target state="translated">La syntaxe de l'initialiseur d'objet ne peut pas être utilisée pour initialiser une instance de 'System.Object'.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerExpected"> <source>Initializer expected.</source> <target state="translated">Initialiseur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_LineContWithCommentOrNoPrecSpace"> <source>The line continuation character '_' must be preceded by at least one white space and it must be followed by a comment or the '_' must be the last character on the line.</source> <target state="translated">Le caractère de continuation de ligne '_' doit être précédé d'au moins un espace blanc et être suivi d'un commentaire. Sinon, '_' doit être le dernier caractère de la ligne.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleFile1"> <source>Unable to load module file '{0}': {1}</source> <target state="translated">Impossible de charger le fichier de module '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadRefLib1"> <source>Unable to load referenced library '{0}': {1}</source> <target state="translated">Impossible de charger la bibliothèque référencée '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_EventHandlerSignatureIncompatible2"> <source>Method '{0}' cannot handle event '{1}' because they do not have a compatible signature.</source> <target state="translated">La méthode '{0}' ne peut pas gérer l'événement '{1}', car sa signature n'est pas compatible.</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalCompilationConstantNotValid"> <source>Conditional compilation constant '{1}' is not valid: {0}</source> <target state="translated">La constante de compilation conditionnelle '{1}' est non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwice1"> <source>Interface '{0}' can be implemented only once by this type.</source> <target state="translated">L'interface '{0}' ne peut être implémentée qu'une seule fois par ce type.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames2"> <source>Interface '{0}' can be implemented only once by this type, but already appears with different tuple element names, as '{1}'.</source> <target state="translated">L'interface '{0}' ne peut être implémentée qu'une seule fois par ce type, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames3"> <source>Interface '{0}' can be implemented only once by this type, but already appears with different tuple element names, as '{1}' (via '{2}').</source> <target state="translated">L'interface '{0}' ne peut être implémentée qu'une seule fois par ce type, mais elle apparaît déjà avec noms d'éléments tuples différents, notamment '{1}' (par l'intermédiaire de '{2}').</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNamesReverse3"> <source>Interface '{0}' (via '{1}') can be implemented only once by this type, but already appears with different tuple element names, as '{2}'.</source> <target state="translated">L'interface '{0}' (par l'intermédiaire de '{1}') ne peut être implémentée qu'une seule fois par ce type, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames4"> <source>Interface '{0}' (via '{1}') can be implemented only once by this type, but already appears with different tuple element names, as '{2}' (via '{3}').</source> <target state="translated">L'interface '{0}' (par l'intermédiaire de '{1}') ne peut être implémentée qu'une seule fois par ce type, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{2}' (par l'intermédiaire de '{3}').</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames2"> <source>Interface '{0}' can be inherited only once by this interface, but already appears with different tuple element names, as '{1}'.</source> <target state="translated">L'interface '{0}' ne peut être héritée qu'une seule fois par cette interface, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames3"> <source>Interface '{0}' can be inherited only once by this interface, but already appears with different tuple element names, as '{1}' (via '{2}').</source> <target state="translated">L'interface '{0}' ne peut être héritée qu'une seule fois par cette interface, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{1}' (par l'intermédiaire de '{2}').</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNamesReverse3"> <source>Interface '{0}' (via '{1}') can be inherited only once by this interface, but already appears with different tuple element names, as '{2}'.</source> <target state="translated">L'interface '{0}' (par l'intermédiaire de '{1}') ne peut être héritée qu'une seule fois par cette interface, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames4"> <source>Interface '{0}' (via '{1}') can be inherited only once by this interface, but already appears with different tuple element names, as '{2}' (via '{3}').</source> <target state="translated">L'interface '{0}' (par l'intermédiaire de '{1}') ne peut être héritée qu'une seule fois par cette interface, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{2}' (par l'intermédiaire de '{3}').</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNotImplemented1"> <source>Interface '{0}' is not implemented by this class.</source> <target state="translated">L'interface '{0}' n'est pas implémentée par cette classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousImplementsMember3"> <source>'{0}' exists in multiple base interfaces. Use the name of the interface that declares '{0}' in the 'Implements' clause instead of the name of the derived interface.</source> <target state="translated">'{0}' existe dans plusieurs interfaces de base. Utilisez le nom de l'interface qui déclare '{0}' dans la clause 'Implements' au lieu du nom de l'interface dérivée.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsOnNew"> <source>'Sub New' cannot implement interface members.</source> <target state="translated">'Sub New' ne peut pas implémenter des membres d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitInStruct"> <source>Arrays declared as structure members cannot be declared with an initial size.</source> <target state="translated">Les tableaux déclarés en tant que membres de structures ne peuvent pas être déclarés avec une taille initiale.</target> <note /> </trans-unit> <trans-unit id="ERR_EventTypeNotDelegate"> <source>Events declared with an 'As' clause must have a delegate type.</source> <target state="translated">Les événements déclarés avec une clause 'As' doivent avoir un type délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_ProtectedTypeOutsideClass"> <source>Protected types can only be declared inside of a class.</source> <target state="translated">Les types protégés ne peuvent être déclarés qu'à l'intérieur d'une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPropertyWithNoParams"> <source>Properties with no required parameters cannot be declared 'Default'.</source> <target state="translated">Les propriétés sans paramètre requis ne peuvent pas être déclarées 'Default'.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerInStruct"> <source>Initializers on structure members are valid only for 'Shared' members and constants.</source> <target state="translated">Les initialiseurs pour les membres de structure ne sont valides que pour les membres et constantes 'Shared'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateImport1"> <source>Namespace or type '{0}' has already been imported.</source> <target state="translated">L'espace de noms ou le type '{0}' a déjà été importé.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleFlags1"> <source>Modules cannot be declared '{0}'.</source> <target state="translated">Les modules ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsStmtWrongOrder"> <source>'Implements' statements must follow any 'Inherits' statement and precede all declarations in a class.</source> <target state="translated">'Les instructions 'Implements' doivent suivre toute instruction 'Inherits' et précéder toutes les déclarations dans une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberClashesWithSynth7"> <source>{0} '{1}' implicitly defines '{2}', which conflicts with a member implicitly declared for {3} '{4}' in {5} '{6}'.</source> <target state="translated">{0} '{1}' définit implicitement '{2}', qui est en conflit avec un membre déclaré implicitement pour {3} '{4}' dans {5} '{6}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberClashesWithMember5"> <source>{0} '{1}' implicitly defines '{2}', which conflicts with a member of the same name in {3} '{4}'.</source> <target state="translated">{0} '{1}' définit implicitement '{2}', qui est en conflit avec un membre du même nom dans {3} '{4}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MemberClashesWithSynth6"> <source>{0} '{1}' conflicts with a member implicitly declared for {2} '{3}' in {4} '{5}'.</source> <target state="translated">{0} '{1}' est en conflit avec un membre déclaré implicitement pour {2} '{3}' dans {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeClashesWithVbCoreType4"> <source>{0} '{1}' conflicts with a Visual Basic Runtime {2} '{3}'.</source> <target state="translated">{0} '{1}' est en conflit avec un {2} '{3}' Visual Basic Runtime.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeMissingAction"> <source>First argument to a security attribute must be a valid SecurityAction.</source> <target state="translated">Le premier argument d'un attribut de sécurité doit être un SecurityAction valide.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidAction"> <source>Security attribute '{0}' has an invalid SecurityAction value '{1}'.</source> <target state="translated">L'attribut de sécurité '{0}' a une valeur SecurityAction '{1}' non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionAssembly"> <source>SecurityAction value '{0}' is invalid for security attributes applied to an assembly.</source> <target state="translated">La valeur SecurityAction '{0}' n'est pas valide pour les attributs de sécurité appliqués à un assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionTypeOrMethod"> <source>SecurityAction value '{0}' is invalid for security attributes applied to a type or a method.</source> <target state="translated">La valeur SecurityAction '{0}' n'est pas valide pour les attributs de sécurité appliqués à un type ou à une méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_PrincipalPermissionInvalidAction"> <source>SecurityAction value '{0}' is invalid for PrincipalPermission attribute.</source> <target state="translated">La valeur SecurityAction '{0}' n'est pas valide pour l'attribut PrincipalPermission.</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeInvalidFile"> <source>Unable to resolve file path '{0}' specified for the named argument '{1}' for PermissionSet attribute.</source> <target state="translated">Impossible de résoudre le chemin d'accès au fichier '{0}' spécifié pour l'argument nommé '{1}' de l'attribut PermissionSet.</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeFileReadError"> <source>Error reading file '{0}' specified for the named argument '{1}' for PermissionSet attribute: '{2}'.</source> <target state="translated">Erreur lors de la lecture du fichier '{0}' spécifié pour l'argument nommé '{1}' pour l'attribut PermissionSet : '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SetHasOnlyOneParam"> <source>'Set' method cannot have more than one parameter.</source> <target state="translated">'La méthode 'Set' ne peut pas comporter plusieurs paramètres.</target> <note /> </trans-unit> <trans-unit id="ERR_SetValueNotPropertyType"> <source>'Set' parameter must have the same type as the containing property.</source> <target state="translated">'Le paramètre 'Set' doit être du même type que la propriété conteneur.</target> <note /> </trans-unit> <trans-unit id="ERR_SetHasToBeByVal1"> <source>'Set' parameter cannot be declared '{0}'.</source> <target state="translated">'Le paramètre 'Set' ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureCantUseProtected"> <source>Method in a structure cannot be declared 'Protected', 'Protected Friend', or 'Private Protected'.</source> <target state="translated">Une méthode dans une structure ne peut pas être déclarée 'Protected', 'Protected Friend' ou 'Private Protected'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceDelegateSpecifier1"> <source>Delegate in an interface cannot be declared '{0}'.</source> <target state="translated">Un délégué dans une interface ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceEnumSpecifier1"> <source>Enum in an interface cannot be declared '{0}'.</source> <target state="translated">Un enum dans une interface ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceClassSpecifier1"> <source>Class in an interface cannot be declared '{0}'.</source> <target state="translated">Une classe dans une interface ne peut pas être déclarée '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceStructSpecifier1"> <source>Structure in an interface cannot be declared '{0}'.</source> <target state="translated">Une structure dans une interface ne peut pas être déclarée '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceInterfaceSpecifier1"> <source>Interface in an interface cannot be declared '{0}'.</source> <target state="translated">Une interface dans une interface ne peut pas être déclarée '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoleteSymbolNoMessage1"> <source>'{0}' is obsolete.</source> <target state="translated">'{0}' est obsolète.</target> <note /> </trans-unit> <trans-unit id="ERR_MetaDataIsNotAssembly"> <source>'{0}' is a module and cannot be referenced as an assembly.</source> <target state="translated">'{0}' est un module et ne peut pas être référencé en tant qu'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_MetaDataIsNotModule"> <source>'{0}' is an assembly and cannot be referenced as a module.</source> <target state="translated">'{0}' est un assembly et ne peut pas être référencé en tant que module.</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceComparison3"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'. Use 'Is' operator to compare two reference types.</source> <target state="translated">L'opérateur '{0}' n'est pas défini pour les types '{1}' et '{2}'. Utilisez 'Is' pour comparer deux types référence.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchVariableNotLocal1"> <source>'{0}' is not a local variable or parameter, and so cannot be used as a 'Catch' variable.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant que variable 'Catch', car ce n'est ni une variable locale ni un paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleMemberCantImplement"> <source>Members in a Module cannot implement interface members.</source> <target state="translated">Les membres d'un module ne peuvent pas implémenter des membres d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_EventDelegatesCantBeFunctions"> <source>Events cannot be declared with a delegate type that has a return type.</source> <target state="translated">Les événements ne peuvent pas être déclarés avec un type délégué ayant un type de retour.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDate"> <source>Date constant is not valid.</source> <target state="translated">Constante de date non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverride4"> <source>'{0}' cannot override '{1}' because it is not declared 'Overridable'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car il n'est pas déclaré 'Overridable'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyArraysOnBoth"> <source>Array modifiers cannot be specified on both a variable and its type.</source> <target state="translated">Impossible de spécifier des modificateurs de tableau pour la variable et son type.</target> <note /> </trans-unit> <trans-unit id="ERR_NotOverridableRequiresOverrides"> <source>'NotOverridable' cannot be specified for methods that do not override another method.</source> <target state="translated">'NotOverridable' ne peut pas être spécifié pour les méthodes qui ne se substituent pas à une autre méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_PrivateTypeOutsideType"> <source>Types declared 'Private' must be inside another type.</source> <target state="translated">Les types déclarés 'Private' doivent se trouver à l'intérieur d'un autre type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeRefResolutionError3"> <source>Import of type '{0}' from assembly or module '{1}' failed.</source> <target state="translated">Échec de l'importation du type '{0}' à partir de l'assembly ou du module '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTupleTypeRefResolutionError1"> <source>Predefined type '{0}' is not defined or imported.</source> <target state="translated">Le type prédéfini '{0}' n'est pas défini ou importé.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayWrongType"> <source>ParamArray parameters must have an array type.</source> <target state="translated">Les paramètres ParamArray doivent avoir un type tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_CoClassMissing2"> <source>Implementing class '{0}' for interface '{1}' cannot be found.</source> <target state="translated">La classe d'implémentation '{0}' pour l'interface '{1}' est introuvable.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidCoClass1"> <source>Type '{0}' cannot be used as an implementing class.</source> <target state="translated">Impossible d'utiliser le type '{0}' comme classe d'implémentation.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMeReference"> <source>Reference to object under construction is not valid when calling another constructor.</source> <target state="translated">Toute référence à un objet en construction n'est pas valide lors de l'appel d'un autre constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplicitMeReference"> <source>Implicit reference to object under construction is not valid when calling another constructor.</source> <target state="translated">Toute référence implicite à un objet en construction n'est pas valide lors de l'appel d'un autre constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeMemberNotFound2"> <source>Member '{0}' cannot be found in class '{1}'. This condition is usually the result of a mismatched 'Microsoft.VisualBasic.dll'.</source> <target state="translated">Le membre '{0}' est introuvable dans la classe '{1}'. Cette condition est le résultat d'un fichier 'Microsoft.VisualBasic.dll' incompatible.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags"> <source>Property accessors cannot be declared '{0}'.</source> <target state="translated">Les accesseurs de propriété ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlagsRestrict"> <source>Access modifier '{0}' is not valid. The access modifier of 'Get' and 'Set' should be more restrictive than the property access level.</source> <target state="translated">Le modificateur d'accès '{0}' n'est pas valide. Le modificateur d'accès de 'Get' et 'Set' doit être plus restrictif que le niveau d'accès de la propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOneAccessorForGetSet"> <source>Access modifier can only be applied to either 'Get' or 'Set', but not both.</source> <target state="translated">Le modificateur d'accès ne peut être appliqué qu'à 'Get' ou 'Set', mais pas aux deux.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleSet"> <source>'Set' accessor of property '{0}' is not accessible.</source> <target state="translated">'L'accesseur 'Set' de la propriété '{0}' n'est pas accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleGet"> <source>'Get' accessor of property '{0}' is not accessible.</source> <target state="translated">'L'accesseur 'Get' de la propriété '{0}' n'est pas accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyNoAccessorFlag"> <source>'WriteOnly' properties cannot have an access modifier on 'Set'.</source> <target state="translated">'Les propriétés 'WriteOnly' ne peuvent pas avoir un modificateur d'accès pour 'Set'.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyNoAccessorFlag"> <source>'ReadOnly' properties cannot have an access modifier on 'Get'.</source> <target state="translated">'Les propriétés 'ReadOnly' ne peuvent pas avoir un modificateur d'accès pour 'Get'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags1"> <source>Property accessors cannot be declared '{0}' in a 'NotOverridable' property.</source> <target state="translated">Les accesseurs de propriété ne peuvent pas être déclarés '{0}' dans une propriété 'NotOverridable'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags2"> <source>Property accessors cannot be declared '{0}' in a 'Default' property.</source> <target state="translated">Les accesseurs de propriété ne peuvent pas être déclarés '{0}' dans une propriété 'Default'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags3"> <source>Property cannot be declared '{0}' because it contains a 'Private' accessor.</source> <target state="translated">La propriété ne peut pas être déclarée '{0}', car elle contient un accesseur 'Private'.</target> <note /> </trans-unit> <trans-unit id="ERR_InAccessibleCoClass3"> <source>Implementing class '{0}' for interface '{1}' is not accessible in this context because it is '{2}'.</source> <target state="translated">La classe d'implémentation '{0}' pour l'interface '{1}' n'est pas accessible dans ce contexte, car elle est '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingValuesForArraysInApplAttrs"> <source>Arrays used as attribute arguments are required to explicitly specify values for all elements.</source> <target state="translated">Les tableaux utilisés en tant qu'arguments d'attribut sont requis pour spécifier explicitement des valeurs pour tous les éléments.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitEventMemberNotInvalid"> <source>'Exit AddHandler', 'Exit RemoveHandler' and 'Exit RaiseEvent' are not valid. Use 'Return' to exit from event members.</source> <target state="translated">'Exit AddHandler', 'Exit RemoveHandler' et 'Exit RaiseEvent' ne sont pas valides. Utilisez 'Return' pour quitter les membres d'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsEvent"> <source>Statement cannot appear within an event body. End of event assumed.</source> <target state="translated">Cette instruction ne peut pas apparaître dans le corps d'un événement. Elle est interprétée comme la fin de l'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndEvent"> <source>'Custom Event' must end with a matching 'End Event'.</source> <target state="translated">'Custom Event' doit se terminer par un 'End Event' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndAddHandler"> <source>'AddHandler' declaration must end with a matching 'End AddHandler'.</source> <target state="translated">'La déclaration 'AddHandler' doit se terminer par un 'End AddHandler' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndRemoveHandler"> <source>'RemoveHandler' declaration must end with a matching 'End RemoveHandler'.</source> <target state="translated">'La déclaration 'RemoveHandler' doit se terminer par un 'End RemoveHandler' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndRaiseEvent"> <source>'RaiseEvent' declaration must end with a matching 'End RaiseEvent'.</source> <target state="translated">'La déclaration 'RaiseEvent' doit se terminer par un 'End RaiseEvent' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_CustomEventInvInInterface"> <source>'Custom' modifier is not valid on events declared in interfaces.</source> <target state="translated">'Le modificateur 'Custom' n'est pas valide pour les événements déclarés dans les interfaces.</target> <note /> </trans-unit> <trans-unit id="ERR_CustomEventRequiresAs"> <source>'Custom' modifier is not valid on events declared without explicit delegate types.</source> <target state="translated">'Le modificateur 'Custom' n'est pas valide pour les événements déclarés sans types délégués explicites.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndEvent"> <source>'End Event' must be preceded by a matching 'Custom Event'.</source> <target state="translated">'End Event' doit être précédé d'un 'Custom Event' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndAddHandler"> <source>'End AddHandler' must be preceded by a matching 'AddHandler' declaration.</source> <target state="translated">'End AddHandler' doit être précédé d'une déclaration 'AddHandler' correspondante.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndRemoveHandler"> <source>'End RemoveHandler' must be preceded by a matching 'RemoveHandler' declaration.</source> <target state="translated">'End RemoveHandler' doit être précédé d'une déclaration 'RemoveHandler' correspondante.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndRaiseEvent"> <source>'End RaiseEvent' must be preceded by a matching 'RaiseEvent' declaration.</source> <target state="translated">'End RaiseEvent' doit être précédé d'une déclaration 'RaiseEvent' correspondante.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAddHandlerDef"> <source>'AddHandler' is already declared.</source> <target state="translated">'AddHandler' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRemoveHandlerDef"> <source>'RemoveHandler' is already declared.</source> <target state="translated">'RemoveHandler' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRaiseEventDef"> <source>'RaiseEvent' is already declared.</source> <target state="translated">'RaiseEvent' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingAddHandlerDef1"> <source>'AddHandler' definition missing for event '{0}'.</source> <target state="translated">'La définition 'AddHandler' est manquante pour l'événement '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRemoveHandlerDef1"> <source>'RemoveHandler' definition missing for event '{0}'.</source> <target state="translated">'La définition 'RemoveHandler' est manquante pour l'événement '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRaiseEventDef1"> <source>'RaiseEvent' definition missing for event '{0}'.</source> <target state="translated">'La définition 'RaiseEvent' est manquante pour l'événement '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventAddRemoveHasOnlyOneParam"> <source>'AddHandler' and 'RemoveHandler' methods must have exactly one parameter.</source> <target state="translated">'Les méthodes 'AddHandler' et 'RemoveHandler' doivent avoir exactement un paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_EventAddRemoveByrefParamIllegal"> <source>'AddHandler' and 'RemoveHandler' method parameters cannot be declared 'ByRef'.</source> <target state="translated">'Les paramètres de méthode 'AddHandler' et 'RemoveHandler' ne peuvent pas être déclarés 'ByRef'.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecifiersInvOnEventMethod"> <source>Specifiers are not valid on 'AddHandler', 'RemoveHandler' and 'RaiseEvent' methods.</source> <target state="translated">Les spécificateurs ne sont pas valides pour les méthodes 'AddHandler', 'RemoveHandler' et 'RaiseEvent'.</target> <note /> </trans-unit> <trans-unit id="ERR_AddRemoveParamNotEventType"> <source>'AddHandler' and 'RemoveHandler' method parameters must have the same delegate type as the containing event.</source> <target state="translated">'Les paramètres de méthode 'AddHandler' et 'RemoveHandler' doivent avoir le même type délégué que l'événement conteneur.</target> <note /> </trans-unit> <trans-unit id="ERR_RaiseEventShapeMismatch1"> <source>'RaiseEvent' method must have the same signature as the containing event's delegate type '{0}'.</source> <target state="translated">'La méthode 'RaiseEvent' doit avoir la même signature que le type délégué de l'événement conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventMethodOptionalParamIllegal1"> <source>'AddHandler', 'RemoveHandler' and 'RaiseEvent' method parameters cannot be declared '{0}'.</source> <target state="translated">'Les paramètres de méthode 'AddHandler', 'RemoveHandler' et 'RaiseEvent' ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantReferToMyGroupInsideGroupType1"> <source>'{0}' cannot refer to itself through its default instance; use 'Me' instead.</source> <target state="translated">'{0}' ne peut pas faire référence à lui-même via son instance par défaut ; utilisez 'Me' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUseOfCustomModifier"> <source>'Custom' modifier can only be used immediately before an 'Event' declaration.</source> <target state="translated">'Un modificateur 'Custom' ne peut être utilisé qu'immédiatement avant une déclaration 'Event'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionStrictCustom"> <source>Option Strict Custom can only be used as an option to the command-line compiler (vbc.exe).</source> <target state="translated">Option Strict Custom ne peut être utilisé qu'en tant qu'option du compilateur de ligne de commande (vbc.exe).</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteInvalidOnEventMember"> <source>'{0}' cannot be applied to the 'AddHandler', 'RemoveHandler', or 'RaiseEvent' definitions. If required, apply the attribute directly to the event.</source> <target state="translated">'{0}' ne peut pas être appliqué aux définitions 'AddHandler', 'RemoveHandler', or 'RaiseEvent'. Si nécessaire, appliquez l'attribut directement à l'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingIncompatible2"> <source>Method '{0}' does not have a signature compatible with delegate '{1}'.</source> <target state="translated">La méthode '{0}' n'a pas de signature compatible avec le délégué '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlName"> <source>XML name expected.</source> <target state="translated">Nom XML attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedXmlPrefix"> <source>XML namespace prefix '{0}' is not defined.</source> <target state="translated">Le préfixe de l'espace de noms XML '{0}' n'est pas défini.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateXmlAttribute"> <source>Duplicate XML attribute '{0}'.</source> <target state="translated">Attribut XML '{0}' en double.</target> <note /> </trans-unit> <trans-unit id="ERR_MismatchedXmlEndTag"> <source>End tag &lt;/{0}{1}{2}&gt; expected.</source> <target state="translated">Fin de balise &lt;/{0}{1}{2}&gt; attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingXmlEndTag"> <source>Element is missing an end tag.</source> <target state="translated">Balise de fin manquante dans l'élément.</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedXmlPrefix"> <source>XML namespace prefix '{0}' is reserved for use by XML and the namespace URI cannot be changed.</source> <target state="translated">Le préfixe de l'espace de noms XML '{0}' est réservé pour une utilisation par XML et l'URI de l'espace de noms ne peut pas être changé.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingVersionInXmlDecl"> <source>Required attribute 'version' missing from XML declaration.</source> <target state="translated">Attribut 'version' requis absent de la déclaration XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalAttributeInXmlDecl"> <source>XML declaration does not allow attribute '{0}{1}{2}'.</source> <target state="translated">La déclaration XML n'autorise pas l'attribut '{0}{1}{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_QuotedEmbeddedExpression"> <source>Embedded expression cannot appear inside a quoted attribute value. Try removing quotes.</source> <target state="translated">Une expression incorporée ne peut pas s'afficher à l'intérieur d'une valeur d'attribut entre guillemets. Supprimez les guillemets.</target> <note /> </trans-unit> <trans-unit id="ERR_VersionMustBeFirstInXmlDecl"> <source>XML attribute 'version' must be the first attribute in XML declaration.</source> <target state="translated">L'attribut XML 'version' doit être le premier attribut dans une déclaration XML.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOrder"> <source>XML attribute '{0}' must appear before XML attribute '{1}'.</source> <target state="translated">L'attribut XML '{0}' doit apparaître avant l'attribut XML '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndEmbedded"> <source>Expected closing '%&gt;' for embedded expression.</source> <target state="translated">%&gt;' fermant attendu pour une expression incorporée.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndPI"> <source>Expected closing '?&gt;' for XML processor instruction.</source> <target state="translated">?&gt;' fermant attendu pour une instruction de processeur XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndComment"> <source>Expected closing '--&gt;' for XML comment.</source> <target state="translated">--&gt;' fermant attendu pour un commentaire XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndCData"> <source>Expected closing ']]&gt;' for XML CDATA section.</source> <target state="translated">]]&gt;' fermant attendu pour une section CDATA XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSQuote"> <source>Expected matching closing single quote for XML attribute value.</source> <target state="translated">Guillemet simple fermant correspondant attendu pour une valeur d'attribut XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQuote"> <source>Expected matching closing double quote for XML attribute value.</source> <target state="translated">Guillemet double fermant attendu pour une valeur d'attribut XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLT"> <source>Expected beginning '&lt;' for an XML tag.</source> <target state="translated">&lt;' ouvrant attendu pour une balise XML.</target> <note /> </trans-unit> <trans-unit id="ERR_StartAttributeValue"> <source>Expected quoted XML attribute value or embedded expression.</source> <target state="translated">Valeur d'attribut XML entre guillemets ou expression incorporée attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDiv"> <source>Expected '/' for XML end tag.</source> <target state="translated">/' attendu pour la balise de fin XML.</target> <note /> </trans-unit> <trans-unit id="ERR_NoXmlAxesLateBinding"> <source>XML axis properties do not support late binding.</source> <target state="translated">Les propriétés d'axes XML ne prennent pas en charge la liaison tardive.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlStartNameChar"> <source>Character '{0}' ({1}) is not allowed at the beginning of an XML name.</source> <target state="translated">Le caractère '{0}' ({1}) n'est pas autorisé au début d'un nom XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlNameChar"> <source>Character '{0}' ({1}) is not allowed in an XML name.</source> <target state="translated">Le caractère '{0}' ({1}) n'est pas autorisé dans un nom XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlCommentChar"> <source>Character sequence '--' is not allowed in an XML comment.</source> <target state="translated">La séquence de caractères '--' n'est pas autorisée dans un commentaire XML.</target> <note /> </trans-unit> <trans-unit id="ERR_EmbeddedExpression"> <source>An embedded expression cannot be used here.</source> <target state="translated">Une expression incorporée ne peut pas être utilisée ici.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlWhiteSpace"> <source>Missing required white space.</source> <target state="translated">Espace requis manquant.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalProcessingInstructionName"> <source>XML processing instruction name '{0}' is not valid.</source> <target state="translated">Le nom de l'instruction de traitement XML '{0}' n'est pas valide.</target> <note /> </trans-unit> <trans-unit id="ERR_DTDNotSupported"> <source>XML DTDs are not supported.</source> <target state="translated">Les DTD XML ne sont pas prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlWhiteSpace"> <source>White space cannot appear here.</source> <target state="translated">L'espace ne peut pas s'afficher ici.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSColon"> <source>Expected closing ';' for XML entity.</source> <target state="translated">;' fermant attendu pour une entité XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlBeginEmbedded"> <source>Expected '%=' at start of an embedded expression.</source> <target state="translated">%=' attendu au début d'une expression incorporée.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEntityReference"> <source>XML entity references are not supported.</source> <target state="translated">Les références d'entité XML ne sont pas prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeValue1"> <source>Attribute value is not valid; expecting '{0}'.</source> <target state="translated">Valeur d'attribut non valide ; '{0}' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeValue2"> <source>Attribute value is not valid; expecting '{0}' or '{1}'.</source> <target state="translated">Valeur d'attribut non valide ; '{0}' ou '{1}' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedXmlNamespace"> <source>Prefix '{0}' cannot be bound to namespace name reserved for '{1}'.</source> <target state="translated">Le préfixe '{0}' ne peut pas être lié au nom d'espace de noms réservé pour '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalDefaultNamespace"> <source>Namespace declaration with prefix cannot have an empty value inside an XML literal.</source> <target state="translated">Une déclaration d'espace de noms avec préfixe ne peut pas avoir une valeur vide dans un littéral XML.</target> <note /> </trans-unit> <trans-unit id="ERR_QualifiedNameNotAllowed"> <source>':' is not allowed. XML qualified names cannot be used in this context.</source> <target state="translated">':' n'est pas autorisé. Les noms qualifiés XML ne peuvent pas être utilisés dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlns"> <source>Namespace declaration must start with 'xmlns'.</source> <target state="translated">Une déclaration d'espace de noms doit commencer par 'xmlns'.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlnsPrefix"> <source>Element names cannot use the 'xmlns' prefix.</source> <target state="translated">Les noms d'éléments ne peuvent pas utiliser le préfixe 'xmlns'.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlFeaturesNotAvailable"> <source>XML literals and XML axis properties are not available. Add references to System.Xml, System.Xml.Linq, and System.Core or other assemblies declaring System.Linq.Enumerable, System.Xml.Linq.XElement, System.Xml.Linq.XName, System.Xml.Linq.XAttribute and System.Xml.Linq.XNamespace types.</source> <target state="translated">Les littéraux XML et les propriétés d'axe XML ne sont pas disponibles. Ajoutez des références à System.Xml, System.Xml.Linq et System.Core ou d'autres assemblys qui déclarent des types System.Linq.Enumerable, System.Xml.Linq.XElement, System.Xml.Linq.XName, System.Xml.Linq.XAttribute et System.Xml.Linq.XNamespace.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToReadUacManifest2"> <source>Unable to open Win32 manifest file '{0}' : {1}</source> <target state="translated">Impossible d'ouvrir le fichier manifeste Win32 '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="WRN_UseValueForXmlExpression3"> <source>Cannot convert '{0}' to '{1}'. You can use the 'Value' property to get the string value of the first element of '{2}'.</source> <target state="translated">Impossible de convertir '{0}' en '{1}'. Vous pouvez utiliser la propriété 'Value' pour obtenir la valeur de chaîne du premier élément de '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UseValueForXmlExpression3_Title"> <source>Cannot convert IEnumerable(Of XElement) to String</source> <target state="translated">Impossible de convertir IEnumerable(Of XElement) en String</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMismatchForXml3"> <source>Value of type '{0}' cannot be converted to '{1}'. You can use the 'Value' property to get the string value of the first element of '{2}'.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}'. Vous pouvez utiliser la propriété 'Value' pour obtenir la valeur de chaîne du premier élément de '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryOperandsForXml4"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'. You can use the 'Value' property to get the string value of the first element of '{3}'.</source> <target state="translated">L'opérateur '{0}' n'est pas défini pour les types '{1}' et '{2}'. Vous pouvez utiliser la propriété 'Value' pour obtenir la valeur de chaîne du premier élément de '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_FullWidthAsXmlDelimiter"> <source>Full width characters are not valid as XML delimiters.</source> <target state="translated">Les caractères à pleine chasse ne sont pas valides en tant que délimiteurs XML.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSubsystemVersion"> <source>The value '{0}' is not a valid subsystem version. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise.</source> <target state="translated">La valeur '{0}' n'est pas une version de sous-système valide. La version doit être 6.02 ou supérieure pour ARM ou AppContainerExe, et 4.00 ou supérieure dans les autres cas.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFileAlignment"> <source>Invalid file section alignment '{0}'</source> <target state="translated">Alignement de section de fichier non valide '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOutputName"> <source>Invalid output name: {0}</source> <target state="translated">Nom de sortie non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInformationFormat"> <source>Invalid debug information format: {0}</source> <target state="translated">Format des informations de débogage non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_LibAnycpu32bitPreferredConflict"> <source>/platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe.</source> <target state="translated">/platform:anycpu32bitpreferred peut uniquement être utilisé avec /t:exe, /t:winexe et /t:appcontainerexe.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedAccess"> <source>Expression has the type '{0}' which is a restricted type and cannot be used to access members inherited from 'Object' or 'ValueType'.</source> <target state="translated">L'expression a le type '{0}', qui est un type restreint et qui ne peut pas être utilisé pour accéder aux membres hérités de 'Object' ou 'ValueType'.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedConversion1"> <source>Expression of type '{0}' cannot be converted to 'Object' or 'ValueType'.</source> <target state="translated">Impossible de convertir l'expression de type '{0}' en 'Object' ou 'ValueType'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypecharInLabel"> <source>Type characters are not allowed in label identifiers.</source> <target state="translated">Les caractères de type ne sont pas autorisés dans les identificateurs d'étiquette.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedType1"> <source>'{0}' cannot be made nullable, and cannot be used as the data type of an array element, field, anonymous type member, type argument, 'ByRef' parameter, or return statement.</source> <target state="translated">'{0}' ne peut pas être rendu nullable ni être utilisé comme type de données d'un élément de tableau, champ, membre de type anonyme, argument de type, paramètre 'ByRef' ou instruction return.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypecharInAlias"> <source>Type characters are not allowed on Imports aliases.</source> <target state="translated">Les caractères de type ne sont pas autorisés pour les alias Imports.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleConstructorOnBase"> <source>Class '{0}' has no accessible 'Sub New' and cannot be inherited.</source> <target state="translated">La classe '{0}' n'a pas de 'Sub New' accessible et ne peut pas être héritée.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticLocalInStruct"> <source>Local variables within methods of structures cannot be declared 'Static'.</source> <target state="translated">Les variables locales à l'intérieur des méthodes des structures ne peuvent pas être déclarées 'Static'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocalStatic1"> <source>Static local variable '{0}' is already declared.</source> <target state="translated">Une variable locale statique '{0}' est déjà déclarée.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportAliasConflictsWithType2"> <source>Imports alias '{0}' conflicts with '{1}' declared in the root namespace.</source> <target state="translated">L'alias '{0}' pour Imports est en conflit avec '{1}' déclaré dans l'espace de noms racine.</target> <note /> </trans-unit> <trans-unit id="ERR_CantShadowAMustOverride1"> <source>'{0}' cannot shadow a method declared 'MustOverride'.</source> <target state="translated">'{0}' ne peut pas masquer une méthode déclarée 'MustOverride'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleEventImplMismatch3"> <source>Event '{0}' cannot implement event '{2}.{1}' because its delegate type does not match the delegate type of another event implemented by '{0}'.</source> <target state="translated">L'événement '{0}' ne peut pas implémenter l'événement '{2}.{1}', car son type délégué ne correspond pas au type délégué d'un autre événement implémenté par '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSpecifierCombo2"> <source>'{0}' and '{1}' cannot be combined.</source> <target state="translated">'Impossible de combiner '{0}' et '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MustBeOverloads2"> <source>{0} '{1}' must be declared 'Overloads' because another '{1}' is declared 'Overloads' or 'Overrides'.</source> <target state="translated">{0} '{1}' doit être déclaré 'Overloads', car un autre '{1}' est déclaré 'Overloads' ou 'Overrides'.</target> <note /> </trans-unit> <trans-unit id="ERR_MustOverridesInClass1"> <source>'{0}' must be declared 'MustInherit' because it contains methods declared 'MustOverride'.</source> <target state="translated">'{0}' doit être déclaré 'MustInherit', car il contient des méthodes déclarées 'MustOverride'.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesSyntaxInClass"> <source>'Handles' in classes must specify a 'WithEvents' variable, 'MyBase', 'MyClass' or 'Me' qualified with a single identifier.</source> <target state="translated">'Dans les classes, 'Handles' doit spécifier une variable 'WithEvents', ou 'MyBase', 'MyClass' ou 'Me' qualifié par un identificateur unique.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberShadowsMustOverride5"> <source>'{0}', implicitly declared for {1} '{2}', cannot shadow a 'MustOverride' method in the base {3} '{4}'.</source> <target state="translated">'{0}', déclaré implicitement pour {1} '{2}', ne peut pas masquer une méthode 'MustOverride' dans le {3} '{4}' de base.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotOverrideInAccessibleMember"> <source>'{0}' cannot override '{1}' because it is not accessible in this context.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car il n'est pas accessible dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesSyntaxInModule"> <source>'Handles' in modules must specify a 'WithEvents' variable qualified with a single identifier.</source> <target state="translated">'Handles' dans les modules doivent spécifier une variable 'WithEvents' qualifiée avec un unique identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOpRequiresReferenceTypes1"> <source>'IsNot' requires operands that have reference types, but this operand has the value type '{0}'.</source> <target state="translated">'IsNot' requiert des opérandes qui ont des types référence, mais cet opérande a le type valeur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ClashWithReservedEnumMember1"> <source>'{0}' conflicts with the reserved member by this name that is implicitly declared in all enums.</source> <target state="translated">'{0}' est en conflit avec le membre réservé par ce nom qui est implicitement déclaré dans tous les enums.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefinedEnumMember2"> <source>'{0}' is already declared in this {1}.</source> <target state="translated">'{0}' est déjà déclaré dans ce {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadUseOfVoid"> <source>'System.Void' can only be used in a GetType expression.</source> <target state="translated">'System.Void' ne peut être utilisé que dans une expression GetType.</target> <note /> </trans-unit> <trans-unit id="ERR_EventImplMismatch5"> <source>Event '{0}' cannot implement event '{1}' on interface '{2}' because their delegate types '{3}' and '{4}' do not match.</source> <target state="translated">L'événement '{0}' ne peut pas implémenter l'événement '{1}' pour l'interface '{2}', car leurs types délégués '{3}' et '{4}' ne correspondent pas.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeUnavailable3"> <source>Type '{0}' in assembly '{1}' has been forwarded to assembly '{2}'. Either a reference to '{2}' is missing from your project or the type '{0}' is missing from assembly '{2}'.</source> <target state="translated">Le type '{0}' dans l'assembly '{1}' a été transmis à l'assembly '{2}'. Soit une référence à '{2}' est absente du projet soit le type '{0}' est absent de l'assembly '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeFwdCycle2"> <source>'{0}' in assembly '{1}' has been forwarded to itself and so is an unsupported type.</source> <target state="translated">'{0}' dans l'assembly '{1}' a été transféré à lui-même et est donc un type non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeInCCExpression"> <source>Non-intrinsic type names are not allowed in conditional compilation expressions.</source> <target state="translated">Les noms de types non intrinsèques ne sont pas autorisés dans les expressions de compilation conditionnelles.</target> <note /> </trans-unit> <trans-unit id="ERR_BadCCExpression"> <source>Syntax error in conditional compilation expression.</source> <target state="translated">Erreur de syntaxe dans l'expression de compilation conditionnelle.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidArrayDisallowed"> <source>Arrays of type 'System.Void' are not allowed in this expression.</source> <target state="translated">Les tableaux de type 'System.Void' ne sont pas autorisés dans cette expression.</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataMembersAmbiguous3"> <source>'{0}' is ambiguous because multiple kinds of members with this name exist in {1} '{2}'.</source> <target state="translated">'{0}' est ambigu, car plusieurs genres de membres portant ce nom existent dans {1} '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOfExprAlwaysFalse2"> <source>Expression of type '{0}' can never be of type '{1}'.</source> <target state="translated">L'expression de type '{0}' ne peut jamais être de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyPrivatePartialMethods1"> <source>Partial methods must be declared 'Private' instead of '{0}'.</source> <target state="translated">Les méthodes partielles doivent être déclarées 'Private' au lieu de '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustBePrivate"> <source>Partial methods must be declared 'Private'.</source> <target state="translated">Les méthodes partielles doivent être déclarées 'Private'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOnePartialMethodAllowed2"> <source>Method '{0}' cannot be declared 'Partial' because only one method '{1}' can be marked 'Partial'.</source> <target state="translated">La méthode '{0}' ne peut pas être déclarée 'Partial', car une seule méthode '{1}' peut être marquée comme 'Partial'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOneImplementingMethodAllowed3"> <source>Method '{0}' cannot implement partial method '{1}' because '{2}' already implements it. Only one method can implement a partial method.</source> <target state="translated">La méthode '{0}' ne peut pas implémenter de méthode partielle '{1}', car '{2}' l'implémente déjà. Une seule méthode peut implémenter une méthode partielle.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodMustBeEmpty"> <source>Partial methods must have empty method bodies.</source> <target state="translated">Les méthodes partielles doivent avoir des corps de méthodes vides.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustBeSub1"> <source>'{0}' cannot be declared 'Partial' because partial methods must be Subs.</source> <target state="translated">'{0}' ne peut pas être déclaré 'Partial', car les méthodes partielles doivent être des Subs.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodGenericConstraints2"> <source>Method '{0}' does not have the same generic constraints as the partial method '{1}'.</source> <target state="translated">La méthode '{0}' n'a pas les mêmes contraintes génériques que la méthode partielle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialDeclarationImplements1"> <source>Partial method '{0}' cannot use the 'Implements' keyword.</source> <target state="translated">La méthode partielle '{0}' ne peut pas utiliser le mot clé 'Implements'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPartialMethodInAddressOf1"> <source>'AddressOf' cannot be applied to '{0}' because '{0}' is a partial method without an implementation.</source> <target state="translated">'AddressOf' ne peut pas être appliqué à '{0}', car '{0}' est une méthode partielle sans implémentation.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementationMustBePrivate2"> <source>Method '{0}' must be declared 'Private' in order to implement partial method '{1}'.</source> <target state="translated">La méthode '{0}' doit être déclarée 'Private' pour implémenter la méthode partielle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamNamesMustMatch3"> <source>Parameter name '{0}' does not match the name of the corresponding parameter, '{1}', defined on the partial method declaration '{2}'.</source> <target state="translated">Le nom de paramètre '{0}' ne correspond pas au nom du paramètre correspondant, '{1}', défini dans la déclaration de méthode partielle '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodTypeParamNameMismatch3"> <source>Name of type parameter '{0}' does not match '{1}', the corresponding type parameter defined on the partial method declaration '{2}'.</source> <target state="translated">Le nom du paramètre de type '{0}' ne correspond pas à '{1}', le paramètre de type correspondant défini dans la déclaration de méthode partielle '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeSharedProperty1"> <source>'Shared' attribute property '{0}' cannot be the target of an assignment.</source> <target state="translated">'La propriété d'attribut 'Shared' '{0}' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeReadOnlyProperty1"> <source>'ReadOnly' attribute property '{0}' cannot be the target of an assignment.</source> <target state="translated">'La propriété d'attribut 'ReadOnly' '{0}' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateResourceName1"> <source>Resource name '{0}' cannot be used more than once.</source> <target state="translated">Le nom de ressource '{0}' ne peut pas être utilisé plusieurs fois.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateResourceFileName1"> <source>Each linked resource and module must have a unique filename. Filename '{0}' is specified more than once in this assembly.</source> <target state="translated">Chaque ressource et module liés doivent avoir un nom de fichier unique. Le nom de fichier '{0}' est indiqué plusieurs fois dans cet assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeMustBeClassNotStruct1"> <source>'{0}' cannot be used as an attribute because it is not a class.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant qu'attribut, car ce n'est pas une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeMustInheritSysAttr"> <source>'{0}' cannot be used as an attribute because it does not inherit from 'System.Attribute'.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant qu'attribut, car il n'hérite pas de 'System.Attribute'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeCannotBeAbstract"> <source>'{0}' cannot be used as an attribute because it is declared 'MustInherit'.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant qu'attribut, car il est déclaré 'MustInherit'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToOpenResourceFile1"> <source>Unable to open resource file '{0}': {1}</source> <target state="translated">Impossible d'ouvrir le fichier de ressources '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicProperty1"> <source>Attribute member '{0}' cannot be the target of an assignment because it is not declared 'Public'.</source> <target state="translated">Le membre d'attribut '{0}' ne peut pas être la cible d'une assignation, car il n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_STAThreadAndMTAThread0"> <source>'System.STAThreadAttribute' and 'System.MTAThreadAttribute' cannot both be applied to the same method.</source> <target state="translated">'Impossible d'appliquer à la fois 'System.STAThreadAttribute' et 'System.MTAThreadAttribute' à la même méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_IndirectUnreferencedAssembly4"> <source>Project '{0}' makes an indirect reference to assembly '{1}', which contains '{2}'. Add a file reference to '{3}' to your project.</source> <target state="translated">Le projet '{0}' établit une référence indirecte à l'assembly '{1}', qui contient '{2}'. Ajoutez une référence de fichier pour '{3}' dans votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicType1"> <source>Type '{0}' cannot be used in an attribute because it is not declared 'Public'.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans un attribut, car il n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicContType2"> <source>Type '{0}' cannot be used in an attribute because its container '{1}' is not declared 'Public'.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans un attribut, car son conteneur '{1}' n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnNonEmptySubOrFunction"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Sub, Function, or Operator with a non-empty body.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à un Sub, Function ou Operator avec un corps non vide.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnDeclare"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Declare.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à un Declare.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnGetOrSet"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Get or Set.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à un Get ou Set.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnGenericSubOrFunction"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a method that is generic or contained in a generic type.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à une méthode générique ou contenue dans un type générique.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassOnGeneric"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to a class that is generic or contained inside a generic type.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' ne peut pas être appliqué à une classe qui est générique ou contenue dans un type générique.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInstanceMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to instance method.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à une méthode d'instance.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInterfaceMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to interface methods.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué aux méthodes d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnEventMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to 'AddHandler', 'RemoveHandler' or 'RaiseEvent' method.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à une méthode 'AddHandler', 'RemoveHandler' ou 'RaiseEvent'.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadArguments"> <source>Friend assembly reference '{0}' is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.</source> <target state="translated">La référence d'assembly Friend '{0}' n'est pas valide. Les déclarations InternalsVisibleTo ne peuvent pas avoir une version, une culture, un jeton de clé publique ou une architecture de processeur spécifié.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyStrongNameRequired"> <source>Friend assembly reference '{0}' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.</source> <target state="translated">La référence d'assembly Friend '{0}' n'est pas valide. Les assemblys signés avec un nom fort doivent spécifier une clé publique dans leurs déclarations InternalsVisibleTo.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyNameInvalid"> <source>Friend declaration '{0}' is invalid and cannot be resolved.</source> <target state="translated">La déclaration Friend '{0}' n'est pas valide et ne peut pas être résolue.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadAccessOverride2"> <source>Member '{0}' cannot override member '{1}' defined in another assembly/project because the access modifier 'Protected Friend' expands accessibility. Use 'Protected' instead.</source> <target state="translated">Le membre '{0}' ne peut pas se substituer au membre '{1}' défini dans un autre assembly/projet, car le modificateur d'accès 'Protected Friend' étend l'accessibilité. Utilisez 'Protected' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfLocalBeforeDeclaration1"> <source>Local variable '{0}' cannot be referred to before it is declared.</source> <target state="translated">Il ne peut exister aucune référence à la variable locale '{0}' tant que cette variable n'est pas déclarée.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordFromModule1"> <source>'{0}' is not valid within a Module.</source> <target state="translated">'{0}' n'est pas valide dans un module.</target> <note /> </trans-unit> <trans-unit id="ERR_BogusWithinLineIf"> <source>Statement cannot end a block outside of a line 'If' statement.</source> <target state="translated">L'instruction ne peut pas terminer un bloc en dehors d'une instruction 'If'.</target> <note /> </trans-unit> <trans-unit id="ERR_CharToIntegralTypeMismatch1"> <source>'Char' values cannot be converted to '{0}'. Use 'Microsoft.VisualBasic.AscW' to interpret a character as a Unicode value or 'Microsoft.VisualBasic.Val' to interpret it as a digit.</source> <target state="translated">'Impossible de convertir les valeurs 'Char' en '{0}'. Utilisez soit 'Microsoft.VisualBasic.AscW' pour interpréter un caractère comme une valeur Unicode, soit 'Microsoft.VisualBasic.Val' pour interpréter le caractère comme un chiffre.</target> <note /> </trans-unit> <trans-unit id="ERR_IntegralToCharTypeMismatch1"> <source>'{0}' values cannot be converted to 'Char'. Use 'Microsoft.VisualBasic.ChrW' to interpret a numeric value as a Unicode character or first convert it to 'String' to produce a digit.</source> <target state="translated">'Impossible de convertir les valeurs '{0}' en 'Char'. Utilisez 'Microsoft.VisualBasic.ChrW' pour interpréter une valeur numérique en tant que caractère Unicode ou convertissez-la d'abord en 'String' pour obtenir un chiffre.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDirectDelegateConstruction1"> <source>Delegate '{0}' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor.</source> <target state="translated">Le délégué '{0}' requiert une expression 'AddressOf' ou une expression lambda en tant qu'unique argument de son constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodMustBeFirstStatementOnLine"> <source>Method declaration statements must be the first statement on a logical line.</source> <target state="translated">Une instruction de déclaration de méthode doit être la première instruction d'une ligne logique.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrAssignmentNotFieldOrProp1"> <source>'{0}' cannot be named as a parameter in an attribute specifier because it is not a field or property.</source> <target state="translated">'{0}' ne peut pas être nommé en tant que paramètre dans un spécificateur d'attribut, car ce n'est ni un champ ni une propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsObjectComparison1"> <source>Option Strict On disallows operands of type Object for operator '{0}'. Use the 'Is' operator to test for object identity.</source> <target state="translated">Option Strict On n'autorise pas les opérandes de type Object pour l'opérateur '{0}'. Utilisez l'opérateur 'Is' pour tester l'identité de l'objet.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstituentArraySizes"> <source>Bounds can be specified only for the top-level array when initializing an array of arrays.</source> <target state="translated">Les limites ne peuvent être spécifiées que pour le tableau de premier niveau lors de l'initialisation d'un tableau de tableaux.</target> <note /> </trans-unit> <trans-unit id="ERR_FileAttributeNotAssemblyOrModule"> <source>'Assembly' or 'Module' expected.</source> <target state="translated">'Assembly' ou 'Module' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_FunctionResultCannotBeIndexed1"> <source>'{0}' has no parameters and its return type cannot be indexed.</source> <target state="translated">'{0}' n'a aucun paramètre et son type de retour ne peut pas être indexé.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentSyntax"> <source>Comma, ')', or a valid expression continuation expected.</source> <target state="translated">Virgule, ')' ou continuation d'expression valide attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedResumeOrGoto"> <source>'Resume' or 'GoTo' expected.</source> <target state="translated">'Resume' ou 'GoTo' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAssignmentOperator"> <source>'=' expected.</source> <target state="translated">'=' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted2"> <source>Parameter '{0}' in '{1}' already has a matching omitted argument.</source> <target state="translated">Le paramètre '{0}' dans '{1}' a déjà un argument omis correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotCallEvent1"> <source>'{0}' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.</source> <target state="translated">'{0}' est un événement. Il ne peut donc pas être appelé directement. Utilisez une instruction 'RaiseEvent' pour déclencher un événement.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachCollectionDesignPattern1"> <source>Expression is of type '{0}', which is not a collection type.</source> <target state="translated">L'expression est du type '{0}', qui n'est pas un type de collection.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueForNonOptionalParam"> <source>Default values cannot be supplied for parameters that are not declared 'Optional'.</source> <target state="translated">Des valeurs par défaut ne peuvent pas être fournies pour des paramètres qui ne sont pas déclarés 'Optional'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterMyBase"> <source>'MyBase' must be followed by '.' and an identifier.</source> <target state="translated">'MyBase' doit être suivi de '.' et d'un identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterMyClass"> <source>'MyClass' must be followed by '.' and an identifier.</source> <target state="translated">'MyClass' doit être suivi de '.' et d'un identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictArgumentCopyBackNarrowing3"> <source>Option Strict On disallows narrowing from type '{1}' to type '{2}' in copying the value of 'ByRef' parameter '{0}' back to the matching argument.</source> <target state="translated">Option Strict On interdit le passage du type '{1}' au type '{2}' lors de la recopie de la valeur du paramètre 'ByRef' '{0}' dans l'argument correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_LbElseifAfterElse"> <source>'#ElseIf' cannot follow '#Else' as part of a '#If' block.</source> <target state="translated">'#ElseIf' ne peut pas suivre '#Else' dans un bloc '#If'.</target> <note /> </trans-unit> <trans-unit id="ERR_StandaloneAttribute"> <source>Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.</source> <target state="translated">Le spécificateur d'attribut n'est pas une instruction complète. Utilisez un signe de continuation de ligne pour appliquer l'attribut à l'instruction suivante.</target> <note /> </trans-unit> <trans-unit id="ERR_NoUniqueConstructorOnBase2"> <source>Class '{0}' must declare a 'Sub New' because its base class '{1}' has more than one accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car sa classe de base '{1}' comporte plus de 'Sub New' accessibles qu'il n'est possible d'appeler sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtraNextVariable"> <source>'Next' statement names more variables than there are matching 'For' statements.</source> <target state="translated">'L'instruction 'Next' nomme plus de variables qu'il n'existe d'instructions 'For' correspondantes.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNewCallTooMany2"> <source>First statement of this 'Sub New' must be a call to 'MyBase.New' or 'MyClass.New' because base class '{0}' of '{1}' has more than one accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel à 'MyBase.New' ou 'MyClass.New', car la classe de base '{0}' de '{1}' a plusieurs 'Sub New' accessibles qu'il est possible d'appeler sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_ForCtlVarArraySizesSpecified"> <source>Array declared as for loop control variable cannot be declared with an initial size.</source> <target state="translated">Un tableau déclaré en tant que variable de contrôle de boucle for ne peut pas être déclaré avec une taille initiale.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnNewOverloads"> <source>The '{0}' keyword is used to overload inherited members; do not use the '{0}' keyword when overloading 'Sub New'.</source> <target state="translated">Le mot clé '{0}' est utilisé pour surcharger les membres hérités ; n'utilisez pas le mot clé '{0}' lors de la surcharge de 'Sub New'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnGenericParam"> <source>Type character cannot be used in a type parameter declaration.</source> <target state="translated">Le caractère de type ne peut pas être utilisé dans une déclaration de paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewGenericArguments1"> <source>Too few type arguments to '{0}'.</source> <target state="translated">Arguments de type insuffisants dans '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyGenericArguments1"> <source>Too many type arguments to '{0}'.</source> <target state="translated">Arguments de type trop nombreux dans '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfied2"> <source>Type argument '{0}' does not inherit from or implement the constraint type '{1}'.</source> <target state="translated">L'argument de type '{0}' n'hérite pas ou n'implémente pas le type de contrainte '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOrMemberNotGeneric1"> <source>'{0}' has no type parameters and so cannot have type arguments.</source> <target state="translated">'{0}' n'a pas de paramètres de type et donc ne peut pas avoir d'arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_NewIfNullOnGenericParam"> <source>'New' cannot be used on a type parameter that does not have a 'New' constraint.</source> <target state="translated">'New' ne peut pas être utilisé pour un paramètre de type qui n'a pas de contrainte 'New'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleClassConstraints1"> <source>Type parameter '{0}' can only have one constraint that is a class.</source> <target state="translated">Le paramètre de type '{0}' ne peut avoir qu'une seule contrainte qui est une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstNotClassInterfaceOrTypeParam1"> <source>Type constraint '{0}' must be either a class, interface or type parameter.</source> <target state="translated">La contrainte de type '{0}' doit être un paramètre de classe, d'interface ou de type.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateTypeParamName1"> <source>Type parameter already declared with name '{0}'.</source> <target state="translated">Le paramètre de type est déjà déclaré avec le nom '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam2"> <source>Type parameter '{0}' for '{1}' cannot be inferred.</source> <target state="translated">Le paramètre de type '{0}' pour '{1}' ne peut pas être déduit.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorGenericParam1"> <source>'Is' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a type parameter with no class constraint.</source> <target state="translated">'L'opérande 'Is' de type '{0}' ne peut être comparé qu'à 'Nothing', car '{0}' est un paramètre de type sans contrainte de classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentCopyBackNarrowing3"> <source>Copying the value of 'ByRef' parameter '{0}' back to the matching argument narrows from type '{1}' to type '{2}'.</source> <target state="translated">La copie de la valeur du paramètre 'ByRef' '{0}' dans l'argument correspondant passe du type '{1}' au type '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ShadowingGenericParamWithMember1"> <source>'{0}' has the same name as a type parameter.</source> <target state="translated">'{0}' porte le même nom qu'un paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericParamBase2"> <source>{0} '{1}' cannot inherit from a type parameter.</source> <target state="translated">{0} '{1}' ne peut pas hériter d'un paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsGenericParam"> <source>Type parameter not allowed in 'Implements' clause.</source> <target state="translated">Le paramètre de type n'est pas autorisé dans la clause 'Implements'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyNullLowerBound"> <source>Array lower bounds can be only '0'.</source> <target state="translated">Les limites inférieures du tableau ne peuvent être que '0'.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassConstraintNotInheritable1"> <source>Type constraint cannot be a 'NotInheritable' class.</source> <target state="translated">La contrainte de type ne peut pas être une classe 'NotInheritable'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintIsRestrictedType1"> <source>'{0}' cannot be used as a type constraint.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant que contrainte de type.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericParamsOnInvalidMember"> <source>Type parameters cannot be specified on this declaration.</source> <target state="translated">Les paramètres de type ne peuvent pas être spécifiés pour cette déclaration.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericArgsOnAttributeSpecifier"> <source>Type arguments are not valid because attributes cannot be generic.</source> <target state="translated">Les arguments de type ne sont pas valides, car les attributs ne peuvent pas être génériques.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrCannotBeGenerics"> <source>Type parameters, generic types or types contained in generic types cannot be used as attributes.</source> <target state="translated">Les paramètres de type, les types génériques ou les types contenus dans des types génériques ne peuvent pas être utilisés comme attributs.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticLocalInGenericMethod"> <source>Local variables within generic methods cannot be declared 'Static'.</source> <target state="translated">Les variables locales dans les méthodes génériques ne peuvent pas être déclarées 'Static'.</target> <note /> </trans-unit> <trans-unit id="ERR_SyntMemberShadowsGenericParam3"> <source>{0} '{1}' implicitly defines a member '{2}' which has the same name as a type parameter.</source> <target state="translated">{0} '{1}' définit implicitement un membre '{2}' qui a le même nom que le paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintAlreadyExists1"> <source>Constraint type '{0}' already specified for this type parameter.</source> <target state="translated">Le type de contrainte '{0}' est déjà spécifié pour ce paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacePossiblyImplTwice2"> <source>Cannot implement interface '{0}' because its implementation could conflict with the implementation of another implemented interface '{1}' for some type arguments.</source> <target state="translated">Impossible d'implémenter l'interface '{0}', car son implémentation pourrait être en conflit avec l'implémentation d'une autre interface '{1}' implémentée pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ModulesCannotBeGeneric"> <source>Modules cannot be generic.</source> <target state="translated">Les modules ne peuvent pas être génériques.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericClassCannotInheritAttr"> <source>Classes that are generic or contained in a generic type cannot inherit from an attribute class.</source> <target state="translated">Les classes qui sont génériques ou contenues dans un type générique ne peuvent pas hériter d'une classe d'attributs.</target> <note /> </trans-unit> <trans-unit id="ERR_DeclaresCantBeInGeneric"> <source>'Declare' statements are not allowed in generic types or types contained in generic types.</source> <target state="translated">'Les instructions 'Declare' ne sont pas autorisées dans les types génériques ou les types contenus dans des types génériques.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithConstraintMismatch2"> <source>'{0}' cannot override '{1}' because they differ by type parameter constraints.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car leurs contraintes de paramètre de type les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsWithConstraintMismatch3"> <source>'{0}' cannot implement '{1}.{2}' because they differ by type parameter constraints.</source> <target state="translated">'{0}' ne peut pas implémenter '{1}.{2}', car ils diffèrent par leur contraintes de paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_OpenTypeDisallowed"> <source>Type parameters or types constructed with type parameters are not allowed in attribute arguments.</source> <target state="translated">Les paramètres de type ou les types construits avec des paramètres de type ne sont pas autorisés dans les arguments d'attribut.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesInvalidOnGenericMethod"> <source>Generic methods cannot use 'Handles' clause.</source> <target state="translated">Les méthodes génériques ne peuvent pas utiliser une clause 'Handles'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleNewConstraints"> <source>'New' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'La contrainte 'New' ne peut pas être spécifiée plusieurs fois pour le même paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_MustInheritForNewConstraint2"> <source>Type argument '{0}' is declared 'MustInherit' and does not satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">L'argument de type '{0}' est déclaré 'MustInherit' et ne satisfait pas la contrainte 'New' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuitableNewForNewConstraint2"> <source>Type argument '{0}' must have a public parameterless instance constructor to satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">L'argument de type '{0}' doit avoir un constructeur d'instance sans paramètre public pour satisfaire la contrainte 'New' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGenericParamForNewConstraint2"> <source>Type parameter '{0}' must have either a 'New' constraint or a 'Structure' constraint to satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">Le paramètre de type '{0}' doit avoir une contrainte 'New' ou une contrainte 'Structure' pour satisfaire la contrainte 'New' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NewArgsDisallowedForTypeParam"> <source>Arguments cannot be passed to a 'New' used on a type parameter.</source> <target state="translated">Les arguments ne peuvent pas être passés à un 'New' utilisé pour un paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRawGenericTypeImport1"> <source>Generic type '{0}' cannot be imported more than once.</source> <target state="translated">Le type générique '{0}' ne peut pas être importé plus d'une fois.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypeArgumentCountOverloadCand1"> <source>Overload resolution failed because no accessible '{0}' accepts this number of type arguments.</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible n'accepte ce nombre d'arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeArgsUnexpected"> <source>Type arguments unexpected.</source> <target state="translated">Arguments de type inattendus.</target> <note /> </trans-unit> <trans-unit id="ERR_NameSameAsMethodTypeParam1"> <source>'{0}' is already declared as a type parameter of this method.</source> <target state="translated">'{0}' est déjà déclaré en tant que paramètre de type de cette méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamNameFunctionNameCollision"> <source>Type parameter cannot have the same name as its defining function.</source> <target state="translated">Un paramètre de type ne peut pas avoir le même nom que sa fonction de définition.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstraintSyntax"> <source>Type or 'New' expected.</source> <target state="translated">Type ou 'New' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_OfExpected"> <source>'Of' required when specifying type arguments for a generic type or method.</source> <target state="translated">'Of' requis lors de la spécification des arguments de type pour un type ou une méthode générique.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayOfRawGenericInvalid"> <source>'(' unexpected. Arrays of uninstantiated generic types are not allowed.</source> <target state="translated">'(' inattendu. Les tableaux de types génériques non instanciés ne sont pas autorisés.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachAmbiguousIEnumerable1"> <source>'For Each' on type '{0}' is ambiguous because the type implements multiple instantiations of 'System.Collections.Generic.IEnumerable(Of T)'.</source> <target state="translated">'For Each' pour le type '{0}' est ambigu, car le type implémente plusieurs instanciations de 'System.Collections.Generic.IEnumerable(Of T)'.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOperatorGenericParam1"> <source>'IsNot' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a type parameter with no class constraint.</source> <target state="translated">'L'opérande 'IsNot' de type '{0}' peut être comparé uniquement à 'Nothing', car '{0}' est un paramètre de type sans contrainte de classe.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamQualifierDisallowed"> <source>Type parameters cannot be used as qualifiers.</source> <target state="translated">Les paramètres de type ne peuvent pas être utilisés comme qualificateurs.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMissingCommaOrRParen"> <source>Comma or ')' expected.</source> <target state="translated">Virgule ou ')' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMissingAsCommaOrRParen"> <source>'As', comma or ')' expected.</source> <target state="translated">'As', virgule ou ')' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleReferenceConstraints"> <source>'Class' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'La contrainte 'Class' ne peut pas être spécifiée plusieurs fois pour le même paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleValueConstraints"> <source>'Structure' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'La contrainte 'Structure' ne peut pas être spécifiée plusieurs fois pour le même paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_NewAndValueConstraintsCombined"> <source>'New' constraint and 'Structure' constraint cannot be combined.</source> <target state="translated">'La contrainte 'New' et la contrainte 'Structure' ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAndValueConstraintsCombined"> <source>'Class' constraint and 'Structure' constraint cannot be combined.</source> <target state="translated">'La contrainte 'Class' et la contrainte 'Structure' ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForStructConstraint2"> <source>Type argument '{0}' does not satisfy the 'Structure' constraint for type parameter '{1}'.</source> <target state="translated">L'argument de type '{0}' ne satisfait pas la contrainte 'Structure' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForRefConstraint2"> <source>Type argument '{0}' does not satisfy the 'Class' constraint for type parameter '{1}'.</source> <target state="translated">L'argument de type '{0}' ne satisfait pas la contrainte 'Class' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAndClassTypeConstrCombined"> <source>'Class' constraint and a specific class type constraint cannot be combined.</source> <target state="translated">'Une contrainte 'Class' et une contrainte de type classe spécifique ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueAndClassTypeConstrCombined"> <source>'Structure' constraint and a specific class type constraint cannot be combined.</source> <target state="translated">'Une contrainte 'Structure' et une contrainte de type classe spécifique ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashIndirectIndirect4"> <source>Indirect constraint '{0}' obtained from the type parameter constraint '{1}' conflicts with the indirect constraint '{2}' obtained from the type parameter constraint '{3}'.</source> <target state="translated">La contrainte indirecte '{0}' obtenue de la contrainte de paramètre de type '{1}' est en conflit avec la contrainte indirecte '{2}' obtenue de la contrainte de paramètre de type '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashDirectIndirect3"> <source>Constraint '{0}' conflicts with the indirect constraint '{1}' obtained from the type parameter constraint '{2}'.</source> <target state="translated">La contrainte '{0}' est en conflit avec la contrainte indirecte '{1}' obtenue de la contrainte de paramètre de type '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashIndirectDirect3"> <source>Indirect constraint '{0}' obtained from the type parameter constraint '{1}' conflicts with the constraint '{2}'.</source> <target state="translated">La contrainte indirecte '{0}' obtenue à partir de la contrainte de paramètre de type '{1}' est en conflit avec la contrainte '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintCycleLink2"> <source> '{0}' is constrained to '{1}'.</source> <target state="translated"> '{0}' est limité à '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintCycle2"> <source>Type parameter '{0}' cannot be constrained to itself: {1}</source> <target state="translated">Le paramètre de type '{0}' ne peut pas être limité par lui-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamWithStructConstAsConst"> <source>Type parameter with a 'Structure' constraint cannot be used as a constraint.</source> <target state="translated">Un paramètre de type avec une contrainte 'Structure' ne peut pas être utilisé en tant que contrainte.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableDisallowedForStructConstr1"> <source>'System.Nullable' does not satisfy the 'Structure' constraint for type parameter '{0}'. Only non-nullable 'Structure' types are allowed.</source> <target state="translated">'System.Nullable' ne satisfait pas la contrainte 'Structure' pour le paramètre de type '{0}'. Seuls les types 'Structure' non-nullable sont autorisés.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingDirectConstraints3"> <source>Constraint '{0}' conflicts with the constraint '{1}' already specified for type parameter '{2}'.</source> <target state="translated">La contrainte '{0}' est en conflit avec la contrainte '{1}' déjà spécifiée pour le paramètre de type '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceUnifiesWithInterface2"> <source>Cannot inherit interface '{0}' because it could be identical to interface '{1}' for some type arguments.</source> <target state="translated">Impossible d'hériter de l'interface '{0}', car elle peut être identique à l'interface '{1}' pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseUnifiesWithInterfaces3"> <source>Cannot inherit interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' for some type arguments.</source> <target state="translated">Impossible d'hériter de l'interface '{0}', car l'interface '{1}' dont elle hérite peut être identique à l'interface '{2}' pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceBaseUnifiesWithBase4"> <source>Cannot inherit interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' from which the interface '{3}' inherits for some type arguments.</source> <target state="translated">Impossible d'hériter de l'interface '{0}', car l'interface '{1}' dont elle hérite peut être identique à l'interface '{2}' dont l'interface '{3}' hérite pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceUnifiesWithBase3"> <source>Cannot inherit interface '{0}' because it could be identical to interface '{1}' from which the interface '{2}' inherits for some type arguments.</source> <target state="translated">Impossible d'hériter de l'interface '{0}', car elle peut être identique à l'interface '{1}' dont l'interface '{2}' hérite pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsBaseUnifiesWithInterfaces3"> <source>Cannot implement interface '{0}' because the interface '{1}' from which it inherits could be identical to implemented interface '{2}' for some type arguments.</source> <target state="translated">Impossible d'implémenter l'interface '{0}', car l'interface '{1}' dont elle hérite peut être identique à l'interface '{2}' implémentée pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsInterfaceBaseUnifiesWithBase4"> <source>Cannot implement interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' from which the implemented interface '{3}' inherits for some type arguments.</source> <target state="translated">Impossible d'implémenter l'interface '{0}', car l'interface '{1}' dont elle hérite peut être identique à l'interface '{2}' dont l'interface '{3}' implémentée hérite pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsInterfaceUnifiesWithBase3"> <source>Cannot implement interface '{0}' because it could be identical to interface '{1}' from which the implemented interface '{2}' inherits for some type arguments.</source> <target state="translated">Impossible d'implémenter l'interface '{0}', car elle peut être identique à l'interface '{1}' dont l'interface '{2}' implémentée hérite pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionalsCantBeStructGenericParams"> <source>Generic parameters used as optional parameter types must be class constrained.</source> <target state="translated">Les paramètres génériques utilisés en tant que types de paramètre optionnels doivent être contraints par classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNullableMethod"> <source>Methods of 'System.Nullable(Of T)' cannot be used as operands of the 'AddressOf' operator.</source> <target state="translated">Les méthodes de 'System.Nullable(Of T)' ne peuvent pas être utilisées en tant qu'opérandes de l'opérateur 'AddressOf'.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorNullable1"> <source>'Is' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a nullable type.</source> <target state="translated">'L'opérande 'Is' de type '{0}' ne peut être comparé qu'à 'Nothing', car '{0}' est un type Nullable.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOperatorNullable1"> <source>'IsNot' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a nullable type.</source> <target state="translated">'L'opérande 'IsNot' de type '{0}' ne peut être comparé qu'à 'Nothing', car '{0}' est un type Nullable.</target> <note /> </trans-unit> <trans-unit id="ERR_ShadowingTypeOutsideClass1"> <source>'{0}' cannot be declared 'Shadows' outside of a class, structure, or interface.</source> <target state="translated">'{0}' ne peut pas être déclaré 'Shadows' en dehors d'une classe, d'une structure ou d'une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertySetParamCollisionWithValue"> <source>Property parameters cannot have the name 'Value'.</source> <target state="translated">Les paramètres de propriété ne peuvent pas porter le nom 'Value'.</target> <note /> </trans-unit> <trans-unit id="ERR_SxSIndirectRefHigherThanDirectRef3"> <source>The project currently contains references to more than one version of '{0}', a direct reference to version {2} and an indirect reference to version {1}. Change the direct reference to use version {1} (or higher) of {0}.</source> <target state="translated">Le projet contient actuellement des références à plusieurs versions de '{0}', une référence directe à la version {2} et une référence indirecte à la version {1}. Modifiez la référence directe pour utiliser la version {1} (ou supérieure) de {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateReferenceStrong"> <source>Multiple assemblies with equivalent identity have been imported: '{0}' and '{1}'. Remove one of the duplicate references.</source> <target state="translated">Plusieurs assemblys ayant une identité équivalente ont été importés : '{0}' et '{1}'. Supprimez une des références en double.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateReference2"> <source>Project already has a reference to assembly '{0}'. A second reference to '{1}' cannot be added.</source> <target state="translated">Le projet a déjà une référence à l'assembly '{0}'. Une seconde référence à '{1}' ne peut pas être ajoutée.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCallOrIndex"> <source>Illegal call expression or index expression.</source> <target state="translated">Expression d'appel ou expression d'index non conforme.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictDefaultPropertyAttribute"> <source>Conflict between the default property and the 'DefaultMemberAttribute' defined on '{0}'.</source> <target state="translated">Conflit entre la propriété par défaut et le 'DefaultMemberAttribute' défini pour '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeUuid2"> <source>'{0}' cannot be applied because the format of the GUID '{1}' is not correct.</source> <target state="translated">'Impossible d'appliquer '{0}', car le format du GUID '{1}' n'est pas correct.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassAndReservedAttribute1"> <source>'Microsoft.VisualBasic.ComClassAttribute' and '{0}' cannot both be applied to the same class.</source> <target state="translated">'Impossible d'appliquer à la fois 'Microsoft.VisualBasic.ComClassAttribute' et '{0}' à la même classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassRequiresPublicClass2"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to '{0}' because its container '{1}' is not declared 'Public'.</source> <target state="translated">'Impossible d'appliquer 'Microsoft.VisualBasic.ComClassAttribute' à '{0}', car son conteneur '{1}' n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassReservedDispIdZero1"> <source>'System.Runtime.InteropServices.DispIdAttribute' cannot be applied to '{0}' because 'Microsoft.VisualBasic.ComClassAttribute' reserves zero for the default property.</source> <target state="translated">'System.Runtime.InteropServices.DispIdAttribute' ne peut pas être appliqué à '{0}', car 'Microsoft.VisualBasic.ComClassAttribute' réserve zéro pour la propriété par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassReservedDispId1"> <source>'System.Runtime.InteropServices.DispIdAttribute' cannot be applied to '{0}' because 'Microsoft.VisualBasic.ComClassAttribute' reserves values less than zero.</source> <target state="translated">'System.Runtime.InteropServices.DispIdAttribute' ne peut pas être appliqué à '{0}', car 'Microsoft.VisualBasic.ComClassAttribute' réserve des valeurs inférieures à zéro.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassDuplicateGuids1"> <source>'InterfaceId' and 'EventsId' parameters for 'Microsoft.VisualBasic.ComClassAttribute' on '{0}' cannot have the same value.</source> <target state="translated">'Les paramètres 'InterfaceId' et 'EventsId' pour 'Microsoft.VisualBasic.ComClassAttribute' pour '{0}' ne peuvent pas avoir la même valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassCantBeAbstract0"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to a class that is declared 'MustInherit'.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' ne peut pas être appliqué à une classe qui est déclarée 'MustInherit'.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassRequiresPublicClass1"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to '{0}' because it is not declared 'Public'.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' ne peut pas être appliqué à '{0}', car il n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnknownOperator"> <source>Operator declaration must be one of: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</source> <target state="translated">La déclaration d'opérateur doit être l'une des suivantes : +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateConversionCategoryUsed"> <source>'Widening' and 'Narrowing' cannot be combined.</source> <target state="translated">'Widening' et 'Narrowing' ne peuvent pas être combinés.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorNotOverloadable"> <source>Operator is not overloadable. Operator declaration must be one of: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</source> <target state="translated">L'opérateur n'est pas surchargeable. La déclaration d'opérateur doit être l'une des suivantes : +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHandles"> <source>'Handles' is not valid on operator declarations.</source> <target state="translated">'Handles' n'est pas valide pour les déclarations d'opérateur.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplements"> <source>'Implements' is not valid on operator declarations.</source> <target state="translated">'Implements' n'est pas valide pour les déclarations d'opérateur.</target> <note /> </trans-unit> <trans-unit id="ERR_EndOperatorExpected"> <source>'End Operator' expected.</source> <target state="translated">'End Operator' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_EndOperatorNotAtLineStart"> <source>'End Operator' must be the first statement on a line.</source> <target state="translated">'End Operator' doit être la première instruction sur une ligne.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndOperator"> <source>'End Operator' must be preceded by a matching 'Operator'.</source> <target state="translated">'End Operator' doit être précédé d'un 'Operator' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitOperatorNotValid"> <source>'Exit Operator' is not valid. Use 'Return' to exit an operator.</source> <target state="translated">'Exit Operator' n'est pas valide. Utilisez 'Return' pour quitter un opérateur.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayIllegal1"> <source>'{0}' parameters cannot be declared 'ParamArray'.</source> <target state="translated">'Les paramètres '{0}' ne peuvent pas être déclarés 'ParamArray'.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionalIllegal1"> <source>'{0}' parameters cannot be declared 'Optional'.</source> <target state="translated">'Les paramètres '{0}' ne peuvent pas être déclarés 'Optional'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorMustBePublic"> <source>Operators must be declared 'Public'.</source> <target state="translated">Les opérateurs doivent être déclarés 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorMustBeShared"> <source>Operators must be declared 'Shared'.</source> <target state="translated">Les opérateurs doivent être déclarés 'Shared'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadOperatorFlags1"> <source>Operators cannot be declared '{0}'.</source> <target state="translated">Les opérateurs ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OneParameterRequired1"> <source>Operator '{0}' must have one parameter.</source> <target state="translated">L'opérateur '{0}' doit avoir un paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_TwoParametersRequired1"> <source>Operator '{0}' must have two parameters.</source> <target state="translated">L'opérateur '{0}' doit avoir deux paramètres.</target> <note /> </trans-unit> <trans-unit id="ERR_OneOrTwoParametersRequired1"> <source>Operator '{0}' must have either one or two parameters.</source> <target state="translated">L'opérateur '{0}' doit avoir un ou deux paramètres.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvMustBeWideningOrNarrowing"> <source>Conversion operators must be declared either 'Widening' or 'Narrowing'.</source> <target state="translated">Les opérateurs de conversion doivent être déclarés 'Widening' ou 'Narrowing'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorDeclaredInModule"> <source>Operators cannot be declared in modules.</source> <target state="translated">Les opérateurs ne peuvent pas être déclarés dans des modules.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSpecifierOnNonConversion1"> <source>Only conversion operators can be declared '{0}'.</source> <target state="translated">Seuls les opérateurs de conversion peuvent être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnaryParamMustBeContainingType1"> <source>Parameter of this unary operator must be of the containing type '{0}'.</source> <target state="translated">Le paramètre de cet opérateur unaire doit être du type conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryParamMustBeContainingType1"> <source>At least one parameter of this binary operator must be of the containing type '{0}'.</source> <target state="translated">Au moins un paramètre de cet opérateur binaire doit être du type conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvParamMustBeContainingType1"> <source>Either the parameter type or the return type of this conversion operator must be of the containing type '{0}'.</source> <target state="translated">Le type de paramètre ou le type de retour de cet opérateur de conversion doit être du type conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorRequiresBoolReturnType1"> <source>Operator '{0}' must have a return type of Boolean.</source> <target state="translated">L'opérateur '{0}' doit avoir un type de retour Boolean.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToSameType"> <source>Conversion operators cannot convert from a type to the same type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir d'un type en un type identique.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToInterfaceType"> <source>Conversion operators cannot convert to an interface type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir en un type interface.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToBaseType"> <source>Conversion operators cannot convert from a type to its base type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir d'un type en son type de base.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToDerivedType"> <source>Conversion operators cannot convert from a type to its derived type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'un type en son type dérivé.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToObject"> <source>Conversion operators cannot convert to Object.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir en Object.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromInterfaceType"> <source>Conversion operators cannot convert from an interface type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'un type interface.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromBaseType"> <source>Conversion operators cannot convert from a base type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'un type de base.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromDerivedType"> <source>Conversion operators cannot convert from a derived type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'un type dérivé.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromObject"> <source>Conversion operators cannot convert from Object.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'Object.</target> <note /> </trans-unit> <trans-unit id="ERR_MatchingOperatorExpected2"> <source>Matching '{0}' operator is required for '{1}'.</source> <target state="translated">Un opérateur '{0}' correspondant est requis pour '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableLogicalOperator3"> <source>Return and parameter types of '{0}' must be '{1}' to be used in a '{2}' expression.</source> <target state="translated">Les types de retour et de paramètres de '{0}' doivent être '{1}' pour être utilisés dans une expression '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionOperatorRequired3"> <source>Type '{0}' must define operator '{1}' to be used in a '{2}' expression.</source> <target state="translated">Le type '{0}' doit définir l'opérateur '{1}' à utiliser dans une expression '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CopyBackTypeMismatch3"> <source>Cannot copy the value of 'ByRef' parameter '{0}' back to the matching argument because type '{1}' cannot be converted to type '{2}'.</source> <target state="translated">Impossible de recopier la valeur du paramètre 'ByRef' '{0}' dans l'argument correspondant, car le type '{1}' ne peut pas être converti en type '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ForLoopOperatorRequired2"> <source>Type '{0}' must define operator '{1}' to be used in a 'For' statement.</source> <target state="translated">Le type '{0}' doit définir l'opérateur '{1}' à utiliser dans une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableForLoopOperator2"> <source>Return and parameter types of '{0}' must be '{1}' to be used in a 'For' statement.</source> <target state="translated">Les types de retour et de paramètres de '{0}' doivent être '{1}' pour être utilisés dans une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableForLoopRelOperator2"> <source>Parameter types of '{0}' must be '{1}' to be used in a 'For' statement.</source> <target state="translated">Les types de paramètres de '{0}' doivent être '{1}' pour être utilisés dans une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorRequiresIntegerParameter1"> <source>Operator '{0}' must have a second parameter of type 'Integer' or 'Integer?'.</source> <target state="translated">L'opérateur '{0}' doit avoir un second paramètre de type 'Integer' ou 'Integer?'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyNullableOnBoth"> <source>Nullable modifier cannot be specified on both a variable and its type.</source> <target state="translated">Impossible de spécifier un modificateur autorisant les valeurs Null pour la variable et son type.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForStructConstraintNull"> <source>Type '{0}' must be a value type or a type argument constrained to 'Structure' in order to be used with 'Nullable' or nullable modifier '?'.</source> <target state="translated">Le type '{0}' doit être un type valeur ou un argument de type limité à 'Structure' pour pouvoir être utilisé avec 'Nullable' ou le modificateur autorisant les valeurs Null '?'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyArrayAndNullableOnBoth"> <source>Nullable modifier '?' and array modifiers '(' and ')' cannot be specified on both a variable and its type.</source> <target state="translated">Impossible de spécifier le modificateur autorisant les valeurs Null '?' ainsi que les modificateurs de tableau '(' et ')' pour la variable et son type.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyTypeCharacterOnIIF"> <source>Expressions used with an 'If' expression cannot contain type characters.</source> <target state="translated">Les expressions utilisées avec une expression 'If' ne peuvent pas contenir de caractères de type.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFName"> <source>'If' operands cannot be named arguments.</source> <target state="translated">'Les opérandes 'If' ne peuvent pas être des arguments nommés.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFConversion"> <source>Cannot infer a common type for the second and third operands of the 'If' operator. One must have a widening conversion to the other.</source> <target state="translated">Impossible de déduire un type commun pour le second et le troisième opérandes de l'opérateur 'If'. L'un doit avoir une conversion étendue vers l'autre.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCondTypeInIIF"> <source>First operand in a binary 'If' expression must be a nullable value type, a reference type, or an unconstrained generic type.</source> <target state="translated">Le premier opérande d'une expression 'If' binaire doit être un type valeur Nullable, un type référence ou un type générique sans contrainte.</target> <note /> </trans-unit> <trans-unit id="ERR_CantCallIIF"> <source>'If' operator cannot be used in a 'Call' statement.</source> <target state="translated">'L'opérateur 'If' ne peut pas être utilisé dans une instruction 'Call'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyAsNewAndNullable"> <source>Nullable modifier cannot be specified in variable declarations with 'As New'.</source> <target state="translated">Impossible de spécifier un modificateur autorisant les valeurs Null dans les déclarations de variable avec 'As New'.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFConversion2"> <source>Cannot infer a common type for the first and second operands of the binary 'If' operator. One must have a widening conversion to the other.</source> <target state="translated">Impossible de déduire un type commun pour le premier et le second opérandes de l'opérateur 'If' binaire. L'un doit avoir une conversion étendue vers l'autre.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNullTypeInCCExpression"> <source>Nullable types are not allowed in conditional compilation expressions.</source> <target state="translated">Les types Nullable ne sont pas autorisés dans les expressions de compilation conditionnelles.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableImplicit"> <source>Nullable modifier cannot be used with a variable whose implicit type is 'Object'.</source> <target state="translated">Impossible d'utiliser un modificateur autorisant les valeurs Null avec une variable dont le type implicite est 'Object'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRuntimeHelper"> <source>Requested operation is not available because the runtime library function '{0}' is not defined.</source> <target state="translated">L'opération demandée n'est pas disponible, car la fonction de la bibliothèque runtime '{0}' n'est pas définie.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterGlobalNameSpace"> <source>'Global' must be followed by '.' and an identifier.</source> <target state="translated">'Global' doit être suivi par '.' et un identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_NoGlobalExpectedIdentifier"> <source>'Global' not allowed in this context; identifier expected.</source> <target state="translated">'Global' n'est pas autorisé dans ce contexte ; identificateur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_NoGlobalInHandles"> <source>'Global' not allowed in handles; local name expected.</source> <target state="translated">'Global' interdit dans les handles ; nom local attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseIfNoMatchingIf"> <source>'ElseIf' must be preceded by a matching 'If' or 'ElseIf'.</source> <target state="translated">'ElseIf' doit être précédé d'un 'If' ou 'ElseIf' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeConstructor2"> <source>Attribute constructor has a 'ByRef' parameter of type '{0}'; cannot use constructors with byref parameters to apply the attribute.</source> <target state="translated">Le constructeur d'attribut a un paramètre 'ByRef' de type '{0}' ; impossible d'utiliser les constructeurs avec des paramètres byref pour appliquer l'attribut.</target> <note /> </trans-unit> <trans-unit id="ERR_EndUsingWithoutUsing"> <source>'End Using' must be preceded by a matching 'Using'.</source> <target state="translated">'End Using' doit être précédé d'un 'Using' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndUsing"> <source>'Using' must end with a matching 'End Using'.</source> <target state="translated">'Using' doit se terminer par un 'End Using' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoUsing"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'Using' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve dans une instruction 'Using' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingRequiresDisposePattern"> <source>'Using' operand of type '{0}' must implement 'System.IDisposable'.</source> <target state="translated">'L'opérande 'Using' de type '{0}' doit implémenter 'System.IDisposable'.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingResourceVarNeedsInitializer"> <source>'Using' resource variable must have an explicit initialization.</source> <target state="translated">'La variable de ressource 'Using' doit avoir une initialisation explicite.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingResourceVarCantBeArray"> <source>'Using' resource variable type can not be array type.</source> <target state="translated">'Le type de variable de ressource 'Using' ne peut pas être de type tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_OnErrorInUsing"> <source>'On Error' statements are not valid within 'Using' statements.</source> <target state="translated">'Les instructions 'On Error' ne sont pas valides dans les instructions 'Using'.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyNameConflictInMyCollection"> <source>'{0}' has the same name as a member used for type '{1}' exposed in a 'My' group. Rename the type or its enclosing namespace.</source> <target state="translated">'{0}' porte le même nom qu'un autre membre utilisé pour le type '{1}' exposé dans un groupe 'My'. Renommez le type ou son espace de noms englobant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplicitVar"> <source>Implicit variable '{0}' is invalid because of '{1}'.</source> <target state="translated">La variable Implicite '{0}' n'est pas valide en raison de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectInitializerRequiresFieldName"> <source>Object initializers require a field name to initialize.</source> <target state="translated">Les initialiseurs d'objet requièrent un nom de fichier à initialiser.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedFrom"> <source>'From' expected.</source> <target state="translated">'From' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaBindingMismatch1"> <source>Nested function does not have the same signature as delegate '{0}'.</source> <target state="translated">La fonction imbriquée n'a pas la même signature que le délégué '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaBindingMismatch2"> <source>Nested sub does not have a signature that is compatible with delegate '{0}'.</source> <target state="translated">Un Sub imbriqué n'a pas une signature compatible avec le délégué '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftByRefParamQuery1"> <source>'ByRef' parameter '{0}' cannot be used in a query expression.</source> <target state="translated">'Le paramètre 'ByRef' '{0}' ne peut pas être utilisé dans une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeNotSupported"> <source>Expression cannot be converted into an expression tree.</source> <target state="translated">Impossible de convertir l'expression en une arborescence d'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftStructureMeQuery"> <source>Instance members and 'Me' cannot be used within query expressions in structures.</source> <target state="translated">Les membres d'instance et 'Me' ne peuvent pas être utilisés au sein d'expressions de requêtes dans des structures.</target> <note /> </trans-unit> <trans-unit id="ERR_InferringNonArrayType1"> <source>Variable cannot be initialized with non-array type '{0}'.</source> <target state="translated">La variable ne peut pas être initialisée avec un type autre qu'un type tableau '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefParamInExpressionTree"> <source>References to 'ByRef' parameters cannot be converted to an expression tree.</source> <target state="translated">Impossible de convertir les références aux paramètres 'ByRef' en une arborescence de l'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAnonTypeMemberName1"> <source>Anonymous type member or property '{0}' is already declared.</source> <target state="translated">Le membre de type anonyme ou la propriété '{0}' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAnonymousTypeForExprTree"> <source>Cannot convert anonymous type to an expression tree because a property of the type is used to initialize another property.</source> <target state="translated">Impossible de convertir le type anonyme en arborescence de l'expression, car une propriété de ce type sert à initialiser une autre propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftAnonymousType1"> <source>Anonymous type property '{0}' cannot be used in the definition of a lambda expression within the same initialization list.</source> <target state="translated">La propriété de type anonyme '{0}' ne peut pas être utilisée dans la définition d'une expression lambda au sein de la même liste d'initialisation.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionOnlyAllowedOnModuleSubOrFunction"> <source>'Extension' attribute can be applied only to 'Module', 'Sub', or 'Function' declarations.</source> <target state="translated">'L'attribut 'Extension' ne peut être appliqué qu'aux déclarations 'Module', 'Sub' ou 'Function'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodNotInModule"> <source>Extension methods can be defined only in modules.</source> <target state="translated">Les méthodes d'extension ne peuvent être définies que dans des modules.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodNoParams"> <source>Extension methods must declare at least one parameter. The first parameter specifies which type to extend.</source> <target state="translated">Les méthodes d'extension doivent déclarer au moins un paramètre. Le premier paramètre spécifie le type à étendre.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOptionalFirstArg"> <source>'Optional' cannot be applied to the first parameter of an extension method. The first parameter specifies which type to extend.</source> <target state="translated">'Optional' ne peut pas être appliqué au premier paramètre d'une méthode d'extension. Le premier paramètre spécifie le type à étendre.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodParamArrayFirstArg"> <source>'ParamArray' cannot be applied to the first parameter of an extension method. The first parameter specifies which type to extend.</source> <target state="translated">'ParamArray' ne peut pas être appliqué au premier paramètre d'une méthode d'extension. Le premier paramètre spécifie le type à étendre.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeFieldNameInference"> <source>Anonymous type member name can be inferred only from a simple or qualified name with no arguments.</source> <target state="translated">Le nom du membre de type anonyme ne peut être déduit qu'à partir d'un nom simple ou qualifié sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotMemberOfAnonymousType2"> <source>'{0}' is not a member of '{1}'; it does not exist in the current context.</source> <target state="translated">'{0}' n'est pas membre de '{1}' ; il n'existe pas dans le contexte actuel.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionAttributeInvalid"> <source>The custom-designed version of 'System.Runtime.CompilerServices.ExtensionAttribute' found by the compiler is not valid. Its attribute usage flags must be set to allow assemblies, classes, and methods.</source> <target state="translated">La version personnalisée de 'System.Runtime.CompilerServices.ExtensionAttribute' trouvée par le compilateur n'est pas valide. Ses indicateurs d'utilisation d'attribut doivent être définis pour autoriser les assemblys, les classes et les méthodes.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypePropertyOutOfOrder1"> <source>Anonymous type member property '{0}' cannot be used to infer the type of another member property because the type of '{0}' is not yet established.</source> <target state="translated">La propriété du membre de type anonyme '{0}' ne peut pas être utilisée pour déduire le type d'une autre propriété de membre, car le type de '{0}' n'est pas encore établi.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeDisallowsTypeChar"> <source>Type characters cannot be used in anonymous type declarations.</source> <target state="translated">Les caractères de type ne peuvent pas être utilisés dans des déclarations de type anonymes.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleLiteralDisallowsTypeChar"> <source>Type characters cannot be used in tuple literals.</source> <target state="translated">Impossible d'utiliser des caractères de type dans des littéraux de tuple.</target> <note /> </trans-unit> <trans-unit id="ERR_NewWithTupleTypeSyntax"> <source>'New' cannot be used with tuple type. Use a tuple literal expression instead.</source> <target state="translated">'Impossible d'utiliser 'new' avec le type tuple. Utilisez une expression littérale de tuple à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeMustBeStruct"> <source>Predefined type '{0}' must be a structure.</source> <target state="translated">Le type prédéfini '{0}' doit être une structure.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodUncallable1"> <source>Extension method '{0}' has type constraints that can never be satisfied.</source> <target state="translated">La méthode d'extension '{0}' a des contraintes de type qui ne peuvent pas être satisfaites.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOverloadCandidate3"> <source> Extension method '{0}' defined in '{1}': {2}</source> <target state="translated"> Méthode d'extension '{0}' définie dans '{1}': {2}</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatch"> <source>Method does not have a signature compatible with the delegate.</source> <target state="translated">La méthode n'a pas de signature compatible avec le délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingTypeInferenceFails"> <source>Type arguments could not be inferred from the delegate.</source> <target state="translated">Impossible de déduire les arguments de type à partir du délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs"> <source>Too many arguments.</source> <target state="translated">Arguments trop nombreux.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted1"> <source>Parameter '{0}' already has a matching omitted argument.</source> <target state="translated">Le paramètre '{0}' a déjà un argument omis correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice1"> <source>Parameter '{0}' already has a matching argument.</source> <target state="translated">Le paramètre '{0}' a déjà un argument correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound1"> <source>'{0}' is not a method parameter.</source> <target state="translated">'{0}' n'est pas un paramètre de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument1"> <source>Argument not specified for parameter '{0}'.</source> <target state="translated">Argument non spécifié pour le paramètre '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam1"> <source>Type parameter '{0}' cannot be inferred.</source> <target state="translated">Le paramètre de type '{0}' ne peut pas être déduit.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOverloadCandidate2"> <source> Extension method '{0}' defined in '{1}'.</source> <target state="translated"> Méthode d'extension '{0}' définie dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNeedField"> <source>Anonymous type must contain at least one member.</source> <target state="translated">Le type anonyme doit contenir au moins un membre.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNameWithoutPeriod"> <source>Anonymous type member name must be preceded by a period.</source> <target state="translated">Le nom du membre de type anonyme doit être précédé d'un point.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeExpectedIdentifier"> <source>Identifier expected, preceded with a period.</source> <target state="translated">Identificateur attendu, précédé d'un point.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs2"> <source>Too many arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Arguments trop nombreux dans la méthode d'extension '{0}' définie dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted3"> <source>Parameter '{0}' in extension method '{1}' defined in '{2}' already has a matching omitted argument.</source> <target state="translated">Le paramètre '{0}' de la méthode d'extension '{1}' définie dans '{2}' a déjà un argument omis correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice3"> <source>Parameter '{0}' of extension method '{1}' defined in '{2}' already has a matching argument.</source> <target state="translated">Le paramètre '{0}' de la méthode d'extension '{1}' définie dans '{2}' a déjà un argument correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound3"> <source>'{0}' is not a parameter of extension method '{1}' defined in '{2}'.</source> <target state="translated">'{0}' n'est pas un paramètre de la méthode d'extension '{1}' définie dans '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument3"> <source>Argument not specified for parameter '{0}' of extension method '{1}' defined in '{2}'.</source> <target state="translated">Argument non spécifié pour le paramètre '{0}' de la méthode d'extension '{1}' définie dans '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam3"> <source>Type parameter '{0}' for extension method '{1}' defined in '{2}' cannot be inferred.</source> <target state="translated">Le paramètre de type '{0}' pour la méthode d'extension '{1}' définie dans '{2}' ne peut pas être déduit.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewGenericArguments2"> <source>Too few type arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Arguments de type insuffisants dans la méthode d'extension '{0}' définie dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyGenericArguments2"> <source>Too many type arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Arguments de type trop nombreux dans la méthode d'extension '{0}' définie dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedInOrEq"> <source>'In' or '=' expected.</source> <target state="translated">'In' ou '=' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQueryableSource"> <source>Expression of type '{0}' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.</source> <target state="translated">L'expression de type '{0}' ne peut pas être interrogée. Vérifiez qu'une référence d'assembly et/ou une importation d'espace de noms existent pour le fournisseur LINQ.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryOperatorNotFound"> <source>Definition of method '{0}' is not accessible in this context.</source> <target state="translated">La définition de la méthode '{0}' n'est pas accessible dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseOnErrorGotoWithClosure"> <source>Method cannot contain both a '{0}' statement and a definition of a variable that is used in a lambda or query expression.</source> <target state="translated">La méthode ne peut pas contenir une instruction '{0}' et une définition d'une variable qui est utilisée dans une expression lambda ou de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotGotoNonScopeBlocksWithClosure"> <source>'{0}{1}' is not valid because '{2}' is inside a scope that defines a variable that is used in a lambda or query expression.</source> <target state="translated">'{0}{1}' n'est pas valide, car '{2}' se trouve dans une portée qui définit une variable utilisée dans une expression lambda ou une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeQuery"> <source>Instance of restricted type '{0}' cannot be used in a query expression.</source> <target state="translated">Impossible d'utiliser l'instance du type restreint '{0}' dans une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonymousTypeFieldNameInference"> <source>Range variable name can be inferred only from a simple or qualified name with no arguments.</source> <target state="translated">Le nom de la variable de portée peut être déduit uniquement à partir d'un nom qualifié ou d'un nom simple sans arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryDuplicateAnonTypeMemberName1"> <source>Range variable '{0}' is already declared.</source> <target state="translated">La variable de portée '{0}' est déjà déclarée.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonymousTypeDisallowsTypeChar"> <source>Type characters cannot be used in range variable declarations.</source> <target state="translated">Les caractères de type ne peuvent pas être utilisés dans des déclarations de variable de portée.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyInClosure"> <source>'ReadOnly' variable cannot be the target of an assignment in a lambda expression inside a constructor.</source> <target state="translated">'Une variable 'ReadOnly' ne peut pas être la cible d'une assignation dans une expression lambda au sein d'un constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ExprTreeNoMultiDimArrayCreation"> <source>Multi-dimensional array cannot be converted to an expression tree.</source> <target state="translated">Impossible de convertir un tableau multidimensionnel en une arborescence de l'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_ExprTreeNoLateBind"> <source>Late binding operations cannot be converted to an expression tree.</source> <target state="translated">Impossible de convertir les opérations à liaison tardive en une arborescence de l'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedBy"> <source>'By' expected.</source> <target state="translated">'By' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryInvalidControlVariableName1"> <source>Range variable name cannot match the name of a member of the 'Object' class.</source> <target state="translated">Le nom de la variable de portée ne peut pas correspondre au nom d'un membre de la classe 'Object'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIn"> <source>'In' expected.</source> <target state="translated">'In' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNameNotDeclared"> <source>Name '{0}' is either not declared or not in the current scope.</source> <target state="translated">Le nom '{0}' n'est pas déclaré ou ne se trouve pas dans la portée actuelle.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedFunctionArgumentNarrowing3"> <source>Return type of nested function matching parameter '{0}' narrows from '{1}' to '{2}'.</source> <target state="translated">Le type de retour de la fonction imbriquée qui correspond au paramètre '{0}' passe de '{1}' à '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonTypeFieldXMLNameInference"> <source>Anonymous type member name cannot be inferred from an XML identifier that is not a valid Visual Basic identifier.</source> <target state="translated">Le nom du membre de type anonyme ne peut pas être déduit à partir d'un identificateur XML qui n'est pas un identificateur Visual Basic valide.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonTypeFieldXMLNameInference"> <source>Range variable name cannot be inferred from an XML identifier that is not a valid Visual Basic identifier.</source> <target state="translated">Le nom de la variable de portée ne peut pas être déduit à partir d'un identificateur XML qui n'est pas un identificateur Visual Basic valide.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedInto"> <source>'Into' expected.</source> <target state="translated">'Into' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnAggregation"> <source>Aggregate function name cannot be used with a type character.</source> <target state="translated">Le nom d'une fonction d'agrégation ne peut pas être utilisé avec un caractère de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOn"> <source>'On' expected.</source> <target state="translated">'On' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEquals"> <source>'Equals' expected.</source> <target state="translated">'Equals' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAnd"> <source>'And' expected.</source> <target state="translated">'And' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_EqualsTypeMismatch"> <source>'Equals' cannot compare a value of type '{0}' with a value of type '{1}'.</source> <target state="translated">'Equals' ne peut pas comparer une valeur de type '{0}' à une valeur de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EqualsOperandIsBad"> <source>You must reference at least one range variable on both sides of the 'Equals' operator. Range variable(s) {0} must appear on one side of the 'Equals' operator, and range variable(s) {1} must appear on the other.</source> <target state="translated">Vous devez référencer au moins une variable de portée des deux côtés de l'opérateur 'Equals'. La ou les variables de portée {0} doivent apparaître d'un côté de l'opérateur 'Equals' alors que la ou les variables de portée {1} doivent apparaître de l'autre côté.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNotDelegate1"> <source>Lambda expression cannot be converted to '{0}' because '{0}' is not a delegate type.</source> <target state="translated">Impossible de convertir l'expression lambda en '{0}', car '{0}' n'est pas un type délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNotCreatableDelegate1"> <source>Lambda expression cannot be converted to '{0}' because type '{0}' is declared 'MustInherit' and cannot be created.</source> <target state="translated">Impossible de convertir l'expression lambda en '{0}', car le type '{0}' est déclaré 'MustInherit' et ne peut pas être créé.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotInferNullableForVariable1"> <source>A nullable type cannot be inferred for variable '{0}'.</source> <target state="translated">Impossible de déduire un type Nullable pour la variable '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableTypeInferenceNotSupported"> <source>Nullable type inference is not supported in this context.</source> <target state="translated">L'inférence de type Nullable n'est pas prise en charge dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedJoin"> <source>'Join' expected.</source> <target state="translated">'Join' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableParameterMustSpecifyType"> <source>Nullable parameters must specify a type.</source> <target state="translated">Les paramètres Nullable doivent spécifier un type.</target> <note /> </trans-unit> <trans-unit id="ERR_IterationVariableShadowLocal2"> <source>Range variable '{0}' hides a variable in an enclosing block, a previously defined range variable, or an implicitly declared variable in a query expression.</source> <target state="translated">La variable de portée '{0}' masque une variable dans un bloc englobant, une variable de portée précédemment définie ou une variable déclarée implicitement dans une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdasCannotHaveAttributes"> <source>Attributes cannot be applied to parameters of lambda expressions.</source> <target state="translated">Des attributs ne peuvent pas être appliqués aux paramètres d'expressions lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaInSelectCaseExpr"> <source>Lambda expressions are not valid in the first expression of a 'Select Case' statement.</source> <target state="translated">Les expressions lambda ne sont pas valides dans la première expression d'une instruction 'Select Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfInSelectCaseExpr"> <source>'AddressOf' expressions are not valid in the first expression of a 'Select Case' statement.</source> <target state="translated">'Les expressions 'AddressOf' ne sont pas valides dans la première expression d'une instruction 'Select Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableCharNotSupported"> <source>The '?' character cannot be used here.</source> <target state="translated">Impossible d'utiliser le caractère '?' ici.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftStructureMeLambda"> <source>Instance members and 'Me' cannot be used within a lambda expression in structures.</source> <target state="translated">Les membres d'instance et 'Me' ne peuvent pas être utilisés au sein d'une expression lambda dans des structures.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftByRefParamLambda1"> <source>'ByRef' parameter '{0}' cannot be used in a lambda expression.</source> <target state="translated">'Le paramètre 'ByRef' '{0}' ne peut pas être utilisé dans une expression lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeLambda"> <source>Instance of restricted type '{0}' cannot be used in a lambda expression.</source> <target state="translated">Impossible d'utiliser l'instance du type restreint '{0}' dans une expression lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaParamShadowLocal1"> <source>Lambda parameter '{0}' hides a variable in an enclosing block, a previously defined range variable, or an implicitly declared variable in a query expression.</source> <target state="translated">Le paramètre lambda '{0}' masque une variable dans un bloc englobant, une variable de portée précédemment définie ou une variable déclarée implicitement dans une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowImplicitObjectLambda"> <source>Option Strict On requires each lambda expression parameter to be declared with an 'As' clause if its type cannot be inferred.</source> <target state="translated">Chaque paramètre d'expression lambda de Option Strict On doit être déclaré avec une clause 'As' si son type ne peut pas être déduit.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyParamsOnLambdaParamNoType"> <source>Array modifiers cannot be specified on lambda expression parameter name. They must be specified on its type.</source> <target state="translated">Impossible de spécifier des modificateurs de tableau pour le nom de paramètre d'une expression lambda. Ils doivent être spécifiés dans son type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments, car plusieurs types sont possibles. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments, car plusieurs types sont possibles. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments, car plusieurs types sont possibles. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments, car plusieurs types sont possibles.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments, car plusieurs types sont possibles.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments, car plusieurs types sont possibles.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments, car ils ne sont pas convertis vers le même type. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments, car ils ne sont pas convertis vers le même type. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments, car ils ne sont pas convertis vers le même type. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments, car ils ne sont pas convertis vers le même type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments, car ils ne sont pas convertis vers le même type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments, car ils ne sont pas convertis vers le même type.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatchStrictOff2"> <source>Option Strict On does not allow narrowing in implicit type conversions between method '{0}' and delegate '{1}'.</source> <target state="translated">Option Strict On n'autorise pas les conversions restrictives lors des conversions de types implicites entre la méthode '{0}' et le délégué '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleReturnTypeOfMember2"> <source>'{0}' is not accessible in this context because the return type is not accessible.</source> <target state="translated">'{0}' n'est pas accessible dans ce contexte, car le type de retour n'est pas accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIdentifierOrGroup"> <source>'Group' or an identifier expected.</source> <target state="translated">'Group' ou identificateur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedGroup"> <source>'Group' not allowed in this context; identifier expected.</source> <target state="translated">'Group' n'est pas autorisé dans ce contexte ; identificateur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatchStrictOff3"> <source>Option Strict On does not allow narrowing in implicit type conversions between extension method '{0}' defined in '{2}' and delegate '{1}'.</source> <target state="translated">Option Strict On n'autorise pas les conversions restrictives lors des conversions de types implicites entre la méthode d'extension '{0}' définie dans '{2}' et le délégué '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingIncompatible3"> <source>Extension Method '{0}' defined in '{2}' does not have a signature compatible with delegate '{1}'.</source> <target state="translated">La méthode d'extension '{0}' définie dans '{2}' n'a pas une signature compatible avec le délégué '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNarrowing2"> <source>Argument matching parameter '{0}' narrows to '{1}'.</source> <target state="translated">Le paramètre de correspondance d'arguments '{0}' passe à '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadCandidate1"> <source> {0}</source> <target state="translated"> {0}</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyInitializedInStructure"> <source>Auto-implemented Properties contained in Structures cannot have initializers unless they are marked 'Shared'.</source> <target state="translated">Les propriétés implémentées automatiquement contenues dans les structures ne peuvent pas avoir d'initialiseurs sauf si elles sont marquées comme 'Shared'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsElements"> <source>XML elements cannot be selected from type '{0}'.</source> <target state="translated">Les éléments XML ne peuvent pas être sélectionnés à partir du type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsAttributes"> <source>XML attributes cannot be selected from type '{0}'.</source> <target state="translated">Les attributs XML ne peuvent pas être sélectionnés à partir du type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsDescendants"> <source>XML descendant elements cannot be selected from type '{0}'.</source> <target state="translated">Les éléments descendants XML ne peuvent pas être sélectionnés à partir du type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOrMemberNotGeneric2"> <source>Extension method '{0}' defined in '{1}' is not generic (or has no free type parameters) and so cannot have type arguments.</source> <target state="translated">La méthode d'extension '{0}' définie dans '{1}' n'est pas générique (ou n'a pas de paramètre de type libre) et ne peut pas avoir d'arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodCannotBeLateBound"> <source>Late-bound extension methods are not supported.</source> <target state="translated">Les méthodes d'extension à liaison tardive ne sont pas prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceArrayRankMismatch1"> <source>Cannot infer a data type for '{0}' because the array dimensions do not match.</source> <target state="translated">Impossible de déduire un type de données pour '{0}', car les dimensions du tableau ne correspondent pas.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryStrictDisallowImplicitObject"> <source>Type of the range variable cannot be inferred, and late binding is not allowed with Option Strict on. Use an 'As' clause to specify the type.</source> <target state="translated">Le type de la variable de portée ne peut pas être déduit, et la liaison tardive n'est pas autorisée avec Option Strict on. Utilisez une clause 'As' pour indiquer le type.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedInterfaceWithGeneric"> <source>Type '{0}' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.</source> <target state="translated">Le type '{0}' ne peut pas être incorporé, car il a un argument générique. Désactivez l'incorporation des types interop.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseGenericTypeAcrossAssemblyBoundaries"> <source>Type '{0}' cannot be used across assembly boundaries because it has a generic type argument that is an embedded interop type.</source> <target state="translated">Le type '{0}' ne peut pas être utilisé au-delà des limites de l'assembly, car il a un argument de type générique qui est un type interop incorporé.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbol2"> <source>'{0}' is obsolete: '{1}'.</source> <target state="translated">'{0}' est obsolète : '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbol2_Title"> <source>Type or member is obsolete</source> <target state="translated">Le type ou le membre est obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverloadBase4"> <source>{0} '{1}' shadows an overloadable member declared in the base {2} '{3}'. If you want to overload the base method, this method must be declared 'Overloads'.</source> <target state="translated">{0} '{1}' cache un membre surchargeable dans le {2} '{3}' de base. Si vous voulez surcharger la méthode de base, cette méthode doit être déclarée 'Overloads'.</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverloadBase4_Title"> <source>Member shadows an overloadable member declared in the base type</source> <target state="translated">Le membre masque un membre surchargeable déclaré dans le type de base</target> <note /> </trans-unit> <trans-unit id="WRN_OverrideType5"> <source>{0} '{1}' conflicts with {2} '{1}' in the base {3} '{4}' and should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' est en conflit avec {2} '{1}' dans le {3} '{4}' de base et doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_OverrideType5_Title"> <source>Member conflicts with member in the base type and should be declared 'Shadows'</source> <target state="translated">Le membre est en conflit avec le membre du type de base et devrait être déclaré comme 'Shadows'</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverride2"> <source>{0} '{1}' shadows an overridable method in the base {2} '{3}'. To override the base method, this method must be declared 'Overrides'.</source> <target state="translated">{0} '{1}' cache une méthode surchargeable dans le {2} '{3}' de base. Pour substituer la méthode de base, cette méthode doit être déclarée 'Overrides'.</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverride2_Title"> <source>Member shadows an overridable method in the base type</source> <target state="translated">Le membre masque une méthode substituable dans le type de base</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultnessShadowed4"> <source>Default property '{0}' conflicts with the default property '{1}' in the base {2} '{3}'. '{0}' will be the default property. '{0}' should be declared 'Shadows'.</source> <target state="translated">La propriété par défaut '{0}' est en conflit avec la propriété par défaut '{1}' dans le {2} '{3}' de base. '{0}' sera la propriété par défaut. '{0}' doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultnessShadowed4_Title"> <source>Default property conflicts with the default property in the base type</source> <target state="translated">La propriété par défaut est en conflit avec la propriété par défaut du type de base</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbolNoMessage1"> <source>'{0}' is obsolete.</source> <target state="translated">'{0}' est obsolète.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbolNoMessage1_Title"> <source>Type or member is obsolete</source> <target state="translated">Le type ou le membre est obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration0"> <source>Possible problem detected while building assembly: {0}</source> <target state="translated">Problème possible détecté pendant la génération de l'assembly : {0}</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration0_Title"> <source>Possible problem detected while building assembly</source> <target state="translated">Problème potentiel détecté lors de la génération de l’assembly</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration1"> <source>Possible problem detected while building assembly '{0}': {1}</source> <target state="translated">Problème possible détecté pendant la génération de l'assembly : '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration1_Title"> <source>Possible problem detected while building assembly</source> <target state="translated">Problème potentiel détecté lors de la génération de l’assembly</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassNoMembers1"> <source>'Microsoft.VisualBasic.ComClassAttribute' is specified for class '{0}' but '{0}' has no public members that can be exposed to COM; therefore, no COM interfaces are generated.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' est spécifié pour la classe '{0}', mais '{0}' n'a pas de membres publics pouvant être exposés à COM ; par conséquent, aucune interface COM n'est générée.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassNoMembers1_Title"> <source>'Microsoft.VisualBasic.ComClassAttribute' is specified for class but class has no public members that can be exposed to COM</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' est spécifié pour la classe, mais celle-ci n’a pas de membres publics pouvant être exposés à COM</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsMember5"> <source>{0} '{1}' implicitly declares '{2}', which conflicts with a member in the base {3} '{4}', and so the {0} should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' déclare implicitement '{2}', qui est en conflit avec un membre dans le {3} '{4}' de base, {0} doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsMember5_Title"> <source>Property or event implicitly declares type or member that conflicts with a member in the base type</source> <target state="translated">La propriété ou l’événement déclare implicitement un type ou un membre qui est en conflit avec un membre du type de base</target> <note /> </trans-unit> <trans-unit id="WRN_MemberShadowsSynthMember6"> <source>{0} '{1}' conflicts with a member implicitly declared for {2} '{3}' in the base {4} '{5}' and should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' est en conflit avec un membre implicitement déclaré pour {2} '{3}' dans le {4} '{5}' de base et doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberShadowsSynthMember6_Title"> <source>Member conflicts with a member implicitly declared for property or event in the base type</source> <target state="translated">Le membre est en conflit avec un membre déclaré implicitement pour la propriété ou l’événement dans le type de base</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsSynthMember7"> <source>{0} '{1}' implicitly declares '{2}', which conflicts with a member implicitly declared for {3} '{4}' in the base {5} '{6}'. {0} should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' déclare implicitement '{2}', qui est en conflit avec un membre implicitement déclaré pour {3} '{4}' dans le {5} '{6}' de base. {0} doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsSynthMember7_Title"> <source>Property or event implicitly declares member, which conflicts with a member implicitly declared for property or event in the base type</source> <target state="translated">La propriété ou l’événement déclare implicitement un membre, qui est en conflit avec un membre déclaré implicitement pour la propriété ou l’événement du type de base</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor3"> <source>'{0}' accessor of '{1}' is obsolete: '{2}'.</source> <target state="translated">'L'accesseur '{0}' de '{1}' est obsolète : '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor3_Title"> <source>Property accessor is obsolete</source> <target state="translated">Accesseur de propriété obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor2"> <source>'{0}' accessor of '{1}' is obsolete.</source> <target state="translated">'L'accesseur '{0}' de '{1}' est obsolète.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor2_Title"> <source>Property accessor is obsolete</source> <target state="translated">Accesseur de propriété obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_FieldNotCLSCompliant1"> <source>Type of member '{0}' is not CLS-compliant.</source> <target state="translated">Le type de membre '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_FieldNotCLSCompliant1_Title"> <source>Type of member is not CLS-compliant</source> <target state="translated">Le type du membre n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_BaseClassNotCLSCompliant2"> <source>'{0}' is not CLS-compliant because it derives from '{1}', which is not CLS-compliant.</source> <target state="translated">'{0}' n'est pas conforme CLS, car il dérive de '{1}', qui n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_BaseClassNotCLSCompliant2_Title"> <source>Type is not CLS-compliant because it derives from base type that is not CLS-compliant</source> <target state="translated">Le type n’est pas conforme CLS, car il est dérivé d’un type de base qui n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ProcTypeNotCLSCompliant1"> <source>Return type of function '{0}' is not CLS-compliant.</source> <target state="translated">Le type de retour de la fonction '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_ProcTypeNotCLSCompliant1_Title"> <source>Return type of function is not CLS-compliant</source> <target state="translated">Le type de retour de la fonction n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ParamNotCLSCompliant1"> <source>Type of parameter '{0}' is not CLS-compliant.</source> <target state="translated">Le type de paramètre '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_ParamNotCLSCompliant1_Title"> <source>Type of parameter is not CLS-compliant</source> <target state="translated">Le type de paramètre n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_InheritedInterfaceNotCLSCompliant2"> <source>'{0}' is not CLS-compliant because the interface '{1}' it inherits from is not CLS-compliant.</source> <target state="translated">'{0}' n'est pas conforme CLS, car l'interface '{1}' dont il hérite n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_InheritedInterfaceNotCLSCompliant2_Title"> <source>Type is not CLS-compliant because the interface it inherits from is not CLS-compliant</source> <target state="translated">Le type n’est pas conforme CLS, car l’interface dont il hérite n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLSMemberInNonCLSType3"> <source>{0} '{1}' cannot be marked CLS-compliant because its containing type '{2}' is not CLS-compliant.</source> <target state="translated">{0} '{1}' ne peut pas être marqué comme conforme CLS, car son type conteneur '{2}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSMemberInNonCLSType3_Title"> <source>Member cannot be marked CLS-compliant because its containing type is not CLS-compliant</source> <target state="translated">Le membre ne peut pas être signalé comme conforme CLS, car son type contenant n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NameNotCLSCompliant1"> <source>Name '{0}' is not CLS-compliant.</source> <target state="translated">Le nom '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NameNotCLSCompliant1_Title"> <source>Name is not CLS-compliant</source> <target state="translated">Le nom n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_EnumUnderlyingTypeNotCLS1"> <source>Underlying type '{0}' of Enum is not CLS-compliant.</source> <target state="translated">Le type sous-jacent '{0}' d'Enum n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_EnumUnderlyingTypeNotCLS1_Title"> <source>Underlying type of Enum is not CLS-compliant</source> <target state="translated">Le type sous-jacent du type Enum n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMemberInCLSInterface1"> <source>Non CLS-compliant '{0}' is not allowed in a CLS-compliant interface.</source> <target state="translated">Le '{0}' non conforme CLS n'est pas autorisé dans une interface conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMemberInCLSInterface1_Title"> <source>Non CLS-compliant member is not allowed in a CLS-compliant interface</source> <target state="translated">Un membre non conforme CLS n’est pas autorisé dans une interface conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMustOverrideInCLSType1"> <source>Non CLS-compliant 'MustOverride' member is not allowed in CLS-compliant type '{0}'.</source> <target state="translated">Le membre « MustOverride » non conforme CLS n’est pas autorisé dans un type « {0} » conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMustOverrideInCLSType1_Title"> <source>Non CLS-compliant 'MustOverride' member is not allowed in CLS-compliant type</source> <target state="translated">Un membre 'MustOverride' non conforme CLS n’est pas autorisé dans un type conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayOverloadsNonCLS2"> <source>'{0}' is not CLS-compliant because it overloads '{1}' which differs from it only by array of array parameter types or by the rank of the array parameter types.</source> <target state="translated">'{0}' n'est pas conforme CLS, car il surcharge '{1}' dont il diffère uniquement par un tableau de types de paramètres tableau ou par le rang des types de paramètres tableau.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayOverloadsNonCLS2_Title"> <source>Method is not CLS-compliant because it overloads method which differs from it only by array of array parameter types or by the rank of the array parameter types</source> <target state="translated">La méthode n’est pas conforme CLS, car elle surcharge une méthode dont elle diffère uniquement par un tableau de types de paramètres tableau ou par la dimension des types de paramètres tableau</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant1"> <source>Root namespace '{0}' is not CLS-compliant.</source> <target state="translated">L'espace de noms racine '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant1_Title"> <source>Root namespace is not CLS-compliant</source> <target state="translated">L’espace de noms racine n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant2"> <source>Name '{0}' in the root namespace '{1}' is not CLS-compliant.</source> <target state="translated">Le nom '{0}' de l'espace de noms racine '{1}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant2_Title"> <source>Part of the root namespace is not CLS-compliant</source> <target state="translated">Une partie de l’espace de noms racine n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_GenericConstraintNotCLSCompliant1"> <source>Generic parameter constraint type '{0}' is not CLS-compliant.</source> <target state="translated">Le type de contrainte de paramètre générique '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_GenericConstraintNotCLSCompliant1_Title"> <source>Generic parameter constraint type is not CLS-compliant</source> <target state="translated">Le type de contrainte de paramètre générique n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_TypeNotCLSCompliant1"> <source>Type '{0}' is not CLS-compliant.</source> <target state="translated">Le type '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeNotCLSCompliant1_Title"> <source>Type is not CLS-compliant</source> <target state="translated">Le type n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_OptionalValueNotCLSCompliant1"> <source>Type of optional value for optional parameter '{0}' is not CLS-compliant.</source> <target state="translated">Le type de la valeur facultative pour le paramètre optionnel '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_OptionalValueNotCLSCompliant1_Title"> <source>Type of optional value for optional parameter is not CLS-compliant</source> <target state="translated">Le type de valeur facultative pour le paramètre facultatif n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLSAttrInvalidOnGetSet"> <source>System.CLSCompliantAttribute cannot be applied to property 'Get' or 'Set'.</source> <target state="translated">System.CLSCompliantAttribute ne peut pas être appliqué à la propriété 'Get' ou 'Set'.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSAttrInvalidOnGetSet_Title"> <source>System.CLSCompliantAttribute cannot be applied to property 'Get' or 'Set'</source> <target state="translated">Impossible d'appliquer System.CLSCompliantAttribute à la propriété 'Get' ou 'Set'</target> <note /> </trans-unit> <trans-unit id="WRN_TypeConflictButMerged6"> <source>{0} '{1}' and partial {2} '{3}' conflict in {4} '{5}', but are being merged because one of them is declared partial.</source> <target state="translated">{0} '{1}' et {2} '{3}' partiel sont en conflit dans {4} '{5}', mais vont être fusionnés, car l'un d'eux est déclaré partiel.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeConflictButMerged6_Title"> <source>Type and partial type conflict, but are being merged because one of them is declared partial</source> <target state="translated">Le type et le type partiel sont en conflit, mais ils sont fusionnés, car l’un d’eux est déclaré partiel</target> <note /> </trans-unit> <trans-unit id="WRN_ShadowingGenericParamWithParam1"> <source>Type parameter '{0}' has the same name as a type parameter of an enclosing type. Enclosing type's type parameter will be shadowed.</source> <target state="translated">Le paramètre de type '{0}' a le même nom qu'un paramètre de type d'un type englobant. Le paramètre de type du type englobant sera shadowed.</target> <note /> </trans-unit> <trans-unit id="WRN_ShadowingGenericParamWithParam1_Title"> <source>Type parameter has the same name as a type parameter of an enclosing type</source> <target state="translated">Le paramètre de type a le même nom qu’un paramètre de type d’un type englobant</target> <note /> </trans-unit> <trans-unit id="WRN_CannotFindStandardLibrary1"> <source>Could not find standard library '{0}'.</source> <target state="translated">La bibliothèque standard '{0}' est introuvable.</target> <note /> </trans-unit> <trans-unit id="WRN_CannotFindStandardLibrary1_Title"> <source>Could not find standard library</source> <target state="translated">Bibliothèque standard introuvable</target> <note /> </trans-unit> <trans-unit id="WRN_EventDelegateTypeNotCLSCompliant2"> <source>Delegate type '{0}' of event '{1}' is not CLS-compliant.</source> <target state="translated">Le type délégué '{0}' de l'événement '{1}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_EventDelegateTypeNotCLSCompliant2_Title"> <source>Delegate type of event is not CLS-compliant</source> <target state="translated">Le type d’événement délégué n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_DebuggerHiddenIgnoredOnProperties"> <source>System.Diagnostics.DebuggerHiddenAttribute does not affect 'Get' or 'Set' when applied to the Property definition. Apply the attribute directly to the 'Get' and 'Set' procedures as appropriate.</source> <target state="translated">System.Diagnostics.DebuggerHiddenAttribute n'affecte pas 'Get' ou 'Set' lorsqu'il est appliqué à la définition Property. Appliquez l'attribut directement aux procédures 'Get' et 'Set' de manière appropriée.</target> <note /> </trans-unit> <trans-unit id="WRN_DebuggerHiddenIgnoredOnProperties_Title"> <source>System.Diagnostics.DebuggerHiddenAttribute does not affect 'Get' or 'Set' when applied to the Property definition</source> <target state="translated">System.Diagnostics.DebuggerHiddenAttribute n’affecte pas 'Get' ou 'Set' lorsqu’il est appliqué à la définition Property</target> <note /> </trans-unit> <trans-unit id="WRN_SelectCaseInvalidRange"> <source>Range specified for 'Case' statement is not valid. Make sure that the lower bound is less than or equal to the upper bound.</source> <target state="translated">La plage spécifiée pour l'instruction 'Case' n'est pas valide. Vérifiez que la limite inférieure est inférieure ou égale à la limite supérieure.</target> <note /> </trans-unit> <trans-unit id="WRN_SelectCaseInvalidRange_Title"> <source>Range specified for 'Case' statement is not valid</source> <target state="translated">La plage spécifiée pour l’instruction 'Case' n’est pas valide</target> <note /> </trans-unit> <trans-unit id="WRN_CLSEventMethodInNonCLSType3"> <source>'{0}' method for event '{1}' cannot be marked CLS compliant because its containing type '{2}' is not CLS compliant.</source> <target state="translated">'La méthode '{0}' pour l'événement '{1}' ne peut pas être marquée comme conforme CLS, car son type conteneur '{2}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSEventMethodInNonCLSType3_Title"> <source>AddHandler or RemoveHandler method for event cannot be marked CLS compliant because its containing type is not CLS compliant</source> <target state="translated">Les méthodes AddHandler ou RemoveHandler pour un événement ne peuvent pas être signalées comme conformes CLS, car leur type contenant n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ExpectedInitComponentCall2"> <source>'{0}' in designer-generated type '{1}' should call InitializeComponent method.</source> <target state="translated">'{0}' dans le type généré par le concepteur '{1}' doit appeler la méthode InitializeComponent.</target> <note /> </trans-unit> <trans-unit id="WRN_ExpectedInitComponentCall2_Title"> <source>Constructor in designer-generated type should call InitializeComponent method</source> <target state="translated">Le constructeur du type généré par le concepteur doit appeler la méthode InitializeComponent</target> <note /> </trans-unit> <trans-unit id="WRN_NamespaceCaseMismatch3"> <source>Casing of namespace name '{0}' does not match casing of namespace name '{1}' in '{2}'.</source> <target state="translated">La casse du nom de l'espace de noms '{0}' ne correspond pas à la casse du nom de l'espace de noms '{1}' dans '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NamespaceCaseMismatch3_Title"> <source>Casing of namespace name does not match</source> <target state="translated">La casse du nom de l’espace de noms est incorrecte</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyNamespaceOrClass1"> <source>Namespace or type specified in the Imports '{0}' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.</source> <target state="translated">L'espace de noms ou le type spécifié dans les Imports '{0}' ne contient aucun membre public ou est introuvable. Vérifiez que l'espace de noms ou le type est défini et qu'il contient au moins un membre public. Vérifiez que le nom de l'élément importé n'utilise pas d'autres alias.</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyNamespaceOrClass1_Title"> <source>Namespace or type specified in Imports statement doesn't contain any public member or cannot be found</source> <target state="translated">L’espace de noms ou le type spécifié dans l’instruction Imports ne contient pas de membre public ou est introuvable</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyProjectNamespaceOrClass1"> <source>Namespace or type specified in the project-level Imports '{0}' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.</source> <target state="translated">L'espace de noms ou le type spécifié dans les importations '{0}' au niveau du projet ne contient aucun membre public ou est introuvable. Vérifiez que l'espace de noms ou le type est défini, et qu'il contient au moins un membre public. Vérifiez que le nom de l'élément importé n'utilise pas d'alias.</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyProjectNamespaceOrClass1_Title"> <source>Namespace or type imported at project level doesn't contain any public member or cannot be found</source> <target state="translated">L'espace de noms ou le type importé au niveau du projet ne contient pas de membre public ou est introuvable</target> <note /> </trans-unit> <trans-unit id="WRN_IndirectRefToLinkedAssembly2"> <source>A reference was created to embedded interop assembly '{0}' because of an indirect reference to that assembly from assembly '{1}'. Consider changing the 'Embed Interop Types' property on either assembly.</source> <target state="translated">Une référence a été créée pour l'assembly d'interopérabilité incorporé '{0}' en raison d'une référence indirecte à cet assembly à partir de l'assembly '{1}'. Modifiez la propriété 'Incorporer les types interop' pour l'un des assemblys.</target> <note /> </trans-unit> <trans-unit id="WRN_IndirectRefToLinkedAssembly2_Title"> <source>A reference was created to embedded interop assembly because of an indirect reference to that assembly</source> <target state="translated">Une référence a été créée pour l’assembly d’interopérabilité incorporé en raison d’une référence indirecte à cet assembly</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase3"> <source>Class '{0}' should declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car le '{1}' dans sa classe de base '{2}' est marqué comme obsolète.</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase3_Title"> <source>Class should declare a 'Sub New' because the constructor in its base class is marked obsolete</source> <target state="translated">La classe doit déclarer un 'Sub New', car le constructeur dans sa classe de base est marqué comme obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase4"> <source>Class '{0}' should declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete: '{3}'.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car le '{1}' dans sa classe de base '{2}' est marqué comme obsolète : '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase4_Title"> <source>Class should declare a 'Sub New' because the constructor in its base class is marked obsolete</source> <target state="translated">La classe doit déclarer un 'Sub New', car le constructeur dans sa classe de base est marqué comme obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall3"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le '{0}' dans la classe de base '{1}' de '{2}' est marquée comme obsolète.</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall3_Title"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the constructor in the base class is marked obsolete</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le constructeur de la classe de base est marqué comme obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall4"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete: '{3}'</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le '{0}' dans la classe de base '{1}' de '{2}' est marquée comme obsolète : '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall4_Title"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the constructor in the base class is marked obsolete</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le constructeur de la classe de base est marqué comme obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinOperator"> <source>Operator without an 'As' clause; type of Object assumed.</source> <target state="translated">Opérateur sans clause 'As' ; type Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinOperator_Title"> <source>Operator without an 'As' clause</source> <target state="translated">Opérateur sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_ConstraintsFailedForInferredArgs2"> <source>Type arguments inferred for method '{0}' result in the following warnings :{1}</source> <target state="translated">Les arguments de type déduits pour la méthode '{0}' donnent les avertissements suivants : {1}</target> <note /> </trans-unit> <trans-unit id="WRN_ConstraintsFailedForInferredArgs2_Title"> <source>Type arguments inferred for method result in warnings</source> <target state="translated">Les arguments de type déduits pour la méthode entraînent des avertissements</target> <note /> </trans-unit> <trans-unit id="WRN_ConditionalNotValidOnFunction"> <source>Attribute 'Conditional' is only valid on 'Sub' declarations.</source> <target state="translated">L'attribut 'Conditional' est valide uniquement dans les déclarations 'Sub'.</target> <note /> </trans-unit> <trans-unit id="WRN_ConditionalNotValidOnFunction_Title"> <source>Attribute 'Conditional' is only valid on 'Sub' declarations</source> <target state="translated">L'attribut 'Conditional' est valide uniquement dans les déclarations 'Sub'</target> <note /> </trans-unit> <trans-unit id="WRN_UseSwitchInsteadOfAttribute"> <source>Use command-line option '{0}' or appropriate project settings instead of '{1}'.</source> <target state="translated">Utilisez l'option de ligne de commande '{0}' ou les paramètres de projet appropriés plutôt que '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UseSwitchInsteadOfAttribute_Title"> <source>Use command-line option /keyfile, /keycontainer, or /delaysign instead of AssemblyKeyFileAttribute, AssemblyKeyNameAttribute, or AssemblyDelaySignAttribute</source> <target state="translated">Utilisez l’option de ligne de commande /keyfile, /keycontainer ou /delaysign au lieu de AssemblyKeyFileAttribute, AssemblyKeyNameAttribute ou AssemblyDelaySignAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveAddHandlerCall"> <source>Statement recursively calls the containing '{0}' for event '{1}'.</source> <target state="translated">L'instruction appelle de manière récursive le '{0}' conteneur pour l'événement '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveAddHandlerCall_Title"> <source>Statement recursively calls the event's containing AddHandler</source> <target state="translated">L’instruction appelle de manière récursive l’élément AddHandler contenant l’événement</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionCopyBack"> <source>Implicit conversion from '{1}' to '{2}' in copying the value of 'ByRef' parameter '{0}' back to the matching argument.</source> <target state="translated">Conversion implicite de '{1}' en '{2}' lors de la recopie de la valeur du paramètre 'ByRef' '{0}' dans l'argument correspondant.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionCopyBack_Title"> <source>Implicit conversion in copying the value of 'ByRef' parameter back to the matching argument</source> <target state="translated">Conversion implicite lors de la copie de la valeur du paramètre 'ByRef dans l’argument correspondant</target> <note /> </trans-unit> <trans-unit id="WRN_MustShadowOnMultipleInheritance2"> <source>{0} '{1}' conflicts with other members of the same name across the inheritance hierarchy and so should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' est en conflit avec d'autres membres du même nom dans la hiérarchie d'héritage et doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_MustShadowOnMultipleInheritance2_Title"> <source>Method conflicts with other members of the same name across the inheritance hierarchy and so should be declared 'Shadows'</source> <target state="translated">La méthode est en conflit avec d’autres membres du même nom dans la hiérarchie d’héritage. Par conséquent, elle devrait être déclarée 'Shadows'</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveOperatorCall"> <source>Expression recursively calls the containing Operator '{0}'.</source> <target state="translated">L'expression appelle de manière récursive l'opérateur conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveOperatorCall_Title"> <source>Expression recursively calls the containing Operator</source> <target state="translated">L’expression appelle de manière récursive l’opérateur conteneur</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversion2"> <source>Implicit conversion from '{0}' to '{1}'.</source> <target state="translated">Conversion implicite de '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversion2_Title"> <source>Implicit conversion</source> <target state="translated">Conversion implicite</target> <note /> </trans-unit> <trans-unit id="WRN_MutableStructureInUsing"> <source>Local variable '{0}' is read-only and its type is a structure. Invoking its members or passing it ByRef does not change its content and might lead to unexpected results. Consider declaring this variable outside of the 'Using' block.</source> <target state="translated">La variable locale '{0}' est en lecture seule et son type est une structure. L'appel de ses membres ou le passage de ByRef ne modifie pas son contenu et peut provoquer des résultats inattendus. Déclarez cette variable en dehors du bloc 'Using'.</target> <note /> </trans-unit> <trans-unit id="WRN_MutableStructureInUsing_Title"> <source>Local variable declared by Using statement is read-only and its type is a structure</source> <target state="translated">La variable locale déclarée à l’aide d’une instruction Using est en lecture seule et son type est une structure</target> <note /> </trans-unit> <trans-unit id="WRN_MutableGenericStructureInUsing"> <source>Local variable '{0}' is read-only. When its type is a structure, invoking its members or passing it ByRef does not change its content and might lead to unexpected results. Consider declaring this variable outside of the 'Using' block.</source> <target state="translated">La variable locale '{0}' est en lecture seule. Lorsque son type est une structure, l'appel de ses membres ou le passage de ByRef ne modifie pas son contenu et peut provoquer des résultats inattendus. Déclarez cette variable en dehors du bloc 'Using'.</target> <note /> </trans-unit> <trans-unit id="WRN_MutableGenericStructureInUsing_Title"> <source>Local variable declared by Using statement is read-only and its type may be a structure</source> <target state="translated">La variable locale déclarée à l’aide d’une instruction Using est en lecture seule et son type peut être une structure</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionSubst1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionSubst1_Title"> <source>Implicit conversion</source> <target state="translated">Conversion implicite</target> <note /> </trans-unit> <trans-unit id="WRN_LateBindingResolution"> <source>Late bound resolution; runtime errors could occur.</source> <target state="translated">Résolution à liaison tardive ; des erreurs d'exécution peuvent se produire.</target> <note /> </trans-unit> <trans-unit id="WRN_LateBindingResolution_Title"> <source>Late bound resolution</source> <target state="translated">Résolution à liaison tardive</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1"> <source>Operands of type Object used for operator '{0}'; use the 'Is' operator to test object identity.</source> <target state="translated">Opérandes de type Object utilisés pour l'opérateur '{0}' ; utilisez l'opérateur 'Is' pour tester l'identité de l'objet.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1_Title"> <source>Operands of type Object used for operator</source> <target state="translated">Opérandes de type Object utilisés pour l’opérateur</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath2"> <source>Operands of type Object used for operator '{0}'; runtime errors could occur.</source> <target state="translated">Opérandes de type Object utilisés pour l'opérateur '{0}' ; des erreurs d'exécution peuvent se produire.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath2_Title"> <source>Operands of type Object used for operator</source> <target state="translated">Opérandes de type Object utilisés pour l’opérateur</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedVar1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedVar1_Title"> <source>Variable declaration without an 'As' clause</source> <target state="translated">Déclaration de variable sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumed1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumed1_Title"> <source>Function without an 'As' clause</source> <target state="translated">Fonction sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedProperty1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedProperty1_Title"> <source>Property without an 'As' clause</source> <target state="translated">Propriété sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinVarDecl"> <source>Variable declaration without an 'As' clause; type of Object assumed.</source> <target state="translated">Déclaration de variable sans clause 'As' ; type Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinVarDecl_Title"> <source>Variable declaration without an 'As' clause</source> <target state="translated">Déclaration de variable sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinFunction"> <source>Function without an 'As' clause; return type of Object assumed.</source> <target state="translated">Fonction sans clause 'As' ; type de retour Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinFunction_Title"> <source>Function without an 'As' clause</source> <target state="translated">Fonction sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinProperty"> <source>Property without an 'As' clause; type of Object assumed.</source> <target state="translated">Propriété sans clause 'As' ; type Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinProperty_Title"> <source>Property without an 'As' clause</source> <target state="translated">Propriété sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocal"> <source>Unused local variable: '{0}'.</source> <target state="translated">Variable locale inutilisée : '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocal_Title"> <source>Unused local variable</source> <target state="translated">Variable locale non utilisée</target> <note /> </trans-unit> <trans-unit id="WRN_SharedMemberThroughInstance"> <source>Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.</source> <target state="translated">Accès d'un membre partagé, d'un membre de constante, d'un membre enum ou d'un type imbriqué via une instance ; l'expression qualifiante ne sera pas évaluée.</target> <note /> </trans-unit> <trans-unit id="WRN_SharedMemberThroughInstance_Title"> <source>Access of shared member, constant member, enum member or nested type through an instance</source> <target state="translated">Accès d’un membre partagé, d’un membre de constante, d’un membre enum ou d’un type imbriqué via une instance</target> <note /> </trans-unit> <trans-unit id="WRN_RecursivePropertyCall"> <source>Expression recursively calls the containing property '{0}'.</source> <target state="translated">L'expression appelle de manière récursive la propriété conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursivePropertyCall_Title"> <source>Expression recursively calls the containing property</source> <target state="translated">L’expression appelle de manière récursive la propriété conteneur</target> <note /> </trans-unit> <trans-unit id="WRN_OverlappingCatch"> <source>'Catch' block never reached, because '{0}' inherits from '{1}'.</source> <target state="translated">'Le bloc 'Catch' n'a jamais été atteint, car '{0}' hérite de '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_OverlappingCatch_Title"> <source>'Catch' block never reached; exception type's base type handled above in the same Try statement</source> <target state="translated">'Le bloc 'Catch' n'a jamais été atteint. Le type de base du type d'exception est géré au-dessus dans la même instruction Try</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRef"> <source>Variable '{0}' is passed by reference before it has been assigned a value. A null reference exception could result at runtime.</source> <target state="translated">La variable '{0}' est passée par référence avant qu'une valeur lui ait été attribuée. Cela peut provoquer une exception de référence null au moment de l'exécution.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRef_Title"> <source>Variable is passed by reference before it has been assigned a value</source> <target state="translated">La variable est transmise par référence avant de se voir attribuer une valeur</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateCatch"> <source>'Catch' block never reached; '{0}' handled above in the same Try statement.</source> <target state="translated">'Bloc 'Catch' jamais atteint ; '{0}' géré au-dessus dans la même instruction Try.</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateCatch_Title"> <source>'Catch' block never reached; exception type handled above in the same Try statement</source> <target state="translated">'Le bloc 'Catch' n’a jamais été atteint. Le type d’exception est traité au-dessus dans la même instruction Try</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1Not"> <source>Operands of type Object used for operator '{0}'; use the 'IsNot' operator to test object identity.</source> <target state="translated">Opérandes de type Object utilisés pour l'opérateur '{0}' ; utilisez l'opérateur 'IsNot' pour tester l'identité de l'objet.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1Not_Title"> <source>Operands of type Object used for operator &lt;&gt;</source> <target state="translated">Opérandes de type Object utilisés pour l’opérateur &lt;&gt;</target> <note /> </trans-unit> <trans-unit id="WRN_BadChecksumValExtChecksum"> <source>Bad checksum value, non hex digits or odd number of hex digits.</source> <target state="translated">Valeur de checksum erronée, pas de chiffre hexadécimal ou de nombre impair de chiffres hexadécimaux.</target> <note /> </trans-unit> <trans-unit id="WRN_BadChecksumValExtChecksum_Title"> <source>Bad checksum value, non hex digits or odd number of hex digits</source> <target state="translated">Valeur de checksum erronée, pas de chiffre hexadécimal ou de nombre impair de chiffres hexadécimaux</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleDeclFileExtChecksum"> <source>File name already declared with a different GUID and checksum value.</source> <target state="translated">Le nom de fichier est déjà déclaré avec un GUID et une valeur de checksum différents.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleDeclFileExtChecksum_Title"> <source>File name already declared with a different GUID and checksum value</source> <target state="translated">Le nom de fichier est déjà déclaré avec un GUID et une valeur de checksum différents</target> <note /> </trans-unit> <trans-unit id="WRN_BadGUIDFormatExtChecksum"> <source>Bad GUID format.</source> <target state="translated">Format de GUID incorrect.</target> <note /> </trans-unit> <trans-unit id="WRN_BadGUIDFormatExtChecksum_Title"> <source>Bad GUID format</source> <target state="translated">Format de GUID incorrect</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMathSelectCase"> <source>Operands of type Object used in expressions for 'Select', 'Case' statements; runtime errors could occur.</source> <target state="translated">Opérandes de type Object utilisés dans les expressions pour les instructions 'Select', 'Case' ; des erreurs au moment de l'exécution peuvent se produire.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMathSelectCase_Title"> <source>Operands of type Object used in expressions for 'Select', 'Case' statements</source> <target state="translated">Opérandes de type Object utilisés dans des expressions pour les instructions 'Select' et 'Case'</target> <note /> </trans-unit> <trans-unit id="WRN_EqualToLiteralNothing"> <source>This expression will always evaluate to Nothing (due to null propagation from the equals operator). To check if the value is null consider using 'Is Nothing'.</source> <target state="translated">Cette expression sera toujours évaluée en Nothing (en raison de la propagation nulle à partir de l'opérateur égal). Pour vérifier si la valeur est null, utilisez 'Is Nothing'.</target> <note /> </trans-unit> <trans-unit id="WRN_EqualToLiteralNothing_Title"> <source>This expression will always evaluate to Nothing</source> <target state="translated">Cette expression sera toujours évaluée en Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_NotEqualToLiteralNothing"> <source>This expression will always evaluate to Nothing (due to null propagation from the equals operator). To check if the value is not null consider using 'IsNot Nothing'.</source> <target state="translated">Cette expression sera toujours évaluée en Nothing (en raison de la propagation nulle à partir de l'opérateur égal). Pour vérifier si la valeur n'est pas null, utilisez 'IsNot Nothing'.</target> <note /> </trans-unit> <trans-unit id="WRN_NotEqualToLiteralNothing_Title"> <source>This expression will always evaluate to Nothing</source> <target state="translated">Cette expression sera toujours évaluée en Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocalConst"> <source>Unused local constant: '{0}'.</source> <target state="translated">Constante locale inutilisée : '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocalConst_Title"> <source>Unused local constant</source> <target state="translated">Constante locale non utilisée</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassInterfaceShadows5"> <source>'Microsoft.VisualBasic.ComClassAttribute' on class '{0}' implicitly declares {1} '{2}', which conflicts with a member of the same name in {3} '{4}'. Use 'Microsoft.VisualBasic.ComClassAttribute(InterfaceShadows:=True)' if you want to hide the name on the base {4}.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' dans la classe '{0}' déclare implicitement {1} '{2}', qui est en conflit avec un membre du même nom dans {3} '{4}'. Utilisez 'Microsoft.VisualBasic.ComClassAttribute(InterfaceShadows:=True)' si vous voulez masquer le nom dans le {4} de base.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassInterfaceShadows5_Title"> <source>'Microsoft.VisualBasic.ComClassAttribute' on class implicitly declares member, which conflicts with a member of the same name</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' sur la classe déclare le membre de manière implicite, ce qui provoque un conflit avec un membre du même nom</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassPropertySetObject1"> <source>'{0}' cannot be exposed to COM as a property 'Let'. You will not be able to assign non-object values (such as numbers or strings) to this property from Visual Basic 6.0 using a 'Let' statement.</source> <target state="translated">'{0}' ne peut pas être exposé à COM en tant que propriété 'Let'. Vous ne serez pas en mesure d'assigner des valeurs qui ne sont pas des objets (telles que des nombres ou des chaînes) à cette propriété à partir de Visual Basic 6.0 à l'aide d'une instruction 'Let'.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassPropertySetObject1_Title"> <source>Property cannot be exposed to COM as a property 'Let'</source> <target state="translated">La propriété ne peut pas être exposée à COM en tant que propriété 'Let'</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRef"> <source>Variable '{0}' is used before it has been assigned a value. A null reference exception could result at runtime.</source> <target state="translated">La variable '{0}' est utilisée avant qu'une valeur ne lui ait été assignée. Une exception de référence null peut se produire au moment de l'exécution.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRef_Title"> <source>Variable is used before it has been assigned a value</source> <target state="translated">La variable est utilisée avant de se voir attribuer une valeur</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncRef1"> <source>Function '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">La fonction '{0}' ne retourne pas une valeur pour tous les chemins du code. Une exception de référence null peut se produire au moment de l'exécution lorsque le résultat est utilisé.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncRef1_Title"> <source>Function doesn't return a value on all code paths</source> <target state="translated">La fonction ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpRef1"> <source>Operator '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">L'opérateur '{0}' ne retourne pas une valeur pour tous les chemins du code. Une exception de référence null peut se produire au moment de l'exécution lorsque le résultat est utilisé.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpRef1_Title"> <source>Operator doesn't return a value on all code paths</source> <target state="translated">L’opérateur ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropRef1"> <source>Property '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">La propriété '{0}' ne retourne pas une valeur pour tous les chemins du code. Une exception de référence null peut se produire au moment de l'exécution lorsque le résultat est utilisé.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropRef1_Title"> <source>Property doesn't return a value on all code paths</source> <target state="translated">La propriété ne retourne pas une valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRefStr"> <source>Variable '{0}' is passed by reference before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use</source> <target state="translated">La variable '{0}' est passée par référence avant qu'une valeur lui ait été attribuée. Cela peut provoquer une exception de référence null au moment de l'exécution. Assurez-vous que la structure et tous les membres de référence sont initialisés avant leur utilisation</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRefStr_Title"> <source>Variable is passed by reference before it has been assigned a value</source> <target state="translated">La variable est transmise par référence avant de se voir attribuer une valeur</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefStr"> <source>Variable '{0}' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use</source> <target state="translated">La variable '{0}' est utilisée avant qu'une valeur ne lui ait été assignée. Une exception de référence null peut se produire au moment de l'exécution. Vérifiez que la structure ou que tous les membres de référence sont initialisés avant de les utiliser</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefStr_Title"> <source>Variable is used before it has been assigned a value</source> <target state="translated">La variable est utilisée avant de se voir attribuer une valeur</target> <note /> </trans-unit> <trans-unit id="WRN_StaticLocalNoInference"> <source>Static variable declared without an 'As' clause; type of Object assumed.</source> <target state="translated">Variable Static déclarée sans clause 'As' ; type Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_StaticLocalNoInference_Title"> <source>Static variable declared without an 'As' clause</source> <target state="translated">Variable statique déclarée sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName"> <source>Assembly reference '{0}' is invalid and cannot be resolved.</source> <target state="translated">La référence d'assembly '{0}' n'est pas valide et ne peut pas être résolue.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName_Title"> <source>Assembly reference is invalid and cannot be resolved</source> <target state="translated">La référence d'assembly n'est pas valide et ne peut pas être résolue</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadXMLLine"> <source>XML comment block must immediately precede the language element to which it applies. XML comment will be ignored.</source> <target state="translated">Le bloc de commentaires XML doit précéder immédiatement l'élément de langage auquel il se rapporte. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadXMLLine_Title"> <source>XML comment block must immediately precede the language element to which it applies</source> <target state="translated">Le bloc de commentaires XML doit précéder immédiatement l’élément de langage auquel il se rapporte</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocMoreThanOneCommentBlock"> <source>Only one XML comment block is allowed per language element.</source> <target state="translated">Un seul bloc de commentaires XML est autorisé par élément de langage.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocMoreThanOneCommentBlock_Title"> <source>Only one XML comment block is allowed per language element</source> <target state="translated">Un seul bloc de commentaires XML est autorisé par élément de langage</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocNotFirstOnLine"> <source>XML comment must be the first statement on a line. XML comment will be ignored.</source> <target state="translated">Le commentaire XML doit être la première instruction sur une ligne. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocNotFirstOnLine_Title"> <source>XML comment must be the first statement on a line</source> <target state="translated">Le commentaire XML doit être la première instruction d’une ligne</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInsideMethod"> <source>XML comment cannot appear within a method or a property. XML comment will be ignored.</source> <target state="translated">Un commentaire XML ne peut pas figurer dans une méthode ou une propriété. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInsideMethod_Title"> <source>XML comment cannot appear within a method or a property</source> <target state="translated">Le commentaire XML ne peut pas apparaître dans une méthode ou une propriété</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParseError1"> <source>XML documentation parse error: {0} XML comment will be ignored.</source> <target state="translated">Erreur d'analyse de la documentation XML : le commentaire XML {0} sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParseError1_Title"> <source>XML documentation parse error</source> <target state="translated">Erreur d'analyse de la documentation XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocDuplicateXMLNode1"> <source>XML comment tag '{0}' appears with identical attributes more than once in the same XML comment block.</source> <target state="translated">La balise de commentaire XML '{0}' s'affiche avec des attributs identiques plusieurs fois dans le même bloc de commentaires XML.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocDuplicateXMLNode1_Title"> <source>XML comment tag appears with identical attributes more than once in the same XML comment block</source> <target state="translated">La balise de commentaire XML apparaît plusieurs fois avec des attributs identiques dans le même bloc de commentaire XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocIllegalTagOnElement2"> <source>XML comment tag '{0}' is not permitted on a '{1}' language element.</source> <target state="translated">La balise de commentaire XML '{0}' n'est pas autorisée dans un élément de langage '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocIllegalTagOnElement2_Title"> <source>XML comment tag is not permitted on language element</source> <target state="translated">La balise de commentaire XML n’est pas autorisée sur un élément de langue</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadParamTag2"> <source>XML comment parameter '{0}' does not match a parameter on the corresponding '{1}' statement.</source> <target state="translated">Le paramètre de commentaire XML '{0}' ne correspond pas à un paramètre pour l'instruction '{1}' correspondante.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadParamTag2_Title"> <source>XML comment parameter does not match a parameter on the corresponding declaration statement</source> <target state="translated">Le paramètre du commentaire XML ne correspond pas à un paramètre pour l’instruction de déclaration correspondante</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParamTagWithoutName"> <source>XML comment parameter must have a 'name' attribute.</source> <target state="translated">Le paramètre de commentaire XML doit avoir un attribut 'name'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParamTagWithoutName_Title"> <source>XML comment parameter must have a 'name' attribute</source> <target state="translated">Le paramètre de commentaire XML doit avoir un attribut 'name'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefAttributeNotFound1"> <source>XML comment has a tag with a 'cref' attribute '{0}' that could not be resolved.</source> <target state="translated">Le commentaire XML a une balise avec un attribut 'cref' '{0}' qui n'a pas pu être résolu.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefAttributeNotFound1_Title"> <source>XML comment has a tag with a 'cref' attribute that could not be resolved</source> <target state="translated">Le commentaire XML possède une balise avec un attribut 'cref' qui n’a pas pu être résolu</target> <note /> </trans-unit> <trans-unit id="WRN_XMLMissingFileOrPathAttribute1"> <source>XML comment tag 'include' must have a '{0}' attribute. XML comment will be ignored.</source> <target state="translated">La balise de commentaire XML 'include' doit avoir un attribut '{0}'. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLMissingFileOrPathAttribute1_Title"> <source>XML comment tag 'include' must have 'file' and 'path' attributes</source> <target state="translated">La balise de commentaire XML 'include' doit comporter les attributs 'file' et 'path'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLCannotWriteToXMLDocFile2"> <source>Unable to create XML documentation file '{0}': {1}</source> <target state="translated">Impossible de créer un fichier de documentation XML '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLCannotWriteToXMLDocFile2_Title"> <source>Unable to create XML documentation file</source> <target state="translated">Impossible de créer un fichier de documentation XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocWithoutLanguageElement"> <source>XML documentation comments must precede member or type declarations.</source> <target state="translated">Les commentaires de documentation XML doivent précéder les déclarations de membre ou de type.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocWithoutLanguageElement_Title"> <source>XML documentation comments must precede member or type declarations</source> <target state="translated">Les commentaires de documentation XML doivent précéder les déclarations de membre ou de type</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnWriteOnlyProperty"> <source>XML comment tag 'returns' is not permitted on a 'WriteOnly' Property.</source> <target state="translated">La balise de commentaire XML 'returns' n'est pas autorisée pour une propriété 'WriteOnly'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnWriteOnlyProperty_Title"> <source>XML comment tag 'returns' is not permitted on a 'WriteOnly' Property</source> <target state="translated">La balise de commentaire XML 'returns' n'est pas autorisée pour une propriété 'WriteOnly'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocOnAPartialType"> <source>XML comment cannot be applied more than once on a partial {0}. XML comments for this {0} will be ignored.</source> <target state="translated">Le commentaire XML ne peut pas être appliqué plusieurs fois pour un {0} partiel. Les commentaires XML pour ce {0} seront ignorés.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocOnAPartialType_Title"> <source>XML comment cannot be applied more than once on a partial type</source> <target state="translated">Le commentaire XML ne peut pas être appliqué plusieurs fois sur un type partiel</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnADeclareSub"> <source>XML comment tag 'returns' is not permitted on a 'declare sub' language element.</source> <target state="translated">La balise de commentaire XML 'returns' n'est pas autorisée pour un élément de langage 'declare sub'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnADeclareSub_Title"> <source>XML comment tag 'returns' is not permitted on a 'declare sub' language element</source> <target state="translated">La balise de commentaire XML 'returns' n’est pas autorisée pour un élément de langage 'declare sub'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocStartTagWithNoEndTag"> <source>XML documentation parse error: Start tag '{0}' doesn't have a matching end tag. XML comment will be ignored.</source> <target state="translated">Erreur d'analyse de la documentation XML : la balise de début '{0}' n'a pas de balise de fin correspondante. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocStartTagWithNoEndTag_Title"> <source>XML documentation parse error: Start tag doesn't have a matching end tag</source> <target state="translated">Erreur d’analyse de la documentation XML. La balise de début n’a pas de balise de fin correspondante</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadGenericParamTag2"> <source>XML comment type parameter '{0}' does not match a type parameter on the corresponding '{1}' statement.</source> <target state="translated">Le paramètre de type du commentaire XML '{0}' ne correspond pas à un paramètre de type pour l'instruction '{1}' correspondante.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadGenericParamTag2_Title"> <source>XML comment type parameter does not match a type parameter on the corresponding declaration statement</source> <target state="translated">Le paramètre de type du commentaire XML ne correspond pas à un paramètre de type pour l’instruction de déclaration correspondante</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocGenericParamTagWithoutName"> <source>XML comment type parameter must have a 'name' attribute.</source> <target state="translated">Le paramètre de type de commentaire XML doit avoir un attribut 'name'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocGenericParamTagWithoutName_Title"> <source>XML comment type parameter must have a 'name' attribute</source> <target state="translated">Le paramètre de type de commentaire XML doit avoir un attribut 'name'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocExceptionTagWithoutCRef"> <source>XML comment exception must have a 'cref' attribute.</source> <target state="translated">Une exception de commentaire XML doit avoir un attribut 'cref'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocExceptionTagWithoutCRef_Title"> <source>XML comment exception must have a 'cref' attribute</source> <target state="translated">Une exception de commentaire XML doit avoir un attribut 'cref'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInvalidXMLFragment"> <source>Unable to include XML fragment '{0}' of file '{1}'.</source> <target state="translated">Impossible d'inclure le fragment XML '{0}' du fichier '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInvalidXMLFragment_Title"> <source>Unable to include XML fragment</source> <target state="translated">Impossible d'inclure le fragment XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadFormedXML"> <source>Unable to include XML fragment '{1}' of file '{0}'. {2}</source> <target state="translated">Impossible d'inclure le fragment XML '{1}' du fichier '{0}'. {2}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadFormedXML_Title"> <source>Unable to include XML fragment</source> <target state="translated">Impossible d'inclure le fragment XML</target> <note /> </trans-unit> <trans-unit id="WRN_InterfaceConversion2"> <source>Runtime errors might occur when converting '{0}' to '{1}'.</source> <target state="translated">Des erreurs d'exécution peuvent se produire lors de la conversion de '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_InterfaceConversion2_Title"> <source>Runtime errors might occur when converting to or from interface type</source> <target state="translated">Des erreurs d’exécution peuvent survenir lors de la conversion vers ou depuis le type d'interface</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableLambda"> <source>Using the iteration variable in a lambda expression may have unexpected results. Instead, create a local variable within the loop and assign it the value of the iteration variable.</source> <target state="translated">L'utilisation de la variable d'itération dans une expression lambda peut provoquer des résultats inattendus. Créez une variable locale dans la boucle et assignez-lui la valeur de la variable d'itération à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableLambda_Title"> <source>Using the iteration variable in a lambda expression may have unexpected results</source> <target state="translated">L’utilisation d’une variable d’itération dans une expression lambda peut avoir des résultats inattendus</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaPassedToRemoveHandler"> <source>Lambda expression will not be removed from this event handler. Assign the lambda expression to a variable and use the variable to add and remove the event.</source> <target state="translated">L'expression lambda ne sera pas supprimée de ce gestionnaire d'événements. Assignez l'expression lambda à une variable et utilisez cette dernière pour ajouter et supprimer l'événement.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaPassedToRemoveHandler_Title"> <source>Lambda expression will not be removed from this event handler</source> <target state="translated">L’expression lambda ne sera pas supprimée de ce gestionnaire d’événements</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableQuery"> <source>Using the iteration variable in a query expression may have unexpected results. Instead, create a local variable within the loop and assign it the value of the iteration variable.</source> <target state="translated">L'utilisation de la variable d'itération dans une expression de requête peut provoquer des résultats inattendus. Créez une variable locale dans la boucle et assignez-lui la valeur de la variable d'itération à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableQuery_Title"> <source>Using the iteration variable in a query expression may have unexpected results</source> <target state="translated">L’utilisation d’une variable d’itération dans une expression de requête peut avoir des résultats inattendus</target> <note /> </trans-unit> <trans-unit id="WRN_RelDelegatePassedToRemoveHandler"> <source>The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event. Assign the 'AddressOf' expression to a variable, and use the variable to add or remove the method as the handler.</source> <target state="translated">L'expression 'AddressOf' n'a pas d'effet dans ce contexte, car l'argument de la méthode pour 'AddressOf' requiert une conversion souple en type délégué de l'événement. Assignez l'expression 'AddressOf' à une variable et utilisez la variable pour ajouter ou supprimer la méthode comme gestionnaire.</target> <note /> </trans-unit> <trans-unit id="WRN_RelDelegatePassedToRemoveHandler_Title"> <source>The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event</source> <target state="translated">L’expression 'AddressOf' n’a pas d’effet dans ce contexte, car l’argument de la méthode pour 'AddressOf' requiert une conversion souple en type délégué de l’événement</target> <note /> </trans-unit> <trans-unit id="WRN_QueryMissingAsClauseinVarDecl"> <source>Range variable is assumed to be of type Object because its type cannot be inferred. Use an 'As' clause to specify a different type.</source> <target state="translated">La variable de portée est considérée comme étant de type Object, car son type ne peut pas être déduit. Utilisez une clause 'As' pour indiquer un type différent.</target> <note /> </trans-unit> <trans-unit id="WRN_QueryMissingAsClauseinVarDecl_Title"> <source>Range variable is assumed to be of type Object because its type cannot be inferred</source> <target state="translated">La variable de portée est considérée être de type Object, car son type ne peut pas être déduit</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdaMissingFunction"> <source>Multiline lambda expression is missing 'End Function'.</source> <target state="translated">L'expression lambda multiligne ne contient pas de 'End Function'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdaMissingSub"> <source>Multiline lambda expression is missing 'End Sub'.</source> <target state="translated">L'expression lambda multiligne ne contient pas 'End Sub'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOnLambdaReturnType"> <source>Attributes cannot be applied to return types of lambda expressions.</source> <target state="translated">Les attributs ne peuvent pas être appliqués aux types de retour des expressions lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_SubDisallowsStatement"> <source>Statement is not valid inside a single-line statement lambda.</source> <target state="translated">L'instruction n'est pas valide au sein d'une lambda-instruction sur une seule ligne.</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesBang"> <source>This single-line statement lambda must be enclosed in parentheses. For example: (Sub() &lt;statement&gt;)!key</source> <target state="translated">Cette lambda-instruction sur une seule ligne doit être mise entre parenthèses. Par exemple : (Sub() &lt;instruction&gt;)!key</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesDot"> <source>This single-line statement lambda must be enclosed in parentheses. For example: (Sub() &lt;statement&gt;).Invoke()</source> <target state="translated">Cette lambda-instruction sur une seule ligne doit être mise entre parenthèses. Par exemple : (Sub() &lt;instruction&gt;).Invoke()</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesLParen"> <source>This single-line statement lambda must be enclosed in parentheses. For example: Call (Sub() &lt;statement&gt;) ()</source> <target state="translated">Cette lambda-instruction sur une seule ligne doit être mise entre parenthèses. Par exemple : Call (Sub() &lt;instruction&gt;) ()</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresSingleStatement"> <source>Single-line statement lambdas must include exactly one statement.</source> <target state="translated">Les lambda-instructions sur une seule ligne doivent inclure exactement une instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticInLambda"> <source>Static local variables cannot be declared inside lambda expressions.</source> <target state="translated">Les variables locales static ne peuvent pas être déclarées dans des expressions lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializedExpandedProperty"> <source>Expanded Properties cannot be initialized.</source> <target state="translated">Les propriétés développées ne peuvent pas être initialisées.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCantHaveParams"> <source>Auto-implemented properties cannot have parameters.</source> <target state="translated">Les propriétés implémentées automatiquement ne peuvent pas avoir de paramètres.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCantBeWriteOnly"> <source>Auto-implemented properties cannot be WriteOnly.</source> <target state="translated">Les propriétés implémentées automatiquement ne peuvent pas être WriteOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFCount"> <source>'If' operator requires either two or three operands.</source> <target state="translated">'L'opérateur 'If' requiert deux ou trois opérandes.</target> <note /> </trans-unit> <trans-unit id="ERR_NotACollection1"> <source>Cannot initialize the type '{0}' with a collection initializer because it is not a collection type.</source> <target state="translated">Impossible d'initialiser le type '{0}' avec un initialiseur de collection, car il ne s'agit pas d'un type de collection.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAddMethod1"> <source>Cannot initialize the type '{0}' with a collection initializer because it does not have an accessible 'Add' method.</source> <target state="translated">Impossible d'initialiser le type '{0}' avec un initialiseur de collection, car il n'a pas de méthode 'Add' accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_CantCombineInitializers"> <source>An Object Initializer and a Collection Initializer cannot be combined in the same initialization.</source> <target state="translated">Un initialiseur d'objet et un initialiseur de collection ne peuvent pas être combinés dans la même initialisation.</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyAggregateInitializer"> <source>An aggregate collection initializer entry must contain at least one element.</source> <target state="translated">Une entrée d'initialiseur de collection d'agrégation doit contenir au moins un élément.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEndElementNoMatchingStart"> <source>XML end element must be preceded by a matching start element.</source> <target state="translated">Un élément de fin XML doit être précédé d'un élément de début correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdasCannotContainOnError"> <source>'On Error' and 'Resume' cannot appear inside a lambda expression.</source> <target state="translated">'On Error' et 'Resume' ne peuvent pas être utilisés dans une expression lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceDisallowedHere"> <source>Keywords 'Out' and 'In' can only be used in interface and delegate declarations.</source> <target state="translated">Les mots clés 'Out' et 'In' peuvent uniquement être utilisés dans des déclarations interface et delegate.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEndCDataNotAllowedInContent"> <source>The literal string ']]&gt;' is not allowed in element content.</source> <target state="translated">La chaîne littérale ']]&gt;' n'est pas autorisée dans le contenu de l'élément.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadsModifierInModule"> <source>Inappropriate use of '{0}' keyword in a module.</source> <target state="translated">Utilisation inappropriée du mot clé '{0}' dans un module.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedTypeOrNamespace1"> <source>Type or namespace '{0}' is not defined.</source> <target state="translated">Le type ou l'espace de noms '{0}' n'est pas défini.</target> <note /> </trans-unit> <trans-unit id="ERR_IdentityDirectCastForFloat"> <source>Using DirectCast operator to cast a floating-point value to the same type is not supported.</source> <target state="translated">L'opérateur DirectCast ne peut pas être utilisé pour effectuer un cast d'une valeur à virgule flottante en un type identique.</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteIdentityDirectCastForValueType"> <source>Using DirectCast operator to cast a value-type to the same type is obsolete.</source> <target state="translated">L’opérateur DirectCast ne peut plus être utilisé pour effectuer un cast d’un type valeur en un type identique.</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteIdentityDirectCastForValueType_Title"> <source>Using DirectCast operator to cast a value-type to the same type is obsolete</source> <target state="translated">L’opérateur DirectCast ne peut plus être utilisé pour effectuer un cast d’un type valeur en un type identique</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode"> <source>Unreachable code detected.</source> <target state="translated">Code inatteignable détecté.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode_Title"> <source>Unreachable code detected</source> <target state="translated">Code inaccessible détecté</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncVal1"> <source>Function '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">La fonction '{0}' ne retourne pas une valeur pour tous les chemins du code. Une instruction 'Return' est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncVal1_Title"> <source>Function doesn't return a value on all code paths</source> <target state="translated">La fonction ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpVal1"> <source>Operator '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">L'opérateur '{0}' ne retourne pas une valeur pour tous les chemins du code. Une instruction 'Return' est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpVal1_Title"> <source>Operator doesn't return a value on all code paths</source> <target state="translated">L’opérateur ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropVal1"> <source>Property '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">La propriété '{0}' ne retourne pas une valeur pour tous les chemins du code. Une instruction 'Return' est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropVal1_Title"> <source>Property doesn't return a value on all code paths</source> <target state="translated">La propriété ne retourne pas une valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="ERR_NestedGlobalNamespace"> <source>Global namespace may not be nested in another namespace.</source> <target state="translated">Un espace de noms global ne peut pas être imbriqué dans un autre espace de noms.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatch6"> <source>'{0}' cannot expose type '{1}' in {2} '{3}' through {4} '{5}'.</source> <target state="translated">'{0}' ne peut pas exposer le type '{1}' dans {2} '{3}' via {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadMetaDataReference1"> <source>'{0}' cannot be referenced because it is not a valid assembly.</source> <target state="translated">'Impossible de référencer '{0}', car il ne s'agit pas d'un assembly valide.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyDoesntImplementAllAccessors"> <source>'{0}' cannot be implemented by a {1} property.</source> <target state="translated">'{0}' ne peut pas être implémenté par une propriété {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedMustOverride"> <source> {0}: {1}</source> <target state="translated"> {0}: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_IfTooManyTypesObjectDisallowed"> <source>Cannot infer a common type because more than one type is possible.</source> <target state="translated">Impossible de déduire un type commun, car plusieurs types sont possibles.</target> <note /> </trans-unit> <trans-unit id="WRN_IfTooManyTypesObjectAssumed"> <source>Cannot infer a common type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type commun, car plusieurs types sont possibles. Type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_IfTooManyTypesObjectAssumed_Title"> <source>Cannot infer a common type because more than one type is possible</source> <target state="translated">Impossible de déduire un type commun, car plusieurs types sont possibles</target> <note /> </trans-unit> <trans-unit id="ERR_IfNoTypeObjectDisallowed"> <source>Cannot infer a common type, and Option Strict On does not allow 'Object' to be assumed.</source> <target state="translated">Impossible de déduire un type commun, et Option Strict On n'autorise pas l'utilisation par défaut de 'Object'.</target> <note /> </trans-unit> <trans-unit id="WRN_IfNoTypeObjectAssumed"> <source>Cannot infer a common type; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type commun ; type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_IfNoTypeObjectAssumed_Title"> <source>Cannot infer a common type</source> <target state="translated">Impossible de déduire un type commun</target> <note /> </trans-unit> <trans-unit id="ERR_IfNoType"> <source>Cannot infer a common type.</source> <target state="translated">Impossible de déduire un type commun.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyFileFailure"> <source>Error extracting public key from file '{0}': {1}</source> <target state="translated">Erreur d'extraction de la clé publique du fichier '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyContainerFailure"> <source>Error extracting public key from container '{0}': {1}</source> <target state="translated">Erreur d'extraction de la clé publique du conteneur '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefNotEqualToThis"> <source>Friend access was granted by '{0}', but the public key of the output assembly does not match that specified by the attribute in the granting assembly.</source> <target state="translated">Un accès Friend a été concédé par '{0}', mais la clé publique de l'assembly de sortie ne correspond pas à celle spécifiée par l'attribut concédant.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefSigningMismatch"> <source>Friend access was granted by '{0}', but the strong name signing state of the output assembly does not match that of the granting assembly.</source> <target state="translated">Un accès Friend a été concédé par '{0}', mais l'état de signature avec nom fort de l'assembly de sortie ne correspond pas à celui de l'assembly concédant.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNoKey"> <source>Public sign was specified and requires a public key, but no public key was specified</source> <target state="translated">La signature publique a été spécifiée et nécessite une clé publique. Toutefois, aucune clé publique n'a été spécifiée</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNetModule"> <source>Public signing is not supported for netmodules.</source> <target state="translated">La signature publique n'est pas prise en charge pour les netmodules.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning"> <source>Attribute '{0}' is ignored when public signing is specified.</source> <target state="translated">L'attribut '{0}' est ignoré quand une signature publique est spécifiée.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning_Title"> <source>Attribute is ignored when public signing is specified.</source> <target state="translated">L'attribut est ignoré quand une signature publique est spécifiée.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey"> <source>Delay signing was specified and requires a public key, but no public key was specified.</source> <target state="translated">La signature différée a été spécifiée et nécessite une clé publique, mais aucune clé publique n’a été spécifiée.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey_Title"> <source>Delay signing was specified and requires a public key, but no public key was specified</source> <target state="translated">La signature différée a été spécifiée et nécessite une clé publique, mais aucune clé publique n'a été spécifiée</target> <note /> </trans-unit> <trans-unit id="ERR_SignButNoPrivateKey"> <source>Key file '{0}' is missing the private key needed for signing.</source> <target state="translated">Le fichier de clé '{0}' ne comprend pas la clé privée nécessaire à la signature.</target> <note /> </trans-unit> <trans-unit id="ERR_FailureSigningAssembly"> <source>Error signing assembly '{0}': {1}</source> <target state="translated">Erreur lors de la signature de l'assembly '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat"> <source>The specified version string does not conform to the required format - major[.minor[.build|*[.revision|*]]]</source> <target state="translated">Le format de la chaîne de version spécifiée n'est pas conforme au format requis - major[.minor[.build|*[.revision|*]]]</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">Le format de la chaîne de version spécifiée n'est pas conforme au format requis - major.minor.build.revision</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat_Title"> <source>The specified version string does not conform to the recommended format</source> <target state="translated">La chaîne de version spécifiée n’est pas conforme au format recommandé</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat2"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">Le format de la chaîne de version spécifiée n'est pas conforme au format requis - major.minor.build.revision</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCultureForExe"> <source>Executables cannot be satellite assemblies; culture should always be empty</source> <target state="translated">Les exécutables ne peuvent pas être des assemblys satellites ; la culture doit toujours être vide</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored"> <source>The entry point of the program is global script code; ignoring '{0}' entry point.</source> <target state="translated">Le point d'entrée du programme est du code de script global ; point d'entrée '{0}' ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored_Title"> <source>The entry point of the program is global script code; ignoring entry point</source> <target state="translated">Le point d'entrée du programme est du code de script global ; ce point d'entrée est ignoré</target> <note /> </trans-unit> <trans-unit id="WRN_EmptyPrefixAndXmlnsLocalName"> <source>The xmlns attribute has special meaning and should not be written with a prefix.</source> <target state="translated">L’attribut xmlns a une signification particulière et ne doit pas être écrit avec un préfixe.</target> <note /> </trans-unit> <trans-unit id="WRN_EmptyPrefixAndXmlnsLocalName_Title"> <source>The xmlns attribute has special meaning and should not be written with a prefix</source> <target state="translated">L’attribut xmlns a une signification particulière et ne doit pas être écrit avec un préfixe</target> <note /> </trans-unit> <trans-unit id="WRN_PrefixAndXmlnsLocalName"> <source>It is not recommended to have attributes named xmlns. Did you mean to write 'xmlns:{0}' to define a prefix named '{0}'?</source> <target state="translated">Il n'est pas recommandé de nommer des attributs xmlns. Vouliez-vous écrire 'xmlns:{0}' pour définir un préfixe nommé '{0}' ?</target> <note /> </trans-unit> <trans-unit id="WRN_PrefixAndXmlnsLocalName_Title"> <source>It is not recommended to have attributes named xmlns</source> <target state="translated">Il n’est pas recommandé de nommer des attributs xmlns</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSingleScript"> <source>Expected a single script (.vbx file)</source> <target state="translated">Un seul script est attendu (fichier .vbx)</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedAssemblyName"> <source>The assembly name '{0}' is reserved and cannot be used as a reference in an interactive session</source> <target state="translated">Le nom d'assembly '{0}' est réservé et ne peut pas servir de référence dans une session interactive</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceDirectiveOnlyAllowedInScripts"> <source>#R is only allowed in scripts</source> <target state="translated">#R n'est autorisé que dans les scripts</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAllowedInScript"> <source>You cannot declare Namespace in script code</source> <target state="translated">Impossible de déclarer un espace de noms dans le code de script</target> <note /> </trans-unit> <trans-unit id="ERR_KeywordNotAllowedInScript"> <source>You cannot use '{0}' in top-level script code</source> <target state="translated">Vous ne pouvez pas utiliser '{0}' dans du code de script de premier niveau</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNoType"> <source>Cannot infer a return type. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Impossible de déduire un type de retour. Ajoutez une clause 'As' pour spécifier le type de retour.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaNoTypeObjectAssumed"> <source>Cannot infer a return type; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type de retour ; type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaNoTypeObjectAssumed_Title"> <source>Cannot infer a return type</source> <target state="translated">Impossible de déduire un type de retour</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaTooManyTypesObjectAssumed"> <source>Cannot infer a return type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type de retour, car plusieurs types sont possibles. Type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaTooManyTypesObjectAssumed_Title"> <source>Cannot infer a return type because more than one type is possible</source> <target state="translated">Impossible de déduire un type de retour car plusieurs types sont possibles</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNoTypeObjectDisallowed"> <source>Cannot infer a return type. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Impossible de déduire un type de retour. Ajoutez une clause 'As' pour spécifier le type de retour.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaTooManyTypesObjectDisallowed"> <source>Cannot infer a return type because more than one type is possible. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Impossible de déduire un type de retour, car plusieurs types sont possibles. Ajoutez une clause 'As' pour spécifier le type de retour.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch"> <source>The command line switch '{0}' is not yet implemented and was ignored.</source> <target state="translated">Le commutateur de ligne de commande '{0}' n'est pas encore implémenté et a été ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch_Title"> <source>Command line switch is not yet implemented</source> <target state="translated">Le commutateur de ligne de commande n’est pas encore implémenté</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitNoTypeObjectDisallowed"> <source>Cannot infer an element type, and Option Strict On does not allow 'Object' to be assumed. Specifying the type of the array might correct this error.</source> <target state="translated">Impossible de déduire un type d'élément, et Option Strict On n'autorise pas l'utilisation par défaut de 'Object'. La spécification du type du tableau peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitNoType"> <source>Cannot infer an element type. Specifying the type of the array might correct this error.</source> <target state="translated">Impossible de déduire un type d'élément. La spécification du type de tableau peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitTooManyTypesObjectDisallowed"> <source>Cannot infer an element type because more than one type is possible. Specifying the type of the array might correct this error.</source> <target state="translated">Impossible de déduire un type d'élément, car plusieurs types sont possibles. La spécification du type du tableau peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitNoTypeObjectAssumed"> <source>Cannot infer an element type; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type d'élément ; type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitNoTypeObjectAssumed_Title"> <source>Cannot infer an element type</source> <target state="translated">Impossible de déduire un type d’élément</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitTooManyTypesObjectAssumed"> <source>Cannot infer an element type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type d'élément, car plusieurs types sont possibles. Type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitTooManyTypesObjectAssumed_Title"> <source>Cannot infer an element type because more than one type is possible</source> <target state="translated">Impossible de déduire un type d’élément car plusieurs types sont possibles</target> <note /> </trans-unit> <trans-unit id="WRN_TypeInferenceAssumed3"> <source>Data type of '{0}' in '{1}' could not be inferred. '{2}' assumed.</source> <target state="translated">Impossible de déduire le type de données de '{0}' dans '{1}'. '{2}' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeInferenceAssumed3_Title"> <source>Data type could not be inferred</source> <target state="translated">Le type de données n’a pas pu être déduit</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousCastConversion2"> <source>Option Strict On does not allow implicit conversions from '{0}' to '{1}' because the conversion is ambiguous.</source> <target state="translated">Option Strict On n'autorise pas les conversions implicites de '{0}' en '{1}', car la conversion est ambiguë.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousCastConversion2"> <source>Conversion from '{0}' to '{1}' may be ambiguous.</source> <target state="translated">La conversion de '{0}' en '{1}' peut être ambiguë.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousCastConversion2_Title"> <source>Conversion may be ambiguous</source> <target state="translated">La conversion est peut-être ambiguë</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceIEnumerableSuggestion3"> <source>'{0}' cannot be converted to '{1}'. Consider using '{2}' instead.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Utilisez '{2}' à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceIEnumerableSuggestion3"> <source>'{0}' cannot be converted to '{1}'. Consider using '{2}' instead.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Utilisez '{2}' à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceIEnumerableSuggestion3_Title"> <source>Type cannot be converted to target collection type</source> <target state="translated">Le type ne peut pas être converti en type de collection cible</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedIn6"> <source>'{4}' cannot be converted to '{5}' because '{0}' is not derived from '{1}', as required for the 'In' generic parameter '{2}' in '{3}'.</source> <target state="translated">'Impossible de convertir '{4}' en '{5}', car '{0}' n'est pas dérivé de '{1}', comme le requiert le paramètre générique 'In' '{2}' dans '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedOut6"> <source>'{4}' cannot be converted to '{5}' because '{0}' is not derived from '{1}', as required for the 'Out' generic parameter '{2}' in '{3}'.</source> <target state="translated">'Impossible de convertir '{4}' en '{5}', car '{0}' n'est pas dérivé de '{1}', comme le requiert le paramètre générique 'Out' '{2}' dans '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedIn6"> <source>Implicit conversion from '{4}' to '{5}'; this conversion may fail because '{0}' is not derived from '{1}', as required for the 'In' generic parameter '{2}' in '{3}'.</source> <target state="translated">Conversion implicite de '{4}' en '{5}' ; cette conversion peut échouer car '{0}' ne dérive pas de '{1}', comme cela est requis pour le paramètre générique 'In' '{2}' dans '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedIn6_Title"> <source>Implicit conversion; this conversion may fail because the target type is not derived from the source type, as required for 'In' generic parameter</source> <target state="translated">Conversion implicite. Il est possible que cette conversion échoue, car le type cible n’est pas dérivé d’un type source, comme le requiert le paramètre générique 'In'</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedOut6"> <source>Implicit conversion from '{4}' to '{5}'; this conversion may fail because '{0}' is not derived from '{1}', as required for the 'Out' generic parameter '{2}' in '{3}'.</source> <target state="translated">Conversion implicite de '{4}' en '{5}' ; cette conversion peut échouer car '{0}' ne dérive pas de '{1}', comme cela est requis pour le paramètre générique 'Out' '{2}' dans '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedOut6_Title"> <source>Implicit conversion; this conversion may fail because the target type is not derived from the source type, as required for 'Out' generic parameter</source> <target state="translated">Conversion implicite. Il est possible que cette conversion échoue, car le type cible n’est pas dérivé du type source, comme le requiert le paramètre générique 'Out'</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedTryIn4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an In type parameter, 'In {2}'.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Changez '{2}' dans la définition de '{3}' en paramètre de type In, 'In {2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedTryOut4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an Out type parameter, 'Out {2}'.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Changez '{2}' dans la définition de '{3}' en paramètre de type Out, 'Out {2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryIn4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an In type parameter, 'In {2}'.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Changez '{2}' dans la définition de '{3}' en paramètre de type In, 'In {2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryIn4_Title"> <source>Type cannot be converted to target type</source> <target state="translated">Le type ne peut pas être converti en type cible</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryOut4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an Out type parameter, 'Out {2}'.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Changez '{2}' dans la définition de '{3}' en paramètre de type Out, 'Out {2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryOut4_Title"> <source>Type cannot be converted to target type</source> <target state="translated">Le type ne peut pas être converti en type cible</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceDeclarationAmbiguous3"> <source>Interface '{0}' is ambiguous with another implemented interface '{1}' due to the 'In' and 'Out' parameters in '{2}'.</source> <target state="translated">La présence des paramètres 'In' et 'Out' dans '{2}' crée une ambiguïté entre l'interface '{0}' et une autre interface '{1}' implémentée.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceDeclarationAmbiguous3_Title"> <source>Interface is ambiguous with another implemented interface due to 'In' and 'Out' parameters</source> <target state="translated">La présence des paramètres 'In' et 'Out' crée une ambiguïté entre l’interface et une autre interface implémentée</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInterfaceNesting"> <source>Enumerations, classes, and structures cannot be declared in an interface that has an 'In' or 'Out' type parameter.</source> <target state="translated">Les énumérations, les classes et les structures ne peuvent pas être déclarées dans une interface comportant un paramètre de type 'In' ou 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VariancePreventsSynthesizedEvents2"> <source>Event definitions with parameters are not allowed in an interface such as '{0}' that has 'In' or 'Out' type parameters. Consider declaring the event by using a delegate type which is not defined within '{0}'. For example, 'Event {1} As Action(Of ...)'.</source> <target state="translated">Les définitions d'événement avec des paramètres ne sont pas autorisées dans une interface '{0}' qui a des paramètres de type 'In' ou 'Out'. Déclarez l'événement à l'aide d'un type délégué qui n'est pas défini dans '{0}'. Par exemple, 'Event {1} As Action(Of ...)'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInByRefDisallowed1"> <source>Type '{0}' cannot be used in this context because 'In' and 'Out' type parameters cannot be used for ByRef parameter types, and '{0}' is an 'In' type parameter.</source> <target state="translated">Le type '{0}' ne peut pas être utilisé dans ce contexte, car les paramètres de type 'In' et 'Out' ne peuvent pas être utilisés pour les types de paramètre ByRef et '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInNullableDisallowed2"> <source>Type '{0}' cannot be used in '{1}' because 'In' and 'Out' type parameters cannot be made nullable, and '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{1}', car les paramètres de type 'In' et 'Out' ne peuvent pas être rendus Nullable et '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowed1"> <source>Type '{0}' cannot be used in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans ce contexte, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedForGeneric3"> <source>Type '{0}' cannot be used for the '{1}' in '{2}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{1}' dans '{2}' dans ce contexte, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedHere2"> <source>Type '{0}' cannot be used in '{1}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{1}' dans ce contexte, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedHereForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' of '{3}' in '{1}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{2}' de '{3}' dans '{1}' dans ce contexte, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInPropertyDisallowed1"> <source>Type '{0}' cannot be used as a property type in this context because '{0}' is an 'In' type parameter and the property is not marked WriteOnly.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de propriété dans ce contexte, car '{0}' est un paramètre de type 'In' et la propriété n'est pas marquée WriteOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInReadOnlyPropertyDisallowed1"> <source>Type '{0}' cannot be used as a ReadOnly property type because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de propriété ReadOnly, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInReturnDisallowed1"> <source>Type '{0}' cannot be used as a return type because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de retour, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutByRefDisallowed1"> <source>Type '{0}' cannot be used in this context because 'In' and 'Out' type parameters cannot be used for ByRef parameter types, and '{0}' is an 'Out' type parameter.</source> <target state="translated">Le type '{0}' ne peut pas être utilisé dans ce contexte, car les paramètres de type 'In' et 'Out' ne peuvent pas être utilisés pour les types de paramètre ByRef et '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutByValDisallowed1"> <source>Type '{0}' cannot be used as a ByVal parameter type because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de paramètre ByVal, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutConstraintDisallowed1"> <source>Type '{0}' cannot be used as a generic type constraint because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que contrainte de type générique, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutNullableDisallowed2"> <source>Type '{0}' cannot be used in '{1}' because 'In' and 'Out' type parameters cannot be made nullable, and '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{1}', car les paramètres de type 'In' et 'Out' ne peuvent pas être rendus Nullable et '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowed1"> <source>Type '{0}' cannot be used in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans ce contexte, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedForGeneric3"> <source>Type '{0}' cannot be used for the '{1}' in '{2}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{1}' dans '{2}' dans ce contexte, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedHere2"> <source>Type '{0}' cannot be used in '{1}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{1}' dans ce contexte, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedHereForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' of '{3}' in '{1}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{2}' de '{3}' dans '{1}' dans ce contexte, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutPropertyDisallowed1"> <source>Type '{0}' cannot be used as a property type in this context because '{0}' is an 'Out' type parameter and the property is not marked ReadOnly.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de propriété dans ce contexte, car '{0}' est un paramètre de type 'Out' et la propriété n'est pas marquée ReadOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutWriteOnlyPropertyDisallowed1"> <source>Type '{0}' cannot be used as a WriteOnly property type because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de propriété WriteOnly, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowed2"> <source>Type '{0}' cannot be used in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans ce contexte, car le contexte et la définition de '{0}' sont tous les deux imbriqués dans l'interface '{1}', et '{1}' a des paramètres de type 'In' ou 'Out'. Déplacez la définition de '{0}' en dehors de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' in '{3}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{2}' dans '{3}' dans ce contexte, car le contexte et la définition de '{0}' sont tous les deux imbriqués dans l'interface '{1}', et '{1}' a des paramètres de type 'In' ou 'Out'. Déplacez la définition de '{0}' en dehors de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedHere3"> <source>Type '{0}' cannot be used in '{2}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{2}' dans ce contexte, car le contexte et la définition de '{0}' sont tous les deux imbriqués dans l'interface '{1}', et '{1}' a des paramètres de type 'In' ou 'Out'. Déplacez la définition de '{0}' en dehors de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedHereForGeneric5"> <source>Type '{0}' cannot be used for the '{3}' of '{4}' in '{2}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{3}' de '{4}' dans '{2}' dans ce contexte, car le contexte et la définition de '{0}' sont tous les deux imbriqués dans l'interface '{1}', et '{1}' a des paramètres de type 'In' ou 'Out'. Déplacez la définition de '{0}' en dehors de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterNotValidForType"> <source>Parameter not valid for the specified unmanaged type.</source> <target state="translated">Paramètre non valide pour le type non managé spécifié.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeNotValidForFields"> <source>Unmanaged type '{0}' not valid for fields.</source> <target state="translated">Type non managé '{0}' non valide pour les champs.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeOnlyValidForFields"> <source>Unmanaged type '{0}' is only valid for fields.</source> <target state="translated">Le type non managé '{0}' n'est valide que pour les champs.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired1"> <source>Attribute parameter '{0}' must be specified.</source> <target state="translated">Le paramètre d'attribut '{0}' doit être spécifié.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired2"> <source>Attribute parameter '{0}' or '{1}' must be specified.</source> <target state="translated">Le paramètre d'attribut '{0}' ou '{1}' doit être spécifié.</target> <note /> </trans-unit> <trans-unit id="ERR_MemberConflictWithSynth4"> <source>Conflicts with '{0}', which is implicitly declared for '{1}' in {2} '{3}'.</source> <target state="translated">Conflit avec '{0}', qui est déclaré implicitement pour '{1}' dans {2} '{3}'.</target> <note /> </trans-unit> <trans-unit id="IDS_ProjectSettingsLocationName"> <source>&lt;project settings&gt;</source> <target state="translated">&lt;paramètres de projet&gt;</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeAttributeOnWriteOnlyProperty"> <source>Attributes applied on a return type of a WriteOnly Property have no effect.</source> <target state="translated">Les attributs appliqués sur un type de retour d'une propriété WriteOnly sont sans effet.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeAttributeOnWriteOnlyProperty_Title"> <source>Attributes applied on a return type of a WriteOnly Property have no effect</source> <target state="translated">Les attributs appliqués sur un type de retour d'une propriété WriteOnly sont sans effet</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidTarget"> <source>Security attribute '{0}' is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations.</source> <target state="translated">L'attribut de sécurité '{0}' n'est pas valide dans ce type de déclaration. Les attributs de sécurité ne sont valides que dans les déclarations d'assembly, de type et de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_AbsentReferenceToPIA1"> <source>Cannot find the interop type that matches the embedded type '{0}'. Are you missing an assembly reference?</source> <target state="translated">Impossible de trouver le type interop qui correspond au type incorporé '{0}'. Une référence d'assembly est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLinkClassWithNoPIA1"> <source>Reference to class '{0}' is not allowed when its assembly is configured to embed interop types.</source> <target state="translated">Une référence à la classe '{0}' n'est pas autorisée lorsque son assembly est configuré pour incorporer les types interop.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidStructMemberNoPIA1"> <source>Embedded interop structure '{0}' can contain only public instance fields.</source> <target state="translated">La structure d'interopérabilité incorporée '{0}' ne peut contenir que des champs d'instance publics.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIAAttributeMissing2"> <source>Interop type '{0}' cannot be embedded because it is missing the required '{1}' attribute.</source> <target state="translated">Impossible d'incorporer le type interop '{0}', car il lui manque l'attribut '{1}' obligatoire.</target> <note /> </trans-unit> <trans-unit id="ERR_PIAHasNoAssemblyGuid1"> <source>Cannot embed interop types from assembly '{0}' because it is missing the '{1}' attribute.</source> <target state="translated">Impossible d'incorporer les types interop de l'assembly '{0}', car l'attribut '{1}' est manquant.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocalTypes3"> <source>Cannot embed interop type '{0}' found in both assembly '{1}' and '{2}'. Consider disabling the embedding of interop types.</source> <target state="translated">Impossible d'incorporer le type interop '{0}' trouvé dans les assemblys '{1}' et '{2}'. Désactivez l'incorporation des types interop.</target> <note /> </trans-unit> <trans-unit id="ERR_PIAHasNoTypeLibAttribute1"> <source>Cannot embed interop types from assembly '{0}' because it is missing either the '{1}' attribute or the '{2}' attribute.</source> <target state="translated">Impossible d'incorporer les types interop de l'assembly '{0}', car l'attribut '{1}' ou '{2}' est manquant.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceInterfaceMustBeInterface"> <source>Interface '{0}' has an invalid source interface which is required to embed event '{1}'.</source> <target state="translated">L'interface '{0}' a une interface source non valide qui est nécessaire à l'incorporation de l'événement '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventNoPIANoBackingMember"> <source>Source interface '{0}' is missing method '{1}', which is required to embed event '{2}'.</source> <target state="translated">L'interface source '{0}' n'a pas de méthode '{1}', qui est requise pour incorporer l'événement '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedInteropType"> <source>Nested type '{0}' cannot be embedded.</source> <target state="translated">Le type imbriqué '{0}' ne peut pas être incorporé.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalTypeNameClash2"> <source>Embedding the interop type '{0}' from assembly '{1}' causes a name clash in the current assembly. Consider disabling the embedding of interop types.</source> <target state="translated">L'incorporation du type interop '{0}' de l'assembly '{1}' entraîne un conflit de noms dans l'assembly actuel. Désactivez l'incorporation des types interop.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropMethodWithBody1"> <source>Embedded interop method '{0}' contains a body.</source> <target state="translated">La méthode interop incorporée '{0}' contient un corps.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncInQuery"> <source>'Await' may only be used in a query expression within the first collection expression of the initial 'From' clause or within the collection expression of a 'Join' clause.</source> <target state="translated">'Await' peut uniquement être utilisé dans une expression de requête contenue dans la première expression de collection de la clause 'From' initiale ou dans l'expression de collection d'une clause 'Join'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGetAwaiterMethod1"> <source>'Await' requires that the type '{0}' have a suitable GetAwaiter method.</source> <target state="translated">'Await' nécessite que le type '{0}' ait une méthode GetAwaiter appropriée.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIsCompletedOnCompletedGetResult2"> <source>'Await' requires that the return type '{0}' of '{1}.GetAwaiter()' have suitable IsCompleted, OnCompleted and GetResult members, and implement INotifyCompletion or ICriticalNotifyCompletion.</source> <target state="translated">'Await' nécessite que le type de retour '{0}' de '{1}.GetAwaiter()' ait des membres IsCompleted, OnCompleted et GetResult appropriés et qu'ils implémentent INotifyCompletion ou ICriticalNotifyCompletion.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesntImplementAwaitInterface2"> <source>'{0}' does not implement '{1}'.</source> <target state="translated">'{0}' n'implémente pas '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitNothing"> <source>Cannot await Nothing. Consider awaiting 'Task.Yield()' instead.</source> <target state="translated">Impossible d'attendre Nothing. Attendez plutôt 'Task.Yield()'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncByRefParam"> <source>Async methods cannot have ByRef parameters.</source> <target state="translated">Les méthodes Async n'acceptent pas les paramètres ByRef.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAsyncIteratorModifiers"> <source>'Async' and 'Iterator' modifiers cannot be used together.</source> <target state="translated">'Les modificateurs 'Async' et 'Iterator' ne peuvent pas être utilisés en même temps.</target> <note /> </trans-unit> <trans-unit id="ERR_BadResumableAccessReturnVariable"> <source>The implicit return variable of an Iterator or Async method cannot be accessed.</source> <target state="translated">Impossible d'accéder à la variable de retour implicite d'une méthode Iterator ou Async.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnFromNonGenericTaskAsync"> <source>'Return' statements in this Async method cannot return a value since the return type of the function is 'Task'. Consider changing the function's return type to 'Task(Of T)'.</source> <target state="translated">'Les instructions 'Return' de cette méthode Async ne peuvent pas retourner de valeur puisque que le retour de la fonction est de type 'Task'. Convertissez le type de retour de la fonction en 'Task(Of T)'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturnOperand1"> <source>Since this is an async method, the return expression must be of type '{0}' rather than 'Task(Of {0})'.</source> <target state="translated">Étant donné qu'il s'agit d'une méthode Async, l'expression de retour doit être de type '{0}' plutôt que 'Task(Of {0})'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturn"> <source>The 'Async' modifier can only be used on Subs, or on Functions that return Task or Task(Of T).</source> <target state="translated">Le modificateur 'Async' peut uniquement être utilisé dans les procédures Sub, ou dans les fonctions retournant Task ou Task(Of T).</target> <note /> </trans-unit> <trans-unit id="ERR_CantAwaitAsyncSub1"> <source>'{0}' does not return a Task and cannot be awaited. Consider changing it to an Async Function.</source> <target state="translated">'{0}' ne peut pas retourner de tâche ni être attendu. Utilisez plutôt une fonction Async.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLambdaModifier"> <source>'Only the 'Async' or 'Iterator' modifier is valid on a lambda.</source> <target state="translated">'Seuls les modificateurs 'Async' et 'Iterator' sont valides dans les expressions lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncMethod"> <source>'Await' can only be used within an Async method. Consider marking this method with the 'Async' modifier and changing its return type to 'Task(Of {0})'.</source> <target state="translated">'Await' peut uniquement être utilisé dans une méthode Async. Marquez cette méthode avec le modificateur 'Async' et changez son type de retour en 'Task(Of {0})'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncVoidMethod"> <source>'Await' can only be used within an Async method. Consider marking this method with the 'Async' modifier and changing its return type to 'Task'.</source> <target state="translated">'Await' peut uniquement être utilisé dans une méthode Async. Marquez cette méthode avec le modificateur 'Async' et changez son type de retour en 'Task'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncLambda"> <source>'Await' can only be used within an Async lambda expression. Consider marking this lambda expression with the 'Async' modifier.</source> <target state="translated">'Await' peut uniquement être utilisé dans une expression lambda Async. Marquez cette expression lambda avec le modificateur 'Async'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitNotInAsyncMethodOrLambda"> <source>'Await' can only be used when contained within a method or lambda expression marked with the 'Async' modifier.</source> <target state="translated">'Await' peut uniquement être utilisé lorsqu'il est contenu dans une méthode ou une expression lambda marquée avec le modificateur 'Async'.</target> <note /> </trans-unit> <trans-unit id="ERR_StatementLambdaInExpressionTree"> <source>Statement lambdas cannot be converted to expression trees.</source> <target state="translated">Des lambda-instructions ne peuvent pas être converties en arborescences de l'expression.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression"> <source>Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the Await operator to the result of the call.</source> <target state="translated">Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel. Envisagez d'appliquer l'opérateur Await au résultat de l'appel.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression_Title"> <source>Because this call is not awaited, execution of the current method continues before the call is completed</source> <target state="translated">Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel</target> <note /> </trans-unit> <trans-unit id="ERR_LoopControlMustNotAwait"> <source>Loop control variable cannot include an 'Await'.</source> <target state="translated">La variable de contrôle de boucle ne peut pas inclure un 'Await'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticInitializerInResumable"> <source>Static variables cannot appear inside Async or Iterator methods.</source> <target state="translated">Les méthodes Async et Iterator ne peuvent pas contenir de variables statiques.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedResumableType1"> <source>'{0}' cannot be used as a parameter type for an Iterator or Async method.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant que type de paramètre pour une méthode Iterator ou Async.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorAsync"> <source>Constructor must not have the 'Async' modifier.</source> <target state="translated">Le constructeur doit être associé au modificateur 'Async'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustNotBeAsync1"> <source>'{0}' cannot be declared 'Partial' because it has the 'Async' modifier.</source> <target state="translated">'{0}' ne peut pas être déclaré comme 'Partial', car son modificateur est de type 'Async'.</target> <note /> </trans-unit> <trans-unit id="ERR_ResumablesCannotContainOnError"> <source>'On Error' and 'Resume' cannot appear inside async or iterator methods.</source> <target state="translated">'Les méthodes Async et Iterator ne peuvent pas contenir d'instructions 'On Error' et 'Resume' .</target> <note /> </trans-unit> <trans-unit id="ERR_ResumableLambdaInExpressionTree"> <source>Lambdas with the 'Async' or 'Iterator' modifiers cannot be converted to expression trees.</source> <target state="translated">Les expressions lambda avec un modificateur 'Async' ou 'Iterator' ne peuvent pas être converties en arborescences d'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeResumable1"> <source>Variable of restricted type '{0}' cannot be declared in an Async or Iterator method.</source> <target state="translated">Les variables du type restreint '{0}' ne peuvent pas être déclarées dans les méthodes Async ou Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInTryHandler"> <source>'Await' cannot be used inside a 'Catch' statement, a 'Finally' statement, or a 'SyncLock' statement.</source> <target state="translated">'Await' ne peut pas être utilisé dans une instruction 'Catch', 'Finally' ou 'SyncLock'.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits"> <source>This async method lacks 'Await' operators and so will run synchronously. Consider using the 'Await' operator to await non-blocking API calls, or 'Await Task.Run(...)' to do CPU-bound work on a background thread.</source> <target state="translated">Aucun opérateur 'Await' ne se trouve dans cette méthode Async, par conséquent, elle sera exécutée de façon synchrone. Utilisez un opérateur 'Await' pour attendre les appels non bloquants d'API, ou un opérateur 'Await Task.Run(...)' pour les tâches utilisant le processeur de façon intensive effectuées sur un thread d'arrière-plan.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits_Title"> <source>This async method lacks 'Await' operators and so will run synchronously</source> <target state="translated">Cette méthode asynchrone n’a pas d’opérateurs 'Await' et sera exécutée de manière synchrone</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableDelegate"> <source>The Task returned from this Async Function will be dropped, and any exceptions in it ignored. Consider changing it to an Async Sub so its exceptions are propagated.</source> <target state="translated">La tâche retournée à partir de cette fonction asynchrone sera supprimée et toutes les exceptions qu'elle contient seront ignorées. Envisagez de la transformer en une procédure Sub asynchrone afin que ses exceptions soient propagées.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableDelegate_Title"> <source>The Task returned from this Async Function will be dropped, and any exceptions in it ignored</source> <target state="translated">La tâche renvoyée à partir de cette fonction asynchrone sera supprimée et toutes les exceptions qu’elle contient seront ignorées</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalAsyncInClassOrStruct"> <source>Async and Iterator methods are not allowed in a [Class|Structure|Interface|Module] that has the 'SecurityCritical' or 'SecuritySafeCritical' attribute.</source> <target state="translated">Les méthodes Async et Iterator ne sont pas autorisées dans un(e) [Classe|Structure|Interface|Module] qui a l'attribut 'SecurityCritical' ou 'SecuritySafeCritical'.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalAsync"> <source>Security attribute '{0}' cannot be applied to an Async or Iterator method.</source> <target state="translated">L'attribut de sécurité '{0}' ne peut pas être appliqué à une méthode Async ou Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnResumableMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to an Async or Iterator method.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué aux méthodes Async et Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_SynchronizedAsyncMethod"> <source>'MethodImplOptions.Synchronized' cannot be applied to an Async method.</source> <target state="translated">'MethodImplOptions.Synchronized' ne peut pas être appliqué à une méthode Async.</target> <note /> </trans-unit> <trans-unit id="ERR_AsyncSubMain"> <source>The 'Main' method cannot be marked 'Async'.</source> <target state="translated">La méthode 'Main' ne peut pas être marquée comme 'Async'.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncSubCouldBeFunction"> <source>Some overloads here take an Async Function rather than an Async Sub. Consider either using an Async Function, or casting this Async Sub explicitly to the desired type.</source> <target state="translated">Certaines surcharges doivent être associées à une fonction Async plutôt qu'à une procédure Sub Async. Utilisez une fonction Async ou effectuez une conversion explicite de la procédure Sub Async vers le type désiré.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncSubCouldBeFunction_Title"> <source>Some overloads here take an Async Function rather than an Async Sub</source> <target state="translated">Certaines surcharges doivent être associées à une fonction Async plutôt qu’à une procédure Sub Async</target> <note /> </trans-unit> <trans-unit id="ERR_MyGroupCollectionAttributeCycle"> <source>MyGroupCollectionAttribute cannot be applied to itself.</source> <target state="translated">MyGroupCollectionAttribute ne peut pas être appliqué à lui-même.</target> <note /> </trans-unit> <trans-unit id="ERR_LiteralExpected"> <source>Literal expected.</source> <target state="translated">Littéral attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_WinRTEventWithoutDelegate"> <source>Event declarations that target WinMD must specify a delegate type. Add an As clause to the event declaration.</source> <target state="translated">Les déclarations d'événement qui ciblent WinMD doivent spécifier un type de délégué. Ajoutez une clause As à la déclaration d'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_MixingWinRTAndNETEvents"> <source>Event '{0}' cannot implement a Windows Runtime event '{1}' and a regular .NET event '{2}'</source> <target state="translated">L'événement '{0}' ne peut pas implémenter un événement Windows Runtime '{1}' et un événement .NET régulier '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventImplRemoveHandlerParamWrong"> <source>Event '{0}' cannot implement event '{1}' on interface '{2}' because the parameters of their 'RemoveHandler' methods do not match.</source> <target state="translated">L'événement '{0}' ne peut pas implémenter l'événement '{1}' dans l'interface '{2}', car les paramètres de leurs méthodes 'RemoveHandler' respectives ne sont pas les mêmes.</target> <note /> </trans-unit> <trans-unit id="ERR_AddParamWrongForWinRT"> <source>The type of the 'AddHandler' method's parameter must be the same as the type of the event.</source> <target state="translated">Le type du paramètre de la méthode 'AddHandler' doit être identique au type de l'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_RemoveParamWrongForWinRT"> <source>In a Windows Runtime event, the type of the 'RemoveHandler' method parameter must be 'EventRegistrationToken'</source> <target state="translated">Dans un événement Windows Runtime, le type du paramètre de méthode 'RemoveHandler' doit être 'EventRegistrationToken'</target> <note /> </trans-unit> <trans-unit id="ERR_ReImplementingWinRTInterface5"> <source>'{0}.{1}' from 'implements {2}' is already implemented by the base class '{3}'. Re-implementation of Windows Runtime Interface '{4}' is not allowed</source> <target state="translated">'{0}.{1}' issu de 'implements {2}' est déjà implémenté par la classe de base '{3}'. Vous n'êtes pas autorisé à réimplémenter l'interface Windows Runtime '{4}'</target> <note /> </trans-unit> <trans-unit id="ERR_ReImplementingWinRTInterface4"> <source>'{0}.{1}' is already implemented by the base class '{2}'. Re-implementation of Windows Runtime Interface '{3}' is not allowed</source> <target state="translated">'{0}.{1}' est déjà implémenté par la classe de base '{2}'. Vous n'êtes pas autorisé à réimplémenter l'interface Windows Runtime '{3}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorByRefParam"> <source>Iterator methods cannot have ByRef parameters.</source> <target state="translated">Les méthodes Iterator n'acceptent pas les paramètres ByRef.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorExpressionLambda"> <source>Single-line lambdas cannot have the 'Iterator' modifier. Use a multiline lambda instead.</source> <target state="translated">Les expressions lambda sur une seule ligne ne peuvent pas avoir de modificateur 'Iterator'. Utilisez une expression lambda multiligne à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorReturn"> <source>Iterator functions must return either IEnumerable(Of T), or IEnumerator(Of T), or the non-generic forms IEnumerable or IEnumerator.</source> <target state="translated">Les fonctions Iterator doivent retourner IEnumerable(Of T) ou IEnumerator(Of T), ou bien les formulaires non génériques IEnumerable ou IEnumerator.</target> <note /> </trans-unit> <trans-unit id="ERR_BadReturnValueInIterator"> <source>To return a value from an Iterator function, use 'Yield' rather than 'Return'.</source> <target state="translated">Pour retourner une valeur depuis une fonction Iterator, utilisez 'Yield' plutôt que 'Return'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInNonIteratorMethod"> <source>'Yield' can only be used in a method marked with the 'Iterator' modifier.</source> <target state="translated">'Yield' peut uniquement être utilisé dans une méthode marquée à l'aide du modificateur 'Iterator'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInTryHandler"> <source>'Yield' cannot be used inside a 'Catch' statement or a 'Finally' statement.</source> <target state="translated">'Yield' ne peut pas être utilisé dans une instruction 'Catch' ou 'Finally'.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValWinRtEventVal1"> <source>The AddHandler for Windows Runtime event '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">L'événement AddHandler pour Windows Runtime '{0}' ne retourne pas une valeur pour tous les chemins du code. Une instruction 'Return' est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValWinRtEventVal1_Title"> <source>The AddHandler for Windows Runtime event doesn't return a value on all code paths</source> <target state="translated">L’événement AddHandler pour Windows Runtime ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodDefaultParameterValueMismatch2"> <source>Optional parameter of a method '{0}' does not have the same default value as the corresponding parameter of the partial method '{1}'.</source> <target state="translated">Le paramètre facultatif d'une méthode '{0}' n'a pas la même valeur par défaut que le paramètre correspondant de la méthode partielle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamArrayMismatch2"> <source>Parameter of a method '{0}' differs by ParamArray modifier from the corresponding parameter of the partial method '{1}'.</source> <target state="translated">Le paramètre d'une méthode '{0}' diffère par son modificateur ParamArray du paramètre correspondant de la méthode partielle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMismatch"> <source>Module name '{0}' stored in '{1}' must match its filename.</source> <target state="translated">Le nom de module '{0}' stocké dans '{1}' doit correspondre à son nom de fichier.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleName"> <source>Invalid module name: {0}</source> <target state="translated">Nom de module non valide : {0}</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden"> <source>Attribute '{0}' from module '{1}' will be ignored in favor of the instance appearing in source.</source> <target state="translated">L'attribut '{0}' du module '{1}' sera ignoré au profit de l'instance présente dans la source.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden_Title"> <source>Attribute from module will be ignored in favor of the instance appearing in source</source> <target state="translated">L’attribut du module sera ignoré en faveur de l’instance qui apparaît dans la source</target> <note /> </trans-unit> <trans-unit id="ERR_CmdOptionConflictsSource"> <source>Attribute '{0}' given in a source file conflicts with option '{1}'.</source> <target state="translated">L'attribut '{0}' spécifié dans un fichier source est en conflit avec l'option '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName"> <source>Referenced assembly '{0}' does not have a strong name.</source> <target state="translated">L'assembly référencé '{0}' n'a pas de nom fort.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName_Title"> <source>Referenced assembly does not have a strong name</source> <target state="translated">L'assembly référencé n'a pas de nom fort</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSignaturePublicKey"> <source>Invalid signature public key specified in AssemblySignatureKeyAttribute.</source> <target state="translated">Une clé publique de signature non valide a été spécifiée dans AssemblySignatureKeyAttribute.</target> <note /> </trans-unit> <trans-unit id="ERR_CollisionWithPublicTypeInModule"> <source>Type '{0}' conflicts with public type defined in added module '{1}'.</source> <target state="translated">Le type '{0}' est en conflit avec le type public défini dans le module '{1}' ajouté.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypeConflictsWithDeclaration"> <source>Type '{0}' exported from module '{1}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Le type '{0}' exporté à partir du module '{1}' est en conflit avec le type déclaré dans le module principal de cet assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypesConflict"> <source>Type '{0}' exported from module '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Le type '{0}' exporté à partir du module '{1}' est en conflit avec le type '{2}' exporté à partir du module '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch"> <source>Referenced assembly '{0}' has different culture setting of '{1}'.</source> <target state="translated">L'assembly référencé '{0}' a un paramètre de culture différent : '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch_Title"> <source>Referenced assembly has different culture setting</source> <target state="translated">L'assembly référencé a un paramètre de culture différent</target> <note /> </trans-unit> <trans-unit id="ERR_AgnosticToMachineModule"> <source>Agnostic assembly cannot have a processor specific module '{0}'.</source> <target state="translated">Un assembly agnostique ne peut pas avoir un module '{0}' propre au processeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingMachineModule"> <source>Assembly and module '{0}' cannot target different processors.</source> <target state="translated">L'assembly et le module '{0}' ne peuvent pas cibler des processeurs différents.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly"> <source>Referenced assembly '{0}' targets a different processor.</source> <target state="translated">L'assembly référencé '{0}' cible un processeur différent.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly_Title"> <source>Referenced assembly targets a different processor</source> <target state="translated">L'assembly référencé cible un processeur différent</target> <note /> </trans-unit> <trans-unit id="ERR_CryptoHashFailed"> <source>Cryptographic failure while creating hashes.</source> <target state="translated">Échec de chiffrement pendant la création de hachages.</target> <note /> </trans-unit> <trans-unit id="ERR_CantHaveWin32ResAndManifest"> <source>Conflicting options specified: Win32 resource file; Win32 manifest.</source> <target state="translated">Options spécifiées en conflit : fichier de ressources Win32 ; manifeste Win32.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithDeclaration"> <source>Forwarded type '{0}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Le type transmis '{0}' est en conflit avec le type déclaré dans le module principal de cet assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypesConflict"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' forwarded to assembly '{3}'.</source> <target state="translated">Le type '{0}' transmis à l'assembly '{1}' est en conflit avec le type '{2}' transmis à l'assembly '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooLongMetadataName"> <source>Name '{0}' exceeds the maximum length allowed in metadata.</source> <target state="translated">Le nom '{0}' dépasse la longueur maximale autorisée dans les métadonnées.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNetModuleReference"> <source>Reference to '{0}' netmodule missing.</source> <target state="translated">Référence à netmodule '{0}' manquante.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMustBeUnique"> <source>Module '{0}' is already defined in this assembly. Each module must have a unique filename.</source> <target state="translated">Le module '{0}' est déjà défini dans cet assembly. Chaque module doit avoir un nom de fichier unique.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithExportedType"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Le type '{0}' transmis à l'assembly '{1}' est en conflit avec le type '{2}' exporté à partir du module '{3}'.</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDREFERENCE"> <source>Adding assembly reference '{0}'</source> <target state="translated">Ajout de la référence d'assembly '{0}'</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDLINKREFERENCE"> <source>Adding embedded assembly reference '{0}'</source> <target state="translated">Ajout de la référence d'assembly incorporé '{0}'</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDMODULE"> <source>Adding module reference '{0}'</source> <target state="translated">Ajout de la référence de module '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_NestingViolatesCLS1"> <source>Type '{0}' does not inherit the generic type parameters of its container.</source> <target state="translated">Le type '{0}' n'hérite pas des paramètres de type générique de son conteneur.</target> <note /> </trans-unit> <trans-unit id="ERR_PDBWritingFailed"> <source>Failure writing debug information: {0}</source> <target state="translated">Échec de l'écriture des informations de débogage : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_ParamDefaultValueDiffersFromAttribute"> <source>The parameter has multiple distinct default values.</source> <target state="translated">Le paramètre contient plusieurs valeurs par défaut distinctes.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldHasMultipleDistinctConstantValues"> <source>The field has multiple distinct constant values.</source> <target state="translated">Le champ contient plusieurs valeurs de constante distinctes.</target> <note /> </trans-unit> <trans-unit id="ERR_EncNoPIAReference"> <source>Cannot continue since the edit includes a reference to an embedded type: '{0}'.</source> <target state="translated">Impossible de continuer, car la modification inclut une référence à un type incorporé : '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EncReferenceToAddedMember"> <source>Member '{0}' added during the current debug session can only be accessed from within its declaring assembly '{1}'.</source> <target state="translated">Le membre '{0}' ajouté durant la session de débogage actuelle est uniquement accessible à partir de son assembly de déclaration '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedModule1"> <source>'{0}' is an unsupported .NET module.</source> <target state="translated">'{0}' est un module .NET non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedEvent1"> <source>'{0}' is an unsupported event.</source> <target state="translated">'{0}' est un événement non pris en charge.</target> <note /> </trans-unit> <trans-unit id="PropertiesCanNotHaveTypeArguments"> <source>Properties can not have type arguments</source> <target state="translated">Les propriétés ne peuvent pas avoir d'arguments de type</target> <note /> </trans-unit> <trans-unit id="IdentifierSyntaxNotWithinSyntaxTree"> <source>IdentifierSyntax not within syntax tree</source> <target state="translated">IdentifierSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="AnonymousObjectCreationExpressionSyntaxNotWithinTree"> <source>AnonymousObjectCreationExpressionSyntax not within syntax tree</source> <target state="translated">AnonymousObjectCreationExpressionSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="FieldInitializerSyntaxNotWithinSyntaxTree"> <source>FieldInitializerSyntax not within syntax tree</source> <target state="translated">FieldInitializerSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="IDS_TheSystemCannotFindThePathSpecified"> <source>The system cannot find the path specified</source> <target state="translated">Le système ne trouve pas le chemin indiqué</target> <note /> </trans-unit> <trans-unit id="ThereAreNoPointerTypesInVB"> <source>There are no pointer types in VB.</source> <target state="translated">Les types pointer n'existent pas en VB.</target> <note /> </trans-unit> <trans-unit id="ThereIsNoDynamicTypeInVB"> <source>There is no dynamic type in VB.</source> <target state="translated">Les types dynamiques n'existent pas en VB.</target> <note /> </trans-unit> <trans-unit id="VariableSyntaxNotWithinSyntaxTree"> <source>variableSyntax not within syntax tree</source> <target state="translated">variableSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="AggregateSyntaxNotWithinSyntaxTree"> <source>AggregateSyntax not within syntax tree</source> <target state="translated">AggregateSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="FunctionSyntaxNotWithinSyntaxTree"> <source>FunctionSyntax not within syntax tree</source> <target state="translated">FunctionSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="PositionIsNotWithinSyntax"> <source>Position is not within syntax tree</source> <target state="translated">La position ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="RangeVariableSyntaxNotWithinSyntaxTree"> <source>RangeVariableSyntax not within syntax tree</source> <target state="translated">RangeVariableSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="DeclarationSyntaxNotWithinSyntaxTree"> <source>DeclarationSyntax not within syntax tree</source> <target state="translated">DeclarationSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="StatementOrExpressionIsNotAValidType"> <source>StatementOrExpression is not an ExecutableStatementSyntax or an ExpressionSyntax</source> <target state="translated">StatementOrExpression n'est pas un ExecutableStatementSyntax ou un ExpressionSyntax</target> <note /> </trans-unit> <trans-unit id="DeclarationSyntaxNotWithinTree"> <source>DeclarationSyntax not within tree</source> <target state="translated">DeclarationSyntax ne se trouve pas dans l'arborescence</target> <note /> </trans-unit> <trans-unit id="TypeParameterNotWithinTree"> <source>TypeParameter not within tree</source> <target state="translated">TypeParameter ne se trouve dans l'arborescence</target> <note /> </trans-unit> <trans-unit id="NotWithinTree"> <source> not within tree</source> <target state="translated"> ne se trouve pas dans l'arborescence</target> <note /> </trans-unit> <trans-unit id="LocationMustBeProvided"> <source>Location must be provided in order to provide minimal type qualification.</source> <target state="translated">L'emplacement doit être indiqué pour fournir une qualification de type minimale.</target> <note /> </trans-unit> <trans-unit id="SemanticModelMustBeProvided"> <source>SemanticModel must be provided in order to provide minimal type qualification.</source> <target state="translated">SemanticModel doit être indiqué afin de fournir une qualification de type minimale.</target> <note /> </trans-unit> <trans-unit id="NumberOfTypeParametersAndArgumentsMustMatch"> <source>the number of type parameters and arguments should be the same</source> <target state="translated">le nombre de paramètres et d'arguments de type doit être identique</target> <note /> </trans-unit> <trans-unit id="ERR_ResourceInModule"> <source>Cannot link resource files when building a module</source> <target state="translated">Impossible de lier des fichiers de ressources lors de la création d'un module</target> <note /> </trans-unit> <trans-unit id="NotAVbSymbol"> <source>Not a VB symbol.</source> <target state="translated">Symbole VB non valide.</target> <note /> </trans-unit> <trans-unit id="ElementsCannotBeNull"> <source>Elements cannot be null.</source> <target state="translated">Les éléments ne peuvent pas avoir la valeur null.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportClause"> <source>Unused import clause.</source> <target state="translated">Clause d’importation inutilisée.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportStatement"> <source>Unused import statement.</source> <target state="translated">Instruction d’importation inutilisée.</target> <note /> </trans-unit> <trans-unit id="WrongSemanticModelType"> <source>Expected a {0} SemanticModel.</source> <target state="translated">SemanticModel {0} attendu.</target> <note /> </trans-unit> <trans-unit id="PositionNotWithinTree"> <source>Position must be within span of the syntax tree.</source> <target state="translated">La position doit se trouver dans l'étendue de l'arborescence de syntaxe.</target> <note /> </trans-unit> <trans-unit id="SpeculatedSyntaxNodeCannotBelongToCurrentCompilation"> <source>Syntax node to be speculated cannot belong to a syntax tree from the current compilation.</source> <target state="translated">Le nœud de syntaxe à extrapoler ne peut pas appartenir à une arborescence de syntaxe de la compilation actuelle.</target> <note /> </trans-unit> <trans-unit id="ChainingSpeculativeModelIsNotSupported"> <source>Chaining speculative semantic model is not supported. You should create a speculative model from the non-speculative ParentModel.</source> <target state="translated">Le chaînage d'un modèle sémantique spéculatif n'est pas pris en charge. Vous devez créer un modèle spéculatif à partir du ParentModel non spéculatif.</target> <note /> </trans-unit> <trans-unit id="IDS_ToolName"> <source>Microsoft (R) Visual Basic Compiler</source> <target state="translated">Compilateur Microsoft (R) Visual Basic</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine1"> <source>{0} version {1}</source> <target state="translated">{0} version {1}</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine2"> <source>Copyright (C) Microsoft Corporation. All rights reserved.</source> <target state="translated">Copyright (C) Microsoft Corporation. Tous droits réservés.</target> <note /> </trans-unit> <trans-unit id="IDS_LangVersions"> <source>Supported language versions:</source> <target state="translated">Versions de langage prises en charge :</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong"> <source>Local name '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">Le nom local '{0}' est trop long pour PDB. Raccourcissez-le ou compilez sans /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong_Title"> <source>Local name is too long for PDB</source> <target state="translated">Le nom local est trop long pour PDB</target> <note /> </trans-unit> <trans-unit id="WRN_PdbUsingNameTooLong"> <source>Import string '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">La chaîne d'importation '{0}' est trop longue pour PDB. Raccourcissez-la ou compilez sans /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbUsingNameTooLong_Title"> <source>Import string is too long for PDB</source> <target state="translated">La chaîne d’importation est trop longue pour PDB</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefToTypeParameter"> <source>XML comment has a tag with a 'cref' attribute '{0}' that bound to a type parameter. Use the &lt;typeparamref&gt; tag instead.</source> <target state="translated">Le commentaire XML a une balise avec un attribut 'cref' '{0}' qui est lié à un paramètre de type. Utilisez la balise &lt;typeparamref&gt; à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefToTypeParameter_Title"> <source>XML comment has a tag with a 'cref' attribute that bound to a type parameter</source> <target state="translated">Le commentaire XML possède une balise avec un attribut 'cref' lié à un paramètre de type</target> <note /> </trans-unit> <trans-unit id="ERR_LinkedNetmoduleMetadataMustProvideFullPEImage"> <source>Linked netmodule metadata must provide a full PE image: '{0}'.</source> <target state="translated">Les métadonnées netmodule liées doivent fournir une image PE complète : '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated"> <source>An instance of analyzer {0} cannot be created from {1} : {2}.</source> <target state="translated">Impossible de créer une instance de l'analyseur {0} à partir de {1} : {2}.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated_Title"> <source>Instance of analyzer cannot be created</source> <target state="translated">L’instance de l’analyseur ne peut pas être créée</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly"> <source>The assembly {0} does not contain any analyzers.</source> <target state="translated">L'assembly {0} ne contient pas d'analyseurs.</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly_Title"> <source>Assembly does not contain any analyzers</source> <target state="translated">L'assembly ne contient pas d'analyseur</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer"> <source>Unable to load analyzer assembly {0} : {1}.</source> <target state="translated">Impossible de charger l'assembly d'analyseur {0} : {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer_Title"> <source>Unable to load analyzer assembly</source> <target state="translated">Impossible de charger l’assembly de l’analyseur</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer"> <source>Skipping some types in analyzer assembly {0} due to a ReflectionTypeLoadException : {1}.</source> <target state="translated">Certains types contenus dans l'assembly analyseur {0} ont été ignorés pour cause de ReflectionTypeLoadException : {1}.</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer_Title"> <source>Skip loading types in analyzer assembly that fail due to a ReflectionTypeLoadException</source> <target state="translated">Ignorer le chargement de types dans un assembly d’analyseur qui échouent en raison d’une ReflectionTypeLoadException</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadRulesetFile"> <source>Error reading ruleset file {0} - {1}</source> <target state="translated">Erreur lors de la lecture du fichier ruleset {0} - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PlatformDoesntSupport"> <source>{0} is not supported in current project type.</source> <target state="translated">{0} n'est pas pris en charge dans le type de projet actif.</target> <note /> </trans-unit> <trans-unit id="ERR_CantUseRequiredAttribute"> <source>The RequiredAttribute attribute is not permitted on Visual Basic types.</source> <target state="translated">L'attribut RequiredAttribute n'est pas autorisé dans des types Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ERR_EncodinglessSyntaxTree"> <source>Cannot emit debug information for a source text without encoding.</source> <target state="translated">Impossible d'émettre des informations de débogage pour un texte source sans encodage.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatSpecifier"> <source>'{0}' is not a valid format specifier</source> <target state="translated">'{0}' n'est pas un spécificateur de format valide</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPreprocessorConstantType"> <source>Preprocessor constant '{0}' of type '{1}' is not supported, only primitive types are allowed.</source> <target state="translated">La constante de préprocesseur '{0}' de type '{1}' n'est pas prise en charge, seuls les types primitifs sont autorisés.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedWarningKeyword"> <source>'Warning' expected.</source> <target state="translated">'Warning' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotBeMadeNullable1"> <source>'{0}' cannot be made nullable.</source> <target state="translated">'{0}' ne peut pas être null.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConditionalWithRef"> <source>Leading '?' can only appear inside a 'With' statement, but not inside an object member initializer.</source> <target state="translated">Un '?' de début ne peut s'afficher que dans une instruction 'With', et pas dans un initialiseur de membre d'objet.</target> <note /> </trans-unit> <trans-unit id="ERR_NullPropagatingOpInExpressionTree"> <source>A null propagating operator cannot be converted into an expression tree.</source> <target state="translated">Impossible de convertir un opérateur de propagation null en une arborescence d'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_TooLongOrComplexExpression"> <source>An expression is too long or complex to compile</source> <target state="translated">Une expression est trop longue ou complexe à compiler</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionDoesntHaveName"> <source>This expression does not have a name.</source> <target state="translated">Cette expression n'a pas de nom.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNameOfSubExpression"> <source>This sub-expression cannot be used inside NameOf argument.</source> <target state="translated">Cette sous-expression ne peut pas être utilisée dans un argument NameOf.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodTypeArgsUnexpected"> <source>Method type arguments unexpected.</source> <target state="translated">Arguments de type de méthode inattendus.</target> <note /> </trans-unit> <trans-unit id="NoNoneSearchCriteria"> <source>SearchCriteria is expected.</source> <target state="translated">SearchCriteria est attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCulture"> <source>Assembly culture strings may not contain embedded NUL characters.</source> <target state="translated">Les chaînes de culture d'assembly ne peuvent pas contenir de caractères null incorporés.</target> <note /> </trans-unit> <trans-unit id="ERR_InReferencedAssembly"> <source>There is an error in a referenced assembly '{0}'.</source> <target state="translated">Il existe une erreur dans un assembly référencé '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolationFormatWhitespace"> <source>Format specifier may not contain trailing whitespace.</source> <target state="translated">Le spécificateur de format ne peut pas contenir d’espaces blancs de fin.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolationAlignmentOutOfRange"> <source>Alignment value is outside of the supported range.</source> <target state="translated">La valeur de l'alignement est en dehors de la plage prise en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringFactoryError"> <source>There were one or more errors emitting a call to {0}.{1}. Method or its return type may be missing or malformed.</source> <target state="translated">Une ou plusieurs erreurs se sont produites lors de l'émission de l'appel à {0}.{1}. La méthode ou son type de retour peuvent être manquants ou incorrects.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportClause_Title"> <source>Unused import clause</source> <target state="translated">Clause import inutilisée</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportStatement_Title"> <source>Unused import statement</source> <target state="translated">Instruction import inutilisée</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantStringTooLong"> <source>Length of String constant resulting from concatenation exceeds System.Int32.MaxValue. Try splitting the string into multiple constants.</source> <target state="translated">La longueur de la constante de chaîne qui résulte de la concaténation dépasse System.Int32.MaxValue. Essayez de diviser la chaîne en plusieurs constantes.</target> <note /> </trans-unit> <trans-unit id="ERR_LanguageVersion"> <source>Visual Basic {0} does not support {1}.</source> <target state="translated">Visual Basic {0} ne prend pas en charge {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPdbData"> <source>Error reading debug information for '{0}'</source> <target state="translated">Erreur lors de la lecture des informations de débogage pour '{0}'</target> <note /> </trans-unit> <trans-unit id="FEATURE_ArrayLiterals"> <source>array literal expressions</source> <target state="translated">expressions littérales de tableaux</target> <note /> </trans-unit> <trans-unit id="FEATURE_AsyncExpressions"> <source>async methods or lambdas</source> <target state="translated">méthodes Async ou expressions lambda</target> <note /> </trans-unit> <trans-unit id="FEATURE_AutoProperties"> <source>auto-implemented properties</source> <target state="translated">propriétés implémentées automatiquement</target> <note /> </trans-unit> <trans-unit id="FEATURE_ReadonlyAutoProperties"> <source>readonly auto-implemented properties</source> <target state="translated">propriétés implémentées automatiquement en lecture seule</target> <note /> </trans-unit> <trans-unit id="FEATURE_CoContraVariance"> <source>variance</source> <target state="translated">variance</target> <note /> </trans-unit> <trans-unit id="FEATURE_CollectionInitializers"> <source>collection initializers</source> <target state="translated">initialiseurs de collections</target> <note /> </trans-unit> <trans-unit id="FEATURE_GlobalNamespace"> <source>declaring a Global namespace</source> <target state="translated">déclaration d'un espace de noms global</target> <note /> </trans-unit> <trans-unit id="FEATURE_Iterators"> <source>iterators</source> <target state="translated">itérateurs</target> <note /> </trans-unit> <trans-unit id="FEATURE_LineContinuation"> <source>implicit line continuation</source> <target state="translated">continuation de ligne implicite</target> <note /> </trans-unit> <trans-unit id="FEATURE_StatementLambdas"> <source>multi-line lambda expressions</source> <target state="translated">Expressions lambda multilignes</target> <note /> </trans-unit> <trans-unit id="FEATURE_SubLambdas"> <source>'Sub' lambda expressions</source> <target state="translated">'Expressions lambda 'Sub'</target> <note /> </trans-unit> <trans-unit id="FEATURE_NullPropagatingOperator"> <source>null conditional operations</source> <target state="translated">Opérations conditionnelles null</target> <note /> </trans-unit> <trans-unit id="FEATURE_NameOfExpressions"> <source>'nameof' expressions</source> <target state="translated">'Expressions 'nameof'</target> <note /> </trans-unit> <trans-unit id="FEATURE_RegionsEverywhere"> <source>region directives within method bodies or regions crossing boundaries of declaration blocks</source> <target state="translated">directives region dans des corps de méthodes ou régions traversant les limites de blocs de déclaration</target> <note /> </trans-unit> <trans-unit id="FEATURE_MultilineStringLiterals"> <source>multiline string literals</source> <target state="translated">littéraux de chaîne multiligne</target> <note /> </trans-unit> <trans-unit id="FEATURE_CObjInAttributeArguments"> <source>CObj in attribute arguments</source> <target state="translated">CObj dans les arguments d'attribut</target> <note /> </trans-unit> <trans-unit id="FEATURE_LineContinuationComments"> <source>line continuation comments</source> <target state="translated">commentaires de continuation de ligne</target> <note /> </trans-unit> <trans-unit id="FEATURE_TypeOfIsNot"> <source>TypeOf IsNot expression</source> <target state="translated">Expression TypeOf IsNot</target> <note /> </trans-unit> <trans-unit id="FEATURE_YearFirstDateLiterals"> <source>year-first date literals</source> <target state="translated">littéraux de date avec année en premier</target> <note /> </trans-unit> <trans-unit id="FEATURE_WarningDirectives"> <source>warning directives</source> <target state="translated">directives warning</target> <note /> </trans-unit> <trans-unit id="FEATURE_PartialModules"> <source>partial modules</source> <target state="translated">modules partiels</target> <note /> </trans-unit> <trans-unit id="FEATURE_PartialInterfaces"> <source>partial interfaces</source> <target state="translated">interfaces partielles</target> <note /> </trans-unit> <trans-unit id="FEATURE_ImplementingReadonlyOrWriteonlyPropertyWithReadwrite"> <source>implementing read-only or write-only property with read-write property</source> <target state="translated">implémentation d'une propriété en lecture seule ou en écriture seule avec une propriété en lecture/écriture</target> <note /> </trans-unit> <trans-unit id="FEATURE_DigitSeparators"> <source>digit separators</source> <target state="translated">séparateurs numériques</target> <note /> </trans-unit> <trans-unit id="FEATURE_BinaryLiterals"> <source>binary literals</source> <target state="translated">littéraux binaires</target> <note /> </trans-unit> <trans-unit id="FEATURE_Tuples"> <source>tuples</source> <target state="translated">tuples</target> <note /> </trans-unit> <trans-unit id="FEATURE_PrivateProtected"> <source>Private Protected</source> <target state="translated">Private Protected</target> <note /> </trans-unit> <trans-unit id="ERR_DebugEntryPointNotSourceMethodDefinition"> <source>Debug entry point must be a definition of a method declared in the current compilation.</source> <target state="translated">Le point d'entrée de débogage doit être une définition d'une méthode déclarée dans la compilation actuelle.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPathMap"> <source>The pathmap option was incorrectly formatted.</source> <target state="translated">Le format de l'option pathmap est incorrect.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeIsNotASubmission"> <source>Syntax tree should be created from a submission.</source> <target state="translated">L'arborescence de syntaxe doit être créée à partir d'une soumission.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyUserStrings"> <source>Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string or XML literals.</source> <target state="translated">La longueur combinée des chaînes utilisateur que le programme utilise dépasse la limite autorisée. Essayez de réduire le nombre de littéraux de chaîne ou XML.</target> <note /> </trans-unit> <trans-unit id="ERR_PeWritingFailure"> <source>An error occurred while writing the output file: {0}</source> <target state="translated">Une erreur s'est produite durant l'écriture du fichier de sortie : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_OptionMustBeAbsolutePath"> <source>Option '{0}' must be an absolute path.</source> <target state="translated">L'option '{0}' doit être un chemin absolu.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceLinkRequiresPdb"> <source>/sourcelink switch is only supported when emitting PDB.</source> <target state="translated">Le commutateur /sourcelink est uniquement pris en charge durant l'émission d'un fichier PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleDuplicateElementName"> <source>Tuple element names must be unique.</source> <target state="translated">Les noms d'éléments d'un tuple doivent être uniques.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch"> <source>The tuple element name '{0}' is ignored because a different name or no name is specified by the target type '{1}'.</source> <target state="translated">Le nom d'élément tuple '{0}' est ignoré, car un autre nom est spécifié ou aucun nom n'est spécifié par le type cible '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch_Title"> <source>The tuple element name is ignored because a different name or no name is specified by the assignment target.</source> <target state="translated">Le nom d'élément tuple est ignoré, car un autre nom est spécifié ou aucun nom n'est spécifié par la cible de l'assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementName"> <source>Tuple element name '{0}' is only allowed at position {1}.</source> <target state="translated">Le nom d'élément de tuple '{0}' est uniquement autorisé à la position {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementNameAnyPosition"> <source>Tuple element name '{0}' is disallowed at any position.</source> <target state="translated">Le nom d'élément de tuple '{0}' est interdit à toutes les positions.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleTooFewElements"> <source>Tuple must contain at least two elements.</source> <target state="translated">Le tuple doit contenir au moins deux éléments.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNamesAttributeMissing"> <source>Cannot define a class or member that utilizes tuples because the compiler required type '{0}' cannot be found. Are you missing a reference?</source> <target state="translated">Impossible de définir une classe ou un membre qui utilise des tuples, car le type '{0}' nécessaire au compilateur est introuvable. Une référence est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitTupleElementNamesAttribute"> <source>Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.</source> <target state="translated">Impossible de référencer 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitement. Utilisez la syntaxe des tuples pour définir les noms de tuples.</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturningCallInExpressionTree"> <source>An expression tree may not contain a call to a method or property that returns by reference.</source> <target state="translated">Une arborescence de l'expression ne peut pas contenir un appel à une méthode ou une propriété qui effectue un retour par référence.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedWithoutPdb"> <source>/embed switch is only supported when emitting a PDB.</source> <target state="translated">Le commutateur /embed est uniquement pris en charge durant l'émission d'un fichier PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInstrumentationKind"> <source>Invalid instrumentation kind: {0}</source> <target state="translated">Genre d'instrumentation non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_DocFileGen"> <source>Error writing to XML documentation file: {0}</source> <target state="translated">Erreur d'écriture dans le fichier de documentation XML : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadAssemblyName"> <source>Invalid assembly name: {0}</source> <target state="translated">Nom d'assembly non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_TypeForwardedToMultipleAssemblies"> <source>Module '{0}' in assembly '{1}' is forwarding the type '{2}' to multiple assemblies: '{3}' and '{4}'.</source> <target state="translated">Le module '{0}' dans l'assembly '{1}' transfère le type '{2}' à plusieurs assemblys : '{3}' et '{4}'.</target> <note /> </trans-unit> <trans-unit id="ERR_Merge_conflict_marker_encountered"> <source>Merge conflict marker encountered</source> <target state="translated">Marqueur de conflit de fusion rencontré</target> <note /> </trans-unit> <trans-unit id="ERR_NoRefOutWhenRefOnly"> <source>Do not use refout when using refonly.</source> <target state="translated">N'utilisez pas refout quand vous utilisez refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNetModuleOutputWhenRefOutOrRefOnly"> <source>Cannot compile net modules when using /refout or /refonly.</source> <target state="translated">Impossible de compiler les modules net en utilisant /refout ou /refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNonTrailingNamedArgument"> <source>Named argument '{0}' is used out-of-position but is followed by an unnamed argument</source> <target state="translated">L'argument nommé '{0}' est utilisé hors-position mais est suivi d'un argument sans nom</target> <note /> </trans-unit> <trans-unit id="ERR_BadDocumentationMode"> <source>Provided documentation mode is unsupported or invalid: '{0}'.</source> <target state="translated">Le mode de documentation fourni n'est pas pris en charge ou est non valide : '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLanguageVersion"> <source>Provided language version is unsupported or invalid: '{0}'.</source> <target state="translated">La version de langage fournie n'est pas prise en charge ou est non valide : '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSourceCodeKind"> <source>Provided source code kind is unsupported or invalid: '{0}'</source> <target state="translated">Le genre de code source fourni n'est pas pris en charge ou est non valide : '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_TupleInferredNamesNotAvailable"> <source>Tuple element name '{0}' is inferred. Please use language version {1} or greater to access an element by its inferred name.</source> <target state="translated">Le nom d'élément de tuple '{0}' est déduit. Utilisez la version de langage {1} ou une version supérieure pour accéder à un élément par son nom déduit.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental"> <source>'{0}' is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">'{0}' est utilisé à des fins d'évaluation uniquement. Il sera peut-être changé ou supprimé au cours des prochaines mises à jour.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental_Title"> <source>Type is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">Le type est utilisé à des fins d'évaluation uniquement. Il sera peut-être changé ou supprimé au cours des prochaines mises à jour.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInfo"> <source>Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}'</source> <target state="translated">Impossible de lire les informations de débogage de la méthode '{0}' (jeton 0x{1}) dans l'assembly '{2}'</target> <note /> </trans-unit> <trans-unit id="IConversionExpressionIsNotVisualBasicConversion"> <source>{0} is not a valid Visual Basic conversion expression</source> <target state="translated">{0} n'est pas une expression de conversion Visual Basic valide</target> <note /> </trans-unit> <trans-unit id="IArgumentIsNotVisualBasicArgument"> <source>{0} is not a valid Visual Basic argument</source> <target state="translated">{0} n'est pas un argument Visual Basic valide</target> <note /> </trans-unit> <trans-unit id="FEATURE_LeadingDigitSeparator"> <source>leading digit separator</source> <target state="translated">séparateur numérique de début</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTupleResolutionAmbiguous3"> <source>Predefined type '{0}' is declared in multiple referenced assemblies: '{1}' and '{2}'</source> <target state="translated">Le type prédéfini '{0}' est déclaré dans plusieurs assemblys référencés : '{1}' et '{2}'</target> <note /> </trans-unit> <trans-unit id="ICompoundAssignmentOperationIsNotVisualBasicCompoundAssignment"> <source>{0} is not a valid Visual Basic compound assignment operation</source> <target state="translated">{0} n'est pas une opération d'assignation composée Visual Basic valide</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHashAlgorithmName"> <source>Invalid hash algorithm name: '{0}'</source> <target state="translated">Nom d'algorithme de hachage non valide : '{0}'</target> <note /> </trans-unit> <trans-unit id="FEATURE_InterpolatedStrings"> <source>interpolated strings</source> <target state="translated">chaînes interpolées</target> <note /> </trans-unit> <trans-unit id="FTL_InvalidInputFileName"> <source>File name '{0}' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long</source> <target state="translated">Le nom de fichier '{0}' est vide, contient des caractères non valides, spécifie un lecteur sans chemin d'accès absolu ou est trop long</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeNotSupportedInVB"> <source>'{0}' is not supported in VB.</source> <target state="translated">'{0}' n’est pas pris en charge dans VB.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeNotSupportedInVB_Title"> <source>Attribute is not supported in VB</source> <target state="translated">L’attribut n’est pas pris en charge dans VB</target> <note /> </trans-unit> </body> </file> </xliff>
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="fr" original="../VBResources.resx"> <body> <trans-unit id="ERR_AssignmentInitOnly"> <source>Init-only property '{0}' can only be assigned by an object member initializer, or on 'Me', 'MyClass` or 'MyBase' in an instance constructor.</source> <target state="translated">La propriété d'initialisation uniquement '{0}' peut uniquement être affectée par un initialiseur de membre d'objet, ou sur 'Me', 'MyClass` ou 'MyBase' dans un constructeur d'instance.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSwitchValue"> <source>Command-line syntax error: '{0}' is not a valid value for the '{1}' option. The value must be of the form '{2}'.</source> <target state="translated">Erreur de syntaxe de ligne de commande : '{0}' est une valeur non valide pour l'option '{1}'. La valeur doit se présenter sous la forme '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CommentsAfterLineContinuationNotAvailable1"> <source>Please use language version {0} or greater to use comments after line continuation character.</source> <target state="translated">Utilisez la version de langage {0} ou une version ultérieure pour utiliser des commentaires après le caractère de continuation de la ligne.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultInterfaceImplementationInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Impossible d'incorporer le type '{0}', car il a un membre non abstrait. Affectez la valeur false à la propriété 'Incorporer les types interop'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleAnalyzerConfigsInSameDir"> <source>Multiple analyzer config files cannot be in the same directory ('{0}').</source> <target state="translated">Plusieurs fichiers config d'analyseur ne peuvent pas figurer dans le même répertoire ('{0}').</target> <note /> </trans-unit> <trans-unit id="ERR_OverridingInitOnlyProperty"> <source>'{0}' cannot override init-only '{1}'.</source> <target state="translated">'{0}' ne peut pas substituer le '{1}' d'initialisation uniquement.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyDoesntImplementInitOnly"> <source>Init-only '{0}' cannot be implemented.</source> <target state="translated">Impossible d'implémenter le '{0}' d'initialisation uniquement.</target> <note /> </trans-unit> <trans-unit id="ERR_ReAbstractionInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a re-abstraction of a member from base interface. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Impossible d'incorporer le type '{0}', car il a une nouvelle abstraction d'un membre de l'interface de base. Affectez la valeur false à la propriété 'Incorporer les types interop'.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation"> <source>Target runtime doesn't support default interface implementation.</source> <target state="translated">Le runtime cible ne prend pas en charge l'implémentation d'interface par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportProtectedAccessForInterfaceMember"> <source>Target runtime doesn't support 'Protected', 'Protected Friend', or 'Private Protected' accessibility for a member of an interface.</source> <target state="translated">Le runtime cible ne prend pas en charge l'accessibilité 'Protected', 'Protected Friend' ou 'Private Protected' pour un membre d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedEventNeedsHandlerInTheSameType"> <source>Events of shared WithEvents variables cannot be handled by methods in a different type.</source> <target state="translated">Les événements des variables WithEvents partagées ne peuvent pas être pris en charge par des méthodes dans un autre type.</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyNotSupported"> <source>'UnmanagedCallersOnly' attribute is not supported.</source> <target state="translated">L'attribut 'UnmanagedCallersOnly' n'est pas pris en charge.</target> <note /> </trans-unit> <trans-unit id="FEATURE_CallerArgumentExpression"> <source>caller argument expression</source> <target state="new">caller argument expression</target> <note /> </trans-unit> <trans-unit id="FEATURE_CommentsAfterLineContinuation"> <source>comments after line continuation</source> <target state="translated">commentaires après la continuation de la ligne</target> <note /> </trans-unit> <trans-unit id="FEATURE_InitOnlySettersUsage"> <source>assigning to or passing 'ByRef' properties with init-only setters</source> <target state="translated">affectation ou passage de propriétés 'ByRef' avec des méthodes setter d'initialisation uniquement</target> <note /> </trans-unit> <trans-unit id="FEATURE_UnconstrainedTypeParameterInConditional"> <source>unconstrained type parameters in binary conditional expressions</source> <target state="translated">paramètres de type sans contrainte dans les expressions conditionnelles binaires</target> <note /> </trans-unit> <trans-unit id="IDS_VBCHelp"> <source> Visual Basic Compiler Options - OUTPUT FILE - -out:&lt;file&gt; Specifies the output file name. -target:exe Create a console application (default). (Short form: -t) -target:winexe Create a Windows application. -target:library Create a library assembly. -target:module Create a module that can be added to an assembly. -target:appcontainerexe Create a Windows application that runs in AppContainer. -target:winmdobj Create a Windows Metadata intermediate file -doc[+|-] Generates XML documentation file. -doc:&lt;file&gt; Generates XML documentation file to &lt;file&gt;. -refout:&lt;file&gt; Reference assembly output to generate - INPUT FILES - -addmodule:&lt;file_list&gt; Reference metadata from the specified modules -link:&lt;file_list&gt; Embed metadata from the specified interop assembly. (Short form: -l) -recurse:&lt;wildcard&gt; Include all files in the current directory and subdirectories according to the wildcard specifications. -reference:&lt;file_list&gt; Reference metadata from the specified assembly. (Short form: -r) -analyzer:&lt;file_list&gt; Run the analyzers from this assembly (Short form: -a) -additionalfile:&lt;file list&gt; Additional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings. - RESOURCES - -linkresource:&lt;resinfo&gt; Links the specified file as an external assembly resource. resinfo:&lt;file&gt;[,&lt;name&gt;[,public|private]] (Short form: -linkres) -nowin32manifest The default manifest should not be embedded in the manifest section of the output PE. -resource:&lt;resinfo&gt; Adds the specified file as an embedded assembly resource. resinfo:&lt;file&gt;[,&lt;name&gt;[,public|private]] (Short form: -res) -win32icon:&lt;file&gt; Specifies a Win32 icon file (.ico) for the default Win32 resources. -win32manifest:&lt;file&gt; The provided file is embedded in the manifest section of the output PE. -win32resource:&lt;file&gt; Specifies a Win32 resource file (.res). - CODE GENERATION - -optimize[+|-] Enable optimizations. -removeintchecks[+|-] Remove integer checks. Default off. -debug[+|-] Emit debugging information. -debug:full Emit full debugging information (default). -debug:pdbonly Emit full debugging information. -debug:portable Emit cross-platform debugging information. -debug:embedded Emit cross-platform debugging information into the target .dll or .exe. -deterministic Produce a deterministic assembly (including module version GUID and timestamp) -refonly Produce a reference assembly in place of the main output -instrument:TestCoverage Produce an assembly instrumented to collect coverage information -sourcelink:&lt;file&gt; Source link info to embed into PDB. - ERRORS AND WARNINGS - -nowarn Disable all warnings. -nowarn:&lt;number_list&gt; Disable a list of individual warnings. -warnaserror[+|-] Treat all warnings as errors. -warnaserror[+|-]:&lt;number_list&gt; Treat a list of warnings as errors. -ruleset:&lt;file&gt; Specify a ruleset file that disables specific diagnostics. -errorlog:&lt;file&gt;[,version=&lt;sarif_version&gt;] Specify a file to log all compiler and analyzer diagnostics in SARIF format. sarif_version:{1|2|2.1} Default is 1. 2 and 2.1 both mean SARIF version 2.1.0. -reportanalyzer Report additional analyzer information, such as execution time. -skipanalyzers[+|-] Skip execution of diagnostic analyzers. - LANGUAGE - -define:&lt;symbol_list&gt; Declare global conditional compilation symbol(s). symbol_list:name=value,... (Short form: -d) -imports:&lt;import_list&gt; Declare global Imports for namespaces in referenced metadata files. import_list:namespace,... -langversion:? Display the allowed values for language version -langversion:&lt;string&gt; Specify language version such as `default` (latest major version), or `latest` (latest version, including minor versions), or specific versions like `14` or `15.3` -optionexplicit[+|-] Require explicit declaration of variables. -optioninfer[+|-] Allow type inference of variables. -rootnamespace:&lt;string&gt; Specifies the root Namespace for all type declarations. -optionstrict[+|-] Enforce strict language semantics. -optionstrict:custom Warn when strict language semantics are not respected. -optioncompare:binary Specifies binary-style string comparisons. This is the default. -optioncompare:text Specifies text-style string comparisons. - MISCELLANEOUS - -help Display this usage message. (Short form: -?) -noconfig Do not auto-include VBC.RSP file. -nologo Do not display compiler copyright banner. -quiet Quiet output mode. -verbose Display verbose messages. -parallel[+|-] Concurrent build. -version Display the compiler version number and exit. - ADVANCED - -baseaddress:&lt;number&gt; The base address for a library or module (hex). -checksumalgorithm:&lt;alg&gt; Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default). -codepage:&lt;number&gt; Specifies the codepage to use when opening source files. -delaysign[+|-] Delay-sign the assembly using only the public portion of the strong name key. -publicsign[+|-] Public-sign the assembly using only the public portion of the strong name key. -errorreport:&lt;string&gt; Specifies how to handle internal compiler errors; must be prompt, send, none, or queue (default). -filealign:&lt;number&gt; Specify the alignment used for output file sections. -highentropyva[+|-] Enable high-entropy ASLR. -keycontainer:&lt;string&gt; Specifies a strong name key container. -keyfile:&lt;file&gt; Specifies a strong name key file. -libpath:&lt;path_list&gt; List of directories to search for metadata references. (Semi-colon delimited.) -main:&lt;class&gt; Specifies the Class or Module that contains Sub Main. It can also be a Class that inherits from System.Windows.Forms.Form. (Short form: -m) -moduleassemblyname:&lt;string&gt; Name of the assembly which this module will be a part of. -netcf Target the .NET Compact Framework. -nostdlib Do not reference standard libraries (system.dll and VBC.RSP file). -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Specify a mapping for source path names output by the compiler. -platform:&lt;string&gt; Limit which platforms this code can run on; must be x86, x64, Itanium, arm, arm64 AnyCPU32BitPreferred or anycpu (default). -preferreduilang Specify the preferred output language name. -nosdkpath Disable searching the default SDK path for standard library assemblies. -sdkpath:&lt;path&gt; Location of the .NET Framework SDK directory (mscorlib.dll). -subsystemversion:&lt;version&gt; Specify subsystem version of the output PE. version:&lt;number&gt;[.&lt;number&gt;] -utf8output[+|-] Emit compiler output in UTF8 character encoding. @&lt;file&gt; Insert command-line settings from a text file -vbruntime[+|-|*] Compile with/without the default Visual Basic runtime. -vbruntime:&lt;file&gt; Compile with the alternate Visual Basic runtime in &lt;file&gt;. </source> <target state="translated"> Options du compilateur Visual Basic - FICHIER DE SORTIE - -out:&lt;fichier&gt; Spécifie le nom du fichier de sortie. -target:exe Créer une application console (par défaut). (Forme abrégée : -t) -target:winexe Créer une application Windows. -target:library Créer un assembly de bibliothèque. -target:module Créer un module qui peut être ajouté à un assembly. -target:appcontainerexe Créer une application Windows qui s'exécute dans AppContainer. -target:winmdobj Créer un fichier intermédiaire de métadonnées Windows -doc[+|-] Génère un fichier de documentation XML. -doc:&lt;fichier&gt; Génère un fichier de documentation XML dans &lt;fichier&gt;. -refout:&lt;fichier&gt; Sortie de l'assembly de référence à générer - FICHIERS D'ENTRÉE - -addmodule:&lt;liste_fichiers&gt; Référencer les métadonnées à partir des modules spécifiés -link:&lt;liste_fichiers&gt; Incorporer les métadonnées à partir de l'assembly d'interopérabilité spécifié. (Forme abrégée : -l) -recurse:&lt;générique&gt; Inclure tous les fichiers dans le répertoire et les sous-répertoires actifs en fonction des spécifications des caractères génériques. -reference:&lt;liste_fichiers&gt; Référencer les métadonnées à partir de l'assembly spécifié. (Forme abrégée : -r) -analyzer:&lt;liste_fichiers&gt; Exécuter les analyseurs à partir de cet assembly (Forme abrégée : -a) -additionalfile:&lt;liste_fichiers&gt; Fichiers supplémentaires qui n'affectent pas directement la génération de code mais qui peuvent être utilisés par les analyseurs pour produire des erreurs ou des avertissements. - RESSOURCES - -linkresource:&lt;resinfo&gt; Lie le fichier spécifié sous forme de ressource d'assembly externe. resinfo:&lt;fichier&gt;[,&lt;nom&gt;[,public|private]] (Forme abrégée : -linkres) -nowin32manifest Le manifeste par défaut ne doit pas être incorporé dans la section manifest du PE de sortie. -resource:&lt;resinfo&gt; Ajoute le fichier spécifié en tant que ressource d'assembly incorporée. resinfo:&lt;fichier&gt;[,&lt;nom&gt;[,public|private]] (Forme abrégée : -res) -win32icon:&lt;fichier&gt; Spécifie un fichier icône Win32 (.ico) pour les ressources Win32 par défaut. -win32manifest:&lt;fichier&gt; Le fichier fourni est incorporé dans la section manifest du PE de sortie. -win32resource:&lt;fichier&gt; Spécifie un fichier de ressources Win32 (.res). - GÉNÉRATION DE CODE - -optimize[+|-] Activer les optimisations. -removeintchecks[+|-] Supprimer les contrôles sur les entiers. La valeur par défaut est off. -debug[+|-] Émettre des informations de débogage. -debug:full Émettre des informations de débogage complètes (par défaut). -debug:pdbonly Émettre des informations de débogage complètes. -debug:portable Émettre des informations de débogage multiplateformes. -debug:embedded Émettre des informations de débogage multiplateformes dans le fichier .dll ou .exe cible. -deterministic Produire un assembly déterministe (en incluant le GUID et l'horodatage de la version du module) -refonly Produire un assembly de référence à la place de la sortie principale -instrument:TestCoverage Produire un assembly instrumenté pour collecter les informations de couverture -sourcelink:&lt;fichier&gt; Informations du lien source à incorporer dans le fichier PDB. - ERREURS ET AVERTISSEMENTS - -nowarn Désactiver tous les avertissements. -nowarn:&lt;liste_numéros&gt; Désactiver une liste d'avertissements individuels. -warnaserror[+|-] Traiter tous les avertissements comme des erreurs. -warnaserror[+|-]:&lt;liste_numéros&gt; Traiter une liste d'avertissements comme des erreurs. -ruleset:&lt;fichier&gt; Spécifier un fichier ruleset qui désactive des diagnostics spécifiques. -errorlog:&lt;fichier&gt;[,version=&lt;version_sarif&gt;] Spécifier un fichier pour journaliser tous les diagnostics du compilateur et de l'analyseur au format SARIF. version_sarif :{1|2|2.1} La valeur par défaut est 1. 2 et 2.1 Les deux signifient SARIF version 2.1.0. -reportanalyzer Signaler des informations supplémentaires sur l'analyseur, par exemple la durée d'exécution. -skipanalyzers[+|-] Ignorer l'exécution des analyseurs de diagnostic. - LANGAGE - -define:&lt;liste_symboles&gt; Déclarer des symboles de compilation conditionnelle globale. liste_symboles:name=value,... (Forme abrégée : -d) -imports:&lt;liste_importations&gt; Déclarer des importations globales pour les espaces de noms dans les fichiers de métadonnées référencés. liste_importations:namespace,... -langversion:? Afficher les valeurs autorisées pour la version du langage -langversion:&lt;chaîne&gt; Spécifier la version du langage, par exemple 'default' (dernière version principale) ou 'latest' (dernière version, en incluant les versions mineures), ou des versions spécifiques comme '14' ou '15.3' -optionexplicit[+|-] Imposer une déclaration explicite des variables. -optioninfer[+|-] Autoriser l'inférence de type des variables. -rootnamespace:&lt;chaîne&gt; Spécifie l'espace de noms racine pour toutes les déclarations de type. -optionstrict[+|-] Appliquer une sémantique stricte du langage. -optionstrict:custom Avertir quand la sémantique stricte du langage n'est pas respectée. -optioncompare:binary Spécifie des comparaisons de chaînes de style binaire. Il s'agit de la valeur par défaut. -optioncompare:text Spécifie des comparaisons de chaînes de style texte. - DIVERS - -help Afficher ce message d'utilisation. (Forme abrégée : -?) -noconfig Ne pas inclure automatiquement un fichier VBC.RSP. -nologo Ne pas afficher la bannière de copyright du compilateur. -quiet Mode de sortie silencieux. -verbose Afficher des messages documentés. -parallel[+|-] Build simultanée. -version Afficher le numéro de version du compilateur et quitter le processus. - AVANCÉ - -baseaddress:&lt;numéro&gt; Adresse de base d'une bibliothèque ou d'un module (en hexadécimal). -checksumalgorithm:&lt;alg&gt; Spécifier l'algorithme de calcul de la somme de contrôle de fichier source stockée dans le fichier PDB. Valeurs prises en charge : SHA1 ou SHA256 (par défaut). -codepage:&lt;numéro&gt; Spécifie la page de codes à utiliser à l'ouverture des fichiers sources. -delaysign[+|-] Différer la signature de l'assembly en utilisant uniquement la partie publique de la clé de nom fort. -publicsign[+|-] Signer publiquement l'assembly en utilisant uniquement la partie publique de la clé de nom fort. -errorreport:&lt;chaîne&gt; Spécifie comment prendre en charge les erreurs internes du compilateur ; doit avoir la valeur prompt, send, none ou queue (par défaut). -filealign:&lt;numéro&gt; Spécifier l'alignement utilisé pour les sections du fichier de sortie. -highentropyva[+|-] Activer la randomisation du format d'espace d'adresse d'entropie élevée. -keycontainer:&lt;chaîne&gt; Spécifie un conteneur de clé de nom fort. -keyfile:&lt;fichier&gt; Spécifie un fichier de clé de nom fort. -libpath:&lt;liste_chemins&gt; Liste de répertoires où rechercher des références de métadonnées. (Valeurs délimitées par des points-virgules.) -main:&lt;classe&gt; Spécifie la classe ou le module qui contient Sub Main. Il peut également s'agir d'une classe qui hérite de System.Windows.Forms.Form. (Forme abrégée : -m) -moduleassemblyname:&lt;chaîne&gt; Nom de l'assembly dont ce module doit faire partie. -netcf Cibler le .NET Compact Framework. -nostdlib Ne pas référencer les bibliothèques standard (fichiers system.dll et VBC.RSP). -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Spécifier un mappage pour les noms de chemins sources sortis par le compilateur. -platform:&lt;chaîne&gt; Limiter les plateformes sur lesquelles ce code peut s'exécuter ; doit correspondre à x86, x64, Itanium, arm, arm64 AnyCPU32BitPreferred ou anycpu (par défaut). -preferreduilang Spécifier le nom du langage de sortie préféré. -nosdkpath Désactivez la recherche du chemin du kit SDK par défaut pour les assemblys de bibliothèque standard. -sdkpath:&lt;chemin&gt; Emplacement du répertoire du SDK .NET Framework (mscorlib.dll). -subsystemversion:&lt;version&gt; Spécifier la version du sous-système du PE de sortie. version:&lt;numéro&gt;[.&lt;numéro&gt;] -utf8output[+|-] Émettre la sortie du compilateur au format d'encodage de caractères UTF8. @&lt;fichier&gt; Insérer les paramètres de ligne de commande à partir d'un fichier texte -vbruntime[+|-|*] Compiler avec/sans le runtime Visual Basic par défaut. -vbruntime:&lt;fichier&gt; Compiler avec le runtime Visual Basic de remplacement dans &lt;fichier&gt;. </target> <note /> </trans-unit> <trans-unit id="ThereAreNoFunctionPointerTypesInVB"> <source>There are no function pointer types in VB.</source> <target state="translated">Il n'existe aucun type de pointeur de fonction en VB.</target> <note /> </trans-unit> <trans-unit id="ThereAreNoNativeIntegerTypesInVB"> <source>There are no native integer types in VB.</source> <target state="translated">Il n'existe aucun type d'entier natif dans VB.</target> <note /> </trans-unit> <trans-unit id="Trees0"> <source>trees({0})</source> <target state="translated">arborescences({0})</target> <note /> </trans-unit> <trans-unit id="TreesMustHaveRootNode"> <source>trees({0}) must have root node with SyntaxKind.CompilationUnit.</source> <target state="translated">les arborescences({0}) doivent avoir un nœud racine avec SyntaxKind.CompilationUnit.</target> <note /> </trans-unit> <trans-unit id="CannotAddCompilerSpecialTree"> <source>Cannot add compiler special tree</source> <target state="translated">Impossible d'ajouter une arborescence spéciale du compilateur</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeAlreadyPresent"> <source>Syntax tree already present</source> <target state="translated">Arborescence de syntaxe déjà présente</target> <note /> </trans-unit> <trans-unit id="SubmissionCanHaveAtMostOneSyntaxTree"> <source>Submission can have at most one syntax tree.</source> <target state="translated">Une soumission peut avoir au plus une arborescence de syntaxe.</target> <note /> </trans-unit> <trans-unit id="CannotRemoveCompilerSpecialTree"> <source>Cannot remove compiler special tree</source> <target state="translated">Impossible de supprimer l'arborescence spéciale du compilateur</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeNotFoundToRemove"> <source>SyntaxTree '{0}' not found to remove</source> <target state="translated">SyntaxTree '{0}' à supprimer introuvable</target> <note /> </trans-unit> <trans-unit id="TreeMustHaveARootNodeWithCompilationUnit"> <source>Tree must have a root node with SyntaxKind.CompilationUnit</source> <target state="translated">L'arborescence doit avoir un nœud racine avec SyntaxKind.CompilationUnit</target> <note /> </trans-unit> <trans-unit id="CompilationVisualBasic"> <source>Compilation (Visual Basic): </source> <target state="translated">Compilation (Visual Basic) : </target> <note /> </trans-unit> <trans-unit id="NodeIsNotWithinSyntaxTree"> <source>Node is not within syntax tree</source> <target state="translated">Le nœud ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="CantReferenceCompilationFromTypes"> <source>Can't reference compilation of type '{0}' from {1} compilation.</source> <target state="translated">Impossible de référencer la compilation de type '{0}' à partir de la compilation {1}.</target> <note /> </trans-unit> <trans-unit id="PositionOfTypeParameterTooLarge"> <source>position of type parameter too large</source> <target state="translated">position du paramètre de type trop large</target> <note /> </trans-unit> <trans-unit id="AssociatedTypeDoesNotHaveTypeParameters"> <source>Associated type does not have type parameters</source> <target state="translated">Le type associé n'a pas de paramètres de type</target> <note /> </trans-unit> <trans-unit id="IDS_FunctionReturnType"> <source>function return type</source> <target state="translated">type de retour de la fonction</target> <note /> </trans-unit> <trans-unit id="TypeArgumentCannotBeNothing"> <source>Type argument cannot be Nothing</source> <target state="translated">L'argument de type ne peut pas être Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework"> <source>The assembly '{0}' containing type '{1}' references .NET Framework, which is not supported.</source> <target state="translated">L'assembly '{0}' contenant le type '{1}' référence le .NET Framework, ce qui n'est pas pris en charge.</target> <note>{1} is the type that was loaded, {0} is the containing assembly.</note> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework_Title"> <source>The loaded assembly references .NET Framework, which is not supported.</source> <target state="translated">L'assembly chargé référence le .NET Framework, ce qui n'est pas pris en charge.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration"> <source>Generator '{0}' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Le générateur '{0}' n'a pas pu générer la source. Dans la mesure où il ne va pas contribuer à la sortie, des erreurs de compilation peuvent se produire. Exception levée de type '{1}' avec le message '{2}'</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Le générateur a levé l'exception suivante : '{0}'.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Title"> <source>Generator failed to generate source.</source> <target state="translated">Le générateur n'a pas pu générer la source.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization"> <source>Generator '{0}' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Échec de l'initialisation du générateur '{0}'. Dans la mesure où il ne va pas contribuer à la sortie, des erreurs de compilation peuvent se produire. Exception levée de type '{1}' avec le message '{2}'</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Le générateur a levé l'exception suivante : '{0}'.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Title"> <source>Generator failed to initialize.</source> <target state="translated">Échec de l'initialisation du générateur.</target> <note /> </trans-unit> <trans-unit id="WrongNumberOfTypeArguments"> <source>Wrong number of type arguments</source> <target state="translated">Nombre incorrect d'arguments de type</target> <note /> </trans-unit> <trans-unit id="ERR_FileNotFound"> <source>file '{0}' could not be found</source> <target state="translated">le fichier '{0}' est introuvable</target> <note /> </trans-unit> <trans-unit id="ERR_NoResponseFile"> <source>unable to open response file '{0}'</source> <target state="translated">impossible d'ouvrir le fichier réponse '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentRequired"> <source>option '{0}' requires '{1}'</source> <target state="translated">l'option '{0}' requiert '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchNeedsBool"> <source>option '{0}' can be followed only by '+' or '-'</source> <target state="translated">l'option '{0}' ne peut être suivie que de '+' ou '-'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSwitchValue"> <source>the value '{1}' is invalid for option '{0}'</source> <target state="translated">la valeur '{1}' n'est pas valide pour l'option '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_MutuallyExclusiveOptions"> <source>Compilation options '{0}' and '{1}' can't both be specified at the same time.</source> <target state="translated">Les options de compilation '{0}' et '{1}' ne peuvent pas être spécifiées toutes les deux en même temps.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang"> <source>The language name '{0}' is invalid.</source> <target state="translated">Le nom de langue '{0}' n'est pas valide.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang_Title"> <source>The language name for /preferreduilang is invalid</source> <target state="translated">Le nom de langue pour /preferreduilang n’est pas valide</target> <note /> </trans-unit> <trans-unit id="ERR_VBCoreNetModuleConflict"> <source>The options /vbruntime* and /target:module cannot be combined.</source> <target state="translated">Les options /vbruntime* et /target:module ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatForGuidForOption"> <source>Command-line syntax error: Invalid Guid format '{0}' for option '{1}'</source> <target state="translated">Erreur de syntaxe de ligne de commande : format de Guid '{0}' non valide pour l'option '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_MissingGuidForOption"> <source>Command-line syntax error: Missing Guid for option '{1}'</source> <target state="translated">Erreur de syntaxe de ligne de commande : Guid manquant pour l'option '{1}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadChecksumAlgorithm"> <source>Algorithm '{0}' is not supported</source> <target state="translated">Algorithme '{0}' non pris en charge</target> <note /> </trans-unit> <trans-unit id="WRN_BadSwitch"> <source>unrecognized option '{0}'; ignored</source> <target state="translated">option '{0}' non reconnue ; ignorée</target> <note /> </trans-unit> <trans-unit id="WRN_BadSwitch_Title"> <source>Unrecognized command-line option</source> <target state="translated">Option de ligne de commande non reconnue</target> <note /> </trans-unit> <trans-unit id="ERR_NoSources"> <source>no input sources specified</source> <target state="translated">aucune source d'entrée spécifiée</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded"> <source>source file '{0}' specified multiple times</source> <target state="translated">fichier source '{0}' indiqué plusieurs fois</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded_Title"> <source>Source file specified multiple times</source> <target state="translated">Le fichier source a été spécifié plusieurs fois</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenFileWrite"> <source>can't open '{0}' for writing: {1}</source> <target state="translated">impossible d'ouvrir '{0}' en écriture : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadCodepage"> <source>code page '{0}' is invalid or not installed</source> <target state="translated">la page de '{0}' n'est pas correcte ou n'est pas installée</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryFile"> <source>the file '{0}' is not a text file</source> <target state="translated">le fichier '{0}' n'est pas un fichier texte</target> <note /> </trans-unit> <trans-unit id="ERR_LibNotFound"> <source>could not find library '{0}'</source> <target state="translated">impossible de trouver la bibliothèque '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataReferencesNotSupported"> <source>Metadata references not supported.</source> <target state="translated">Références de métadonnées non prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_IconFileAndWin32ResFile"> <source>cannot specify both /win32icon and /win32resource</source> <target state="translated">impossible de spécifier à la fois /win32icon et /win32resource</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigInResponseFile"> <source>ignoring /noconfig option because it was specified in a response file</source> <target state="translated">Option /noconfig ignorée, car elle était spécifiée dans un fichier réponse</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigInResponseFile_Title"> <source>Ignoring /noconfig option because it was specified in a response file</source> <target state="translated">Option /noconfig ignorée, car elle était spécifiée dans un fichier réponse</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidWarningId"> <source>warning number '{0}' for the option '{1}' is either not configurable or not valid</source> <target state="translated">le numéro d'avertissement '{0}' pour l'option '{1}' n'est pas configurable ou n'est pas valide</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidWarningId_Title"> <source>Warning number is either not configurable or not valid</source> <target state="translated">Le numéro d’avertissement n’est pas configurable ou valide</target> <note /> </trans-unit> <trans-unit id="ERR_NoSourcesOut"> <source>cannot infer an output file name from resource only input files; provide the '/out' option</source> <target state="translated">impossible de déduire le nom d'un fichier de sortie à partir de fichiers d'entrée de ressource uniquement ; fournissez l'option '/out'</target> <note /> </trans-unit> <trans-unit id="ERR_NeedModule"> <source>the /moduleassemblyname option may only be specified when building a target of type 'module'</source> <target state="translated">l'option /moduleassemblyname ne peut être spécifiée que lors de la génération d'une cible de type 'module'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyName"> <source>'{0}' is not a valid value for /moduleassemblyname</source> <target state="translated">'{0}' n'est pas une valeur valide pour /moduleassemblyname</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingManifestSwitches"> <source>Error embedding Win32 manifest: Option /win32manifest conflicts with /nowin32manifest.</source> <target state="translated">Erreur d'incorporation du manifeste Win32 : l'option /win32manifest est en conflit avec /nowin32manifest.</target> <note /> </trans-unit> <trans-unit id="WRN_IgnoreModuleManifest"> <source>Option /win32manifest ignored. It can be specified only when the target is an assembly.</source> <target state="translated">Option /win32manifest ignorée. Elle ne peut être spécifiée que lorsque la cible est un assembly.</target> <note /> </trans-unit> <trans-unit id="WRN_IgnoreModuleManifest_Title"> <source>Option /win32manifest ignored</source> <target state="translated">Option /win32manifest ignorée</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInNamespace"> <source>Statement is not valid in a namespace.</source> <target state="translated">Instruction non valide dans un espace de noms.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedType1"> <source>Type '{0}' is not defined.</source> <target state="translated">Le type '{0}' n'est pas défini.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNext"> <source>'Next' expected.</source> <target state="translated">'Next' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCharConstant"> <source>Character constant must contain exactly one character.</source> <target state="translated">Une constante caractère doit contenir exactement un caractère.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedAssemblyEvent3"> <source>Reference required to assembly '{0}' containing the definition for event '{1}'. Add one to your project.</source> <target state="translated">Une référence à l'assembly '{0}' contenant la définition de l'événement '{1}' est requise. Ajoutez-en une à votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedModuleEvent3"> <source>Reference required to module '{0}' containing the definition for event '{1}'. Add one to your project.</source> <target state="translated">Une référence au module '{0}' contenant la définition pour l'événement '{1}' est requise. Ajoutez-en une à votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_LbExpectedEndIf"> <source>'#If' block must end with a matching '#End If'.</source> <target state="translated">'Le bloc '#If' doit se terminer par un '#End If' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_LbNoMatchingIf"> <source>'#ElseIf', '#Else', or '#End If' must be preceded by a matching '#If'.</source> <target state="translated">'#ElseIf', '#Else' ou '#End If' doit être précédé d'un '#If' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_LbBadElseif"> <source>'#ElseIf' must be preceded by a matching '#If' or '#ElseIf'.</source> <target state="translated">'#ElseIf' doit être précédé d'un '#If' ou '#ElseIf' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromRestrictedType1"> <source>Inheriting from '{0}' is not valid.</source> <target state="translated">L'héritage de '{0}' n'est pas valide.</target> <note /> </trans-unit> <trans-unit id="ERR_InvOutsideProc"> <source>Labels are not valid outside methods.</source> <target state="translated">Les étiquettes ne sont pas valides en dehors des méthodes.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateCantImplement"> <source>Delegates cannot implement interface methods.</source> <target state="translated">Les délégués ne peuvent pas implémenter des méthodes d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateCantHandleEvents"> <source>Delegates cannot handle events.</source> <target state="translated">Les délégués ne peuvent pas gérer les événements.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorRequiresReferenceTypes1"> <source>'Is' operator does not accept operands of type '{0}'. Operands must be reference or nullable types.</source> <target state="translated">'L'opérateur 'Is' n'accepte pas d'opérandes de type '{0}'. Les opérandes doivent être de types référence ou Nullable.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOfRequiresReferenceType1"> <source>'TypeOf ... Is' requires its left operand to have a reference type, but this operand has the value type '{0}'.</source> <target state="translated">'TypeOf ... Is' requiert un opérande gauche ayant un type référence, mais cet opérande a le type valeur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyHasSet"> <source>Properties declared 'ReadOnly' cannot have a 'Set'.</source> <target state="translated">Les propriétés déclarées 'ReadOnly' ne peuvent pas avoir de 'Set'.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyHasGet"> <source>Properties declared 'WriteOnly' cannot have a 'Get'.</source> <target state="translated">Les propriétés déclarées 'WriteOnly' ne peuvent pas avoir de 'Get'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideProc"> <source>Statement is not valid inside a method.</source> <target state="translated">Instruction non valide dans une méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideBlock"> <source>Statement is not valid inside '{0}' block.</source> <target state="translated">Instruction non valide dans un bloc '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedExpressionStatement"> <source>Expression statement is only allowed at the end of an interactive submission.</source> <target state="translated">L'instruction d'expression est autorisée uniquement à la fin d'un envoi interactif.</target> <note /> </trans-unit> <trans-unit id="ERR_EndProp"> <source>Property missing 'End Property'.</source> <target state="translated">End Property' manquant dans la propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSubExpected"> <source>'End Sub' expected.</source> <target state="translated">'End Sub' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_EndFunctionExpected"> <source>'End Function' expected.</source> <target state="translated">'End Function' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_LbElseNoMatchingIf"> <source>'#Else' must be preceded by a matching '#If' or '#ElseIf'.</source> <target state="translated">'#Else' doit être précédé d'un '#If' ou '#ElseIf' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_CantRaiseBaseEvent"> <source>Derived classes cannot raise base class events.</source> <target state="translated">Les classes dérivées ne peuvent pas déclencher les événements de la classe de base.</target> <note /> </trans-unit> <trans-unit id="ERR_TryWithoutCatchOrFinally"> <source>Try must have at least one 'Catch' or a 'Finally'.</source> <target state="translated">Try doit utiliser au moins un 'Catch' ou 'Finally'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventsCantBeFunctions"> <source>Events cannot have a return type.</source> <target state="translated">Les événements ne peuvent pas avoir de type de retour.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndBrack"> <source>Bracketed identifier is missing closing ']'.</source> <target state="translated">Crochet fermant manquant (']') pour l'identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_Syntax"> <source>Syntax error.</source> <target state="translated">Erreur de syntaxe.</target> <note /> </trans-unit> <trans-unit id="ERR_Overflow"> <source>Overflow.</source> <target state="translated">Dépassement de capacité.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalChar"> <source>Character is not valid.</source> <target state="translated">Caractère non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_StdInOptionProvidedButConsoleInputIsNotRedirected"> <source>stdin argument '-' is specified, but input has not been redirected from the standard input stream.</source> <target state="translated">L'argument stdin '-' est spécifié, mais l'entrée n'a pas été redirigée à partir du flux d'entrée standard.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsObjectOperand1"> <source>Option Strict On prohibits operands of type Object for operator '{0}'.</source> <target state="translated">Option Strict On interdit les opérandes de type Object pour l'opérateur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopControlMustNotBeProperty"> <source>Loop control variable cannot be a property or a late-bound indexed array.</source> <target state="translated">Une variable de contrôle de boucle ne peut pas être une propriété ni un tableau indexé à liaison tardive.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodBodyNotAtLineStart"> <source>First statement of a method body cannot be on the same line as the method declaration.</source> <target state="translated">La première instruction d'un corps de méthode ne peut pas se trouver sur la même ligne que la déclaration de la méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_MaximumNumberOfErrors"> <source>Maximum number of errors has been exceeded.</source> <target state="translated">Le nombre maximal d'erreurs est dépassé.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordNotInInstanceMethod1"> <source>'{0}' is valid only within an instance method.</source> <target state="translated">'{0}' est valide uniquement dans une méthode d'instance.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordFromStructure1"> <source>'{0}' is not valid within a structure.</source> <target state="translated">'{0}' n'est pas valide dans une structure.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeConstructor1"> <source>Attribute constructor has a parameter of type '{0}', which is not an integral, floating-point or Enum type or one of Object, Char, String, Boolean, System.Type or 1-dimensional array of these types.</source> <target state="translated">Le constructeur d'attribut a un paramètre de type '{0}', qui n'est pas un type intégral, virgule flottante ni Enum, ni encore Object, Char, String, Boolean, System.Type ou un tableau unidimensionnel de ces types.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayWithOptArgs"> <source>Method cannot have both a ParamArray and Optional parameters.</source> <target state="translated">La méthode ne peut pas comporter simultanément des paramètres ParamArray et Optional.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedArray1"> <source>'{0}' statement requires an array.</source> <target state="translated">'L'instruction '{0}' requiert un tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayNotArray"> <source>ParamArray parameter must be an array.</source> <target state="translated">Le paramètre ParamArray doit être un tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayRank"> <source>ParamArray parameter must be a one-dimensional array.</source> <target state="translated">Le paramètre ParamArray doit être un tableau unidimensionnel.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayRankLimit"> <source>Array exceeds the limit of 32 dimensions.</source> <target state="translated">Le tableau dépasse le nombre de 32 dimensions autorisées.</target> <note /> </trans-unit> <trans-unit id="ERR_AsNewArray"> <source>Arrays cannot be declared with 'New'.</source> <target state="translated">Les tableaux ne peuvent pas être déclarés avec 'New'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs1"> <source>Too many arguments to '{0}'.</source> <target state="translated">Arguments trop nombreux pour '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedCase"> <source>Statements and labels are not valid between 'Select Case' and first 'Case'.</source> <target state="translated">Instructions et étiquettes non valides entre 'Select Case' et la première occurrence de 'Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredConstExpr"> <source>Constant expression is required.</source> <target state="translated">Une expression constante est requise.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredConstConversion2"> <source>Conversion from '{0}' to '{1}' cannot occur in a constant expression.</source> <target state="translated">Une conversion de '{0}' en '{1}' ne peut pas avoir lieu dans une expression constante.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMe"> <source>'Me' cannot be the target of an assignment.</source> <target state="translated">'Me' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyAssignment"> <source>'ReadOnly' variable cannot be the target of an assignment.</source> <target state="translated">'Une variable 'ReadOnly' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitSubOfFunc"> <source>'Exit Sub' is not valid in a Function or Property.</source> <target state="translated">'Exit Sub' n'est pas valide dans un Function ni un Property.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitPropNot"> <source>'Exit Property' is not valid in a Function or Sub.</source> <target state="translated">'Exit Property' n'est pas valide dans un Function ni un Sub.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitFuncOfSub"> <source>'Exit Function' is not valid in a Sub or Property.</source> <target state="translated">'Exit Function' n'est pas valide dans un Sub ni un Property.</target> <note /> </trans-unit> <trans-unit id="ERR_LValueRequired"> <source>Expression is a value and therefore cannot be the target of an assignment.</source> <target state="translated">Cette expression est une valeur et ne peut donc pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_ForIndexInUse1"> <source>For loop control variable '{0}' already in use by an enclosing For loop.</source> <target state="translated">Variable de contrôle de boucle For '{0}' déjà utilisée par une boucle For englobante.</target> <note /> </trans-unit> <trans-unit id="ERR_NextForMismatch1"> <source>Next control variable does not match For loop control variable '{0}'.</source> <target state="translated">La variable de contrôle Next ne correspond pas à la variable de contrôle de boucle For '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseElseNoSelect"> <source>'Case Else' can only appear inside a 'Select Case' statement.</source> <target state="translated">'Case Else' ne peut apparaître qu'à l'intérieur d'une instruction 'Select Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseNoSelect"> <source>'Case' can only appear inside a 'Select Case' statement.</source> <target state="translated">'Case' ne peut apparaître qu'à l'intérieur d'une instruction 'Select Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantAssignToConst"> <source>Constant cannot be the target of an assignment.</source> <target state="translated">Une constante ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedSubscript"> <source>Named arguments are not valid as array subscripts.</source> <target state="translated">Les arguments nommés ne sont pas valides en tant qu'indices de tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndIf"> <source>'If' must end with a matching 'End If'.</source> <target state="translated">'If' doit se terminer par un 'End If' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndWhile"> <source>'While' must end with a matching 'End While'.</source> <target state="translated">'While' doit se terminer par un 'End While' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLoop"> <source>'Do' must end with a matching 'Loop'.</source> <target state="translated">'Do' doit se terminer par un 'Loop' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNext"> <source>'For' must end with a matching 'Next'.</source> <target state="translated">'For' doit se terminer par un 'Next' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndWith"> <source>'With' must end with a matching 'End With'.</source> <target state="translated">'With' doit se terminer par un 'End With' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseNoMatchingIf"> <source>'Else' must be preceded by a matching 'If' or 'ElseIf'.</source> <target state="translated">'Else' doit être précédé d'un 'If' ou 'ElseIf' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndIfNoMatchingIf"> <source>'End If' must be preceded by a matching 'If'.</source> <target state="translated">'End If' doit être précédé d'un 'If' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSelectNoSelect"> <source>'End Select' must be preceded by a matching 'Select Case'.</source> <target state="translated">'End Select' doit être précédé d'un 'Select Case' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitDoNotWithinDo"> <source>'Exit Do' can only appear inside a 'Do' statement.</source> <target state="translated">'Exit Do' ne peut s'utiliser qu'à l'intérieur d'une instruction 'Do'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndWhileNoWhile"> <source>'End While' must be preceded by a matching 'While'.</source> <target state="translated">'End While' doit être précédé d'un 'While' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopNoMatchingDo"> <source>'Loop' must be preceded by a matching 'Do'.</source> <target state="translated">'Loop' doit être précédé d'un 'Do' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NextNoMatchingFor"> <source>'Next' must be preceded by a matching 'For'.</source> <target state="translated">'Next' doit être précédé d'un 'For' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndWithWithoutWith"> <source>'End With' must be preceded by a matching 'With'.</source> <target state="translated">'End With' doit être précédé d'un 'With' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefined1"> <source>Label '{0}' is already defined in the current method.</source> <target state="translated">L'étiquette '{0}' est déjà définie dans la méthode actuelle.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndSelect"> <source>'Select Case' must end with a matching 'End Select'.</source> <target state="translated">'Select Case' doit se terminer par un 'End Select' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitForNotWithinFor"> <source>'Exit For' can only appear inside a 'For' statement.</source> <target state="translated">'Exit For' ne peut apparaître qu'à l'intérieur d'une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitWhileNotWithinWhile"> <source>'Exit While' can only appear inside a 'While' statement.</source> <target state="translated">'Exit While' ne peut apparaître qu'à l'intérieur d'une instruction 'While'.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyProperty1"> <source>'ReadOnly' property '{0}' cannot be the target of an assignment.</source> <target state="translated">'La propriété 'ReadOnly' '{0}' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitSelectNotWithinSelect"> <source>'Exit Select' can only appear inside a 'Select' statement.</source> <target state="translated">'Exit Select' ne peut apparaître qu'à l'intérieur d'une instruction 'Select'.</target> <note /> </trans-unit> <trans-unit id="ERR_BranchOutOfFinally"> <source>Branching out of a 'Finally' is not valid.</source> <target state="translated">La création d'une branche en dehors d'un 'Finally' n'est pas valide.</target> <note /> </trans-unit> <trans-unit id="ERR_QualNotObjectRecord1"> <source>'!' requires its left operand to have a type parameter, class or interface type, but this operand has the type '{0}'.</source> <target state="translated">'!' requiert un opérande gauche ayant un paramètre de type, un type de classe ou d'interface, mais cet opérande a le type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewIndices"> <source>Number of indices is less than the number of dimensions of the indexed array.</source> <target state="translated">Le nombre d'index est inférieur au nombre de dimensions du tableau indexé.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyIndices"> <source>Number of indices exceeds the number of dimensions of the indexed array.</source> <target state="translated">Le nombre d'index est supérieur au nombre de dimensions du tableau indexé.</target> <note /> </trans-unit> <trans-unit id="ERR_EnumNotExpression1"> <source>'{0}' is an Enum type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type Enum et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeNotExpression1"> <source>'{0}' is a type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassNotExpression1"> <source>'{0}' is a class type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type classe et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureNotExpression1"> <source>'{0}' is a structure type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type structure et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNotExpression1"> <source>'{0}' is an interface type and cannot be used as an expression.</source> <target state="translated">'{0}' est un type interface et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotExpression1"> <source>'{0}' is a namespace and cannot be used as an expression.</source> <target state="translated">'{0}' est un espace de noms et ne peut pas être utilisé en tant qu'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamespaceName1"> <source>'{0}' is not a valid name and cannot be used as the root namespace name.</source> <target state="translated">'{0}' n'est pas un nom valide et ne peut pas être utilisé comme nom d'espace de noms racine.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlPrefixNotExpression"> <source>'{0}' is an XML prefix and cannot be used as an expression. Use the GetXmlNamespace operator to create a namespace object.</source> <target state="translated">'{0}' est un préfixe XML et ne peut pas être utilisé comme expression. Utilisez l'opérateur GetXmlNamespace pour créer un objet namespace.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleExtends"> <source>'Inherits' can appear only once within a 'Class' statement and can only specify one class.</source> <target state="translated">'Inherits' ne peut apparaître qu'une seule fois dans une instruction 'Class' et ne peut spécifier qu'une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_PropMustHaveGetSet"> <source>Property without a 'ReadOnly' or 'WriteOnly' specifier must provide both a 'Get' and a 'Set'.</source> <target state="translated">Une propriété sans spécificateur 'ReadOnly' ou 'WriteOnly' doit fournir un 'Get' et un 'Set'.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyHasNoWrite"> <source>'WriteOnly' property must provide a 'Set'.</source> <target state="translated">'Une propriété 'WriteOnly' doit fournir un 'Set'.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyHasNoGet"> <source>'ReadOnly' property must provide a 'Get'.</source> <target state="translated">'Une propriété 'ReadOnly' doit fournir un 'Get'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttribute1"> <source>Attribute '{0}' is not valid: Incorrect argument value.</source> <target state="translated">L'attribut '{0}' n'est pas valide : valeur d'argument incorrecte.</target> <note /> </trans-unit> <trans-unit id="ERR_LabelNotDefined1"> <source>Label '{0}' is not defined.</source> <target state="translated">L'étiquette '{0}' n'est pas définie.</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorCreatingWin32ResourceFile"> <source>Error creating Win32 resources: {0}</source> <target state="translated">Erreur lors de la création de ressources Win32 : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToCreateTempFile"> <source>Cannot create temporary file: {0}</source> <target state="translated">Impossible de créer le fichier temporaire : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNewCall2"> <source>First statement of this 'Sub New' must be a call to 'MyBase.New' or 'MyClass.New' because base class '{0}' of '{1}' does not have an accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel à 'MyBase.New' ou 'MyClass.New', car la classe de base '{0}' de '{1}' n'a pas de 'Sub New' accessible qu'il est possible d'appeler sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedMember3"> <source>{0} '{1}' must implement '{2}' for interface '{3}'.</source> <target state="translated">{0} '{1}' doit implémenter '{2}' pour l'interface '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWithRef"> <source>Leading '.' or '!' can only appear inside a 'With' statement.</source> <target state="translated">Un '.' ou '!' de début ne peut apparaître que dans une instruction 'With'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAccessCategoryUsed"> <source>Only one of 'Public', 'Private', 'Protected', 'Friend', 'Protected Friend', or 'Private Protected' can be specified.</source> <target state="translated">Vous pouvez spécifier uniquement une instance de type 'Public', 'Private', 'Protected', 'Friend', 'Protected Friend' ou 'Private Protected'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateModifierCategoryUsed"> <source>Only one of 'NotOverridable', 'MustOverride', or 'Overridable' can be specified.</source> <target state="translated">Vous pouvez spécifier uniquement une instance de type 'NotOverridable', 'MustOverride' ou 'Overridable'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateSpecifier"> <source>Specifier is duplicated.</source> <target state="translated">Spécificateur en double.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeConflict6"> <source>{0} '{1}' and {2} '{3}' conflict in {4} '{5}'.</source> <target state="translated">{0} '{1}' et {2} '{3}' sont en conflit dans {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedTypeKeyword"> <source>Keyword does not name a type.</source> <target state="translated">Le mot clé ne désigne pas un type.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtraSpecifiers"> <source>Specifiers valid only at the beginning of a declaration.</source> <target state="translated">Les spécificateurs sont valides uniquement au début d'une déclaration.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedType"> <source>Type expected.</source> <target state="translated">Type attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUseOfKeyword"> <source>Keyword is not valid as an identifier.</source> <target state="translated">Mot clé non valide en tant qu'identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndEnum"> <source>'End Enum' must be preceded by a matching 'Enum'.</source> <target state="translated">'End Enum' doit être précédé d'un 'Enum' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndEnum"> <source>'Enum' must end with a matching 'End Enum'.</source> <target state="translated">'Enum' doit se terminer par un 'End Enum' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDeclaration"> <source>Declaration expected.</source> <target state="translated">Déclaration attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayMustBeLast"> <source>End of parameter list expected. Cannot define parameters after a paramarray parameter.</source> <target state="translated">Fin de liste de paramètres attendue. Impossible de définir des paramètres après un paramètre paramarray.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecifiersInvalidOnInheritsImplOpt"> <source>Specifiers and attributes are not valid on this statement.</source> <target state="translated">Les spécificateurs et les attributs ne sont pas valides pour cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSpecifier"> <source>Expected one of 'Dim', 'Const', 'Public', 'Private', 'Protected', 'Friend', 'Shadows', 'ReadOnly' or 'Shared'.</source> <target state="translated">Dim', 'Const', 'Public', 'Private', 'Protected', 'Friend', 'Shadows', 'ReadOnly' ou 'Shared' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedComma"> <source>Comma expected.</source> <target state="translated">Virgule attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAs"> <source>'As' expected.</source> <target state="translated">'As' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRparen"> <source>')' expected.</source> <target state="translated">')' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLparen"> <source>'(' expected.</source> <target state="translated">'(' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNewInType"> <source>'New' is not valid in this context.</source> <target state="translated">'New' n'est pas valide dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedExpression"> <source>Expression expected.</source> <target state="translated">Expression attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOptional"> <source>'Optional' expected.</source> <target state="translated">'Optional' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIdentifier"> <source>Identifier expected.</source> <target state="translated">Identificateur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIntLiteral"> <source>Integer constant expected.</source> <target state="translated">Constante Integer attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEOS"> <source>End of statement expected.</source> <target state="translated">Fin d'instruction attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedForOptionStmt"> <source>'Option' must be followed by 'Compare', 'Explicit', 'Infer', or 'Strict'.</source> <target state="translated">'Option' doit être suivi de 'Compare', 'Explicit', 'Infer' ou 'Strict'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionCompare"> <source>'Option Compare' must be followed by 'Text' or 'Binary'.</source> <target state="translated">'Option Compare' doit être suivi de 'Text' ou 'Binary'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOptionCompare"> <source>'Compare' expected.</source> <target state="translated">'Compare' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowImplicitObject"> <source>Option Strict On requires all variable declarations to have an 'As' clause.</source> <target state="translated">Toutes les déclarations de variable de Option Strict On requièrent une clause 'As'.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsImplicitProc"> <source>Option Strict On requires all Function, Property, and Operator declarations to have an 'As' clause.</source> <target state="translated">Toutes les déclarations Function, Property et Operator de Option Strict On requièrent une clause 'As'.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsImplicitArgs"> <source>Option Strict On requires that all method parameters have an 'As' clause.</source> <target state="translated">Tous les paramètres de méthode de Option Strict On requièrent une clause 'As'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidParameterSyntax"> <source>Comma or ')' expected.</source> <target state="translated">Virgule ou ')' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSubFunction"> <source>'Sub' or 'Function' expected.</source> <target state="translated">'Sub' ou 'Function' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedStringLiteral"> <source>String constant expected.</source> <target state="translated">Constante de chaîne attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingLibInDeclare"> <source>'Lib' expected.</source> <target state="translated">'Lib' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateNoInvoke1"> <source>Delegate class '{0}' has no Invoke method, so an expression of this type cannot be the target of a method call.</source> <target state="translated">La classe déléguée '{0}' n'a pas de méthode Invoke, c'est pourquoi une expression de ce type ne peut pas être la cible d'un appel de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingIsInTypeOf"> <source>'Is' expected.</source> <target state="translated">'Is' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateOption1"> <source>'Option {0}' statement can only appear once per file.</source> <target state="translated">'Une instruction 'Option {0}' ne peut apparaître qu'une seule fois par fichier.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantInherit"> <source>'Inherits' not valid in Modules.</source> <target state="translated">'Inherits' n'est pas valide dans les modules.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantImplement"> <source>'Implements' not valid in Modules.</source> <target state="translated">'Implements' n'est pas valide dans les modules.</target> <note /> </trans-unit> <trans-unit id="ERR_BadImplementsType"> <source>Implemented type must be an interface.</source> <target state="translated">Le type implémenté doit être une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstFlags1"> <source>'{0}' is not valid on a constant declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de constante.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWithEventsFlags1"> <source>'{0}' is not valid on a WithEvents declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration WithEvents.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDimFlags1"> <source>'{0}' is not valid on a member variable declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de variable membre.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParamName1"> <source>Parameter already declared with name '{0}'.</source> <target state="translated">Paramètre déjà déclaré avec le nom '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopDoubleCondition"> <source>'Loop' cannot have a condition if matching 'Do' has one.</source> <target state="translated">'Loop' ne peut pas avoir de condition si le 'Do' correspondant en a une.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRelational"> <source>Relational operator expected.</source> <target state="translated">Opérateur relationnel attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedExitKind"> <source>'Exit' must be followed by 'Sub', 'Function', 'Property', 'Do', 'For', 'While', 'Select', or 'Try'.</source> <target state="translated">'Exit' doit être suivi de 'Sub', 'Function', 'Property', 'Do', 'For', 'While', 'Select' ou 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNamedArgumentInAttributeList"> <source>Named argument expected.</source> <target state="translated">Argument nommé attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentSpecificationBeforeFixedArgumentInLateboundInvocation"> <source>Named argument specifications must appear after all fixed arguments have been specified in a late bound invocation.</source> <target state="translated">Les spécifications d'argument nommé doivent s'afficher après la spécification de tous les arguments fixes dans un appel avec liaison tardive.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNamedArgument"> <source>Named argument expected. Please use language version {0} or greater to use non-trailing named arguments.</source> <target state="translated">Argument nommé attendu. Utilisez la version de langage {0} ou une version ultérieure pour permettre l'emploi d'arguments nommés non placés en position de fin.</target> <note /> </trans-unit> <trans-unit id="ERR_BadMethodFlags1"> <source>'{0}' is not valid on a method declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEventFlags1"> <source>'{0}' is not valid on an event declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration event.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDeclareFlags1"> <source>'{0}' is not valid on a Declare.</source> <target state="translated">'{0}' n'est pas valide dans un Declare.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLocalConstFlags1"> <source>'{0}' is not valid on a local constant declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de constante locale.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLocalDimFlags1"> <source>'{0}' is not valid on a local variable declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de variable locale.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedConditionalDirective"> <source>'If', 'ElseIf', 'Else', 'Const', 'Region', 'ExternalSource', 'ExternalChecksum', 'Enable', 'Disable', 'End' or 'R' expected.</source> <target state="translated">'If', 'ElseIf', 'Else', 'Const', 'Region', 'ExternalSource', 'ExternalChecksum', 'Enable', 'Disable', 'End' ou 'R' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEQ"> <source>'=' expected.</source> <target state="translated">'=' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorNotFound1"> <source>Type '{0}' has no constructors.</source> <target state="translated">Le type '{0}' n'a aucun constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndInterface"> <source>'End Interface' must be preceded by a matching 'Interface'.</source> <target state="translated">'End Interface' doit être précédé d'un 'Interface' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndInterface"> <source>'Interface' must end with a matching 'End Interface'.</source> <target state="translated">'Interface' doit se terminer par un 'End Interface' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFrom2"> <source> '{0}' inherits from '{1}'.</source> <target state="translated"> '{0}' hérite de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNestedIn2"> <source> '{0}' is nested in '{1}'.</source> <target state="translated"> '{0}' est imbriqué dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceCycle1"> <source>Class '{0}' cannot inherit from itself: {1}</source> <target state="translated">La classe '{0}' ne peut pas hériter d'elle-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromNonClass"> <source>Classes can inherit only from other classes.</source> <target state="translated">Les classes ne peuvent hériter que d'autres classes.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefinedType3"> <source>'{0}' is already declared as '{1}' in this {2}.</source> <target state="translated">'{0}' est déjà déclaré en tant que '{1}' dans ce {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadOverrideAccess2"> <source>'{0}' cannot override '{1}' because they have different access levels.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car elles ont des niveaux d'accès différents.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNotOverridable2"> <source>'{0}' cannot override '{1}' because it is declared 'NotOverridable'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car il est déclaré 'NotOverridable'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateProcDef1"> <source>'{0}' has multiple definitions with identical signatures.</source> <target state="translated">'{0}' a plusieurs définitions comportant des signatures identiques.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateProcDefWithDifferentTupleNames2"> <source>'{0}' has multiple definitions with identical signatures with different tuple element names, including '{1}'.</source> <target state="translated">'{0}' a plusieurs définitions comportant des signatures identiques avec des noms d'éléments tuples différents, notamment '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceMethodFlags1"> <source>'{0}' is not valid on an interface method declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de méthode d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound2"> <source>'{0}' is not a parameter of '{1}'.</source> <target state="translated">'{0}' n'est pas un paramètre de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfacePropertyFlags1"> <source>'{0}' is not valid on an interface property declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration de propriété d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice2"> <source>Parameter '{0}' of '{1}' already has a matching argument.</source> <target state="translated">Le paramètre '{0}' de '{1}' a déjà un argument correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceCantUseEventSpecifier1"> <source>'{0}' is not valid on an interface event declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration event d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_TypecharNoMatch2"> <source>Type character '{0}' does not match declared data type '{1}'.</source> <target state="translated">Le caractère de type '{0}' ne correspond pas au type de données déclaré '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSubOrFunction"> <source>'Sub' or 'Function' expected after 'Delegate'.</source> <target state="translated">'Sub' ou 'Function' attendu après 'Delegate'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmptyEnum1"> <source>Enum '{0}' must contain at least one member.</source> <target state="translated">Enum '{0}' doit contenir au moins un membre.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidConstructorCall"> <source>Constructor call is valid only as the first statement in an instance constructor.</source> <target state="translated">Un appel à un constructeur est valide uniquement en tant que première instruction dans un constructeur d'instance.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideConstructor"> <source>'Sub New' cannot be declared 'Overrides'.</source> <target state="translated">'Sub New' ne peut pas être déclaré 'Overrides'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorCannotBeDeclaredPartial"> <source>'Sub New' cannot be declared 'Partial'.</source> <target state="translated">'Sub New' ne peut pas être déclaré 'Partial'.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleEmitFailure"> <source>Failed to emit module '{0}': {1}</source> <target state="translated">Échec de l'émission du module '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_EncUpdateFailedMissingAttribute"> <source>Cannot update '{0}'; attribute '{1}' is missing.</source> <target state="translated">Impossible de mettre à jour '{0}' ; l'attribut '{1}' est manquant.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideNotNeeded3"> <source>{0} '{1}' cannot be declared 'Overrides' because it does not override a {0} in a base class.</source> <target state="translated">{0} '{1}' ne peut pas être déclaré 'Overrides', car il ne se substitue pas à un {0} dans une classe de base.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDot"> <source>'.' expected.</source> <target state="translated">'.' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocals1"> <source>Local variable '{0}' is already declared in the current block.</source> <target state="translated">La variable locale '{0}' est déjà déclarée dans le bloc actuel.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsProc"> <source>Statement cannot appear within a method body. End of method assumed.</source> <target state="translated">Cette instruction ne peut pas apparaître dans le corps de méthode. Elle est interprétée comme la fin de la méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalSameAsFunc"> <source>Local variable cannot have the same name as the function containing it.</source> <target state="translated">Une variable locale ne peut pas avoir le même nom que la fonction qui la contient.</target> <note /> </trans-unit> <trans-unit id="ERR_RecordEmbeds2"> <source> '{0}' contains '{1}' (variable '{2}').</source> <target state="translated"> '{0}' contient '{1}' (variable '{2}').</target> <note /> </trans-unit> <trans-unit id="ERR_RecordCycle2"> <source>Structure '{0}' cannot contain an instance of itself: {1}</source> <target state="translated">La structure '{0}' ne peut pas contenir une instance d'elle-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceCycle1"> <source>Interface '{0}' cannot inherit from itself: {1}</source> <target state="translated">L'interface '{0}' ne peut pas hériter d'elle-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SubNewCycle2"> <source> '{0}' calls '{1}'.</source> <target state="translated"> '{0}' appelle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SubNewCycle1"> <source>Constructor '{0}' cannot call itself: {1}</source> <target state="translated">Le constructeur '{0}' ne peut pas s'appeler lui-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromCantInherit3"> <source>'{0}' cannot inherit from {2} '{1}' because '{1}' is declared 'NotInheritable'.</source> <target state="translated">'{0}' ne peut pas hériter de {2} '{1}', car '{1}' est déclaré 'NotInheritable'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithOptional2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by optional parameters.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seuls les paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithReturnType2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by return types.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seuls les types de retour les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharWithType1"> <source>Type character '{0}' cannot be used in a declaration with an explicit type.</source> <target state="translated">Le caractère de type '{0}' ne peut pas être utilisé dans une déclaration avec un type explicite.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnSub"> <source>Type character cannot be used in a 'Sub' declaration because a 'Sub' doesn't return a value.</source> <target state="translated">Un caractère de type ne peut pas être utilisé dans une déclaration 'Sub', car un 'Sub' ne retourne pas de valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithDefault2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by the default values of optional parameters.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seules les valeurs par défaut des paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingSubscript"> <source>Array subscript expression missing.</source> <target state="translated">Expression d'indice de tableau manquante.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithDefault2"> <source>'{0}' cannot override '{1}' because they differ by the default values of optional parameters.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car seules les valeurs par défaut des paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithOptional2"> <source>'{0}' cannot override '{1}' because they differ by optional parameters.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car les paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldOfValueFieldOfMarshalByRef3"> <source>Cannot refer to '{0}' because it is a member of the value-typed field '{1}' of class '{2}' which has 'System.MarshalByRefObject' as a base class.</source> <target state="translated">Impossible de faire référence à '{0}', car il est membre du champ de valeurs '{1}' de la classe '{2}', qui a 'System.MarshalByRefObject' comme classe de base.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMismatch2"> <source>Value of type '{0}' cannot be converted to '{1}'.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseAfterCaseElse"> <source>'Case' cannot follow a 'Case Else' in the same 'Select' statement.</source> <target state="translated">'Case' ne peut pas suivre 'Case Else' dans la même instruction 'Select'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertArrayMismatch4"> <source>Value of type '{0}' cannot be converted to '{1}' because '{2}' is not derived from '{3}'.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}', car '{2}' n'est pas dérivé de '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertObjectArrayMismatch3"> <source>Value of type '{0}' cannot be converted to '{1}' because '{2}' is not a reference type.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}', car '{2}' n'est pas un type référence.</target> <note /> </trans-unit> <trans-unit id="ERR_ForLoopType1"> <source>'For' loop control variable cannot be of type '{0}' because the type does not support the required operators.</source> <target state="translated">'La variable de contrôle de boucle 'For' ne peut pas être de type '{0}', car le type ne prend pas en charge les opérateurs requis.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithByref2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by parameters declared 'ByRef' or 'ByVal'.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seuls les paramètres déclarés 'ByRef' ou 'ByVal' les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromNonInterface"> <source>Interface can inherit only from another interface.</source> <target state="translated">Une interface ne peut hériter que d'une autre interface.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceOrderOnInherits"> <source>'Inherits' statements must precede all declarations in an interface.</source> <target state="translated">'Les instructions 'Inherits' doivent précéder toutes les déclarations dans une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateDefaultProps1"> <source>'Default' can be applied to only one property name in a {0}.</source> <target state="translated">'Default' ne peut être appliqué qu'à un seul nom de propriété dans un {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMissingFromProperty2"> <source>'{0}' and '{1}' cannot overload each other because only one is declared 'Default'.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seul l'un d'entre eux est déclaré 'Default'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverridingPropertyKind2"> <source>'{0}' cannot override '{1}' because they differ by 'ReadOnly' or 'WriteOnly'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car 'ReadOnly' ou 'WriteOnly' les différencie.</target> <note /> </trans-unit> <trans-unit id="ERR_NewInInterface"> <source>'Sub New' cannot be declared in an interface.</source> <target state="translated">'Sub New' ne peut pas être déclaré dans une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnNew1"> <source>'Sub New' cannot be declared '{0}'.</source> <target state="translated">'Sub New' ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadingPropertyKind2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by 'ReadOnly' or 'WriteOnly'.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seul 'ReadOnly' ou 'WriteOnly' les différencie.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDefaultNotExtend1"> <source>Class '{0}' cannot be indexed because it has no default property.</source> <target state="translated">La classe '{0}' ne peut pas être indexée, car elle n'a pas de propriété par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithArrayVsParamArray2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by parameters declared 'ParamArray'.</source> <target state="translated">'{0}' et '{1}' ne peuvent pas se surcharger mutuellement, car seuls les paramètres déclarés 'ParamArray' les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInstanceMemberAccess"> <source>Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.</source> <target state="translated">Impossible de faire référence à un membre instance d'une classe à partir d'une méthode partagée ou d'un initialiseur de membre partagé sans une instance explicite de la classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRbrace"> <source>'}' expected.</source> <target state="translated">'}' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleAsType1"> <source>Module '{0}' cannot be used as a type.</source> <target state="translated">Le module '{0}' ne peut pas être utilisé en tant que type.</target> <note /> </trans-unit> <trans-unit id="ERR_NewIfNullOnNonClass"> <source>'New' cannot be used on an interface.</source> <target state="translated">'Impossible d'utiliser 'New' pour une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchAfterFinally"> <source>'Catch' cannot appear after 'Finally' within a 'Try' statement.</source> <target state="translated">'Catch' ne peut pas apparaître après 'Finally' dans une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchNoMatchingTry"> <source>'Catch' cannot appear outside a 'Try' statement.</source> <target state="translated">'Catch' ne peut pas apparaître en dehors d'une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_FinallyAfterFinally"> <source>'Finally' can only appear once in a 'Try' statement.</source> <target state="translated">'Finally' ne peut apparaître qu'une seule fois dans une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_FinallyNoMatchingTry"> <source>'Finally' cannot appear outside a 'Try' statement.</source> <target state="translated">'Finally' ne peut pas apparaître en dehors d'une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndTryNoTry"> <source>'End Try' must be preceded by a matching 'Try'.</source> <target state="translated">'End Try' doit être précédé d'un 'Try' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndTry"> <source>'Try' must end with a matching 'End Try'.</source> <target state="translated">'Try' doit se terminer par un 'End Try' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelegateFlags1"> <source>'{0}' is not valid on a Delegate declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration Delegate.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstructorOnBase2"> <source>Class '{0}' must declare a 'Sub New' because its base class '{1}' does not have an accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car sa classe de base '{1}' n'a pas de 'Sub New' accessible qu'il est possible d'appeler sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleSymbol2"> <source>'{0}' is not accessible in this context because it is '{1}'.</source> <target state="translated">'{0}' n'est pas accessible dans ce contexte, car il est '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleMember3"> <source>'{0}.{1}' is not accessible in this context because it is '{2}'.</source> <target state="translated">'{0}.{1}' n'est pas accessible dans ce contexte, car il est '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchNotException1"> <source>'Catch' cannot catch type '{0}' because it is not 'System.Exception' or a class that inherits from 'System.Exception'.</source> <target state="translated">'Catch' ne peut pas intercepter le type '{0}', car il n'est pas 'System.Exception' ou une classe qui hérite de 'System.Exception'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitTryNotWithinTry"> <source>'Exit Try' can only appear inside a 'Try' statement.</source> <target state="translated">'Exit Try' ne peut apparaître qu'à l'intérieur d'une instruction 'Try'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadRecordFlags1"> <source>'{0}' is not valid on a Structure declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEnumFlags1"> <source>'{0}' is not valid on an Enum declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration Enum.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceFlags1"> <source>'{0}' is not valid on an Interface declaration.</source> <target state="translated">'{0}' n'est pas valide dans une déclaration Interface.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithByref2"> <source>'{0}' cannot override '{1}' because they differ by a parameter that is marked as 'ByRef' versus 'ByVal'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car un paramètre marqué comme 'ByRef' pour l'une et 'ByVal' pour l'autre les différencie.</target> <note /> </trans-unit> <trans-unit id="ERR_MyBaseAbstractCall1"> <source>'MyBase' cannot be used with method '{0}' because it is declared 'MustOverride'.</source> <target state="translated">'MyBase' ne peut pas être utilisé avec la méthode '{0}', car il est déclaré 'MustOverride'.</target> <note /> </trans-unit> <trans-unit id="ERR_IdentNotMemberOfInterface4"> <source>'{0}' cannot implement '{1}' because there is no matching {2} on interface '{3}'.</source> <target state="translated">'{0}' ne peut pas implémenter '{1}', car il n'existe pas de {2} correspondant pour l'interface '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementingInterfaceWithDifferentTupleNames5"> <source>'{0}' cannot implement {1} '{2}' on interface '{3}' because the tuple element names in '{4}' do not match those in '{5}'.</source> <target state="translated">'{0}' ne peut pas implémenter {1} '{2}' sur l'interface '{3}', car les noms d'éléments tuples dans '{4}' ne correspondent pas à ceux dans '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_WithEventsRequiresClass"> <source>'WithEvents' variables must have an 'As' clause.</source> <target state="translated">'Les variables 'WithEvents' doivent comporter une clause 'As'.</target> <note /> </trans-unit> <trans-unit id="ERR_WithEventsAsStruct"> <source>'WithEvents' variables can only be typed as classes, interfaces or type parameters with class constraints.</source> <target state="translated">'Les variables 'WithEvents' peuvent seulement être de type classe, interface ou paramètre de type avec des contraintes de classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertArrayRankMismatch2"> <source>Value of type '{0}' cannot be converted to '{1}' because the array types have different numbers of dimensions.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}', car les types tableau ont des nombres de dimensions différents.</target> <note /> </trans-unit> <trans-unit id="ERR_RedimRankMismatch"> <source>'ReDim' cannot change the number of dimensions of an array.</source> <target state="translated">'ReDim' ne peut pas changer le nombre de dimensions d'un tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_StartupCodeNotFound1"> <source>'Sub Main' was not found in '{0}'.</source> <target state="translated">'Sub Main' est introuvable dans '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstAsNonConstant"> <source>Constants must be of an intrinsic or enumerated type, not a class, structure, type parameter, or array type.</source> <target state="translated">Les constantes doivent être de type intrinsèque ou énuméré, et non de type classe, structure, paramètre de type ou tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndSub"> <source>'End Sub' must be preceded by a matching 'Sub'.</source> <target state="translated">'End Sub' doit être précédé d'un 'Sub' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndFunction"> <source>'End Function' must be preceded by a matching 'Function'.</source> <target state="translated">'End Function' doit être précédé d'un 'Function' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndProperty"> <source>'End Property' must be preceded by a matching 'Property'.</source> <target state="translated">'End Property' doit être précédé d'un 'Property' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseMethodSpecifier1"> <source>Methods in a Module cannot be declared '{0}'.</source> <target state="translated">Les méthodes d'un module ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseEventSpecifier1"> <source>Events in a Module cannot be declared '{0}'.</source> <target state="translated">Les événements d'un module ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantUseVarSpecifier1"> <source>Members in a Structure cannot be declared '{0}'.</source> <target state="translated">Les membres d'une structure ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOverrideDueToReturn2"> <source>'{0}' cannot override '{1}' because they differ by their return types.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car leurs types de retour ne sont pas identiques.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidOverrideDueToTupleNames2"> <source>'{0}' cannot override '{1}' because they differ by their tuple element names.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}' car leurs noms d'éléments tuples sont différents.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidOverrideDueToTupleNames2_Title"> <source>Member cannot override because it differs by its tuple element names.</source> <target state="translated">Le membre ne peut pas procéder à la substitution car ses noms d'éléments tuples sont différents.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantWithNoValue"> <source>Constants must have a value.</source> <target state="translated">Les constantes doivent avoir une valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionOverflow1"> <source>Constant expression not representable in type '{0}'.</source> <target state="translated">L'expression constante n'est pas représentable dans le type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertyGet"> <source>'Get' is already declared.</source> <target state="translated">'Get' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertySet"> <source>'Set' is already declared.</source> <target state="translated">'Set' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotDeclared1"> <source>'{0}' is not declared. It may be inaccessible due to its protection level.</source> <target state="translated">'{0}' n'est pas déclaré. Il peut être inaccessible en raison de son niveau de protection.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryOperands3"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'.</source> <target state="translated">L'opérateur '{0}' n'est pas défini pour les types '{1}' et '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedProcedure"> <source>Expression is not a method.</source> <target state="translated">L'expression n'est pas une méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument2"> <source>Argument not specified for parameter '{0}' of '{1}'.</source> <target state="translated">Argument non spécifié pour le paramètre '{0}' de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotMember2"> <source>'{0}' is not a member of '{1}'.</source> <target state="translated">'{0}' n'est pas un membre de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndClassNoClass"> <source>'End Class' must be preceded by a matching 'Class'.</source> <target state="translated">'End Class' doit être précédé d'un 'Class' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_BadClassFlags1"> <source>Classes cannot be declared '{0}'.</source> <target state="translated">Les classes ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportsMustBeFirst"> <source>'Imports' statements must precede any declarations.</source> <target state="translated">'Des instructions 'Imports' doivent précéder toutes les déclarations.</target> <note /> </trans-unit> <trans-unit id="ERR_NonNamespaceOrClassOnImport2"> <source>'{1}' for the Imports '{0}' does not refer to a Namespace, Class, Structure, Enum or Module.</source> <target state="translated">'{1}' pour les Imports '{0}' ne fait pas référence à un Namespace, Class, Structure, Enum ou Module.</target> <note /> </trans-unit> <trans-unit id="ERR_TypecharNotallowed"> <source>Type declaration characters are not valid in this context.</source> <target state="translated">Les caractères de déclaration de type ne sont pas valides dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectReferenceNotSupplied"> <source>Reference to a non-shared member requires an object reference.</source> <target state="translated">Une référence à un membre non partagé requiert une référence d'objet.</target> <note /> </trans-unit> <trans-unit id="ERR_MyClassNotInClass"> <source>'MyClass' cannot be used outside of a class.</source> <target state="translated">'MyClass' ne peut pas être utilisé à l'extérieur d'une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_IndexedNotArrayOrProc"> <source>Expression is not an array or a method, and cannot have an argument list.</source> <target state="translated">L'expression n'est pas un tableau ni une méthode et ne peut pas avoir de liste d'arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_EventSourceIsArray"> <source>'WithEvents' variables cannot be typed as arrays.</source> <target state="translated">'Les variables 'WithEvents' ne peuvent pas être de type tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedConstructorWithParams"> <source>Shared 'Sub New' cannot have any parameters.</source> <target state="translated">Un 'Sub New' partagé ne peut pas avoir de paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedConstructorIllegalSpec1"> <source>Shared 'Sub New' cannot be declared '{0}'.</source> <target state="translated">Un 'Sub New' partagé ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndClass"> <source>'Class' statement must end with a matching 'End Class'.</source> <target state="translated">'Une instruction 'Class' doit se terminer par un 'End Class' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_UnaryOperand2"> <source>Operator '{0}' is not defined for type '{1}'.</source> <target state="translated">L'opérateur '{0}' n'est pas défini pour le type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsWithDefault1"> <source>'Default' cannot be combined with '{0}'.</source> <target state="translated">'Default' ne peut pas être combiné avec '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidValue"> <source>Expression does not produce a value.</source> <target state="translated">Cette expression ne produit pas de valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorFunction"> <source>Constructor must be declared as a Sub, not as a Function.</source> <target state="translated">Le constructeur doit être déclaré en tant que Sub, et non Function.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLiteralExponent"> <source>Exponent is not valid.</source> <target state="translated">Exposant non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_NewCannotHandleEvents"> <source>'Sub New' cannot handle events.</source> <target state="translated">'Sub New' ne peut pas gérer d'événements.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularEvaluation1"> <source>Constant '{0}' cannot depend on its own value.</source> <target state="translated">La constante '{0}' ne peut pas dépendre de sa propre valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnSharedMeth1"> <source>'Shared' cannot be combined with '{0}' on a method declaration.</source> <target state="translated">'Shared' ne peut pas être combiné avec '{0}' pour une déclaration de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnSharedProperty1"> <source>'Shared' cannot be combined with '{0}' on a property declaration.</source> <target state="translated">'Shared' ne peut pas être combiné avec '{0}' pour une déclaration de propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnStdModuleProperty1"> <source>Properties in a Module cannot be declared '{0}'.</source> <target state="translated">Les propriétés d'un module ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedOnProcThatImpl"> <source>Methods or events that implement interface members cannot be declared 'Shared'.</source> <target state="translated">Les méthodes ou événements qui implémentent des membres d'interface ne peuvent pas être déclarés 'Shared'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoWithEventsVarOnHandlesList"> <source>Handles clause requires a WithEvents variable defined in the containing type or one of its base types.</source> <target state="translated">La clause Handles requiert une variable WithEvents définie dans le type conteneur ou l'un de ses types de base.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceAccessMismatch5"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of the base {1} to {3} '{4}'.</source> <target state="translated">'{0}' ne peut pas hériter de {1} '{2}', car il étend l'accès du {1} de base à {3} '{4}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NarrowingConversionDisallowed2"> <source>Option Strict On disallows implicit conversions from '{0}' to '{1}'.</source> <target state="translated">Option Strict On interdit les conversions implicites de '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoArgumentCountOverloadCandidates1"> <source>Overload resolution failed because no accessible '{0}' accepts this number of arguments.</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible n'accepte ce nombre d'arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_NoViableOverloadCandidates1"> <source>Overload resolution failed because no '{0}' is accessible.</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' n'est accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_NoCallableOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called with these arguments:{1}</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible ne peut être appelé avec ces arguments : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called:{1}</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible ne peut être appelé : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonNarrowingOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called without a narrowing conversion:{1}</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible ne peut être appelé sans conversion restrictive : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNarrowing3"> <source>Argument matching parameter '{0}' narrows from '{1}' to '{2}'.</source> <target state="translated">Le paramètre de correspondance d'arguments '{0}' passe de '{1}' à '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoMostSpecificOverload2"> <source>Overload resolution failed because no accessible '{0}' is most specific for these arguments:{1}</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible n'est plus spécifique pour ces arguments : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NotMostSpecificOverload"> <source>Not most specific.</source> <target state="translated">Pas plus spécifique.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadCandidate2"> <source> '{0}': {1}</source> <target state="translated"> '{0}': {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NoGetProperty1"> <source>Property '{0}' is 'WriteOnly'.</source> <target state="translated">La propriété '{0}' est 'WriteOnly'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSetProperty1"> <source>Property '{0}' is 'ReadOnly'.</source> <target state="translated">La propriété '{0}' est 'ReadOnly'.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamTypingInconsistency"> <source>All parameters must be explicitly typed if any of them are explicitly typed.</source> <target state="translated">Tous les paramètres doivent être explicitement typés, si l'un d'eux est explicitement typé.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamNameFunctionNameCollision"> <source>Parameter cannot have the same name as its defining function.</source> <target state="translated">Un paramètre ne peut pas avoir le même nom que sa fonction de définition.</target> <note /> </trans-unit> <trans-unit id="ERR_DateToDoubleConversion"> <source>Conversion from 'Date' to 'Double' requires calling the 'Date.ToOADate' method.</source> <target state="translated">Pour convertir 'Date' en 'Double', vous devez appeler la méthode 'Date.ToOADate'.</target> <note /> </trans-unit> <trans-unit id="ERR_DoubleToDateConversion"> <source>Conversion from 'Double' to 'Date' requires calling the 'Date.FromOADate' method.</source> <target state="translated">Pour convertir 'Double' en 'Date', vous devez appeler la méthode 'Date.FromOADate'.</target> <note /> </trans-unit> <trans-unit id="ERR_ZeroDivide"> <source>Division by zero occurred while evaluating this expression.</source> <target state="translated">Une division par zéro s'est produite lors de l'évaluation de cette expression.</target> <note /> </trans-unit> <trans-unit id="ERR_TryAndOnErrorDoNotMix"> <source>Method cannot contain both a 'Try' statement and an 'On Error' or 'Resume' statement.</source> <target state="translated">Une méthode ne peut pas contenir à la fois une instruction 'Try' et une instruction 'On Error' ou 'Resume'.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyAccessIgnored"> <source>Property access must assign to the property or use its value.</source> <target state="translated">Un accès à la propriété doit assigner la propriété ou utiliser sa valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNoDefault1"> <source>'{0}' cannot be indexed because it has no default property.</source> <target state="translated">'{0}' ne peut pas être indexé, car il n'a pas de propriété par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyAttribute1"> <source>Attribute '{0}' cannot be applied to an assembly.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à un assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidModuleAttribute1"> <source>Attribute '{0}' cannot be applied to a module.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à un module.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInUnnamedNamespace1"> <source>'{0}' is ambiguous.</source> <target state="translated">'{0}' est ambigu.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMemberNotProperty1"> <source>Default member of '{0}' is not a property.</source> <target state="translated">Le membre '{0}' par défaut n'est pas une propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInNamespace2"> <source>'{0}' is ambiguous in the namespace '{1}'.</source> <target state="translated">'{0}' est ambigu dans l'espace de noms '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInImports2"> <source>'{0}' is ambiguous, imported from the namespaces or types '{1}'.</source> <target state="translated">'{0}' est ambigu, importé des espaces de noms ou des types '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInModules2"> <source>'{0}' is ambiguous between declarations in Modules '{1}'.</source> <target state="translated">'{0}' est ambigu entre les déclarations des modules '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInNamespaces2"> <source>'{0}' is ambiguous between declarations in namespaces '{1}'.</source> <target state="translated">'{0}' est ambigu entre les déclarations dans les espaces de noms '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerTooFewDimensions"> <source>Array initializer has too few dimensions.</source> <target state="translated">L'initialiseur de tableau n'utilise pas suffisamment de dimensions.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerTooManyDimensions"> <source>Array initializer has too many dimensions.</source> <target state="translated">L'initialiseur de tableau utilise trop de dimensions.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerTooFewElements1"> <source>Array initializer is missing {0} elements.</source> <target state="translated">Il manque {0} éléments à l'initialiseur de tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerTooManyElements1"> <source>Array initializer has {0} too many elements.</source> <target state="translated">L'initialiseur de tableau utilise {0} élément(s) de trop.</target> <note /> </trans-unit> <trans-unit id="ERR_NewOnAbstractClass"> <source>'New' cannot be used on a class that is declared 'MustInherit'.</source> <target state="translated">'New' ne peut pas être utilisé dans une classe déclarée 'MustInherit'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNamedImportAlias1"> <source>Alias '{0}' is already declared.</source> <target state="translated">L'alias '{0}' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePrefix"> <source>XML namespace prefix '{0}' is already declared.</source> <target state="translated">Le préfixe de l'espace de noms XML '{0}' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsLateBinding"> <source>Option Strict On disallows late binding.</source> <target state="translated">Option Strict On rejette toute liaison tardive.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfOperandNotMethod"> <source>'AddressOf' operand must be the name of a method (without parentheses).</source> <target state="translated">'L'opérande 'AddressOf' doit être le nom d'une méthode (sans parenthèses).</target> <note /> </trans-unit> <trans-unit id="ERR_EndExternalSource"> <source>'#End ExternalSource' must be preceded by a matching '#ExternalSource'.</source> <target state="translated">'#End ExternalSource' doit être précédé d'un '#ExternalSource' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndExternalSource"> <source>'#ExternalSource' statement must end with a matching '#End ExternalSource'.</source> <target state="translated">'L'instruction '#ExternalSource' doit se terminer par un '#End ExternalSource' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedExternalSource"> <source>'#ExternalSource' directives cannot be nested.</source> <target state="translated">'Les directives '#ExternalSource' ne peuvent pas être imbriquées.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNotDelegate1"> <source>'AddressOf' expression cannot be converted to '{0}' because '{0}' is not a delegate type.</source> <target state="translated">'Une expression 'AddressOf' ne peut pas être convertie en '{0}', car '{0}' n'est pas un type délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_SyncLockRequiresReferenceType1"> <source>'SyncLock' operand cannot be of type '{0}' because '{0}' is not a reference type.</source> <target state="translated">'L'opérande 'SyncLock' ne peut pas être de type '{0}', car '{0}' n'est pas un type référence.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodAlreadyImplemented2"> <source>'{0}.{1}' cannot be implemented more than once.</source> <target state="translated">'{0}.{1}' ne peut pas être implémenté plus d'une fois.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInInherits1"> <source>'{0}' cannot be inherited more than once.</source> <target state="translated">'{0}' ne peut pas être hérité plus d'une fois.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamArrayArgument"> <source>Named argument cannot match a ParamArray parameter.</source> <target state="translated">L'argument nommé ne peut pas correspondre à un paramètre ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedParamArrayArgument"> <source>Omitted argument cannot match a ParamArray parameter.</source> <target state="translated">L'argument omis ne peut pas correspondre à un paramètre ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayArgumentMismatch"> <source>Argument cannot match a ParamArray parameter.</source> <target state="translated">L'argument ne peut pas correspondre à un paramètre ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_EventNotFound1"> <source>Event '{0}' cannot be found.</source> <target state="translated">L'événement '{0}' est introuvable.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseVariableSpecifier1"> <source>Variables in Modules cannot be declared '{0}'.</source> <target state="translated">Les variables des modules ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedEventNeedsSharedHandler"> <source>Events of shared WithEvents variables cannot be handled by non-shared methods.</source> <target state="translated">Les événements des variables WithEvents partagées ne peuvent pas être gérés par des méthodes non partagées.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedMinus"> <source>'-' expected.</source> <target state="translated">'-' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceMemberSyntax"> <source>Interface members must be methods, properties, events, or type definitions.</source> <target state="translated">Les membres d'interface doivent être des méthodes, des propriétés, des événements ou des définitions de types.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideInterface"> <source>Statement cannot appear within an interface body.</source> <target state="translated">L'instruction ne peut pas apparaître dans le corps d'une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsInterface"> <source>Statement cannot appear within an interface body. End of interface assumed.</source> <target state="translated">L'instruction ne peut pas apparaître dans le corps d'une interface. Elle est interprétée comme la fin de l'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsInNotInheritableClass1"> <source>'NotInheritable' classes cannot have members declared '{0}'.</source> <target state="translated">'Les classes 'NotInheritable' ne peuvent pas avoir de membres déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseOnlyClassesMustBeExplicit2"> <source>Class '{0}' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): {1}.</source> <target state="translated">La classe '{0}' doit être déclarée 'MustInherit' ou se substituer aux membres 'MustOverride' hérités suivants : {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_MustInheritEventNotOverridden"> <source>'{0}' is a MustOverride event in the base class '{1}'. Visual Basic does not support event overriding. You must either provide an implementation for the event in the base class, or make class '{2}' MustInherit.</source> <target state="translated">'{0}' est un événement MustOverride dans la classe de base '{1}'. Visual Basic ne prend pas en charge pas la surcharge des événements. Vous devez fournir une implémentation pour l'événement dans la classe de base ou bien rendre la classe '{2}' MustInherit.</target> <note /> </trans-unit> <trans-unit id="ERR_NegativeArraySize"> <source>Array dimensions cannot have a negative size.</source> <target state="translated">Les dimensions d'un tableau ne peuvent pas être de taille négative.</target> <note /> </trans-unit> <trans-unit id="ERR_MyClassAbstractCall1"> <source>'MustOverride' method '{0}' cannot be called with 'MyClass'.</source> <target state="translated">'La méthode 'MustOverride' '{0}' ne peut pas être appelée par 'MyClass'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndDisallowedInDllProjects"> <source>'End' statement cannot be used in class library projects.</source> <target state="translated">'L'instruction 'End' ne peut pas être utilisée dans les projets de bibliothèque de classes.</target> <note /> </trans-unit> <trans-unit id="ERR_BlockLocalShadowing1"> <source>Variable '{0}' hides a variable in an enclosing block.</source> <target state="translated">La variable '{0}' masque une variable dans un bloc englobant.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleNotAtNamespace"> <source>'Module' statements can occur only at file or namespace level.</source> <target state="translated">'Les instructions 'Module' ne peuvent intervenir qu'au niveau du fichier ou de l'espace de noms.</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAtNamespace"> <source>'Namespace' statements can occur only at file or namespace level.</source> <target state="translated">'Les instructions 'Namespace' ne peuvent intervenir qu'au niveau du fichier ou de l'espace de noms.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEnum"> <source>Statement cannot appear within an Enum body.</source> <target state="translated">L'instruction ne peut pas apparaître dans le corps d'un Enum.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsEnum"> <source>Statement cannot appear within an Enum body. End of Enum assumed.</source> <target state="translated">Cette instruction ne peut pas apparaître dans le corps d'un Enum. Elle est interprétée comme la fin de l'Enum.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionStrict"> <source>'Option Strict' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Option Strict' ne peut être suivi que de 'On' ou 'Off'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndStructureNoStructure"> <source>'End Structure' must be preceded by a matching 'Structure'.</source> <target state="translated">'End Structure' doit être précédé d'un 'Structure' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndModuleNoModule"> <source>'End Module' must be preceded by a matching 'Module'.</source> <target state="translated">'End Module' doit être précédé d'un 'Module' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_EndNamespaceNoNamespace"> <source>'End Namespace' must be preceded by a matching 'Namespace'.</source> <target state="translated">'End Namespace' doit être précédé d'un 'Namespace' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndStructure"> <source>'Structure' statement must end with a matching 'End Structure'.</source> <target state="translated">'L'instruction 'Structure' doit se terminer par un 'End Structure' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndModule"> <source>'Module' statement must end with a matching 'End Module'.</source> <target state="translated">'L'instruction 'Module' doit se terminer par un 'End Module' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndNamespace"> <source>'Namespace' statement must end with a matching 'End Namespace'.</source> <target state="translated">'L'instruction 'Namespace' doit se terminer par un 'End Namespace' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionStmtWrongOrder"> <source>'Option' statements must precede any declarations or 'Imports' statements.</source> <target state="translated">'Toutes les déclarations et instructions 'Imports' doivent être précédées d'instructions 'Option'.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantInherit"> <source>Structures cannot have 'Inherits' statements.</source> <target state="translated">Les structures ne peuvent pas utiliser d'instructions 'Inherits'.</target> <note /> </trans-unit> <trans-unit id="ERR_NewInStruct"> <source>Structures cannot declare a non-shared 'Sub New' with no parameters.</source> <target state="translated">Les structures ne peuvent pas déclarer un 'Sub New' non partagé sans aucun paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndGet"> <source>'End Get' must be preceded by a matching 'Get'.</source> <target state="translated">'End Get' doit être précédé d'un 'Get' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndGet"> <source>'Get' statement must end with a matching 'End Get'.</source> <target state="translated">'Une instruction 'Get' doit se terminer par un 'End Get' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndSet"> <source>'End Set' must be preceded by a matching 'Set'.</source> <target state="translated">'End Set' doit être précédé d'un 'Set' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndSet"> <source>'Set' statement must end with a matching 'End Set'.</source> <target state="translated">'Une instruction 'Set' doit se terminer par un 'End Set' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsProperty"> <source>Statement cannot appear within a property body. End of property assumed.</source> <target state="translated">Cette instruction ne peut pas apparaître dans le corps d'une propriété. Elle est interprétée comme la fin de la propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateWriteabilityCategoryUsed"> <source>'ReadOnly' and 'WriteOnly' cannot be combined.</source> <target state="translated">'Impossible de combiner 'ReadOnly' et 'WriteOnly'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedGreater"> <source>'&gt;' expected.</source> <target state="translated">'&gt;' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeStmtWrongOrder"> <source>Assembly or Module attribute statements must precede any declarations in a file.</source> <target state="translated">Les instructions d'attribut Assembly ou Module doivent précéder toutes les déclarations dans un fichier.</target> <note /> </trans-unit> <trans-unit id="ERR_NoExplicitArraySizes"> <source>Array bounds cannot appear in type specifiers.</source> <target state="translated">Les limites d'index de tableau ne peuvent pas figurer dans les spécificateurs de type.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyFlags1"> <source>Properties cannot be declared '{0}'.</source> <target state="translated">Les propriétés ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionExplicit"> <source>'Option Explicit' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Option Explicit' ne peut être suivi que de 'On' ou 'Off'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleParameterSpecifiers"> <source>'ByVal' and 'ByRef' cannot be combined.</source> <target state="translated">'Impossible de combiner 'ByVal' et 'ByRef'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleOptionalParameterSpecifiers"> <source>'Optional' and 'ParamArray' cannot be combined.</source> <target state="translated">'Impossible de combiner 'Optional' et 'ParamArray'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedProperty1"> <source>Property '{0}' is of an unsupported type.</source> <target state="translated">La propriété '{0}' est d'un type non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionalParameterUsage1"> <source>Attribute '{0}' cannot be applied to a method with optional parameters.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à une méthode avec des paramètres optionnels.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnFromNonFunction"> <source>'Return' statement in a Sub or a Set cannot return a value.</source> <target state="translated">'L'instruction 'Return' dans un Sub ou un Set ne peut pas retourner de valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_UnterminatedStringLiteral"> <source>String constants must end with a double quote.</source> <target state="translated">Les constantes de chaîne doivent se terminer par un guillemet.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedType1"> <source>'{0}' is an unsupported type.</source> <target state="translated">'{0}' est un type non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEnumBase"> <source>Enums must be declared as an integral type.</source> <target state="translated">Les enums doivent être déclarés en tant que type intégral.</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefIllegal1"> <source>{0} parameters cannot be declared 'ByRef'.</source> <target state="translated">Les paramètres {0} ne peuvent pas être déclarés 'ByRef'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedAssembly3"> <source>Reference required to assembly '{0}' containing the type '{1}'. Add one to your project.</source> <target state="translated">Une référence à l'assembly '{0}' contenant le type '{1}' est requise. Ajoutez-en une à votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedModule3"> <source>Reference required to module '{0}' containing the type '{1}'. Add one to your project.</source> <target state="translated">Une référence au module '{0}' contenant le type '{1}' est requise. Ajoutez-en une à votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnWithoutValue"> <source>'Return' statement in a Function, Get, or Operator must return a value.</source> <target state="translated">'L'instruction 'Return' dans un Function, Get ou Operator doit retourner une valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedField1"> <source>Field '{0}' is of an unsupported type.</source> <target state="translated">Le champ '{0}' est d'un type non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedMethod1"> <source>'{0}' has a return type that is not supported or parameter types that are not supported.</source> <target state="translated">'{0}' a un type de retour ou des types de paramètres non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonIndexProperty1"> <source>Property '{0}' with no parameters cannot be found.</source> <target state="translated">Impossible de trouver la propriété '{0}' sans paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributePropertyType1"> <source>Property or field '{0}' does not have a valid attribute type.</source> <target state="translated">La propriété ou le champ '{0}' n'utilise pas un type d'attribut valide.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalsCannotHaveAttributes"> <source>Attributes cannot be applied to local variables.</source> <target state="translated">Les attributs ne peuvent pas être appliqués aux variables locales.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyOrFieldNotDefined1"> <source>Field or property '{0}' is not found.</source> <target state="translated">Le champ ou la propriété '{0}' est introuvable.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeUsage2"> <source>Attribute '{0}' cannot be applied to '{1}' because the attribute is not valid on this declaration type.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à '{1}', car il n'est pas valide dans ce type de déclaration.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeUsageOnAccessor"> <source>Attribute '{0}' cannot be applied to '{1}' of '{2}' because the attribute is not valid on this declaration type.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué à '{1}' de '{2}', car il n'est pas valide dans ce type de déclaration.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedTypeInInheritsClause2"> <source>Class '{0}' cannot reference its nested type '{1}' in Inherits clause.</source> <target state="translated">La classe '{0}' ne peut pas faire référence à son type incorporé '{1}' dans la clause Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInItsInheritsClause1"> <source>Class '{0}' cannot reference itself in Inherits clause.</source> <target state="translated">La classe '{0}' ne peut pas se référencer elle-même dans une clause Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseTypeReferences2"> <source> Base type of '{0}' needs '{1}' to be resolved.</source> <target state="translated"> Le type de base de '{0}' a besoin de '{1}' pour être résolu.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalBaseTypeReferences3"> <source>Inherits clause of {0} '{1}' causes cyclic dependency: {2}</source> <target state="translated">La clause Inherits de {0} '{1}' provoque une dépendance cyclique : {2}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMultipleAttributeUsage1"> <source>Attribute '{0}' cannot be applied multiple times.</source> <target state="translated">L'attribut '{0}' ne peut pas être appliqué plusieurs fois.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMultipleAttributeUsageInNetModule2"> <source>Attribute '{0}' in '{1}' cannot be applied multiple times.</source> <target state="translated">L'attribut '{0}' dans '{1}' ne peut pas être appliqué plusieurs fois.</target> <note /> </trans-unit> <trans-unit id="ERR_CantThrowNonException"> <source>'Throw' operand must derive from 'System.Exception'.</source> <target state="translated">'L'opérande 'Throw' doit dériver de 'System.Exception'.</target> <note /> </trans-unit> <trans-unit id="ERR_MustBeInCatchToRethrow"> <source>'Throw' statement cannot omit operand outside a 'Catch' statement or inside a 'Finally' statement.</source> <target state="translated">'L'instruction 'Throw' ne peut pas omettre l'opérande en dehors d'une instruction 'Catch' ou dans une instruction 'Finally'.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayMustBeByVal"> <source>ParamArray parameters must be declared 'ByVal'.</source> <target state="translated">Les paramètres ParamArray doivent être déclarés 'ByVal'.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoleteSymbol2"> <source>'{0}' is obsolete: '{1}'.</source> <target state="translated">'{0}' est obsolète : '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RedimNoSizes"> <source>'ReDim' statements require a parenthesized list of the new bounds of each dimension of the array.</source> <target state="translated">'Les instructions 'ReDim' requièrent une liste entre parenthèses des nouvelles limites de chaque dimension du tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_InitWithMultipleDeclarators"> <source>Explicit initialization is not permitted with multiple variables declared with a single type specifier.</source> <target state="translated">Une initialisation explicite n'est pas autorisée avec plusieurs variables déclarées avec un spécificateur de type unique.</target> <note /> </trans-unit> <trans-unit id="ERR_InitWithExplicitArraySizes"> <source>Explicit initialization is not permitted for arrays declared with explicit bounds.</source> <target state="translated">Une initialisation explicite n'est pas autorisée pour les tableaux déclarés avec des limites explicites.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSyncLockNoSyncLock"> <source>'End SyncLock' must be preceded by a matching 'SyncLock'.</source> <target state="translated">'End SyncLock' doit être précédé d'un 'SyncLock' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndSyncLock"> <source>'SyncLock' statement must end with a matching 'End SyncLock'.</source> <target state="translated">'L'instruction 'SyncLock' doit se terminer par un 'End SyncLock' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotEvent2"> <source>'{0}' is not an event of '{1}'.</source> <target state="translated">'{0}' n'est pas un événement de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AddOrRemoveHandlerEvent"> <source>'AddHandler' or 'RemoveHandler' statement event operand must be a dot-qualified expression or a simple name.</source> <target state="translated">'L'opérande d'événement d'instruction 'AddHandler' ou 'RemoveHandler' doit être une expression qualifiée par un point ou un nom simple.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedEnd"> <source>'End' statement not valid.</source> <target state="translated">'Instruction 'End' non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitForNonArray2"> <source>Array initializers are valid only for arrays, but the type of '{0}' is '{1}'.</source> <target state="translated">Les initialiseurs de tableau ne sont valides que pour les tableaux, mais le type de '{0}' est '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EndRegionNoRegion"> <source>'#End Region' must be preceded by a matching '#Region'.</source> <target state="translated">'#End Region' doit être précédé d'un '#Region' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndRegion"> <source>'#Region' statement must end with a matching '#End Region'.</source> <target state="translated">'L'instruction '#Region' doit se terminer par un '#End Region' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsStmtWrongOrder"> <source>'Inherits' statement must precede all declarations in a class.</source> <target state="translated">'L'instruction 'Inherits' doit précéder toutes les déclarations dans une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousAcrossInterfaces3"> <source>'{0}' is ambiguous across the inherited interfaces '{1}' and '{2}'.</source> <target state="translated">'{0}' est ambigu entre les interfaces héritées '{1}' et '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPropertyAmbiguousAcrossInterfaces4"> <source>Default property access is ambiguous between the inherited interface members '{0}' of interface '{1}' and '{2}' of interface '{3}'.</source> <target state="translated">L'accès à la propriété par défaut est ambigu entre les membres '{0}' de l'interface héritée '{1}' et '{2}' de l'interface '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceEventCantUse1"> <source>Events in interfaces cannot be declared '{0}'.</source> <target state="translated">Les événements des interfaces ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExecutableAsDeclaration"> <source>Statement cannot appear outside of a method body.</source> <target state="translated">Cette instruction ne peut pas apparaître en dehors du corps de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureNoDefault1"> <source>Structure '{0}' cannot be indexed because it has no default property.</source> <target state="translated">La structure '{0}' ne peut pas être indexée, car elle n'a pas de propriété par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_MustShadow2"> <source>{0} '{1}' must be declared 'Shadows' because another member with this name is declared 'Shadows'.</source> <target state="translated">{0} '{1}' doit être déclaré 'Shadows', car un autre membre avec ce nom est déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithOptionalTypes2"> <source>'{0}' cannot override '{1}' because they differ by the types of optional parameters.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car les types des paramètres optionnels les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndOfExpression"> <source>End of expression expected.</source> <target state="translated">Fin d'expression attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_StructsCannotHandleEvents"> <source>Methods declared in structures cannot have 'Handles' clauses.</source> <target state="translated">Les méthodes déclarées dans des structures ne peuvent pas comporter de clauses 'Handles'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverridesImpliesOverridable"> <source>Methods declared 'Overrides' cannot be declared 'Overridable' because they are implicitly overridable.</source> <target state="translated">Les méthodes déclarées 'Overrides' ne peuvent pas être déclarées 'Overridable', car elles sont implicitement substituables.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalNamedSameAsParam1"> <source>'{0}' is already declared as a parameter of this method.</source> <target state="translated">'{0}' est déjà déclaré en tant que paramètre de cette méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalNamedSameAsParamInLambda1"> <source>Variable '{0}' is already declared as a parameter of this or an enclosing lambda expression.</source> <target state="translated">La variable '{0}' est déjà déclarée en tant que paramètre de cet élément ou en tant qu'expression lambda englobante.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseTypeSpecifier1"> <source>Type in a Module cannot be declared '{0}'.</source> <target state="translated">Un type dans un module ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InValidSubMainsFound1"> <source>No accessible 'Main' method with an appropriate signature was found in '{0}'.</source> <target state="translated">Aucune méthode 'Main' accessible avec une signature appropriée n'a été trouvée dans '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MoreThanOneValidMainWasFound2"> <source>'Sub Main' is declared more than once in '{0}': {1}</source> <target state="translated">'Sub Main' est déclaré plusieurs fois dans '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_CannotConvertValue2"> <source>Value '{0}' cannot be converted to '{1}'.</source> <target state="translated">Impossible de convertir la valeur '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnErrorInSyncLock"> <source>'On Error' statements are not valid within 'SyncLock' statements.</source> <target state="translated">'Les instructions 'On Error' ne sont pas valides dans les instructions 'SyncLock'.</target> <note /> </trans-unit> <trans-unit id="ERR_NarrowingConversionCollection2"> <source>Option Strict On disallows implicit conversions from '{0}' to '{1}'; the Visual Basic 6.0 collection type is not compatible with the .NET Framework collection type.</source> <target state="translated">Option Strict On interdit les conversions implicites de '{0}' en '{1}' ; le type de collection de Visual Basic 6.0 n'est pas compatible avec le type de collection du .NET Framework.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoTryHandler"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'Try', 'Catch' or 'Finally' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve à l'intérieur d'une instruction 'Try', 'Catch' ou 'Finally' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoSyncLock"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'SyncLock' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve à l'intérieur d'une instruction 'SyncLock' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoWith"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'With' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve à l'intérieur d'une instruction 'With' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoFor"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'For' or 'For Each' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve à l'intérieur d'une instruction 'For' ou 'For Each' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicConstructor"> <source>Attribute cannot be used because it does not have a Public constructor.</source> <target state="translated">Impossible d'utiliser cet attribut, car il n'a pas de constructeur public.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultEventNotFound1"> <source>Event '{0}' specified by the 'DefaultEvent' attribute is not a publicly accessible event for this class.</source> <target state="translated">L'événement '{0}' spécifié par l'attribut 'DefaultEvent' n'est pas un événement accessible publiquement pour cette classe.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNonSerializedUsage"> <source>'NonSerialized' attribute will not have any effect on this member because its containing class is not exposed as 'Serializable'.</source> <target state="translated">'L'attribut 'NonSerialized' n'aura pas d'effet sur ce membre, car sa classe conteneur n'est pas exposée comme 'Serializable'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContinueKind"> <source>'Continue' must be followed by 'Do', 'For' or 'While'.</source> <target state="translated">'Continue' doit être suivi par 'Do', 'For' ou 'While'.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueDoNotWithinDo"> <source>'Continue Do' can only appear inside a 'Do' statement.</source> <target state="translated">'Continue Do' ne peut être utilisé qu'à l'intérieur d'une instruction 'Do'.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueForNotWithinFor"> <source>'Continue For' can only appear inside a 'For' statement.</source> <target state="translated">'Continue For' ne peut être utilisé qu'à l'intérieur d'une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueWhileNotWithinWhile"> <source>'Continue While' can only appear inside a 'While' statement.</source> <target state="translated">'Continue While' ne peut apparaître que dans une instruction 'While'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParameterSpecifier"> <source>Parameter specifier is duplicated.</source> <target state="translated">Le spécificateur de paramètre est en double.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseDLLDeclareSpecifier1"> <source>'Declare' statements in a Module cannot be declared '{0}'.</source> <target state="translated">'Les instructions 'Declare' d'un module ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantUseDLLDeclareSpecifier1"> <source>'Declare' statements in a structure cannot be declared '{0}'.</source> <target state="translated">'Les instructions 'Declare' dans une structure ne peuvent pas être déclarées '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TryCastOfValueType1"> <source>'TryCast' operand must be reference type, but '{0}' is a value type.</source> <target state="translated">'L'opérande 'TryCast' doit être un type référence, mais '{0}' est un type valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_TryCastOfUnconstrainedTypeParam1"> <source>'TryCast' operands must be class-constrained type parameter, but '{0}' has no class constraint.</source> <target state="translated">'L'opérande 'TryCast' doit être un paramètre de type contraint par classe, mais '{0}' n'a pas de contrainte de classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousDelegateBinding2"> <source>No accessible '{0}' is most specific: {1}</source> <target state="translated">Aucun '{0}' accessible n'est plus spécifique : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SharedStructMemberCannotSpecifyNew"> <source>Non-shared members in a Structure cannot be declared 'New'.</source> <target state="translated">Les membres non partagés dans une Structure ne peuvent pas être déclarés 'New'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericSubMainsFound1"> <source>None of the accessible 'Main' methods with the appropriate signatures found in '{0}' can be the startup method since they are all either generic or nested in generic types.</source> <target state="translated">Aucune des méthodes 'Main' accessibles avec les signatures appropriées ayant été trouvées dans '{0}' ne peut être la méthode de démarrage, car elles sont toutes génériques ou imbriquées dans des types génériques.</target> <note /> </trans-unit> <trans-unit id="ERR_GeneralProjectImportsError3"> <source>Error in project-level import '{0}' at '{1}' : {2}</source> <target state="translated">Erreur dans l'importation au niveau du projet '{0}' à '{1}' : {2}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidTypeForAliasesImport2"> <source>'{1}' for the Imports alias to '{0}' does not refer to a Namespace, Class, Structure, Interface, Enum or Module.</source> <target state="translated">'{1}' utilisé pour l'alias Imports de '{0}' ne fait pas référence à un Namespace, Class, Structure, Interface, Enum ou Module.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedConstant2"> <source>Field '{0}.{1}' has an invalid constant value.</source> <target state="translated">Le champ '{0}.{1}' a une valeur constante non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteArgumentsNeedParens"> <source>Method arguments must be enclosed in parentheses.</source> <target state="translated">Les arguments de méthode doivent être mis entre parenthèses.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteLineNumbersAreLabels"> <source>Labels that are numbers must be followed by colons.</source> <target state="translated">Les étiquettes qui sont des nombres doivent être suivies du signe deux-points.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteStructureNotType"> <source>'Type' statements are no longer supported; use 'Structure' statements instead.</source> <target state="translated">'Les instructions 'Type' ne sont plus prises en charge ; utilisez les instructions 'Structure' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteObjectNotVariant"> <source>'Variant' is no longer a supported type; use the 'Object' type instead.</source> <target state="translated">'Variant' n'est plus un type pris en charge ; utilisez le type 'Object' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteLetSetNotNeeded"> <source>'Let' and 'Set' assignment statements are no longer supported.</source> <target state="translated">'Les instructions d'assignation 'Let' et 'Set' ne sont plus prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoletePropertyGetLetSet"> <source>Property Get/Let/Set are no longer supported; use the new Property declaration syntax.</source> <target state="translated">Property Get/Let/Set ne sont plus pris en charge ; utilisez la nouvelle syntaxe de déclaration Property.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteWhileWend"> <source>'Wend' statements are no longer supported; use 'End While' statements instead.</source> <target state="translated">'Les instructions 'Wend' ne sont plus prises en charge ; utilisez les instructions 'End While' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteRedimAs"> <source>'ReDim' statements can no longer be used to declare array variables.</source> <target state="translated">'Les instructions 'ReDim' ne peuvent plus être utilisées pour déclarer des variables tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteOptionalWithoutValue"> <source>Optional parameters must specify a default value.</source> <target state="translated">Les paramètres optionnels doivent spécifier une valeur par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteGosub"> <source>'GoSub' statements are no longer supported.</source> <target state="translated">'Les instructions 'GoSub' ne sont plus prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteOnGotoGosub"> <source>'On GoTo' and 'On GoSub' statements are no longer supported.</source> <target state="translated">'Les instructions 'On GoTo' et 'On GoSub' ne sont plus prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteEndIf"> <source>'EndIf' statements are no longer supported; use 'End If' instead.</source> <target state="translated">'Les instructions 'EndIf' ne sont plus prises en charge ; utilisez 'End If' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteExponent"> <source>'D' can no longer be used to indicate an exponent, use 'E' instead.</source> <target state="translated">'D' ne peut plus être utilisé pour indiquer un exposant ; utilisez 'E' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteAsAny"> <source>'As Any' is not supported in 'Declare' statements.</source> <target state="translated">'As Any' n'est pas pris en charge dans les instructions 'Declare'.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteGetStatement"> <source>'Get' statements are no longer supported. File I/O functionality is available in the 'Microsoft.VisualBasic' namespace.</source> <target state="translated">'Les instructions 'Get' ne sont plus prises en charge. La fonctionnalité d'E/S de fichier est disponible dans l'espace de noms 'Microsoft.VisualBasic'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithArrayVsParamArray2"> <source>'{0}' cannot override '{1}' because they differ by parameters declared 'ParamArray'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car les paramètres déclarés 'ParamArray' les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularBaseDependencies4"> <source>This inheritance causes circular dependencies between {0} '{1}' and its nested or base type '{2}'.</source> <target state="translated">Cet héritage provoque des dépendances circulaires entre {0} '{1}' et son '{2}' incorporé ou type de base.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedBase2"> <source>{0} '{1}' cannot inherit from a type nested within it.</source> <target state="translated">{0} '{1}' ne peut pas hériter d'un type imbriqué.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchOutsideAssembly4"> <source>'{0}' cannot expose type '{1}' outside the project through {2} '{3}'.</source> <target state="translated">'{0}' ne peut pas exposer le type '{1}' en dehors du projet via {2} '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceAccessMismatchOutside3"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of the base {1} outside the assembly.</source> <target state="translated">'{0}' ne peut pas hériter de {1} '{2}', car il étend l'accès du {1} de base en dehors de l'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoletePropertyAccessor3"> <source>'{0}' accessor of '{1}' is obsolete: '{2}'.</source> <target state="translated">'L'accesseur '{0}' de '{1}' est obsolète : '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoletePropertyAccessor2"> <source>'{0}' accessor of '{1}' is obsolete.</source> <target state="translated">'L'accesseur '{0}' de '{1}' est obsolète.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchImplementedEvent6"> <source>'{0}' cannot expose the underlying delegate type '{1}' of the event it is implementing to {2} '{3}' through {4} '{5}'.</source> <target state="translated">'{0}' ne peut pas exposer le type de délégué sous-jacent '{1}' de l'événement qu'il implémente à {2} '{3}' via {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchImplementedEvent4"> <source>'{0}' cannot expose the underlying delegate type '{1}' of the event it is implementing outside the project through {2} '{3}'.</source> <target state="translated">'{0}' ne peut pas exposer le type de délégué sous-jacent '{1}' de l'événement qu'il implémente en dehors du projet via {2} '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceCycleInImportedType1"> <source>Type '{0}' is not supported because it either directly or indirectly inherits from itself.</source> <target state="translated">Le type '{0}' n'est pas pris en charge, car il hérite directement ou indirectement de lui-même.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonObsoleteConstructorOnBase3"> <source>Class '{0}' must declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car le '{1}' dans sa classe de base '{2}' est marqué comme obsolète.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonObsoleteConstructorOnBase4"> <source>Class '{0}' must declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete: '{3}'.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car le '{1}' dans sa classe de base '{2}' est marqué comme obsolète. '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNonObsoleteNewCall3"> <source>First statement of this 'Sub New' must be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le '{0}' dans la classe de base '{1}' de '{2}' est marquée comme obsolète.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNonObsoleteNewCall4"> <source>First statement of this 'Sub New' must be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete: '{3}'.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le '{0}' dans la classe de base '{1}' de '{2}' est marquée comme obsolète : '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsTypeArgAccessMismatch7"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of type '{3}' to {4} '{5}'.</source> <target state="translated">'{0}' ne peut pas hériter de {1} '{2}', car il étend l'accès du '{3}' de type à {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsTypeArgAccessMismatchOutside5"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of type '{3}' outside the assembly.</source> <target state="translated">'{0}' ne peut pas hériter de {1} '{2}', car il étend l'accès du '{3}' de type en dehors de l'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeAccessMismatch3"> <source>Specified access '{0}' for '{1}' does not match the access '{2}' specified on one of its other partial types.</source> <target state="translated">L'accès spécifié '{0}' pour '{1}' ne correspond pas à l'accès '{2}' spécifié pour l'un de ses autres types partiels.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeBadMustInherit1"> <source>'MustInherit' cannot be specified for partial type '{0}' because it cannot be combined with 'NotInheritable' specified for one of its other partial types.</source> <target state="translated">'MustInherit' ne peut pas être spécifié pour le type partiel '{0}', car il ne peut pas être combiné avec 'NotInheritable' spécifié pour l'un de ses autres types partiels.</target> <note /> </trans-unit> <trans-unit id="ERR_MustOverOnNotInheritPartClsMem1"> <source>'MustOverride' cannot be specified on this member because it is in a partial type that is declared 'NotInheritable' in another partial definition.</source> <target state="translated">'MustOverride' ne peut pas être spécifié pour ce membre, car il est dans un type partiel déclaré 'NotInheritable' dans une autre définition partielle.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseMismatchForPartialClass3"> <source>Base class '{0}' specified for class '{1}' cannot be different from the base class '{2}' of one of its other partial types.</source> <target state="translated">La classe de base '{0}' spécifiée pour la classe '{1}' ne peut pas être différente de la classe de base '{2}' de l'un de ses autres types partiels.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeTypeParamNameMismatch3"> <source>Type parameter name '{0}' does not match the name '{1}' of the corresponding type parameter defined on one of the other partial types of '{2}'.</source> <target state="translated">Le nom du paramètre de type '{0}' ne correspond pas au nom '{1}' du paramètre de type correspondant défini pour l'un des autres types partiels de '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeConstraintMismatch1"> <source>Constraints for this type parameter do not match the constraints on the corresponding type parameter defined on one of the other partial types of '{0}'.</source> <target state="translated">Les contraintes pour ce paramètre de type ne correspondent pas aux contraintes du paramètre de type correspondant défini pour l'un des autres types partiels de '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LateBoundOverloadInterfaceCall1"> <source>Late bound overload resolution cannot be applied to '{0}' because the accessing instance is an interface type.</source> <target state="translated">La résolution de surcharge à liaison tardive ne peut pas être appliquée à '{0}', car l'instance d'accès est un type interface.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredAttributeConstConversion2"> <source>Conversion from '{0}' to '{1}' cannot occur in a constant expression used as an argument to an attribute.</source> <target state="translated">La conversion de '{0}' en '{1}' ne peut pas se produire dans une expression constante utilisée en tant qu'argument d'un attribut.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousOverrides3"> <source>Member '{0}' that matches this signature cannot be overridden because the class '{1}' contains multiple members with this same name and signature: {2}</source> <target state="translated">Le membre '{0}' qui correspond à cette signature ne peut pas être remplacé, car la classe '{1}' contient plusieurs membres avec ce nom et cette signature : {2}</target> <note /> </trans-unit> <trans-unit id="ERR_OverriddenCandidate1"> <source> '{0}'</source> <target state="translated"> '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousImplements3"> <source>Member '{0}.{1}' that matches this signature cannot be implemented because the interface '{2}' contains multiple members with this same name and signature: '{3}' '{4}'</source> <target state="translated">Le membre '{0}.{1}' qui correspond à cette signature ne peut pas être implémenté, car l'interface '{2}' contient plusieurs membres avec ce nom et cette signature : '{3}' '{4}'</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNotCreatableDelegate1"> <source>'AddressOf' expression cannot be converted to '{0}' because type '{0}' is declared 'MustInherit' and cannot be created.</source> <target state="translated">'Une expression 'AddressOf' ne peut pas être convertie en '{0}', car le type '{0}' est déclaré 'MustInherit' et ne peut pas être créé.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassGenericMethod"> <source>Generic methods cannot be exposed to COM.</source> <target state="translated">Les méthodes génériques ne peuvent pas être exposées à COM.</target> <note /> </trans-unit> <trans-unit id="ERR_SyntaxInCastOp"> <source>Syntax error in cast operator; two arguments separated by comma are required.</source> <target state="translated">Erreur de syntaxe dans l'opérateur de cast ; deux arguments séparés par une virgule sont requis.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerForNonConstDim"> <source>Array initializer cannot be specified for a non constant dimension; use the empty initializer '{}'.</source> <target state="translated">Un initialiseur de tableau ne peut pas être spécifié pour une dimension non constante ; utilisez l'initialiseur vide '{}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingFailure3"> <source>No accessible method '{0}' has a signature compatible with delegate '{1}':{2}</source> <target state="translated">Aucune méthode accessible '{0}' n'a de signature compatible avec le délégué '{1}':{2}</target> <note /> </trans-unit> <trans-unit id="ERR_StructLayoutAttributeNotAllowed"> <source>Attribute 'StructLayout' cannot be applied to a generic type.</source> <target state="translated">L'attribut 'StructLayout' ne peut pas être appliqué à un type générique.</target> <note /> </trans-unit> <trans-unit id="ERR_IterationVariableShadowLocal1"> <source>Range variable '{0}' hides a variable in an enclosing block or a range variable previously defined in the query expression.</source> <target state="translated">La variable de portée '{0}' masque une variable dans un bloc englobant ou une variable de portée précédemment définie dans l'expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionInfer"> <source>'Option Infer' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Option Infer' ne peut être suivi que par 'On' ou 'Off'.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularInference1"> <source>Type of '{0}' cannot be inferred from an expression containing '{0}'.</source> <target state="translated">Le type de '{0}' ne peut pas être déduit à partir d'une expression contenant '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InAccessibleOverridingMethod5"> <source>'{0}' in class '{1}' cannot override '{2}' in class '{3}' because an intermediate class '{4}' overrides '{2}' in class '{3}' but is not accessible.</source> <target state="translated">'{0}' dans la classe '{1}' ne peut pas se substituer à '{2}' dans la classe '{3}', car une classe intermédiaire '{4}' se substitue à '{2}' dans la classe '{3}', mais n'est pas accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuitableWidestType1"> <source>Type of '{0}' cannot be inferred because the loop bounds and the step clause do not convert to the same type.</source> <target state="translated">Le type de '{0}' ne peut pas être déduit, car les limites de la boucle et la clause step ne sont pas converties en un même type.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousWidestType3"> <source>Type of '{0}' is ambiguous because the loop bounds and the step clause do not convert to the same type.</source> <target state="translated">Le type de '{0}' est ambigu, car les limites de la boucle et la clause step ne sont pas converties dans un type identique.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAssignmentOperatorInInit"> <source>'=' expected (object initializer).</source> <target state="translated">'=' attendu (initialiseur d'objet).</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQualifiedNameInInit"> <source>Name of field or property being initialized in an object initializer must start with '.'.</source> <target state="translated">Le nom du champ ou de la propriété initialisé dans un initialiseur d'objet doit commencer par '.'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLbrace"> <source>'{' expected.</source> <target state="translated">'{' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedTypeOrWith"> <source>Type or 'With' expected.</source> <target state="translated">Type ou 'With' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAggrMemberInit1"> <source>Multiple initializations of '{0}'. Fields and properties can be initialized only once in an object initializer expression.</source> <target state="translated">Plusieurs initialisations de '{0}'. Les champs et les propriétés ne peuvent être initialisés qu'une seule fois dans une expression d'initialiseur d'objet.</target> <note /> </trans-unit> <trans-unit id="ERR_NonFieldPropertyAggrMemberInit1"> <source>Member '{0}' cannot be initialized in an object initializer expression because it is not a field or property.</source> <target state="translated">Le membre '{0}' ne peut pas être initialisé dans une expression d'initialiseur d'objet, car il ne s'agit pas d'un champ ou d'une propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedMemberAggrMemberInit1"> <source>Member '{0}' cannot be initialized in an object initializer expression because it is shared.</source> <target state="translated">Le membre '{0}' ne peut pas être initialisé dans une expression d'initialiseur d'objet, car il est partagé.</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterizedPropertyInAggrInit1"> <source>Property '{0}' cannot be initialized in an object initializer expression because it requires arguments.</source> <target state="translated">La propriété '{0}' ne peut pas être initialisée dans une expression d'initialiseur d'objet, car elle requiert des arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_NoZeroCountArgumentInitCandidates1"> <source>Property '{0}' cannot be initialized in an object initializer expression because all accessible overloads require arguments.</source> <target state="translated">La propriété '{0}' ne peut pas être initialisée dans une expression d'initialiseur d'objet, car toutes les surcharges accessibles nécessitent des arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_AggrInitInvalidForObject"> <source>Object initializer syntax cannot be used to initialize an instance of 'System.Object'.</source> <target state="translated">La syntaxe de l'initialiseur d'objet ne peut pas être utilisée pour initialiser une instance de 'System.Object'.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerExpected"> <source>Initializer expected.</source> <target state="translated">Initialiseur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_LineContWithCommentOrNoPrecSpace"> <source>The line continuation character '_' must be preceded by at least one white space and it must be followed by a comment or the '_' must be the last character on the line.</source> <target state="translated">Le caractère de continuation de ligne '_' doit être précédé d'au moins un espace blanc et être suivi d'un commentaire. Sinon, '_' doit être le dernier caractère de la ligne.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleFile1"> <source>Unable to load module file '{0}': {1}</source> <target state="translated">Impossible de charger le fichier de module '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadRefLib1"> <source>Unable to load referenced library '{0}': {1}</source> <target state="translated">Impossible de charger la bibliothèque référencée '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_EventHandlerSignatureIncompatible2"> <source>Method '{0}' cannot handle event '{1}' because they do not have a compatible signature.</source> <target state="translated">La méthode '{0}' ne peut pas gérer l'événement '{1}', car sa signature n'est pas compatible.</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalCompilationConstantNotValid"> <source>Conditional compilation constant '{1}' is not valid: {0}</source> <target state="translated">La constante de compilation conditionnelle '{1}' est non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwice1"> <source>Interface '{0}' can be implemented only once by this type.</source> <target state="translated">L'interface '{0}' ne peut être implémentée qu'une seule fois par ce type.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames2"> <source>Interface '{0}' can be implemented only once by this type, but already appears with different tuple element names, as '{1}'.</source> <target state="translated">L'interface '{0}' ne peut être implémentée qu'une seule fois par ce type, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames3"> <source>Interface '{0}' can be implemented only once by this type, but already appears with different tuple element names, as '{1}' (via '{2}').</source> <target state="translated">L'interface '{0}' ne peut être implémentée qu'une seule fois par ce type, mais elle apparaît déjà avec noms d'éléments tuples différents, notamment '{1}' (par l'intermédiaire de '{2}').</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNamesReverse3"> <source>Interface '{0}' (via '{1}') can be implemented only once by this type, but already appears with different tuple element names, as '{2}'.</source> <target state="translated">L'interface '{0}' (par l'intermédiaire de '{1}') ne peut être implémentée qu'une seule fois par ce type, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames4"> <source>Interface '{0}' (via '{1}') can be implemented only once by this type, but already appears with different tuple element names, as '{2}' (via '{3}').</source> <target state="translated">L'interface '{0}' (par l'intermédiaire de '{1}') ne peut être implémentée qu'une seule fois par ce type, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{2}' (par l'intermédiaire de '{3}').</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames2"> <source>Interface '{0}' can be inherited only once by this interface, but already appears with different tuple element names, as '{1}'.</source> <target state="translated">L'interface '{0}' ne peut être héritée qu'une seule fois par cette interface, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames3"> <source>Interface '{0}' can be inherited only once by this interface, but already appears with different tuple element names, as '{1}' (via '{2}').</source> <target state="translated">L'interface '{0}' ne peut être héritée qu'une seule fois par cette interface, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{1}' (par l'intermédiaire de '{2}').</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNamesReverse3"> <source>Interface '{0}' (via '{1}') can be inherited only once by this interface, but already appears with different tuple element names, as '{2}'.</source> <target state="translated">L'interface '{0}' (par l'intermédiaire de '{1}') ne peut être héritée qu'une seule fois par cette interface, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames4"> <source>Interface '{0}' (via '{1}') can be inherited only once by this interface, but already appears with different tuple element names, as '{2}' (via '{3}').</source> <target state="translated">L'interface '{0}' (par l'intermédiaire de '{1}') ne peut être héritée qu'une seule fois par cette interface, mais elle apparaît déjà avec des noms d'éléments tuples différents, notamment '{2}' (par l'intermédiaire de '{3}').</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNotImplemented1"> <source>Interface '{0}' is not implemented by this class.</source> <target state="translated">L'interface '{0}' n'est pas implémentée par cette classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousImplementsMember3"> <source>'{0}' exists in multiple base interfaces. Use the name of the interface that declares '{0}' in the 'Implements' clause instead of the name of the derived interface.</source> <target state="translated">'{0}' existe dans plusieurs interfaces de base. Utilisez le nom de l'interface qui déclare '{0}' dans la clause 'Implements' au lieu du nom de l'interface dérivée.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsOnNew"> <source>'Sub New' cannot implement interface members.</source> <target state="translated">'Sub New' ne peut pas implémenter des membres d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitInStruct"> <source>Arrays declared as structure members cannot be declared with an initial size.</source> <target state="translated">Les tableaux déclarés en tant que membres de structures ne peuvent pas être déclarés avec une taille initiale.</target> <note /> </trans-unit> <trans-unit id="ERR_EventTypeNotDelegate"> <source>Events declared with an 'As' clause must have a delegate type.</source> <target state="translated">Les événements déclarés avec une clause 'As' doivent avoir un type délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_ProtectedTypeOutsideClass"> <source>Protected types can only be declared inside of a class.</source> <target state="translated">Les types protégés ne peuvent être déclarés qu'à l'intérieur d'une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPropertyWithNoParams"> <source>Properties with no required parameters cannot be declared 'Default'.</source> <target state="translated">Les propriétés sans paramètre requis ne peuvent pas être déclarées 'Default'.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerInStruct"> <source>Initializers on structure members are valid only for 'Shared' members and constants.</source> <target state="translated">Les initialiseurs pour les membres de structure ne sont valides que pour les membres et constantes 'Shared'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateImport1"> <source>Namespace or type '{0}' has already been imported.</source> <target state="translated">L'espace de noms ou le type '{0}' a déjà été importé.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleFlags1"> <source>Modules cannot be declared '{0}'.</source> <target state="translated">Les modules ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsStmtWrongOrder"> <source>'Implements' statements must follow any 'Inherits' statement and precede all declarations in a class.</source> <target state="translated">'Les instructions 'Implements' doivent suivre toute instruction 'Inherits' et précéder toutes les déclarations dans une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberClashesWithSynth7"> <source>{0} '{1}' implicitly defines '{2}', which conflicts with a member implicitly declared for {3} '{4}' in {5} '{6}'.</source> <target state="translated">{0} '{1}' définit implicitement '{2}', qui est en conflit avec un membre déclaré implicitement pour {3} '{4}' dans {5} '{6}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberClashesWithMember5"> <source>{0} '{1}' implicitly defines '{2}', which conflicts with a member of the same name in {3} '{4}'.</source> <target state="translated">{0} '{1}' définit implicitement '{2}', qui est en conflit avec un membre du même nom dans {3} '{4}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MemberClashesWithSynth6"> <source>{0} '{1}' conflicts with a member implicitly declared for {2} '{3}' in {4} '{5}'.</source> <target state="translated">{0} '{1}' est en conflit avec un membre déclaré implicitement pour {2} '{3}' dans {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeClashesWithVbCoreType4"> <source>{0} '{1}' conflicts with a Visual Basic Runtime {2} '{3}'.</source> <target state="translated">{0} '{1}' est en conflit avec un {2} '{3}' Visual Basic Runtime.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeMissingAction"> <source>First argument to a security attribute must be a valid SecurityAction.</source> <target state="translated">Le premier argument d'un attribut de sécurité doit être un SecurityAction valide.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidAction"> <source>Security attribute '{0}' has an invalid SecurityAction value '{1}'.</source> <target state="translated">L'attribut de sécurité '{0}' a une valeur SecurityAction '{1}' non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionAssembly"> <source>SecurityAction value '{0}' is invalid for security attributes applied to an assembly.</source> <target state="translated">La valeur SecurityAction '{0}' n'est pas valide pour les attributs de sécurité appliqués à un assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionTypeOrMethod"> <source>SecurityAction value '{0}' is invalid for security attributes applied to a type or a method.</source> <target state="translated">La valeur SecurityAction '{0}' n'est pas valide pour les attributs de sécurité appliqués à un type ou à une méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_PrincipalPermissionInvalidAction"> <source>SecurityAction value '{0}' is invalid for PrincipalPermission attribute.</source> <target state="translated">La valeur SecurityAction '{0}' n'est pas valide pour l'attribut PrincipalPermission.</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeInvalidFile"> <source>Unable to resolve file path '{0}' specified for the named argument '{1}' for PermissionSet attribute.</source> <target state="translated">Impossible de résoudre le chemin d'accès au fichier '{0}' spécifié pour l'argument nommé '{1}' de l'attribut PermissionSet.</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeFileReadError"> <source>Error reading file '{0}' specified for the named argument '{1}' for PermissionSet attribute: '{2}'.</source> <target state="translated">Erreur lors de la lecture du fichier '{0}' spécifié pour l'argument nommé '{1}' pour l'attribut PermissionSet : '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_SetHasOnlyOneParam"> <source>'Set' method cannot have more than one parameter.</source> <target state="translated">'La méthode 'Set' ne peut pas comporter plusieurs paramètres.</target> <note /> </trans-unit> <trans-unit id="ERR_SetValueNotPropertyType"> <source>'Set' parameter must have the same type as the containing property.</source> <target state="translated">'Le paramètre 'Set' doit être du même type que la propriété conteneur.</target> <note /> </trans-unit> <trans-unit id="ERR_SetHasToBeByVal1"> <source>'Set' parameter cannot be declared '{0}'.</source> <target state="translated">'Le paramètre 'Set' ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureCantUseProtected"> <source>Method in a structure cannot be declared 'Protected', 'Protected Friend', or 'Private Protected'.</source> <target state="translated">Une méthode dans une structure ne peut pas être déclarée 'Protected', 'Protected Friend' ou 'Private Protected'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceDelegateSpecifier1"> <source>Delegate in an interface cannot be declared '{0}'.</source> <target state="translated">Un délégué dans une interface ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceEnumSpecifier1"> <source>Enum in an interface cannot be declared '{0}'.</source> <target state="translated">Un enum dans une interface ne peut pas être déclaré '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceClassSpecifier1"> <source>Class in an interface cannot be declared '{0}'.</source> <target state="translated">Une classe dans une interface ne peut pas être déclarée '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceStructSpecifier1"> <source>Structure in an interface cannot be declared '{0}'.</source> <target state="translated">Une structure dans une interface ne peut pas être déclarée '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceInterfaceSpecifier1"> <source>Interface in an interface cannot be declared '{0}'.</source> <target state="translated">Une interface dans une interface ne peut pas être déclarée '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoleteSymbolNoMessage1"> <source>'{0}' is obsolete.</source> <target state="translated">'{0}' est obsolète.</target> <note /> </trans-unit> <trans-unit id="ERR_MetaDataIsNotAssembly"> <source>'{0}' is a module and cannot be referenced as an assembly.</source> <target state="translated">'{0}' est un module et ne peut pas être référencé en tant qu'assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_MetaDataIsNotModule"> <source>'{0}' is an assembly and cannot be referenced as a module.</source> <target state="translated">'{0}' est un assembly et ne peut pas être référencé en tant que module.</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceComparison3"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'. Use 'Is' operator to compare two reference types.</source> <target state="translated">L'opérateur '{0}' n'est pas défini pour les types '{1}' et '{2}'. Utilisez 'Is' pour comparer deux types référence.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchVariableNotLocal1"> <source>'{0}' is not a local variable or parameter, and so cannot be used as a 'Catch' variable.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant que variable 'Catch', car ce n'est ni une variable locale ni un paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleMemberCantImplement"> <source>Members in a Module cannot implement interface members.</source> <target state="translated">Les membres d'un module ne peuvent pas implémenter des membres d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_EventDelegatesCantBeFunctions"> <source>Events cannot be declared with a delegate type that has a return type.</source> <target state="translated">Les événements ne peuvent pas être déclarés avec un type délégué ayant un type de retour.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDate"> <source>Date constant is not valid.</source> <target state="translated">Constante de date non valide.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverride4"> <source>'{0}' cannot override '{1}' because it is not declared 'Overridable'.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car il n'est pas déclaré 'Overridable'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyArraysOnBoth"> <source>Array modifiers cannot be specified on both a variable and its type.</source> <target state="translated">Impossible de spécifier des modificateurs de tableau pour la variable et son type.</target> <note /> </trans-unit> <trans-unit id="ERR_NotOverridableRequiresOverrides"> <source>'NotOverridable' cannot be specified for methods that do not override another method.</source> <target state="translated">'NotOverridable' ne peut pas être spécifié pour les méthodes qui ne se substituent pas à une autre méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_PrivateTypeOutsideType"> <source>Types declared 'Private' must be inside another type.</source> <target state="translated">Les types déclarés 'Private' doivent se trouver à l'intérieur d'un autre type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeRefResolutionError3"> <source>Import of type '{0}' from assembly or module '{1}' failed.</source> <target state="translated">Échec de l'importation du type '{0}' à partir de l'assembly ou du module '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTupleTypeRefResolutionError1"> <source>Predefined type '{0}' is not defined or imported.</source> <target state="translated">Le type prédéfini '{0}' n'est pas défini ou importé.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayWrongType"> <source>ParamArray parameters must have an array type.</source> <target state="translated">Les paramètres ParamArray doivent avoir un type tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_CoClassMissing2"> <source>Implementing class '{0}' for interface '{1}' cannot be found.</source> <target state="translated">La classe d'implémentation '{0}' pour l'interface '{1}' est introuvable.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidCoClass1"> <source>Type '{0}' cannot be used as an implementing class.</source> <target state="translated">Impossible d'utiliser le type '{0}' comme classe d'implémentation.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMeReference"> <source>Reference to object under construction is not valid when calling another constructor.</source> <target state="translated">Toute référence à un objet en construction n'est pas valide lors de l'appel d'un autre constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplicitMeReference"> <source>Implicit reference to object under construction is not valid when calling another constructor.</source> <target state="translated">Toute référence implicite à un objet en construction n'est pas valide lors de l'appel d'un autre constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeMemberNotFound2"> <source>Member '{0}' cannot be found in class '{1}'. This condition is usually the result of a mismatched 'Microsoft.VisualBasic.dll'.</source> <target state="translated">Le membre '{0}' est introuvable dans la classe '{1}'. Cette condition est le résultat d'un fichier 'Microsoft.VisualBasic.dll' incompatible.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags"> <source>Property accessors cannot be declared '{0}'.</source> <target state="translated">Les accesseurs de propriété ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlagsRestrict"> <source>Access modifier '{0}' is not valid. The access modifier of 'Get' and 'Set' should be more restrictive than the property access level.</source> <target state="translated">Le modificateur d'accès '{0}' n'est pas valide. Le modificateur d'accès de 'Get' et 'Set' doit être plus restrictif que le niveau d'accès de la propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOneAccessorForGetSet"> <source>Access modifier can only be applied to either 'Get' or 'Set', but not both.</source> <target state="translated">Le modificateur d'accès ne peut être appliqué qu'à 'Get' ou 'Set', mais pas aux deux.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleSet"> <source>'Set' accessor of property '{0}' is not accessible.</source> <target state="translated">'L'accesseur 'Set' de la propriété '{0}' n'est pas accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleGet"> <source>'Get' accessor of property '{0}' is not accessible.</source> <target state="translated">'L'accesseur 'Get' de la propriété '{0}' n'est pas accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyNoAccessorFlag"> <source>'WriteOnly' properties cannot have an access modifier on 'Set'.</source> <target state="translated">'Les propriétés 'WriteOnly' ne peuvent pas avoir un modificateur d'accès pour 'Set'.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyNoAccessorFlag"> <source>'ReadOnly' properties cannot have an access modifier on 'Get'.</source> <target state="translated">'Les propriétés 'ReadOnly' ne peuvent pas avoir un modificateur d'accès pour 'Get'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags1"> <source>Property accessors cannot be declared '{0}' in a 'NotOverridable' property.</source> <target state="translated">Les accesseurs de propriété ne peuvent pas être déclarés '{0}' dans une propriété 'NotOverridable'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags2"> <source>Property accessors cannot be declared '{0}' in a 'Default' property.</source> <target state="translated">Les accesseurs de propriété ne peuvent pas être déclarés '{0}' dans une propriété 'Default'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags3"> <source>Property cannot be declared '{0}' because it contains a 'Private' accessor.</source> <target state="translated">La propriété ne peut pas être déclarée '{0}', car elle contient un accesseur 'Private'.</target> <note /> </trans-unit> <trans-unit id="ERR_InAccessibleCoClass3"> <source>Implementing class '{0}' for interface '{1}' is not accessible in this context because it is '{2}'.</source> <target state="translated">La classe d'implémentation '{0}' pour l'interface '{1}' n'est pas accessible dans ce contexte, car elle est '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingValuesForArraysInApplAttrs"> <source>Arrays used as attribute arguments are required to explicitly specify values for all elements.</source> <target state="translated">Les tableaux utilisés en tant qu'arguments d'attribut sont requis pour spécifier explicitement des valeurs pour tous les éléments.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitEventMemberNotInvalid"> <source>'Exit AddHandler', 'Exit RemoveHandler' and 'Exit RaiseEvent' are not valid. Use 'Return' to exit from event members.</source> <target state="translated">'Exit AddHandler', 'Exit RemoveHandler' et 'Exit RaiseEvent' ne sont pas valides. Utilisez 'Return' pour quitter les membres d'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsEvent"> <source>Statement cannot appear within an event body. End of event assumed.</source> <target state="translated">Cette instruction ne peut pas apparaître dans le corps d'un événement. Elle est interprétée comme la fin de l'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndEvent"> <source>'Custom Event' must end with a matching 'End Event'.</source> <target state="translated">'Custom Event' doit se terminer par un 'End Event' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndAddHandler"> <source>'AddHandler' declaration must end with a matching 'End AddHandler'.</source> <target state="translated">'La déclaration 'AddHandler' doit se terminer par un 'End AddHandler' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndRemoveHandler"> <source>'RemoveHandler' declaration must end with a matching 'End RemoveHandler'.</source> <target state="translated">'La déclaration 'RemoveHandler' doit se terminer par un 'End RemoveHandler' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndRaiseEvent"> <source>'RaiseEvent' declaration must end with a matching 'End RaiseEvent'.</source> <target state="translated">'La déclaration 'RaiseEvent' doit se terminer par un 'End RaiseEvent' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_CustomEventInvInInterface"> <source>'Custom' modifier is not valid on events declared in interfaces.</source> <target state="translated">'Le modificateur 'Custom' n'est pas valide pour les événements déclarés dans les interfaces.</target> <note /> </trans-unit> <trans-unit id="ERR_CustomEventRequiresAs"> <source>'Custom' modifier is not valid on events declared without explicit delegate types.</source> <target state="translated">'Le modificateur 'Custom' n'est pas valide pour les événements déclarés sans types délégués explicites.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndEvent"> <source>'End Event' must be preceded by a matching 'Custom Event'.</source> <target state="translated">'End Event' doit être précédé d'un 'Custom Event' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndAddHandler"> <source>'End AddHandler' must be preceded by a matching 'AddHandler' declaration.</source> <target state="translated">'End AddHandler' doit être précédé d'une déclaration 'AddHandler' correspondante.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndRemoveHandler"> <source>'End RemoveHandler' must be preceded by a matching 'RemoveHandler' declaration.</source> <target state="translated">'End RemoveHandler' doit être précédé d'une déclaration 'RemoveHandler' correspondante.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndRaiseEvent"> <source>'End RaiseEvent' must be preceded by a matching 'RaiseEvent' declaration.</source> <target state="translated">'End RaiseEvent' doit être précédé d'une déclaration 'RaiseEvent' correspondante.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAddHandlerDef"> <source>'AddHandler' is already declared.</source> <target state="translated">'AddHandler' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRemoveHandlerDef"> <source>'RemoveHandler' is already declared.</source> <target state="translated">'RemoveHandler' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRaiseEventDef"> <source>'RaiseEvent' is already declared.</source> <target state="translated">'RaiseEvent' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingAddHandlerDef1"> <source>'AddHandler' definition missing for event '{0}'.</source> <target state="translated">'La définition 'AddHandler' est manquante pour l'événement '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRemoveHandlerDef1"> <source>'RemoveHandler' definition missing for event '{0}'.</source> <target state="translated">'La définition 'RemoveHandler' est manquante pour l'événement '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRaiseEventDef1"> <source>'RaiseEvent' definition missing for event '{0}'.</source> <target state="translated">'La définition 'RaiseEvent' est manquante pour l'événement '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventAddRemoveHasOnlyOneParam"> <source>'AddHandler' and 'RemoveHandler' methods must have exactly one parameter.</source> <target state="translated">'Les méthodes 'AddHandler' et 'RemoveHandler' doivent avoir exactement un paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_EventAddRemoveByrefParamIllegal"> <source>'AddHandler' and 'RemoveHandler' method parameters cannot be declared 'ByRef'.</source> <target state="translated">'Les paramètres de méthode 'AddHandler' et 'RemoveHandler' ne peuvent pas être déclarés 'ByRef'.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecifiersInvOnEventMethod"> <source>Specifiers are not valid on 'AddHandler', 'RemoveHandler' and 'RaiseEvent' methods.</source> <target state="translated">Les spécificateurs ne sont pas valides pour les méthodes 'AddHandler', 'RemoveHandler' et 'RaiseEvent'.</target> <note /> </trans-unit> <trans-unit id="ERR_AddRemoveParamNotEventType"> <source>'AddHandler' and 'RemoveHandler' method parameters must have the same delegate type as the containing event.</source> <target state="translated">'Les paramètres de méthode 'AddHandler' et 'RemoveHandler' doivent avoir le même type délégué que l'événement conteneur.</target> <note /> </trans-unit> <trans-unit id="ERR_RaiseEventShapeMismatch1"> <source>'RaiseEvent' method must have the same signature as the containing event's delegate type '{0}'.</source> <target state="translated">'La méthode 'RaiseEvent' doit avoir la même signature que le type délégué de l'événement conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventMethodOptionalParamIllegal1"> <source>'AddHandler', 'RemoveHandler' and 'RaiseEvent' method parameters cannot be declared '{0}'.</source> <target state="translated">'Les paramètres de méthode 'AddHandler', 'RemoveHandler' et 'RaiseEvent' ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantReferToMyGroupInsideGroupType1"> <source>'{0}' cannot refer to itself through its default instance; use 'Me' instead.</source> <target state="translated">'{0}' ne peut pas faire référence à lui-même via son instance par défaut ; utilisez 'Me' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUseOfCustomModifier"> <source>'Custom' modifier can only be used immediately before an 'Event' declaration.</source> <target state="translated">'Un modificateur 'Custom' ne peut être utilisé qu'immédiatement avant une déclaration 'Event'.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionStrictCustom"> <source>Option Strict Custom can only be used as an option to the command-line compiler (vbc.exe).</source> <target state="translated">Option Strict Custom ne peut être utilisé qu'en tant qu'option du compilateur de ligne de commande (vbc.exe).</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteInvalidOnEventMember"> <source>'{0}' cannot be applied to the 'AddHandler', 'RemoveHandler', or 'RaiseEvent' definitions. If required, apply the attribute directly to the event.</source> <target state="translated">'{0}' ne peut pas être appliqué aux définitions 'AddHandler', 'RemoveHandler', or 'RaiseEvent'. Si nécessaire, appliquez l'attribut directement à l'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingIncompatible2"> <source>Method '{0}' does not have a signature compatible with delegate '{1}'.</source> <target state="translated">La méthode '{0}' n'a pas de signature compatible avec le délégué '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlName"> <source>XML name expected.</source> <target state="translated">Nom XML attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedXmlPrefix"> <source>XML namespace prefix '{0}' is not defined.</source> <target state="translated">Le préfixe de l'espace de noms XML '{0}' n'est pas défini.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateXmlAttribute"> <source>Duplicate XML attribute '{0}'.</source> <target state="translated">Attribut XML '{0}' en double.</target> <note /> </trans-unit> <trans-unit id="ERR_MismatchedXmlEndTag"> <source>End tag &lt;/{0}{1}{2}&gt; expected.</source> <target state="translated">Fin de balise &lt;/{0}{1}{2}&gt; attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingXmlEndTag"> <source>Element is missing an end tag.</source> <target state="translated">Balise de fin manquante dans l'élément.</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedXmlPrefix"> <source>XML namespace prefix '{0}' is reserved for use by XML and the namespace URI cannot be changed.</source> <target state="translated">Le préfixe de l'espace de noms XML '{0}' est réservé pour une utilisation par XML et l'URI de l'espace de noms ne peut pas être changé.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingVersionInXmlDecl"> <source>Required attribute 'version' missing from XML declaration.</source> <target state="translated">Attribut 'version' requis absent de la déclaration XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalAttributeInXmlDecl"> <source>XML declaration does not allow attribute '{0}{1}{2}'.</source> <target state="translated">La déclaration XML n'autorise pas l'attribut '{0}{1}{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_QuotedEmbeddedExpression"> <source>Embedded expression cannot appear inside a quoted attribute value. Try removing quotes.</source> <target state="translated">Une expression incorporée ne peut pas s'afficher à l'intérieur d'une valeur d'attribut entre guillemets. Supprimez les guillemets.</target> <note /> </trans-unit> <trans-unit id="ERR_VersionMustBeFirstInXmlDecl"> <source>XML attribute 'version' must be the first attribute in XML declaration.</source> <target state="translated">L'attribut XML 'version' doit être le premier attribut dans une déclaration XML.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOrder"> <source>XML attribute '{0}' must appear before XML attribute '{1}'.</source> <target state="translated">L'attribut XML '{0}' doit apparaître avant l'attribut XML '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndEmbedded"> <source>Expected closing '%&gt;' for embedded expression.</source> <target state="translated">%&gt;' fermant attendu pour une expression incorporée.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndPI"> <source>Expected closing '?&gt;' for XML processor instruction.</source> <target state="translated">?&gt;' fermant attendu pour une instruction de processeur XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndComment"> <source>Expected closing '--&gt;' for XML comment.</source> <target state="translated">--&gt;' fermant attendu pour un commentaire XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndCData"> <source>Expected closing ']]&gt;' for XML CDATA section.</source> <target state="translated">]]&gt;' fermant attendu pour une section CDATA XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSQuote"> <source>Expected matching closing single quote for XML attribute value.</source> <target state="translated">Guillemet simple fermant correspondant attendu pour une valeur d'attribut XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQuote"> <source>Expected matching closing double quote for XML attribute value.</source> <target state="translated">Guillemet double fermant attendu pour une valeur d'attribut XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLT"> <source>Expected beginning '&lt;' for an XML tag.</source> <target state="translated">&lt;' ouvrant attendu pour une balise XML.</target> <note /> </trans-unit> <trans-unit id="ERR_StartAttributeValue"> <source>Expected quoted XML attribute value or embedded expression.</source> <target state="translated">Valeur d'attribut XML entre guillemets ou expression incorporée attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDiv"> <source>Expected '/' for XML end tag.</source> <target state="translated">/' attendu pour la balise de fin XML.</target> <note /> </trans-unit> <trans-unit id="ERR_NoXmlAxesLateBinding"> <source>XML axis properties do not support late binding.</source> <target state="translated">Les propriétés d'axes XML ne prennent pas en charge la liaison tardive.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlStartNameChar"> <source>Character '{0}' ({1}) is not allowed at the beginning of an XML name.</source> <target state="translated">Le caractère '{0}' ({1}) n'est pas autorisé au début d'un nom XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlNameChar"> <source>Character '{0}' ({1}) is not allowed in an XML name.</source> <target state="translated">Le caractère '{0}' ({1}) n'est pas autorisé dans un nom XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlCommentChar"> <source>Character sequence '--' is not allowed in an XML comment.</source> <target state="translated">La séquence de caractères '--' n'est pas autorisée dans un commentaire XML.</target> <note /> </trans-unit> <trans-unit id="ERR_EmbeddedExpression"> <source>An embedded expression cannot be used here.</source> <target state="translated">Une expression incorporée ne peut pas être utilisée ici.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlWhiteSpace"> <source>Missing required white space.</source> <target state="translated">Espace requis manquant.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalProcessingInstructionName"> <source>XML processing instruction name '{0}' is not valid.</source> <target state="translated">Le nom de l'instruction de traitement XML '{0}' n'est pas valide.</target> <note /> </trans-unit> <trans-unit id="ERR_DTDNotSupported"> <source>XML DTDs are not supported.</source> <target state="translated">Les DTD XML ne sont pas prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlWhiteSpace"> <source>White space cannot appear here.</source> <target state="translated">L'espace ne peut pas s'afficher ici.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSColon"> <source>Expected closing ';' for XML entity.</source> <target state="translated">;' fermant attendu pour une entité XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlBeginEmbedded"> <source>Expected '%=' at start of an embedded expression.</source> <target state="translated">%=' attendu au début d'une expression incorporée.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEntityReference"> <source>XML entity references are not supported.</source> <target state="translated">Les références d'entité XML ne sont pas prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeValue1"> <source>Attribute value is not valid; expecting '{0}'.</source> <target state="translated">Valeur d'attribut non valide ; '{0}' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeValue2"> <source>Attribute value is not valid; expecting '{0}' or '{1}'.</source> <target state="translated">Valeur d'attribut non valide ; '{0}' ou '{1}' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedXmlNamespace"> <source>Prefix '{0}' cannot be bound to namespace name reserved for '{1}'.</source> <target state="translated">Le préfixe '{0}' ne peut pas être lié au nom d'espace de noms réservé pour '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalDefaultNamespace"> <source>Namespace declaration with prefix cannot have an empty value inside an XML literal.</source> <target state="translated">Une déclaration d'espace de noms avec préfixe ne peut pas avoir une valeur vide dans un littéral XML.</target> <note /> </trans-unit> <trans-unit id="ERR_QualifiedNameNotAllowed"> <source>':' is not allowed. XML qualified names cannot be used in this context.</source> <target state="translated">':' n'est pas autorisé. Les noms qualifiés XML ne peuvent pas être utilisés dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlns"> <source>Namespace declaration must start with 'xmlns'.</source> <target state="translated">Une déclaration d'espace de noms doit commencer par 'xmlns'.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlnsPrefix"> <source>Element names cannot use the 'xmlns' prefix.</source> <target state="translated">Les noms d'éléments ne peuvent pas utiliser le préfixe 'xmlns'.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlFeaturesNotAvailable"> <source>XML literals and XML axis properties are not available. Add references to System.Xml, System.Xml.Linq, and System.Core or other assemblies declaring System.Linq.Enumerable, System.Xml.Linq.XElement, System.Xml.Linq.XName, System.Xml.Linq.XAttribute and System.Xml.Linq.XNamespace types.</source> <target state="translated">Les littéraux XML et les propriétés d'axe XML ne sont pas disponibles. Ajoutez des références à System.Xml, System.Xml.Linq et System.Core ou d'autres assemblys qui déclarent des types System.Linq.Enumerable, System.Xml.Linq.XElement, System.Xml.Linq.XName, System.Xml.Linq.XAttribute et System.Xml.Linq.XNamespace.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToReadUacManifest2"> <source>Unable to open Win32 manifest file '{0}' : {1}</source> <target state="translated">Impossible d'ouvrir le fichier manifeste Win32 '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="WRN_UseValueForXmlExpression3"> <source>Cannot convert '{0}' to '{1}'. You can use the 'Value' property to get the string value of the first element of '{2}'.</source> <target state="translated">Impossible de convertir '{0}' en '{1}'. Vous pouvez utiliser la propriété 'Value' pour obtenir la valeur de chaîne du premier élément de '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UseValueForXmlExpression3_Title"> <source>Cannot convert IEnumerable(Of XElement) to String</source> <target state="translated">Impossible de convertir IEnumerable(Of XElement) en String</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMismatchForXml3"> <source>Value of type '{0}' cannot be converted to '{1}'. You can use the 'Value' property to get the string value of the first element of '{2}'.</source> <target state="translated">Impossible de convertir une valeur de type '{0}' en '{1}'. Vous pouvez utiliser la propriété 'Value' pour obtenir la valeur de chaîne du premier élément de '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryOperandsForXml4"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'. You can use the 'Value' property to get the string value of the first element of '{3}'.</source> <target state="translated">L'opérateur '{0}' n'est pas défini pour les types '{1}' et '{2}'. Vous pouvez utiliser la propriété 'Value' pour obtenir la valeur de chaîne du premier élément de '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_FullWidthAsXmlDelimiter"> <source>Full width characters are not valid as XML delimiters.</source> <target state="translated">Les caractères à pleine chasse ne sont pas valides en tant que délimiteurs XML.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSubsystemVersion"> <source>The value '{0}' is not a valid subsystem version. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise.</source> <target state="translated">La valeur '{0}' n'est pas une version de sous-système valide. La version doit être 6.02 ou supérieure pour ARM ou AppContainerExe, et 4.00 ou supérieure dans les autres cas.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFileAlignment"> <source>Invalid file section alignment '{0}'</source> <target state="translated">Alignement de section de fichier non valide '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOutputName"> <source>Invalid output name: {0}</source> <target state="translated">Nom de sortie non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInformationFormat"> <source>Invalid debug information format: {0}</source> <target state="translated">Format des informations de débogage non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_LibAnycpu32bitPreferredConflict"> <source>/platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe.</source> <target state="translated">/platform:anycpu32bitpreferred peut uniquement être utilisé avec /t:exe, /t:winexe et /t:appcontainerexe.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedAccess"> <source>Expression has the type '{0}' which is a restricted type and cannot be used to access members inherited from 'Object' or 'ValueType'.</source> <target state="translated">L'expression a le type '{0}', qui est un type restreint et qui ne peut pas être utilisé pour accéder aux membres hérités de 'Object' ou 'ValueType'.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedConversion1"> <source>Expression of type '{0}' cannot be converted to 'Object' or 'ValueType'.</source> <target state="translated">Impossible de convertir l'expression de type '{0}' en 'Object' ou 'ValueType'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypecharInLabel"> <source>Type characters are not allowed in label identifiers.</source> <target state="translated">Les caractères de type ne sont pas autorisés dans les identificateurs d'étiquette.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedType1"> <source>'{0}' cannot be made nullable, and cannot be used as the data type of an array element, field, anonymous type member, type argument, 'ByRef' parameter, or return statement.</source> <target state="translated">'{0}' ne peut pas être rendu nullable ni être utilisé comme type de données d'un élément de tableau, champ, membre de type anonyme, argument de type, paramètre 'ByRef' ou instruction return.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypecharInAlias"> <source>Type characters are not allowed on Imports aliases.</source> <target state="translated">Les caractères de type ne sont pas autorisés pour les alias Imports.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleConstructorOnBase"> <source>Class '{0}' has no accessible 'Sub New' and cannot be inherited.</source> <target state="translated">La classe '{0}' n'a pas de 'Sub New' accessible et ne peut pas être héritée.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticLocalInStruct"> <source>Local variables within methods of structures cannot be declared 'Static'.</source> <target state="translated">Les variables locales à l'intérieur des méthodes des structures ne peuvent pas être déclarées 'Static'.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocalStatic1"> <source>Static local variable '{0}' is already declared.</source> <target state="translated">Une variable locale statique '{0}' est déjà déclarée.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportAliasConflictsWithType2"> <source>Imports alias '{0}' conflicts with '{1}' declared in the root namespace.</source> <target state="translated">L'alias '{0}' pour Imports est en conflit avec '{1}' déclaré dans l'espace de noms racine.</target> <note /> </trans-unit> <trans-unit id="ERR_CantShadowAMustOverride1"> <source>'{0}' cannot shadow a method declared 'MustOverride'.</source> <target state="translated">'{0}' ne peut pas masquer une méthode déclarée 'MustOverride'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleEventImplMismatch3"> <source>Event '{0}' cannot implement event '{2}.{1}' because its delegate type does not match the delegate type of another event implemented by '{0}'.</source> <target state="translated">L'événement '{0}' ne peut pas implémenter l'événement '{2}.{1}', car son type délégué ne correspond pas au type délégué d'un autre événement implémenté par '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSpecifierCombo2"> <source>'{0}' and '{1}' cannot be combined.</source> <target state="translated">'Impossible de combiner '{0}' et '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_MustBeOverloads2"> <source>{0} '{1}' must be declared 'Overloads' because another '{1}' is declared 'Overloads' or 'Overrides'.</source> <target state="translated">{0} '{1}' doit être déclaré 'Overloads', car un autre '{1}' est déclaré 'Overloads' ou 'Overrides'.</target> <note /> </trans-unit> <trans-unit id="ERR_MustOverridesInClass1"> <source>'{0}' must be declared 'MustInherit' because it contains methods declared 'MustOverride'.</source> <target state="translated">'{0}' doit être déclaré 'MustInherit', car il contient des méthodes déclarées 'MustOverride'.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesSyntaxInClass"> <source>'Handles' in classes must specify a 'WithEvents' variable, 'MyBase', 'MyClass' or 'Me' qualified with a single identifier.</source> <target state="translated">'Dans les classes, 'Handles' doit spécifier une variable 'WithEvents', ou 'MyBase', 'MyClass' ou 'Me' qualifié par un identificateur unique.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberShadowsMustOverride5"> <source>'{0}', implicitly declared for {1} '{2}', cannot shadow a 'MustOverride' method in the base {3} '{4}'.</source> <target state="translated">'{0}', déclaré implicitement pour {1} '{2}', ne peut pas masquer une méthode 'MustOverride' dans le {3} '{4}' de base.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotOverrideInAccessibleMember"> <source>'{0}' cannot override '{1}' because it is not accessible in this context.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car il n'est pas accessible dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesSyntaxInModule"> <source>'Handles' in modules must specify a 'WithEvents' variable qualified with a single identifier.</source> <target state="translated">'Handles' dans les modules doivent spécifier une variable 'WithEvents' qualifiée avec un unique identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOpRequiresReferenceTypes1"> <source>'IsNot' requires operands that have reference types, but this operand has the value type '{0}'.</source> <target state="translated">'IsNot' requiert des opérandes qui ont des types référence, mais cet opérande a le type valeur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ClashWithReservedEnumMember1"> <source>'{0}' conflicts with the reserved member by this name that is implicitly declared in all enums.</source> <target state="translated">'{0}' est en conflit avec le membre réservé par ce nom qui est implicitement déclaré dans tous les enums.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefinedEnumMember2"> <source>'{0}' is already declared in this {1}.</source> <target state="translated">'{0}' est déjà déclaré dans ce {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadUseOfVoid"> <source>'System.Void' can only be used in a GetType expression.</source> <target state="translated">'System.Void' ne peut être utilisé que dans une expression GetType.</target> <note /> </trans-unit> <trans-unit id="ERR_EventImplMismatch5"> <source>Event '{0}' cannot implement event '{1}' on interface '{2}' because their delegate types '{3}' and '{4}' do not match.</source> <target state="translated">L'événement '{0}' ne peut pas implémenter l'événement '{1}' pour l'interface '{2}', car leurs types délégués '{3}' et '{4}' ne correspondent pas.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeUnavailable3"> <source>Type '{0}' in assembly '{1}' has been forwarded to assembly '{2}'. Either a reference to '{2}' is missing from your project or the type '{0}' is missing from assembly '{2}'.</source> <target state="translated">Le type '{0}' dans l'assembly '{1}' a été transmis à l'assembly '{2}'. Soit une référence à '{2}' est absente du projet soit le type '{0}' est absent de l'assembly '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeFwdCycle2"> <source>'{0}' in assembly '{1}' has been forwarded to itself and so is an unsupported type.</source> <target state="translated">'{0}' dans l'assembly '{1}' a été transféré à lui-même et est donc un type non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeInCCExpression"> <source>Non-intrinsic type names are not allowed in conditional compilation expressions.</source> <target state="translated">Les noms de types non intrinsèques ne sont pas autorisés dans les expressions de compilation conditionnelles.</target> <note /> </trans-unit> <trans-unit id="ERR_BadCCExpression"> <source>Syntax error in conditional compilation expression.</source> <target state="translated">Erreur de syntaxe dans l'expression de compilation conditionnelle.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidArrayDisallowed"> <source>Arrays of type 'System.Void' are not allowed in this expression.</source> <target state="translated">Les tableaux de type 'System.Void' ne sont pas autorisés dans cette expression.</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataMembersAmbiguous3"> <source>'{0}' is ambiguous because multiple kinds of members with this name exist in {1} '{2}'.</source> <target state="translated">'{0}' est ambigu, car plusieurs genres de membres portant ce nom existent dans {1} '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOfExprAlwaysFalse2"> <source>Expression of type '{0}' can never be of type '{1}'.</source> <target state="translated">L'expression de type '{0}' ne peut jamais être de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyPrivatePartialMethods1"> <source>Partial methods must be declared 'Private' instead of '{0}'.</source> <target state="translated">Les méthodes partielles doivent être déclarées 'Private' au lieu de '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustBePrivate"> <source>Partial methods must be declared 'Private'.</source> <target state="translated">Les méthodes partielles doivent être déclarées 'Private'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOnePartialMethodAllowed2"> <source>Method '{0}' cannot be declared 'Partial' because only one method '{1}' can be marked 'Partial'.</source> <target state="translated">La méthode '{0}' ne peut pas être déclarée 'Partial', car une seule méthode '{1}' peut être marquée comme 'Partial'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOneImplementingMethodAllowed3"> <source>Method '{0}' cannot implement partial method '{1}' because '{2}' already implements it. Only one method can implement a partial method.</source> <target state="translated">La méthode '{0}' ne peut pas implémenter de méthode partielle '{1}', car '{2}' l'implémente déjà. Une seule méthode peut implémenter une méthode partielle.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodMustBeEmpty"> <source>Partial methods must have empty method bodies.</source> <target state="translated">Les méthodes partielles doivent avoir des corps de méthodes vides.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustBeSub1"> <source>'{0}' cannot be declared 'Partial' because partial methods must be Subs.</source> <target state="translated">'{0}' ne peut pas être déclaré 'Partial', car les méthodes partielles doivent être des Subs.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodGenericConstraints2"> <source>Method '{0}' does not have the same generic constraints as the partial method '{1}'.</source> <target state="translated">La méthode '{0}' n'a pas les mêmes contraintes génériques que la méthode partielle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialDeclarationImplements1"> <source>Partial method '{0}' cannot use the 'Implements' keyword.</source> <target state="translated">La méthode partielle '{0}' ne peut pas utiliser le mot clé 'Implements'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPartialMethodInAddressOf1"> <source>'AddressOf' cannot be applied to '{0}' because '{0}' is a partial method without an implementation.</source> <target state="translated">'AddressOf' ne peut pas être appliqué à '{0}', car '{0}' est une méthode partielle sans implémentation.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementationMustBePrivate2"> <source>Method '{0}' must be declared 'Private' in order to implement partial method '{1}'.</source> <target state="translated">La méthode '{0}' doit être déclarée 'Private' pour implémenter la méthode partielle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamNamesMustMatch3"> <source>Parameter name '{0}' does not match the name of the corresponding parameter, '{1}', defined on the partial method declaration '{2}'.</source> <target state="translated">Le nom de paramètre '{0}' ne correspond pas au nom du paramètre correspondant, '{1}', défini dans la déclaration de méthode partielle '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodTypeParamNameMismatch3"> <source>Name of type parameter '{0}' does not match '{1}', the corresponding type parameter defined on the partial method declaration '{2}'.</source> <target state="translated">Le nom du paramètre de type '{0}' ne correspond pas à '{1}', le paramètre de type correspondant défini dans la déclaration de méthode partielle '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeSharedProperty1"> <source>'Shared' attribute property '{0}' cannot be the target of an assignment.</source> <target state="translated">'La propriété d'attribut 'Shared' '{0}' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeReadOnlyProperty1"> <source>'ReadOnly' attribute property '{0}' cannot be the target of an assignment.</source> <target state="translated">'La propriété d'attribut 'ReadOnly' '{0}' ne peut pas être la cible d'une assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateResourceName1"> <source>Resource name '{0}' cannot be used more than once.</source> <target state="translated">Le nom de ressource '{0}' ne peut pas être utilisé plusieurs fois.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateResourceFileName1"> <source>Each linked resource and module must have a unique filename. Filename '{0}' is specified more than once in this assembly.</source> <target state="translated">Chaque ressource et module liés doivent avoir un nom de fichier unique. Le nom de fichier '{0}' est indiqué plusieurs fois dans cet assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeMustBeClassNotStruct1"> <source>'{0}' cannot be used as an attribute because it is not a class.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant qu'attribut, car ce n'est pas une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeMustInheritSysAttr"> <source>'{0}' cannot be used as an attribute because it does not inherit from 'System.Attribute'.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant qu'attribut, car il n'hérite pas de 'System.Attribute'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeCannotBeAbstract"> <source>'{0}' cannot be used as an attribute because it is declared 'MustInherit'.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant qu'attribut, car il est déclaré 'MustInherit'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToOpenResourceFile1"> <source>Unable to open resource file '{0}': {1}</source> <target state="translated">Impossible d'ouvrir le fichier de ressources '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicProperty1"> <source>Attribute member '{0}' cannot be the target of an assignment because it is not declared 'Public'.</source> <target state="translated">Le membre d'attribut '{0}' ne peut pas être la cible d'une assignation, car il n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_STAThreadAndMTAThread0"> <source>'System.STAThreadAttribute' and 'System.MTAThreadAttribute' cannot both be applied to the same method.</source> <target state="translated">'Impossible d'appliquer à la fois 'System.STAThreadAttribute' et 'System.MTAThreadAttribute' à la même méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_IndirectUnreferencedAssembly4"> <source>Project '{0}' makes an indirect reference to assembly '{1}', which contains '{2}'. Add a file reference to '{3}' to your project.</source> <target state="translated">Le projet '{0}' établit une référence indirecte à l'assembly '{1}', qui contient '{2}'. Ajoutez une référence de fichier pour '{3}' dans votre projet.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicType1"> <source>Type '{0}' cannot be used in an attribute because it is not declared 'Public'.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans un attribut, car il n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicContType2"> <source>Type '{0}' cannot be used in an attribute because its container '{1}' is not declared 'Public'.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans un attribut, car son conteneur '{1}' n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnNonEmptySubOrFunction"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Sub, Function, or Operator with a non-empty body.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à un Sub, Function ou Operator avec un corps non vide.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnDeclare"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Declare.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à un Declare.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnGetOrSet"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Get or Set.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à un Get ou Set.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnGenericSubOrFunction"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a method that is generic or contained in a generic type.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à une méthode générique ou contenue dans un type générique.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassOnGeneric"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to a class that is generic or contained inside a generic type.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' ne peut pas être appliqué à une classe qui est générique ou contenue dans un type générique.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInstanceMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to instance method.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à une méthode d'instance.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInterfaceMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to interface methods.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué aux méthodes d'interface.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnEventMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to 'AddHandler', 'RemoveHandler' or 'RaiseEvent' method.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué à une méthode 'AddHandler', 'RemoveHandler' ou 'RaiseEvent'.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadArguments"> <source>Friend assembly reference '{0}' is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.</source> <target state="translated">La référence d'assembly Friend '{0}' n'est pas valide. Les déclarations InternalsVisibleTo ne peuvent pas avoir une version, une culture, un jeton de clé publique ou une architecture de processeur spécifié.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyStrongNameRequired"> <source>Friend assembly reference '{0}' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.</source> <target state="translated">La référence d'assembly Friend '{0}' n'est pas valide. Les assemblys signés avec un nom fort doivent spécifier une clé publique dans leurs déclarations InternalsVisibleTo.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyNameInvalid"> <source>Friend declaration '{0}' is invalid and cannot be resolved.</source> <target state="translated">La déclaration Friend '{0}' n'est pas valide et ne peut pas être résolue.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadAccessOverride2"> <source>Member '{0}' cannot override member '{1}' defined in another assembly/project because the access modifier 'Protected Friend' expands accessibility. Use 'Protected' instead.</source> <target state="translated">Le membre '{0}' ne peut pas se substituer au membre '{1}' défini dans un autre assembly/projet, car le modificateur d'accès 'Protected Friend' étend l'accessibilité. Utilisez 'Protected' à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfLocalBeforeDeclaration1"> <source>Local variable '{0}' cannot be referred to before it is declared.</source> <target state="translated">Il ne peut exister aucune référence à la variable locale '{0}' tant que cette variable n'est pas déclarée.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordFromModule1"> <source>'{0}' is not valid within a Module.</source> <target state="translated">'{0}' n'est pas valide dans un module.</target> <note /> </trans-unit> <trans-unit id="ERR_BogusWithinLineIf"> <source>Statement cannot end a block outside of a line 'If' statement.</source> <target state="translated">L'instruction ne peut pas terminer un bloc en dehors d'une instruction 'If'.</target> <note /> </trans-unit> <trans-unit id="ERR_CharToIntegralTypeMismatch1"> <source>'Char' values cannot be converted to '{0}'. Use 'Microsoft.VisualBasic.AscW' to interpret a character as a Unicode value or 'Microsoft.VisualBasic.Val' to interpret it as a digit.</source> <target state="translated">'Impossible de convertir les valeurs 'Char' en '{0}'. Utilisez soit 'Microsoft.VisualBasic.AscW' pour interpréter un caractère comme une valeur Unicode, soit 'Microsoft.VisualBasic.Val' pour interpréter le caractère comme un chiffre.</target> <note /> </trans-unit> <trans-unit id="ERR_IntegralToCharTypeMismatch1"> <source>'{0}' values cannot be converted to 'Char'. Use 'Microsoft.VisualBasic.ChrW' to interpret a numeric value as a Unicode character or first convert it to 'String' to produce a digit.</source> <target state="translated">'Impossible de convertir les valeurs '{0}' en 'Char'. Utilisez 'Microsoft.VisualBasic.ChrW' pour interpréter une valeur numérique en tant que caractère Unicode ou convertissez-la d'abord en 'String' pour obtenir un chiffre.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDirectDelegateConstruction1"> <source>Delegate '{0}' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor.</source> <target state="translated">Le délégué '{0}' requiert une expression 'AddressOf' ou une expression lambda en tant qu'unique argument de son constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodMustBeFirstStatementOnLine"> <source>Method declaration statements must be the first statement on a logical line.</source> <target state="translated">Une instruction de déclaration de méthode doit être la première instruction d'une ligne logique.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrAssignmentNotFieldOrProp1"> <source>'{0}' cannot be named as a parameter in an attribute specifier because it is not a field or property.</source> <target state="translated">'{0}' ne peut pas être nommé en tant que paramètre dans un spécificateur d'attribut, car ce n'est ni un champ ni une propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsObjectComparison1"> <source>Option Strict On disallows operands of type Object for operator '{0}'. Use the 'Is' operator to test for object identity.</source> <target state="translated">Option Strict On n'autorise pas les opérandes de type Object pour l'opérateur '{0}'. Utilisez l'opérateur 'Is' pour tester l'identité de l'objet.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstituentArraySizes"> <source>Bounds can be specified only for the top-level array when initializing an array of arrays.</source> <target state="translated">Les limites ne peuvent être spécifiées que pour le tableau de premier niveau lors de l'initialisation d'un tableau de tableaux.</target> <note /> </trans-unit> <trans-unit id="ERR_FileAttributeNotAssemblyOrModule"> <source>'Assembly' or 'Module' expected.</source> <target state="translated">'Assembly' ou 'Module' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_FunctionResultCannotBeIndexed1"> <source>'{0}' has no parameters and its return type cannot be indexed.</source> <target state="translated">'{0}' n'a aucun paramètre et son type de retour ne peut pas être indexé.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentSyntax"> <source>Comma, ')', or a valid expression continuation expected.</source> <target state="translated">Virgule, ')' ou continuation d'expression valide attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedResumeOrGoto"> <source>'Resume' or 'GoTo' expected.</source> <target state="translated">'Resume' ou 'GoTo' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAssignmentOperator"> <source>'=' expected.</source> <target state="translated">'=' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted2"> <source>Parameter '{0}' in '{1}' already has a matching omitted argument.</source> <target state="translated">Le paramètre '{0}' dans '{1}' a déjà un argument omis correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotCallEvent1"> <source>'{0}' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.</source> <target state="translated">'{0}' est un événement. Il ne peut donc pas être appelé directement. Utilisez une instruction 'RaiseEvent' pour déclencher un événement.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachCollectionDesignPattern1"> <source>Expression is of type '{0}', which is not a collection type.</source> <target state="translated">L'expression est du type '{0}', qui n'est pas un type de collection.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueForNonOptionalParam"> <source>Default values cannot be supplied for parameters that are not declared 'Optional'.</source> <target state="translated">Des valeurs par défaut ne peuvent pas être fournies pour des paramètres qui ne sont pas déclarés 'Optional'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterMyBase"> <source>'MyBase' must be followed by '.' and an identifier.</source> <target state="translated">'MyBase' doit être suivi de '.' et d'un identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterMyClass"> <source>'MyClass' must be followed by '.' and an identifier.</source> <target state="translated">'MyClass' doit être suivi de '.' et d'un identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictArgumentCopyBackNarrowing3"> <source>Option Strict On disallows narrowing from type '{1}' to type '{2}' in copying the value of 'ByRef' parameter '{0}' back to the matching argument.</source> <target state="translated">Option Strict On interdit le passage du type '{1}' au type '{2}' lors de la recopie de la valeur du paramètre 'ByRef' '{0}' dans l'argument correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_LbElseifAfterElse"> <source>'#ElseIf' cannot follow '#Else' as part of a '#If' block.</source> <target state="translated">'#ElseIf' ne peut pas suivre '#Else' dans un bloc '#If'.</target> <note /> </trans-unit> <trans-unit id="ERR_StandaloneAttribute"> <source>Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.</source> <target state="translated">Le spécificateur d'attribut n'est pas une instruction complète. Utilisez un signe de continuation de ligne pour appliquer l'attribut à l'instruction suivante.</target> <note /> </trans-unit> <trans-unit id="ERR_NoUniqueConstructorOnBase2"> <source>Class '{0}' must declare a 'Sub New' because its base class '{1}' has more than one accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car sa classe de base '{1}' comporte plus de 'Sub New' accessibles qu'il n'est possible d'appeler sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtraNextVariable"> <source>'Next' statement names more variables than there are matching 'For' statements.</source> <target state="translated">'L'instruction 'Next' nomme plus de variables qu'il n'existe d'instructions 'For' correspondantes.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNewCallTooMany2"> <source>First statement of this 'Sub New' must be a call to 'MyBase.New' or 'MyClass.New' because base class '{0}' of '{1}' has more than one accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel à 'MyBase.New' ou 'MyClass.New', car la classe de base '{0}' de '{1}' a plusieurs 'Sub New' accessibles qu'il est possible d'appeler sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_ForCtlVarArraySizesSpecified"> <source>Array declared as for loop control variable cannot be declared with an initial size.</source> <target state="translated">Un tableau déclaré en tant que variable de contrôle de boucle for ne peut pas être déclaré avec une taille initiale.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnNewOverloads"> <source>The '{0}' keyword is used to overload inherited members; do not use the '{0}' keyword when overloading 'Sub New'.</source> <target state="translated">Le mot clé '{0}' est utilisé pour surcharger les membres hérités ; n'utilisez pas le mot clé '{0}' lors de la surcharge de 'Sub New'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnGenericParam"> <source>Type character cannot be used in a type parameter declaration.</source> <target state="translated">Le caractère de type ne peut pas être utilisé dans une déclaration de paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewGenericArguments1"> <source>Too few type arguments to '{0}'.</source> <target state="translated">Arguments de type insuffisants dans '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyGenericArguments1"> <source>Too many type arguments to '{0}'.</source> <target state="translated">Arguments de type trop nombreux dans '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfied2"> <source>Type argument '{0}' does not inherit from or implement the constraint type '{1}'.</source> <target state="translated">L'argument de type '{0}' n'hérite pas ou n'implémente pas le type de contrainte '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOrMemberNotGeneric1"> <source>'{0}' has no type parameters and so cannot have type arguments.</source> <target state="translated">'{0}' n'a pas de paramètres de type et donc ne peut pas avoir d'arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_NewIfNullOnGenericParam"> <source>'New' cannot be used on a type parameter that does not have a 'New' constraint.</source> <target state="translated">'New' ne peut pas être utilisé pour un paramètre de type qui n'a pas de contrainte 'New'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleClassConstraints1"> <source>Type parameter '{0}' can only have one constraint that is a class.</source> <target state="translated">Le paramètre de type '{0}' ne peut avoir qu'une seule contrainte qui est une classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstNotClassInterfaceOrTypeParam1"> <source>Type constraint '{0}' must be either a class, interface or type parameter.</source> <target state="translated">La contrainte de type '{0}' doit être un paramètre de classe, d'interface ou de type.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateTypeParamName1"> <source>Type parameter already declared with name '{0}'.</source> <target state="translated">Le paramètre de type est déjà déclaré avec le nom '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam2"> <source>Type parameter '{0}' for '{1}' cannot be inferred.</source> <target state="translated">Le paramètre de type '{0}' pour '{1}' ne peut pas être déduit.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorGenericParam1"> <source>'Is' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a type parameter with no class constraint.</source> <target state="translated">'L'opérande 'Is' de type '{0}' ne peut être comparé qu'à 'Nothing', car '{0}' est un paramètre de type sans contrainte de classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentCopyBackNarrowing3"> <source>Copying the value of 'ByRef' parameter '{0}' back to the matching argument narrows from type '{1}' to type '{2}'.</source> <target state="translated">La copie de la valeur du paramètre 'ByRef' '{0}' dans l'argument correspondant passe du type '{1}' au type '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ShadowingGenericParamWithMember1"> <source>'{0}' has the same name as a type parameter.</source> <target state="translated">'{0}' porte le même nom qu'un paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericParamBase2"> <source>{0} '{1}' cannot inherit from a type parameter.</source> <target state="translated">{0} '{1}' ne peut pas hériter d'un paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsGenericParam"> <source>Type parameter not allowed in 'Implements' clause.</source> <target state="translated">Le paramètre de type n'est pas autorisé dans la clause 'Implements'.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyNullLowerBound"> <source>Array lower bounds can be only '0'.</source> <target state="translated">Les limites inférieures du tableau ne peuvent être que '0'.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassConstraintNotInheritable1"> <source>Type constraint cannot be a 'NotInheritable' class.</source> <target state="translated">La contrainte de type ne peut pas être une classe 'NotInheritable'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintIsRestrictedType1"> <source>'{0}' cannot be used as a type constraint.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant que contrainte de type.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericParamsOnInvalidMember"> <source>Type parameters cannot be specified on this declaration.</source> <target state="translated">Les paramètres de type ne peuvent pas être spécifiés pour cette déclaration.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericArgsOnAttributeSpecifier"> <source>Type arguments are not valid because attributes cannot be generic.</source> <target state="translated">Les arguments de type ne sont pas valides, car les attributs ne peuvent pas être génériques.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrCannotBeGenerics"> <source>Type parameters, generic types or types contained in generic types cannot be used as attributes.</source> <target state="translated">Les paramètres de type, les types génériques ou les types contenus dans des types génériques ne peuvent pas être utilisés comme attributs.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticLocalInGenericMethod"> <source>Local variables within generic methods cannot be declared 'Static'.</source> <target state="translated">Les variables locales dans les méthodes génériques ne peuvent pas être déclarées 'Static'.</target> <note /> </trans-unit> <trans-unit id="ERR_SyntMemberShadowsGenericParam3"> <source>{0} '{1}' implicitly defines a member '{2}' which has the same name as a type parameter.</source> <target state="translated">{0} '{1}' définit implicitement un membre '{2}' qui a le même nom que le paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintAlreadyExists1"> <source>Constraint type '{0}' already specified for this type parameter.</source> <target state="translated">Le type de contrainte '{0}' est déjà spécifié pour ce paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacePossiblyImplTwice2"> <source>Cannot implement interface '{0}' because its implementation could conflict with the implementation of another implemented interface '{1}' for some type arguments.</source> <target state="translated">Impossible d'implémenter l'interface '{0}', car son implémentation pourrait être en conflit avec l'implémentation d'une autre interface '{1}' implémentée pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ModulesCannotBeGeneric"> <source>Modules cannot be generic.</source> <target state="translated">Les modules ne peuvent pas être génériques.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericClassCannotInheritAttr"> <source>Classes that are generic or contained in a generic type cannot inherit from an attribute class.</source> <target state="translated">Les classes qui sont génériques ou contenues dans un type générique ne peuvent pas hériter d'une classe d'attributs.</target> <note /> </trans-unit> <trans-unit id="ERR_DeclaresCantBeInGeneric"> <source>'Declare' statements are not allowed in generic types or types contained in generic types.</source> <target state="translated">'Les instructions 'Declare' ne sont pas autorisées dans les types génériques ou les types contenus dans des types génériques.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithConstraintMismatch2"> <source>'{0}' cannot override '{1}' because they differ by type parameter constraints.</source> <target state="translated">'{0}' ne peut pas se substituer à '{1}', car leurs contraintes de paramètre de type les différencient.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsWithConstraintMismatch3"> <source>'{0}' cannot implement '{1}.{2}' because they differ by type parameter constraints.</source> <target state="translated">'{0}' ne peut pas implémenter '{1}.{2}', car ils diffèrent par leur contraintes de paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_OpenTypeDisallowed"> <source>Type parameters or types constructed with type parameters are not allowed in attribute arguments.</source> <target state="translated">Les paramètres de type ou les types construits avec des paramètres de type ne sont pas autorisés dans les arguments d'attribut.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesInvalidOnGenericMethod"> <source>Generic methods cannot use 'Handles' clause.</source> <target state="translated">Les méthodes génériques ne peuvent pas utiliser une clause 'Handles'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleNewConstraints"> <source>'New' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'La contrainte 'New' ne peut pas être spécifiée plusieurs fois pour le même paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_MustInheritForNewConstraint2"> <source>Type argument '{0}' is declared 'MustInherit' and does not satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">L'argument de type '{0}' est déclaré 'MustInherit' et ne satisfait pas la contrainte 'New' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuitableNewForNewConstraint2"> <source>Type argument '{0}' must have a public parameterless instance constructor to satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">L'argument de type '{0}' doit avoir un constructeur d'instance sans paramètre public pour satisfaire la contrainte 'New' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGenericParamForNewConstraint2"> <source>Type parameter '{0}' must have either a 'New' constraint or a 'Structure' constraint to satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">Le paramètre de type '{0}' doit avoir une contrainte 'New' ou une contrainte 'Structure' pour satisfaire la contrainte 'New' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NewArgsDisallowedForTypeParam"> <source>Arguments cannot be passed to a 'New' used on a type parameter.</source> <target state="translated">Les arguments ne peuvent pas être passés à un 'New' utilisé pour un paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRawGenericTypeImport1"> <source>Generic type '{0}' cannot be imported more than once.</source> <target state="translated">Le type générique '{0}' ne peut pas être importé plus d'une fois.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypeArgumentCountOverloadCand1"> <source>Overload resolution failed because no accessible '{0}' accepts this number of type arguments.</source> <target state="translated">La résolution de surcharge a échoué, car aucun '{0}' accessible n'accepte ce nombre d'arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeArgsUnexpected"> <source>Type arguments unexpected.</source> <target state="translated">Arguments de type inattendus.</target> <note /> </trans-unit> <trans-unit id="ERR_NameSameAsMethodTypeParam1"> <source>'{0}' is already declared as a type parameter of this method.</source> <target state="translated">'{0}' est déjà déclaré en tant que paramètre de type de cette méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamNameFunctionNameCollision"> <source>Type parameter cannot have the same name as its defining function.</source> <target state="translated">Un paramètre de type ne peut pas avoir le même nom que sa fonction de définition.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstraintSyntax"> <source>Type or 'New' expected.</source> <target state="translated">Type ou 'New' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_OfExpected"> <source>'Of' required when specifying type arguments for a generic type or method.</source> <target state="translated">'Of' requis lors de la spécification des arguments de type pour un type ou une méthode générique.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayOfRawGenericInvalid"> <source>'(' unexpected. Arrays of uninstantiated generic types are not allowed.</source> <target state="translated">'(' inattendu. Les tableaux de types génériques non instanciés ne sont pas autorisés.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachAmbiguousIEnumerable1"> <source>'For Each' on type '{0}' is ambiguous because the type implements multiple instantiations of 'System.Collections.Generic.IEnumerable(Of T)'.</source> <target state="translated">'For Each' pour le type '{0}' est ambigu, car le type implémente plusieurs instanciations de 'System.Collections.Generic.IEnumerable(Of T)'.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOperatorGenericParam1"> <source>'IsNot' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a type parameter with no class constraint.</source> <target state="translated">'L'opérande 'IsNot' de type '{0}' peut être comparé uniquement à 'Nothing', car '{0}' est un paramètre de type sans contrainte de classe.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamQualifierDisallowed"> <source>Type parameters cannot be used as qualifiers.</source> <target state="translated">Les paramètres de type ne peuvent pas être utilisés comme qualificateurs.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMissingCommaOrRParen"> <source>Comma or ')' expected.</source> <target state="translated">Virgule ou ')' attendue.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMissingAsCommaOrRParen"> <source>'As', comma or ')' expected.</source> <target state="translated">'As', virgule ou ')' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleReferenceConstraints"> <source>'Class' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'La contrainte 'Class' ne peut pas être spécifiée plusieurs fois pour le même paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleValueConstraints"> <source>'Structure' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'La contrainte 'Structure' ne peut pas être spécifiée plusieurs fois pour le même paramètre de type.</target> <note /> </trans-unit> <trans-unit id="ERR_NewAndValueConstraintsCombined"> <source>'New' constraint and 'Structure' constraint cannot be combined.</source> <target state="translated">'La contrainte 'New' et la contrainte 'Structure' ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAndValueConstraintsCombined"> <source>'Class' constraint and 'Structure' constraint cannot be combined.</source> <target state="translated">'La contrainte 'Class' et la contrainte 'Structure' ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForStructConstraint2"> <source>Type argument '{0}' does not satisfy the 'Structure' constraint for type parameter '{1}'.</source> <target state="translated">L'argument de type '{0}' ne satisfait pas la contrainte 'Structure' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForRefConstraint2"> <source>Type argument '{0}' does not satisfy the 'Class' constraint for type parameter '{1}'.</source> <target state="translated">L'argument de type '{0}' ne satisfait pas la contrainte 'Class' pour le paramètre de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAndClassTypeConstrCombined"> <source>'Class' constraint and a specific class type constraint cannot be combined.</source> <target state="translated">'Une contrainte 'Class' et une contrainte de type classe spécifique ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueAndClassTypeConstrCombined"> <source>'Structure' constraint and a specific class type constraint cannot be combined.</source> <target state="translated">'Une contrainte 'Structure' et une contrainte de type classe spécifique ne peuvent pas être combinées.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashIndirectIndirect4"> <source>Indirect constraint '{0}' obtained from the type parameter constraint '{1}' conflicts with the indirect constraint '{2}' obtained from the type parameter constraint '{3}'.</source> <target state="translated">La contrainte indirecte '{0}' obtenue de la contrainte de paramètre de type '{1}' est en conflit avec la contrainte indirecte '{2}' obtenue de la contrainte de paramètre de type '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashDirectIndirect3"> <source>Constraint '{0}' conflicts with the indirect constraint '{1}' obtained from the type parameter constraint '{2}'.</source> <target state="translated">La contrainte '{0}' est en conflit avec la contrainte indirecte '{1}' obtenue de la contrainte de paramètre de type '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashIndirectDirect3"> <source>Indirect constraint '{0}' obtained from the type parameter constraint '{1}' conflicts with the constraint '{2}'.</source> <target state="translated">La contrainte indirecte '{0}' obtenue à partir de la contrainte de paramètre de type '{1}' est en conflit avec la contrainte '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintCycleLink2"> <source> '{0}' is constrained to '{1}'.</source> <target state="translated"> '{0}' est limité à '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintCycle2"> <source>Type parameter '{0}' cannot be constrained to itself: {1}</source> <target state="translated">Le paramètre de type '{0}' ne peut pas être limité par lui-même : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamWithStructConstAsConst"> <source>Type parameter with a 'Structure' constraint cannot be used as a constraint.</source> <target state="translated">Un paramètre de type avec une contrainte 'Structure' ne peut pas être utilisé en tant que contrainte.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableDisallowedForStructConstr1"> <source>'System.Nullable' does not satisfy the 'Structure' constraint for type parameter '{0}'. Only non-nullable 'Structure' types are allowed.</source> <target state="translated">'System.Nullable' ne satisfait pas la contrainte 'Structure' pour le paramètre de type '{0}'. Seuls les types 'Structure' non-nullable sont autorisés.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingDirectConstraints3"> <source>Constraint '{0}' conflicts with the constraint '{1}' already specified for type parameter '{2}'.</source> <target state="translated">La contrainte '{0}' est en conflit avec la contrainte '{1}' déjà spécifiée pour le paramètre de type '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceUnifiesWithInterface2"> <source>Cannot inherit interface '{0}' because it could be identical to interface '{1}' for some type arguments.</source> <target state="translated">Impossible d'hériter de l'interface '{0}', car elle peut être identique à l'interface '{1}' pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseUnifiesWithInterfaces3"> <source>Cannot inherit interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' for some type arguments.</source> <target state="translated">Impossible d'hériter de l'interface '{0}', car l'interface '{1}' dont elle hérite peut être identique à l'interface '{2}' pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceBaseUnifiesWithBase4"> <source>Cannot inherit interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' from which the interface '{3}' inherits for some type arguments.</source> <target state="translated">Impossible d'hériter de l'interface '{0}', car l'interface '{1}' dont elle hérite peut être identique à l'interface '{2}' dont l'interface '{3}' hérite pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceUnifiesWithBase3"> <source>Cannot inherit interface '{0}' because it could be identical to interface '{1}' from which the interface '{2}' inherits for some type arguments.</source> <target state="translated">Impossible d'hériter de l'interface '{0}', car elle peut être identique à l'interface '{1}' dont l'interface '{2}' hérite pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsBaseUnifiesWithInterfaces3"> <source>Cannot implement interface '{0}' because the interface '{1}' from which it inherits could be identical to implemented interface '{2}' for some type arguments.</source> <target state="translated">Impossible d'implémenter l'interface '{0}', car l'interface '{1}' dont elle hérite peut être identique à l'interface '{2}' implémentée pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsInterfaceBaseUnifiesWithBase4"> <source>Cannot implement interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' from which the implemented interface '{3}' inherits for some type arguments.</source> <target state="translated">Impossible d'implémenter l'interface '{0}', car l'interface '{1}' dont elle hérite peut être identique à l'interface '{2}' dont l'interface '{3}' implémentée hérite pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsInterfaceUnifiesWithBase3"> <source>Cannot implement interface '{0}' because it could be identical to interface '{1}' from which the implemented interface '{2}' inherits for some type arguments.</source> <target state="translated">Impossible d'implémenter l'interface '{0}', car elle peut être identique à l'interface '{1}' dont l'interface '{2}' implémentée hérite pour certains arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionalsCantBeStructGenericParams"> <source>Generic parameters used as optional parameter types must be class constrained.</source> <target state="translated">Les paramètres génériques utilisés en tant que types de paramètre optionnels doivent être contraints par classe.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNullableMethod"> <source>Methods of 'System.Nullable(Of T)' cannot be used as operands of the 'AddressOf' operator.</source> <target state="translated">Les méthodes de 'System.Nullable(Of T)' ne peuvent pas être utilisées en tant qu'opérandes de l'opérateur 'AddressOf'.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorNullable1"> <source>'Is' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a nullable type.</source> <target state="translated">'L'opérande 'Is' de type '{0}' ne peut être comparé qu'à 'Nothing', car '{0}' est un type Nullable.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOperatorNullable1"> <source>'IsNot' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a nullable type.</source> <target state="translated">'L'opérande 'IsNot' de type '{0}' ne peut être comparé qu'à 'Nothing', car '{0}' est un type Nullable.</target> <note /> </trans-unit> <trans-unit id="ERR_ShadowingTypeOutsideClass1"> <source>'{0}' cannot be declared 'Shadows' outside of a class, structure, or interface.</source> <target state="translated">'{0}' ne peut pas être déclaré 'Shadows' en dehors d'une classe, d'une structure ou d'une interface.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertySetParamCollisionWithValue"> <source>Property parameters cannot have the name 'Value'.</source> <target state="translated">Les paramètres de propriété ne peuvent pas porter le nom 'Value'.</target> <note /> </trans-unit> <trans-unit id="ERR_SxSIndirectRefHigherThanDirectRef3"> <source>The project currently contains references to more than one version of '{0}', a direct reference to version {2} and an indirect reference to version {1}. Change the direct reference to use version {1} (or higher) of {0}.</source> <target state="translated">Le projet contient actuellement des références à plusieurs versions de '{0}', une référence directe à la version {2} et une référence indirecte à la version {1}. Modifiez la référence directe pour utiliser la version {1} (ou supérieure) de {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateReferenceStrong"> <source>Multiple assemblies with equivalent identity have been imported: '{0}' and '{1}'. Remove one of the duplicate references.</source> <target state="translated">Plusieurs assemblys ayant une identité équivalente ont été importés : '{0}' et '{1}'. Supprimez une des références en double.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateReference2"> <source>Project already has a reference to assembly '{0}'. A second reference to '{1}' cannot be added.</source> <target state="translated">Le projet a déjà une référence à l'assembly '{0}'. Une seconde référence à '{1}' ne peut pas être ajoutée.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCallOrIndex"> <source>Illegal call expression or index expression.</source> <target state="translated">Expression d'appel ou expression d'index non conforme.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictDefaultPropertyAttribute"> <source>Conflict between the default property and the 'DefaultMemberAttribute' defined on '{0}'.</source> <target state="translated">Conflit entre la propriété par défaut et le 'DefaultMemberAttribute' défini pour '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeUuid2"> <source>'{0}' cannot be applied because the format of the GUID '{1}' is not correct.</source> <target state="translated">'Impossible d'appliquer '{0}', car le format du GUID '{1}' n'est pas correct.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassAndReservedAttribute1"> <source>'Microsoft.VisualBasic.ComClassAttribute' and '{0}' cannot both be applied to the same class.</source> <target state="translated">'Impossible d'appliquer à la fois 'Microsoft.VisualBasic.ComClassAttribute' et '{0}' à la même classe.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassRequiresPublicClass2"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to '{0}' because its container '{1}' is not declared 'Public'.</source> <target state="translated">'Impossible d'appliquer 'Microsoft.VisualBasic.ComClassAttribute' à '{0}', car son conteneur '{1}' n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassReservedDispIdZero1"> <source>'System.Runtime.InteropServices.DispIdAttribute' cannot be applied to '{0}' because 'Microsoft.VisualBasic.ComClassAttribute' reserves zero for the default property.</source> <target state="translated">'System.Runtime.InteropServices.DispIdAttribute' ne peut pas être appliqué à '{0}', car 'Microsoft.VisualBasic.ComClassAttribute' réserve zéro pour la propriété par défaut.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassReservedDispId1"> <source>'System.Runtime.InteropServices.DispIdAttribute' cannot be applied to '{0}' because 'Microsoft.VisualBasic.ComClassAttribute' reserves values less than zero.</source> <target state="translated">'System.Runtime.InteropServices.DispIdAttribute' ne peut pas être appliqué à '{0}', car 'Microsoft.VisualBasic.ComClassAttribute' réserve des valeurs inférieures à zéro.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassDuplicateGuids1"> <source>'InterfaceId' and 'EventsId' parameters for 'Microsoft.VisualBasic.ComClassAttribute' on '{0}' cannot have the same value.</source> <target state="translated">'Les paramètres 'InterfaceId' et 'EventsId' pour 'Microsoft.VisualBasic.ComClassAttribute' pour '{0}' ne peuvent pas avoir la même valeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassCantBeAbstract0"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to a class that is declared 'MustInherit'.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' ne peut pas être appliqué à une classe qui est déclarée 'MustInherit'.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassRequiresPublicClass1"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to '{0}' because it is not declared 'Public'.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' ne peut pas être appliqué à '{0}', car il n'est pas déclaré 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnknownOperator"> <source>Operator declaration must be one of: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</source> <target state="translated">La déclaration d'opérateur doit être l'une des suivantes : +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateConversionCategoryUsed"> <source>'Widening' and 'Narrowing' cannot be combined.</source> <target state="translated">'Widening' et 'Narrowing' ne peuvent pas être combinés.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorNotOverloadable"> <source>Operator is not overloadable. Operator declaration must be one of: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</source> <target state="translated">L'opérateur n'est pas surchargeable. La déclaration d'opérateur doit être l'une des suivantes : +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHandles"> <source>'Handles' is not valid on operator declarations.</source> <target state="translated">'Handles' n'est pas valide pour les déclarations d'opérateur.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplements"> <source>'Implements' is not valid on operator declarations.</source> <target state="translated">'Implements' n'est pas valide pour les déclarations d'opérateur.</target> <note /> </trans-unit> <trans-unit id="ERR_EndOperatorExpected"> <source>'End Operator' expected.</source> <target state="translated">'End Operator' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_EndOperatorNotAtLineStart"> <source>'End Operator' must be the first statement on a line.</source> <target state="translated">'End Operator' doit être la première instruction sur une ligne.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndOperator"> <source>'End Operator' must be preceded by a matching 'Operator'.</source> <target state="translated">'End Operator' doit être précédé d'un 'Operator' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitOperatorNotValid"> <source>'Exit Operator' is not valid. Use 'Return' to exit an operator.</source> <target state="translated">'Exit Operator' n'est pas valide. Utilisez 'Return' pour quitter un opérateur.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayIllegal1"> <source>'{0}' parameters cannot be declared 'ParamArray'.</source> <target state="translated">'Les paramètres '{0}' ne peuvent pas être déclarés 'ParamArray'.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionalIllegal1"> <source>'{0}' parameters cannot be declared 'Optional'.</source> <target state="translated">'Les paramètres '{0}' ne peuvent pas être déclarés 'Optional'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorMustBePublic"> <source>Operators must be declared 'Public'.</source> <target state="translated">Les opérateurs doivent être déclarés 'Public'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorMustBeShared"> <source>Operators must be declared 'Shared'.</source> <target state="translated">Les opérateurs doivent être déclarés 'Shared'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadOperatorFlags1"> <source>Operators cannot be declared '{0}'.</source> <target state="translated">Les opérateurs ne peuvent pas être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OneParameterRequired1"> <source>Operator '{0}' must have one parameter.</source> <target state="translated">L'opérateur '{0}' doit avoir un paramètre.</target> <note /> </trans-unit> <trans-unit id="ERR_TwoParametersRequired1"> <source>Operator '{0}' must have two parameters.</source> <target state="translated">L'opérateur '{0}' doit avoir deux paramètres.</target> <note /> </trans-unit> <trans-unit id="ERR_OneOrTwoParametersRequired1"> <source>Operator '{0}' must have either one or two parameters.</source> <target state="translated">L'opérateur '{0}' doit avoir un ou deux paramètres.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvMustBeWideningOrNarrowing"> <source>Conversion operators must be declared either 'Widening' or 'Narrowing'.</source> <target state="translated">Les opérateurs de conversion doivent être déclarés 'Widening' ou 'Narrowing'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorDeclaredInModule"> <source>Operators cannot be declared in modules.</source> <target state="translated">Les opérateurs ne peuvent pas être déclarés dans des modules.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSpecifierOnNonConversion1"> <source>Only conversion operators can be declared '{0}'.</source> <target state="translated">Seuls les opérateurs de conversion peuvent être déclarés '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnaryParamMustBeContainingType1"> <source>Parameter of this unary operator must be of the containing type '{0}'.</source> <target state="translated">Le paramètre de cet opérateur unaire doit être du type conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryParamMustBeContainingType1"> <source>At least one parameter of this binary operator must be of the containing type '{0}'.</source> <target state="translated">Au moins un paramètre de cet opérateur binaire doit être du type conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvParamMustBeContainingType1"> <source>Either the parameter type or the return type of this conversion operator must be of the containing type '{0}'.</source> <target state="translated">Le type de paramètre ou le type de retour de cet opérateur de conversion doit être du type conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorRequiresBoolReturnType1"> <source>Operator '{0}' must have a return type of Boolean.</source> <target state="translated">L'opérateur '{0}' doit avoir un type de retour Boolean.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToSameType"> <source>Conversion operators cannot convert from a type to the same type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir d'un type en un type identique.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToInterfaceType"> <source>Conversion operators cannot convert to an interface type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir en un type interface.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToBaseType"> <source>Conversion operators cannot convert from a type to its base type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir d'un type en son type de base.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToDerivedType"> <source>Conversion operators cannot convert from a type to its derived type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'un type en son type dérivé.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToObject"> <source>Conversion operators cannot convert to Object.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir en Object.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromInterfaceType"> <source>Conversion operators cannot convert from an interface type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'un type interface.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromBaseType"> <source>Conversion operators cannot convert from a base type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'un type de base.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromDerivedType"> <source>Conversion operators cannot convert from a derived type.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'un type dérivé.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromObject"> <source>Conversion operators cannot convert from Object.</source> <target state="translated">Les opérateurs de conversion ne peuvent pas convertir à partir d'Object.</target> <note /> </trans-unit> <trans-unit id="ERR_MatchingOperatorExpected2"> <source>Matching '{0}' operator is required for '{1}'.</source> <target state="translated">Un opérateur '{0}' correspondant est requis pour '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableLogicalOperator3"> <source>Return and parameter types of '{0}' must be '{1}' to be used in a '{2}' expression.</source> <target state="translated">Les types de retour et de paramètres de '{0}' doivent être '{1}' pour être utilisés dans une expression '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionOperatorRequired3"> <source>Type '{0}' must define operator '{1}' to be used in a '{2}' expression.</source> <target state="translated">Le type '{0}' doit définir l'opérateur '{1}' à utiliser dans une expression '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CopyBackTypeMismatch3"> <source>Cannot copy the value of 'ByRef' parameter '{0}' back to the matching argument because type '{1}' cannot be converted to type '{2}'.</source> <target state="translated">Impossible de recopier la valeur du paramètre 'ByRef' '{0}' dans l'argument correspondant, car le type '{1}' ne peut pas être converti en type '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ForLoopOperatorRequired2"> <source>Type '{0}' must define operator '{1}' to be used in a 'For' statement.</source> <target state="translated">Le type '{0}' doit définir l'opérateur '{1}' à utiliser dans une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableForLoopOperator2"> <source>Return and parameter types of '{0}' must be '{1}' to be used in a 'For' statement.</source> <target state="translated">Les types de retour et de paramètres de '{0}' doivent être '{1}' pour être utilisés dans une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableForLoopRelOperator2"> <source>Parameter types of '{0}' must be '{1}' to be used in a 'For' statement.</source> <target state="translated">Les types de paramètres de '{0}' doivent être '{1}' pour être utilisés dans une instruction 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorRequiresIntegerParameter1"> <source>Operator '{0}' must have a second parameter of type 'Integer' or 'Integer?'.</source> <target state="translated">L'opérateur '{0}' doit avoir un second paramètre de type 'Integer' ou 'Integer?'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyNullableOnBoth"> <source>Nullable modifier cannot be specified on both a variable and its type.</source> <target state="translated">Impossible de spécifier un modificateur autorisant les valeurs Null pour la variable et son type.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForStructConstraintNull"> <source>Type '{0}' must be a value type or a type argument constrained to 'Structure' in order to be used with 'Nullable' or nullable modifier '?'.</source> <target state="translated">Le type '{0}' doit être un type valeur ou un argument de type limité à 'Structure' pour pouvoir être utilisé avec 'Nullable' ou le modificateur autorisant les valeurs Null '?'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyArrayAndNullableOnBoth"> <source>Nullable modifier '?' and array modifiers '(' and ')' cannot be specified on both a variable and its type.</source> <target state="translated">Impossible de spécifier le modificateur autorisant les valeurs Null '?' ainsi que les modificateurs de tableau '(' et ')' pour la variable et son type.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyTypeCharacterOnIIF"> <source>Expressions used with an 'If' expression cannot contain type characters.</source> <target state="translated">Les expressions utilisées avec une expression 'If' ne peuvent pas contenir de caractères de type.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFName"> <source>'If' operands cannot be named arguments.</source> <target state="translated">'Les opérandes 'If' ne peuvent pas être des arguments nommés.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFConversion"> <source>Cannot infer a common type for the second and third operands of the 'If' operator. One must have a widening conversion to the other.</source> <target state="translated">Impossible de déduire un type commun pour le second et le troisième opérandes de l'opérateur 'If'. L'un doit avoir une conversion étendue vers l'autre.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCondTypeInIIF"> <source>First operand in a binary 'If' expression must be a nullable value type, a reference type, or an unconstrained generic type.</source> <target state="translated">Le premier opérande d'une expression 'If' binaire doit être un type valeur Nullable, un type référence ou un type générique sans contrainte.</target> <note /> </trans-unit> <trans-unit id="ERR_CantCallIIF"> <source>'If' operator cannot be used in a 'Call' statement.</source> <target state="translated">'L'opérateur 'If' ne peut pas être utilisé dans une instruction 'Call'.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyAsNewAndNullable"> <source>Nullable modifier cannot be specified in variable declarations with 'As New'.</source> <target state="translated">Impossible de spécifier un modificateur autorisant les valeurs Null dans les déclarations de variable avec 'As New'.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFConversion2"> <source>Cannot infer a common type for the first and second operands of the binary 'If' operator. One must have a widening conversion to the other.</source> <target state="translated">Impossible de déduire un type commun pour le premier et le second opérandes de l'opérateur 'If' binaire. L'un doit avoir une conversion étendue vers l'autre.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNullTypeInCCExpression"> <source>Nullable types are not allowed in conditional compilation expressions.</source> <target state="translated">Les types Nullable ne sont pas autorisés dans les expressions de compilation conditionnelles.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableImplicit"> <source>Nullable modifier cannot be used with a variable whose implicit type is 'Object'.</source> <target state="translated">Impossible d'utiliser un modificateur autorisant les valeurs Null avec une variable dont le type implicite est 'Object'.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRuntimeHelper"> <source>Requested operation is not available because the runtime library function '{0}' is not defined.</source> <target state="translated">L'opération demandée n'est pas disponible, car la fonction de la bibliothèque runtime '{0}' n'est pas définie.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterGlobalNameSpace"> <source>'Global' must be followed by '.' and an identifier.</source> <target state="translated">'Global' doit être suivi par '.' et un identificateur.</target> <note /> </trans-unit> <trans-unit id="ERR_NoGlobalExpectedIdentifier"> <source>'Global' not allowed in this context; identifier expected.</source> <target state="translated">'Global' n'est pas autorisé dans ce contexte ; identificateur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_NoGlobalInHandles"> <source>'Global' not allowed in handles; local name expected.</source> <target state="translated">'Global' interdit dans les handles ; nom local attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseIfNoMatchingIf"> <source>'ElseIf' must be preceded by a matching 'If' or 'ElseIf'.</source> <target state="translated">'ElseIf' doit être précédé d'un 'If' ou 'ElseIf' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeConstructor2"> <source>Attribute constructor has a 'ByRef' parameter of type '{0}'; cannot use constructors with byref parameters to apply the attribute.</source> <target state="translated">Le constructeur d'attribut a un paramètre 'ByRef' de type '{0}' ; impossible d'utiliser les constructeurs avec des paramètres byref pour appliquer l'attribut.</target> <note /> </trans-unit> <trans-unit id="ERR_EndUsingWithoutUsing"> <source>'End Using' must be preceded by a matching 'Using'.</source> <target state="translated">'End Using' doit être précédé d'un 'Using' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndUsing"> <source>'Using' must end with a matching 'End Using'.</source> <target state="translated">'Using' doit se terminer par un 'End Using' correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoUsing"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'Using' statement that does not contain this statement.</source> <target state="translated">'GoTo {0}' n'est pas valide, car '{0}' se trouve dans une instruction 'Using' qui ne contient pas cette instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingRequiresDisposePattern"> <source>'Using' operand of type '{0}' must implement 'System.IDisposable'.</source> <target state="translated">'L'opérande 'Using' de type '{0}' doit implémenter 'System.IDisposable'.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingResourceVarNeedsInitializer"> <source>'Using' resource variable must have an explicit initialization.</source> <target state="translated">'La variable de ressource 'Using' doit avoir une initialisation explicite.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingResourceVarCantBeArray"> <source>'Using' resource variable type can not be array type.</source> <target state="translated">'Le type de variable de ressource 'Using' ne peut pas être de type tableau.</target> <note /> </trans-unit> <trans-unit id="ERR_OnErrorInUsing"> <source>'On Error' statements are not valid within 'Using' statements.</source> <target state="translated">'Les instructions 'On Error' ne sont pas valides dans les instructions 'Using'.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyNameConflictInMyCollection"> <source>'{0}' has the same name as a member used for type '{1}' exposed in a 'My' group. Rename the type or its enclosing namespace.</source> <target state="translated">'{0}' porte le même nom qu'un autre membre utilisé pour le type '{1}' exposé dans un groupe 'My'. Renommez le type ou son espace de noms englobant.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplicitVar"> <source>Implicit variable '{0}' is invalid because of '{1}'.</source> <target state="translated">La variable Implicite '{0}' n'est pas valide en raison de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectInitializerRequiresFieldName"> <source>Object initializers require a field name to initialize.</source> <target state="translated">Les initialiseurs d'objet requièrent un nom de fichier à initialiser.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedFrom"> <source>'From' expected.</source> <target state="translated">'From' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaBindingMismatch1"> <source>Nested function does not have the same signature as delegate '{0}'.</source> <target state="translated">La fonction imbriquée n'a pas la même signature que le délégué '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaBindingMismatch2"> <source>Nested sub does not have a signature that is compatible with delegate '{0}'.</source> <target state="translated">Un Sub imbriqué n'a pas une signature compatible avec le délégué '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftByRefParamQuery1"> <source>'ByRef' parameter '{0}' cannot be used in a query expression.</source> <target state="translated">'Le paramètre 'ByRef' '{0}' ne peut pas être utilisé dans une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeNotSupported"> <source>Expression cannot be converted into an expression tree.</source> <target state="translated">Impossible de convertir l'expression en une arborescence d'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftStructureMeQuery"> <source>Instance members and 'Me' cannot be used within query expressions in structures.</source> <target state="translated">Les membres d'instance et 'Me' ne peuvent pas être utilisés au sein d'expressions de requêtes dans des structures.</target> <note /> </trans-unit> <trans-unit id="ERR_InferringNonArrayType1"> <source>Variable cannot be initialized with non-array type '{0}'.</source> <target state="translated">La variable ne peut pas être initialisée avec un type autre qu'un type tableau '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefParamInExpressionTree"> <source>References to 'ByRef' parameters cannot be converted to an expression tree.</source> <target state="translated">Impossible de convertir les références aux paramètres 'ByRef' en une arborescence de l'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAnonTypeMemberName1"> <source>Anonymous type member or property '{0}' is already declared.</source> <target state="translated">Le membre de type anonyme ou la propriété '{0}' est déjà déclaré.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAnonymousTypeForExprTree"> <source>Cannot convert anonymous type to an expression tree because a property of the type is used to initialize another property.</source> <target state="translated">Impossible de convertir le type anonyme en arborescence de l'expression, car une propriété de ce type sert à initialiser une autre propriété.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftAnonymousType1"> <source>Anonymous type property '{0}' cannot be used in the definition of a lambda expression within the same initialization list.</source> <target state="translated">La propriété de type anonyme '{0}' ne peut pas être utilisée dans la définition d'une expression lambda au sein de la même liste d'initialisation.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionOnlyAllowedOnModuleSubOrFunction"> <source>'Extension' attribute can be applied only to 'Module', 'Sub', or 'Function' declarations.</source> <target state="translated">'L'attribut 'Extension' ne peut être appliqué qu'aux déclarations 'Module', 'Sub' ou 'Function'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodNotInModule"> <source>Extension methods can be defined only in modules.</source> <target state="translated">Les méthodes d'extension ne peuvent être définies que dans des modules.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodNoParams"> <source>Extension methods must declare at least one parameter. The first parameter specifies which type to extend.</source> <target state="translated">Les méthodes d'extension doivent déclarer au moins un paramètre. Le premier paramètre spécifie le type à étendre.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOptionalFirstArg"> <source>'Optional' cannot be applied to the first parameter of an extension method. The first parameter specifies which type to extend.</source> <target state="translated">'Optional' ne peut pas être appliqué au premier paramètre d'une méthode d'extension. Le premier paramètre spécifie le type à étendre.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodParamArrayFirstArg"> <source>'ParamArray' cannot be applied to the first parameter of an extension method. The first parameter specifies which type to extend.</source> <target state="translated">'ParamArray' ne peut pas être appliqué au premier paramètre d'une méthode d'extension. Le premier paramètre spécifie le type à étendre.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeFieldNameInference"> <source>Anonymous type member name can be inferred only from a simple or qualified name with no arguments.</source> <target state="translated">Le nom du membre de type anonyme ne peut être déduit qu'à partir d'un nom simple ou qualifié sans argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotMemberOfAnonymousType2"> <source>'{0}' is not a member of '{1}'; it does not exist in the current context.</source> <target state="translated">'{0}' n'est pas membre de '{1}' ; il n'existe pas dans le contexte actuel.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionAttributeInvalid"> <source>The custom-designed version of 'System.Runtime.CompilerServices.ExtensionAttribute' found by the compiler is not valid. Its attribute usage flags must be set to allow assemblies, classes, and methods.</source> <target state="translated">La version personnalisée de 'System.Runtime.CompilerServices.ExtensionAttribute' trouvée par le compilateur n'est pas valide. Ses indicateurs d'utilisation d'attribut doivent être définis pour autoriser les assemblys, les classes et les méthodes.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypePropertyOutOfOrder1"> <source>Anonymous type member property '{0}' cannot be used to infer the type of another member property because the type of '{0}' is not yet established.</source> <target state="translated">La propriété du membre de type anonyme '{0}' ne peut pas être utilisée pour déduire le type d'une autre propriété de membre, car le type de '{0}' n'est pas encore établi.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeDisallowsTypeChar"> <source>Type characters cannot be used in anonymous type declarations.</source> <target state="translated">Les caractères de type ne peuvent pas être utilisés dans des déclarations de type anonymes.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleLiteralDisallowsTypeChar"> <source>Type characters cannot be used in tuple literals.</source> <target state="translated">Impossible d'utiliser des caractères de type dans des littéraux de tuple.</target> <note /> </trans-unit> <trans-unit id="ERR_NewWithTupleTypeSyntax"> <source>'New' cannot be used with tuple type. Use a tuple literal expression instead.</source> <target state="translated">'Impossible d'utiliser 'new' avec le type tuple. Utilisez une expression littérale de tuple à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeMustBeStruct"> <source>Predefined type '{0}' must be a structure.</source> <target state="translated">Le type prédéfini '{0}' doit être une structure.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodUncallable1"> <source>Extension method '{0}' has type constraints that can never be satisfied.</source> <target state="translated">La méthode d'extension '{0}' a des contraintes de type qui ne peuvent pas être satisfaites.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOverloadCandidate3"> <source> Extension method '{0}' defined in '{1}': {2}</source> <target state="translated"> Méthode d'extension '{0}' définie dans '{1}': {2}</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatch"> <source>Method does not have a signature compatible with the delegate.</source> <target state="translated">La méthode n'a pas de signature compatible avec le délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingTypeInferenceFails"> <source>Type arguments could not be inferred from the delegate.</source> <target state="translated">Impossible de déduire les arguments de type à partir du délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs"> <source>Too many arguments.</source> <target state="translated">Arguments trop nombreux.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted1"> <source>Parameter '{0}' already has a matching omitted argument.</source> <target state="translated">Le paramètre '{0}' a déjà un argument omis correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice1"> <source>Parameter '{0}' already has a matching argument.</source> <target state="translated">Le paramètre '{0}' a déjà un argument correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound1"> <source>'{0}' is not a method parameter.</source> <target state="translated">'{0}' n'est pas un paramètre de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument1"> <source>Argument not specified for parameter '{0}'.</source> <target state="translated">Argument non spécifié pour le paramètre '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam1"> <source>Type parameter '{0}' cannot be inferred.</source> <target state="translated">Le paramètre de type '{0}' ne peut pas être déduit.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOverloadCandidate2"> <source> Extension method '{0}' defined in '{1}'.</source> <target state="translated"> Méthode d'extension '{0}' définie dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNeedField"> <source>Anonymous type must contain at least one member.</source> <target state="translated">Le type anonyme doit contenir au moins un membre.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNameWithoutPeriod"> <source>Anonymous type member name must be preceded by a period.</source> <target state="translated">Le nom du membre de type anonyme doit être précédé d'un point.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeExpectedIdentifier"> <source>Identifier expected, preceded with a period.</source> <target state="translated">Identificateur attendu, précédé d'un point.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs2"> <source>Too many arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Arguments trop nombreux dans la méthode d'extension '{0}' définie dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted3"> <source>Parameter '{0}' in extension method '{1}' defined in '{2}' already has a matching omitted argument.</source> <target state="translated">Le paramètre '{0}' de la méthode d'extension '{1}' définie dans '{2}' a déjà un argument omis correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice3"> <source>Parameter '{0}' of extension method '{1}' defined in '{2}' already has a matching argument.</source> <target state="translated">Le paramètre '{0}' de la méthode d'extension '{1}' définie dans '{2}' a déjà un argument correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound3"> <source>'{0}' is not a parameter of extension method '{1}' defined in '{2}'.</source> <target state="translated">'{0}' n'est pas un paramètre de la méthode d'extension '{1}' définie dans '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument3"> <source>Argument not specified for parameter '{0}' of extension method '{1}' defined in '{2}'.</source> <target state="translated">Argument non spécifié pour le paramètre '{0}' de la méthode d'extension '{1}' définie dans '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam3"> <source>Type parameter '{0}' for extension method '{1}' defined in '{2}' cannot be inferred.</source> <target state="translated">Le paramètre de type '{0}' pour la méthode d'extension '{1}' définie dans '{2}' ne peut pas être déduit.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewGenericArguments2"> <source>Too few type arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Arguments de type insuffisants dans la méthode d'extension '{0}' définie dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyGenericArguments2"> <source>Too many type arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Arguments de type trop nombreux dans la méthode d'extension '{0}' définie dans '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedInOrEq"> <source>'In' or '=' expected.</source> <target state="translated">'In' ou '=' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQueryableSource"> <source>Expression of type '{0}' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.</source> <target state="translated">L'expression de type '{0}' ne peut pas être interrogée. Vérifiez qu'une référence d'assembly et/ou une importation d'espace de noms existent pour le fournisseur LINQ.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryOperatorNotFound"> <source>Definition of method '{0}' is not accessible in this context.</source> <target state="translated">La définition de la méthode '{0}' n'est pas accessible dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseOnErrorGotoWithClosure"> <source>Method cannot contain both a '{0}' statement and a definition of a variable that is used in a lambda or query expression.</source> <target state="translated">La méthode ne peut pas contenir une instruction '{0}' et une définition d'une variable qui est utilisée dans une expression lambda ou de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotGotoNonScopeBlocksWithClosure"> <source>'{0}{1}' is not valid because '{2}' is inside a scope that defines a variable that is used in a lambda or query expression.</source> <target state="translated">'{0}{1}' n'est pas valide, car '{2}' se trouve dans une portée qui définit une variable utilisée dans une expression lambda ou une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeQuery"> <source>Instance of restricted type '{0}' cannot be used in a query expression.</source> <target state="translated">Impossible d'utiliser l'instance du type restreint '{0}' dans une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonymousTypeFieldNameInference"> <source>Range variable name can be inferred only from a simple or qualified name with no arguments.</source> <target state="translated">Le nom de la variable de portée peut être déduit uniquement à partir d'un nom qualifié ou d'un nom simple sans arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryDuplicateAnonTypeMemberName1"> <source>Range variable '{0}' is already declared.</source> <target state="translated">La variable de portée '{0}' est déjà déclarée.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonymousTypeDisallowsTypeChar"> <source>Type characters cannot be used in range variable declarations.</source> <target state="translated">Les caractères de type ne peuvent pas être utilisés dans des déclarations de variable de portée.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyInClosure"> <source>'ReadOnly' variable cannot be the target of an assignment in a lambda expression inside a constructor.</source> <target state="translated">'Une variable 'ReadOnly' ne peut pas être la cible d'une assignation dans une expression lambda au sein d'un constructeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ExprTreeNoMultiDimArrayCreation"> <source>Multi-dimensional array cannot be converted to an expression tree.</source> <target state="translated">Impossible de convertir un tableau multidimensionnel en une arborescence de l'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_ExprTreeNoLateBind"> <source>Late binding operations cannot be converted to an expression tree.</source> <target state="translated">Impossible de convertir les opérations à liaison tardive en une arborescence de l'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedBy"> <source>'By' expected.</source> <target state="translated">'By' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryInvalidControlVariableName1"> <source>Range variable name cannot match the name of a member of the 'Object' class.</source> <target state="translated">Le nom de la variable de portée ne peut pas correspondre au nom d'un membre de la classe 'Object'.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIn"> <source>'In' expected.</source> <target state="translated">'In' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNameNotDeclared"> <source>Name '{0}' is either not declared or not in the current scope.</source> <target state="translated">Le nom '{0}' n'est pas déclaré ou ne se trouve pas dans la portée actuelle.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedFunctionArgumentNarrowing3"> <source>Return type of nested function matching parameter '{0}' narrows from '{1}' to '{2}'.</source> <target state="translated">Le type de retour de la fonction imbriquée qui correspond au paramètre '{0}' passe de '{1}' à '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonTypeFieldXMLNameInference"> <source>Anonymous type member name cannot be inferred from an XML identifier that is not a valid Visual Basic identifier.</source> <target state="translated">Le nom du membre de type anonyme ne peut pas être déduit à partir d'un identificateur XML qui n'est pas un identificateur Visual Basic valide.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonTypeFieldXMLNameInference"> <source>Range variable name cannot be inferred from an XML identifier that is not a valid Visual Basic identifier.</source> <target state="translated">Le nom de la variable de portée ne peut pas être déduit à partir d'un identificateur XML qui n'est pas un identificateur Visual Basic valide.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedInto"> <source>'Into' expected.</source> <target state="translated">'Into' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnAggregation"> <source>Aggregate function name cannot be used with a type character.</source> <target state="translated">Le nom d'une fonction d'agrégation ne peut pas être utilisé avec un caractère de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOn"> <source>'On' expected.</source> <target state="translated">'On' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEquals"> <source>'Equals' expected.</source> <target state="translated">'Equals' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAnd"> <source>'And' expected.</source> <target state="translated">'And' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_EqualsTypeMismatch"> <source>'Equals' cannot compare a value of type '{0}' with a value of type '{1}'.</source> <target state="translated">'Equals' ne peut pas comparer une valeur de type '{0}' à une valeur de type '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EqualsOperandIsBad"> <source>You must reference at least one range variable on both sides of the 'Equals' operator. Range variable(s) {0} must appear on one side of the 'Equals' operator, and range variable(s) {1} must appear on the other.</source> <target state="translated">Vous devez référencer au moins une variable de portée des deux côtés de l'opérateur 'Equals'. La ou les variables de portée {0} doivent apparaître d'un côté de l'opérateur 'Equals' alors que la ou les variables de portée {1} doivent apparaître de l'autre côté.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNotDelegate1"> <source>Lambda expression cannot be converted to '{0}' because '{0}' is not a delegate type.</source> <target state="translated">Impossible de convertir l'expression lambda en '{0}', car '{0}' n'est pas un type délégué.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNotCreatableDelegate1"> <source>Lambda expression cannot be converted to '{0}' because type '{0}' is declared 'MustInherit' and cannot be created.</source> <target state="translated">Impossible de convertir l'expression lambda en '{0}', car le type '{0}' est déclaré 'MustInherit' et ne peut pas être créé.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotInferNullableForVariable1"> <source>A nullable type cannot be inferred for variable '{0}'.</source> <target state="translated">Impossible de déduire un type Nullable pour la variable '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableTypeInferenceNotSupported"> <source>Nullable type inference is not supported in this context.</source> <target state="translated">L'inférence de type Nullable n'est pas prise en charge dans ce contexte.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedJoin"> <source>'Join' expected.</source> <target state="translated">'Join' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableParameterMustSpecifyType"> <source>Nullable parameters must specify a type.</source> <target state="translated">Les paramètres Nullable doivent spécifier un type.</target> <note /> </trans-unit> <trans-unit id="ERR_IterationVariableShadowLocal2"> <source>Range variable '{0}' hides a variable in an enclosing block, a previously defined range variable, or an implicitly declared variable in a query expression.</source> <target state="translated">La variable de portée '{0}' masque une variable dans un bloc englobant, une variable de portée précédemment définie ou une variable déclarée implicitement dans une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdasCannotHaveAttributes"> <source>Attributes cannot be applied to parameters of lambda expressions.</source> <target state="translated">Des attributs ne peuvent pas être appliqués aux paramètres d'expressions lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaInSelectCaseExpr"> <source>Lambda expressions are not valid in the first expression of a 'Select Case' statement.</source> <target state="translated">Les expressions lambda ne sont pas valides dans la première expression d'une instruction 'Select Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfInSelectCaseExpr"> <source>'AddressOf' expressions are not valid in the first expression of a 'Select Case' statement.</source> <target state="translated">'Les expressions 'AddressOf' ne sont pas valides dans la première expression d'une instruction 'Select Case'.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableCharNotSupported"> <source>The '?' character cannot be used here.</source> <target state="translated">Impossible d'utiliser le caractère '?' ici.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftStructureMeLambda"> <source>Instance members and 'Me' cannot be used within a lambda expression in structures.</source> <target state="translated">Les membres d'instance et 'Me' ne peuvent pas être utilisés au sein d'une expression lambda dans des structures.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftByRefParamLambda1"> <source>'ByRef' parameter '{0}' cannot be used in a lambda expression.</source> <target state="translated">'Le paramètre 'ByRef' '{0}' ne peut pas être utilisé dans une expression lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeLambda"> <source>Instance of restricted type '{0}' cannot be used in a lambda expression.</source> <target state="translated">Impossible d'utiliser l'instance du type restreint '{0}' dans une expression lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaParamShadowLocal1"> <source>Lambda parameter '{0}' hides a variable in an enclosing block, a previously defined range variable, or an implicitly declared variable in a query expression.</source> <target state="translated">Le paramètre lambda '{0}' masque une variable dans un bloc englobant, une variable de portée précédemment définie ou une variable déclarée implicitement dans une expression de requête.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowImplicitObjectLambda"> <source>Option Strict On requires each lambda expression parameter to be declared with an 'As' clause if its type cannot be inferred.</source> <target state="translated">Chaque paramètre d'expression lambda de Option Strict On doit être déclaré avec une clause 'As' si son type ne peut pas être déduit.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyParamsOnLambdaParamNoType"> <source>Array modifiers cannot be specified on lambda expression parameter name. They must be specified on its type.</source> <target state="translated">Impossible de spécifier des modificateurs de tableau pour le nom de paramètre d'une expression lambda. Ils doivent être spécifiés dans son type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments, car plusieurs types sont possibles. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments, car plusieurs types sont possibles. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments, car plusieurs types sont possibles. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments, car plusieurs types sont possibles.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments, car plusieurs types sont possibles.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments, car plusieurs types sont possibles.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments, car ils ne sont pas convertis vers le même type. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments, car ils ne sont pas convertis vers le même type. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments, car ils ne sont pas convertis vers le même type. La spécification explicite du ou des types de données peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type à partir de ces arguments, car ils ne sont pas convertis vers le même type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode '{0}' à partir de ces arguments, car ils ne sont pas convertis vers le même type.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Impossible de déduire le ou les types de données du ou des paramètres de type dans la méthode d'extension '{0}' définie dans '{1}' à partir de ces arguments, car ils ne sont pas convertis vers le même type.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatchStrictOff2"> <source>Option Strict On does not allow narrowing in implicit type conversions between method '{0}' and delegate '{1}'.</source> <target state="translated">Option Strict On n'autorise pas les conversions restrictives lors des conversions de types implicites entre la méthode '{0}' et le délégué '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleReturnTypeOfMember2"> <source>'{0}' is not accessible in this context because the return type is not accessible.</source> <target state="translated">'{0}' n'est pas accessible dans ce contexte, car le type de retour n'est pas accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIdentifierOrGroup"> <source>'Group' or an identifier expected.</source> <target state="translated">'Group' ou identificateur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedGroup"> <source>'Group' not allowed in this context; identifier expected.</source> <target state="translated">'Group' n'est pas autorisé dans ce contexte ; identificateur attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatchStrictOff3"> <source>Option Strict On does not allow narrowing in implicit type conversions between extension method '{0}' defined in '{2}' and delegate '{1}'.</source> <target state="translated">Option Strict On n'autorise pas les conversions restrictives lors des conversions de types implicites entre la méthode d'extension '{0}' définie dans '{2}' et le délégué '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingIncompatible3"> <source>Extension Method '{0}' defined in '{2}' does not have a signature compatible with delegate '{1}'.</source> <target state="translated">La méthode d'extension '{0}' définie dans '{2}' n'a pas une signature compatible avec le délégué '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNarrowing2"> <source>Argument matching parameter '{0}' narrows to '{1}'.</source> <target state="translated">Le paramètre de correspondance d'arguments '{0}' passe à '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadCandidate1"> <source> {0}</source> <target state="translated"> {0}</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyInitializedInStructure"> <source>Auto-implemented Properties contained in Structures cannot have initializers unless they are marked 'Shared'.</source> <target state="translated">Les propriétés implémentées automatiquement contenues dans les structures ne peuvent pas avoir d'initialiseurs sauf si elles sont marquées comme 'Shared'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsElements"> <source>XML elements cannot be selected from type '{0}'.</source> <target state="translated">Les éléments XML ne peuvent pas être sélectionnés à partir du type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsAttributes"> <source>XML attributes cannot be selected from type '{0}'.</source> <target state="translated">Les attributs XML ne peuvent pas être sélectionnés à partir du type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsDescendants"> <source>XML descendant elements cannot be selected from type '{0}'.</source> <target state="translated">Les éléments descendants XML ne peuvent pas être sélectionnés à partir du type '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOrMemberNotGeneric2"> <source>Extension method '{0}' defined in '{1}' is not generic (or has no free type parameters) and so cannot have type arguments.</source> <target state="translated">La méthode d'extension '{0}' définie dans '{1}' n'est pas générique (ou n'a pas de paramètre de type libre) et ne peut pas avoir d'arguments de type.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodCannotBeLateBound"> <source>Late-bound extension methods are not supported.</source> <target state="translated">Les méthodes d'extension à liaison tardive ne sont pas prises en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceArrayRankMismatch1"> <source>Cannot infer a data type for '{0}' because the array dimensions do not match.</source> <target state="translated">Impossible de déduire un type de données pour '{0}', car les dimensions du tableau ne correspondent pas.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryStrictDisallowImplicitObject"> <source>Type of the range variable cannot be inferred, and late binding is not allowed with Option Strict on. Use an 'As' clause to specify the type.</source> <target state="translated">Le type de la variable de portée ne peut pas être déduit, et la liaison tardive n'est pas autorisée avec Option Strict on. Utilisez une clause 'As' pour indiquer le type.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedInterfaceWithGeneric"> <source>Type '{0}' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.</source> <target state="translated">Le type '{0}' ne peut pas être incorporé, car il a un argument générique. Désactivez l'incorporation des types interop.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseGenericTypeAcrossAssemblyBoundaries"> <source>Type '{0}' cannot be used across assembly boundaries because it has a generic type argument that is an embedded interop type.</source> <target state="translated">Le type '{0}' ne peut pas être utilisé au-delà des limites de l'assembly, car il a un argument de type générique qui est un type interop incorporé.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbol2"> <source>'{0}' is obsolete: '{1}'.</source> <target state="translated">'{0}' est obsolète : '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbol2_Title"> <source>Type or member is obsolete</source> <target state="translated">Le type ou le membre est obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverloadBase4"> <source>{0} '{1}' shadows an overloadable member declared in the base {2} '{3}'. If you want to overload the base method, this method must be declared 'Overloads'.</source> <target state="translated">{0} '{1}' cache un membre surchargeable dans le {2} '{3}' de base. Si vous voulez surcharger la méthode de base, cette méthode doit être déclarée 'Overloads'.</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverloadBase4_Title"> <source>Member shadows an overloadable member declared in the base type</source> <target state="translated">Le membre masque un membre surchargeable déclaré dans le type de base</target> <note /> </trans-unit> <trans-unit id="WRN_OverrideType5"> <source>{0} '{1}' conflicts with {2} '{1}' in the base {3} '{4}' and should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' est en conflit avec {2} '{1}' dans le {3} '{4}' de base et doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_OverrideType5_Title"> <source>Member conflicts with member in the base type and should be declared 'Shadows'</source> <target state="translated">Le membre est en conflit avec le membre du type de base et devrait être déclaré comme 'Shadows'</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverride2"> <source>{0} '{1}' shadows an overridable method in the base {2} '{3}'. To override the base method, this method must be declared 'Overrides'.</source> <target state="translated">{0} '{1}' cache une méthode surchargeable dans le {2} '{3}' de base. Pour substituer la méthode de base, cette méthode doit être déclarée 'Overrides'.</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverride2_Title"> <source>Member shadows an overridable method in the base type</source> <target state="translated">Le membre masque une méthode substituable dans le type de base</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultnessShadowed4"> <source>Default property '{0}' conflicts with the default property '{1}' in the base {2} '{3}'. '{0}' will be the default property. '{0}' should be declared 'Shadows'.</source> <target state="translated">La propriété par défaut '{0}' est en conflit avec la propriété par défaut '{1}' dans le {2} '{3}' de base. '{0}' sera la propriété par défaut. '{0}' doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultnessShadowed4_Title"> <source>Default property conflicts with the default property in the base type</source> <target state="translated">La propriété par défaut est en conflit avec la propriété par défaut du type de base</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbolNoMessage1"> <source>'{0}' is obsolete.</source> <target state="translated">'{0}' est obsolète.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbolNoMessage1_Title"> <source>Type or member is obsolete</source> <target state="translated">Le type ou le membre est obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration0"> <source>Possible problem detected while building assembly: {0}</source> <target state="translated">Problème possible détecté pendant la génération de l'assembly : {0}</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration0_Title"> <source>Possible problem detected while building assembly</source> <target state="translated">Problème potentiel détecté lors de la génération de l’assembly</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration1"> <source>Possible problem detected while building assembly '{0}': {1}</source> <target state="translated">Problème possible détecté pendant la génération de l'assembly : '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration1_Title"> <source>Possible problem detected while building assembly</source> <target state="translated">Problème potentiel détecté lors de la génération de l’assembly</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassNoMembers1"> <source>'Microsoft.VisualBasic.ComClassAttribute' is specified for class '{0}' but '{0}' has no public members that can be exposed to COM; therefore, no COM interfaces are generated.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' est spécifié pour la classe '{0}', mais '{0}' n'a pas de membres publics pouvant être exposés à COM ; par conséquent, aucune interface COM n'est générée.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassNoMembers1_Title"> <source>'Microsoft.VisualBasic.ComClassAttribute' is specified for class but class has no public members that can be exposed to COM</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' est spécifié pour la classe, mais celle-ci n’a pas de membres publics pouvant être exposés à COM</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsMember5"> <source>{0} '{1}' implicitly declares '{2}', which conflicts with a member in the base {3} '{4}', and so the {0} should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' déclare implicitement '{2}', qui est en conflit avec un membre dans le {3} '{4}' de base, {0} doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsMember5_Title"> <source>Property or event implicitly declares type or member that conflicts with a member in the base type</source> <target state="translated">La propriété ou l’événement déclare implicitement un type ou un membre qui est en conflit avec un membre du type de base</target> <note /> </trans-unit> <trans-unit id="WRN_MemberShadowsSynthMember6"> <source>{0} '{1}' conflicts with a member implicitly declared for {2} '{3}' in the base {4} '{5}' and should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' est en conflit avec un membre implicitement déclaré pour {2} '{3}' dans le {4} '{5}' de base et doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberShadowsSynthMember6_Title"> <source>Member conflicts with a member implicitly declared for property or event in the base type</source> <target state="translated">Le membre est en conflit avec un membre déclaré implicitement pour la propriété ou l’événement dans le type de base</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsSynthMember7"> <source>{0} '{1}' implicitly declares '{2}', which conflicts with a member implicitly declared for {3} '{4}' in the base {5} '{6}'. {0} should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' déclare implicitement '{2}', qui est en conflit avec un membre implicitement déclaré pour {3} '{4}' dans le {5} '{6}' de base. {0} doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsSynthMember7_Title"> <source>Property or event implicitly declares member, which conflicts with a member implicitly declared for property or event in the base type</source> <target state="translated">La propriété ou l’événement déclare implicitement un membre, qui est en conflit avec un membre déclaré implicitement pour la propriété ou l’événement du type de base</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor3"> <source>'{0}' accessor of '{1}' is obsolete: '{2}'.</source> <target state="translated">'L'accesseur '{0}' de '{1}' est obsolète : '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor3_Title"> <source>Property accessor is obsolete</source> <target state="translated">Accesseur de propriété obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor2"> <source>'{0}' accessor of '{1}' is obsolete.</source> <target state="translated">'L'accesseur '{0}' de '{1}' est obsolète.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor2_Title"> <source>Property accessor is obsolete</source> <target state="translated">Accesseur de propriété obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_FieldNotCLSCompliant1"> <source>Type of member '{0}' is not CLS-compliant.</source> <target state="translated">Le type de membre '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_FieldNotCLSCompliant1_Title"> <source>Type of member is not CLS-compliant</source> <target state="translated">Le type du membre n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_BaseClassNotCLSCompliant2"> <source>'{0}' is not CLS-compliant because it derives from '{1}', which is not CLS-compliant.</source> <target state="translated">'{0}' n'est pas conforme CLS, car il dérive de '{1}', qui n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_BaseClassNotCLSCompliant2_Title"> <source>Type is not CLS-compliant because it derives from base type that is not CLS-compliant</source> <target state="translated">Le type n’est pas conforme CLS, car il est dérivé d’un type de base qui n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ProcTypeNotCLSCompliant1"> <source>Return type of function '{0}' is not CLS-compliant.</source> <target state="translated">Le type de retour de la fonction '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_ProcTypeNotCLSCompliant1_Title"> <source>Return type of function is not CLS-compliant</source> <target state="translated">Le type de retour de la fonction n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ParamNotCLSCompliant1"> <source>Type of parameter '{0}' is not CLS-compliant.</source> <target state="translated">Le type de paramètre '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_ParamNotCLSCompliant1_Title"> <source>Type of parameter is not CLS-compliant</source> <target state="translated">Le type de paramètre n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_InheritedInterfaceNotCLSCompliant2"> <source>'{0}' is not CLS-compliant because the interface '{1}' it inherits from is not CLS-compliant.</source> <target state="translated">'{0}' n'est pas conforme CLS, car l'interface '{1}' dont il hérite n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_InheritedInterfaceNotCLSCompliant2_Title"> <source>Type is not CLS-compliant because the interface it inherits from is not CLS-compliant</source> <target state="translated">Le type n’est pas conforme CLS, car l’interface dont il hérite n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLSMemberInNonCLSType3"> <source>{0} '{1}' cannot be marked CLS-compliant because its containing type '{2}' is not CLS-compliant.</source> <target state="translated">{0} '{1}' ne peut pas être marqué comme conforme CLS, car son type conteneur '{2}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSMemberInNonCLSType3_Title"> <source>Member cannot be marked CLS-compliant because its containing type is not CLS-compliant</source> <target state="translated">Le membre ne peut pas être signalé comme conforme CLS, car son type contenant n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NameNotCLSCompliant1"> <source>Name '{0}' is not CLS-compliant.</source> <target state="translated">Le nom '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NameNotCLSCompliant1_Title"> <source>Name is not CLS-compliant</source> <target state="translated">Le nom n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_EnumUnderlyingTypeNotCLS1"> <source>Underlying type '{0}' of Enum is not CLS-compliant.</source> <target state="translated">Le type sous-jacent '{0}' d'Enum n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_EnumUnderlyingTypeNotCLS1_Title"> <source>Underlying type of Enum is not CLS-compliant</source> <target state="translated">Le type sous-jacent du type Enum n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMemberInCLSInterface1"> <source>Non CLS-compliant '{0}' is not allowed in a CLS-compliant interface.</source> <target state="translated">Le '{0}' non conforme CLS n'est pas autorisé dans une interface conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMemberInCLSInterface1_Title"> <source>Non CLS-compliant member is not allowed in a CLS-compliant interface</source> <target state="translated">Un membre non conforme CLS n’est pas autorisé dans une interface conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMustOverrideInCLSType1"> <source>Non CLS-compliant 'MustOverride' member is not allowed in CLS-compliant type '{0}'.</source> <target state="translated">Le membre « MustOverride » non conforme CLS n’est pas autorisé dans un type « {0} » conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMustOverrideInCLSType1_Title"> <source>Non CLS-compliant 'MustOverride' member is not allowed in CLS-compliant type</source> <target state="translated">Un membre 'MustOverride' non conforme CLS n’est pas autorisé dans un type conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayOverloadsNonCLS2"> <source>'{0}' is not CLS-compliant because it overloads '{1}' which differs from it only by array of array parameter types or by the rank of the array parameter types.</source> <target state="translated">'{0}' n'est pas conforme CLS, car il surcharge '{1}' dont il diffère uniquement par un tableau de types de paramètres tableau ou par le rang des types de paramètres tableau.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayOverloadsNonCLS2_Title"> <source>Method is not CLS-compliant because it overloads method which differs from it only by array of array parameter types or by the rank of the array parameter types</source> <target state="translated">La méthode n’est pas conforme CLS, car elle surcharge une méthode dont elle diffère uniquement par un tableau de types de paramètres tableau ou par la dimension des types de paramètres tableau</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant1"> <source>Root namespace '{0}' is not CLS-compliant.</source> <target state="translated">L'espace de noms racine '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant1_Title"> <source>Root namespace is not CLS-compliant</source> <target state="translated">L’espace de noms racine n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant2"> <source>Name '{0}' in the root namespace '{1}' is not CLS-compliant.</source> <target state="translated">Le nom '{0}' de l'espace de noms racine '{1}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant2_Title"> <source>Part of the root namespace is not CLS-compliant</source> <target state="translated">Une partie de l’espace de noms racine n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_GenericConstraintNotCLSCompliant1"> <source>Generic parameter constraint type '{0}' is not CLS-compliant.</source> <target state="translated">Le type de contrainte de paramètre générique '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_GenericConstraintNotCLSCompliant1_Title"> <source>Generic parameter constraint type is not CLS-compliant</source> <target state="translated">Le type de contrainte de paramètre générique n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_TypeNotCLSCompliant1"> <source>Type '{0}' is not CLS-compliant.</source> <target state="translated">Le type '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeNotCLSCompliant1_Title"> <source>Type is not CLS-compliant</source> <target state="translated">Le type n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_OptionalValueNotCLSCompliant1"> <source>Type of optional value for optional parameter '{0}' is not CLS-compliant.</source> <target state="translated">Le type de la valeur facultative pour le paramètre optionnel '{0}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_OptionalValueNotCLSCompliant1_Title"> <source>Type of optional value for optional parameter is not CLS-compliant</source> <target state="translated">Le type de valeur facultative pour le paramètre facultatif n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLSAttrInvalidOnGetSet"> <source>System.CLSCompliantAttribute cannot be applied to property 'Get' or 'Set'.</source> <target state="translated">System.CLSCompliantAttribute ne peut pas être appliqué à la propriété 'Get' ou 'Set'.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSAttrInvalidOnGetSet_Title"> <source>System.CLSCompliantAttribute cannot be applied to property 'Get' or 'Set'</source> <target state="translated">Impossible d'appliquer System.CLSCompliantAttribute à la propriété 'Get' ou 'Set'</target> <note /> </trans-unit> <trans-unit id="WRN_TypeConflictButMerged6"> <source>{0} '{1}' and partial {2} '{3}' conflict in {4} '{5}', but are being merged because one of them is declared partial.</source> <target state="translated">{0} '{1}' et {2} '{3}' partiel sont en conflit dans {4} '{5}', mais vont être fusionnés, car l'un d'eux est déclaré partiel.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeConflictButMerged6_Title"> <source>Type and partial type conflict, but are being merged because one of them is declared partial</source> <target state="translated">Le type et le type partiel sont en conflit, mais ils sont fusionnés, car l’un d’eux est déclaré partiel</target> <note /> </trans-unit> <trans-unit id="WRN_ShadowingGenericParamWithParam1"> <source>Type parameter '{0}' has the same name as a type parameter of an enclosing type. Enclosing type's type parameter will be shadowed.</source> <target state="translated">Le paramètre de type '{0}' a le même nom qu'un paramètre de type d'un type englobant. Le paramètre de type du type englobant sera shadowed.</target> <note /> </trans-unit> <trans-unit id="WRN_ShadowingGenericParamWithParam1_Title"> <source>Type parameter has the same name as a type parameter of an enclosing type</source> <target state="translated">Le paramètre de type a le même nom qu’un paramètre de type d’un type englobant</target> <note /> </trans-unit> <trans-unit id="WRN_CannotFindStandardLibrary1"> <source>Could not find standard library '{0}'.</source> <target state="translated">La bibliothèque standard '{0}' est introuvable.</target> <note /> </trans-unit> <trans-unit id="WRN_CannotFindStandardLibrary1_Title"> <source>Could not find standard library</source> <target state="translated">Bibliothèque standard introuvable</target> <note /> </trans-unit> <trans-unit id="WRN_EventDelegateTypeNotCLSCompliant2"> <source>Delegate type '{0}' of event '{1}' is not CLS-compliant.</source> <target state="translated">Le type délégué '{0}' de l'événement '{1}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_EventDelegateTypeNotCLSCompliant2_Title"> <source>Delegate type of event is not CLS-compliant</source> <target state="translated">Le type d’événement délégué n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_DebuggerHiddenIgnoredOnProperties"> <source>System.Diagnostics.DebuggerHiddenAttribute does not affect 'Get' or 'Set' when applied to the Property definition. Apply the attribute directly to the 'Get' and 'Set' procedures as appropriate.</source> <target state="translated">System.Diagnostics.DebuggerHiddenAttribute n'affecte pas 'Get' ou 'Set' lorsqu'il est appliqué à la définition Property. Appliquez l'attribut directement aux procédures 'Get' et 'Set' de manière appropriée.</target> <note /> </trans-unit> <trans-unit id="WRN_DebuggerHiddenIgnoredOnProperties_Title"> <source>System.Diagnostics.DebuggerHiddenAttribute does not affect 'Get' or 'Set' when applied to the Property definition</source> <target state="translated">System.Diagnostics.DebuggerHiddenAttribute n’affecte pas 'Get' ou 'Set' lorsqu’il est appliqué à la définition Property</target> <note /> </trans-unit> <trans-unit id="WRN_SelectCaseInvalidRange"> <source>Range specified for 'Case' statement is not valid. Make sure that the lower bound is less than or equal to the upper bound.</source> <target state="translated">La plage spécifiée pour l'instruction 'Case' n'est pas valide. Vérifiez que la limite inférieure est inférieure ou égale à la limite supérieure.</target> <note /> </trans-unit> <trans-unit id="WRN_SelectCaseInvalidRange_Title"> <source>Range specified for 'Case' statement is not valid</source> <target state="translated">La plage spécifiée pour l’instruction 'Case' n’est pas valide</target> <note /> </trans-unit> <trans-unit id="WRN_CLSEventMethodInNonCLSType3"> <source>'{0}' method for event '{1}' cannot be marked CLS compliant because its containing type '{2}' is not CLS compliant.</source> <target state="translated">'La méthode '{0}' pour l'événement '{1}' ne peut pas être marquée comme conforme CLS, car son type conteneur '{2}' n'est pas conforme CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSEventMethodInNonCLSType3_Title"> <source>AddHandler or RemoveHandler method for event cannot be marked CLS compliant because its containing type is not CLS compliant</source> <target state="translated">Les méthodes AddHandler ou RemoveHandler pour un événement ne peuvent pas être signalées comme conformes CLS, car leur type contenant n’est pas conforme CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ExpectedInitComponentCall2"> <source>'{0}' in designer-generated type '{1}' should call InitializeComponent method.</source> <target state="translated">'{0}' dans le type généré par le concepteur '{1}' doit appeler la méthode InitializeComponent.</target> <note /> </trans-unit> <trans-unit id="WRN_ExpectedInitComponentCall2_Title"> <source>Constructor in designer-generated type should call InitializeComponent method</source> <target state="translated">Le constructeur du type généré par le concepteur doit appeler la méthode InitializeComponent</target> <note /> </trans-unit> <trans-unit id="WRN_NamespaceCaseMismatch3"> <source>Casing of namespace name '{0}' does not match casing of namespace name '{1}' in '{2}'.</source> <target state="translated">La casse du nom de l'espace de noms '{0}' ne correspond pas à la casse du nom de l'espace de noms '{1}' dans '{2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NamespaceCaseMismatch3_Title"> <source>Casing of namespace name does not match</source> <target state="translated">La casse du nom de l’espace de noms est incorrecte</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyNamespaceOrClass1"> <source>Namespace or type specified in the Imports '{0}' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.</source> <target state="translated">L'espace de noms ou le type spécifié dans les Imports '{0}' ne contient aucun membre public ou est introuvable. Vérifiez que l'espace de noms ou le type est défini et qu'il contient au moins un membre public. Vérifiez que le nom de l'élément importé n'utilise pas d'autres alias.</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyNamespaceOrClass1_Title"> <source>Namespace or type specified in Imports statement doesn't contain any public member or cannot be found</source> <target state="translated">L’espace de noms ou le type spécifié dans l’instruction Imports ne contient pas de membre public ou est introuvable</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyProjectNamespaceOrClass1"> <source>Namespace or type specified in the project-level Imports '{0}' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.</source> <target state="translated">L'espace de noms ou le type spécifié dans les importations '{0}' au niveau du projet ne contient aucun membre public ou est introuvable. Vérifiez que l'espace de noms ou le type est défini, et qu'il contient au moins un membre public. Vérifiez que le nom de l'élément importé n'utilise pas d'alias.</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyProjectNamespaceOrClass1_Title"> <source>Namespace or type imported at project level doesn't contain any public member or cannot be found</source> <target state="translated">L'espace de noms ou le type importé au niveau du projet ne contient pas de membre public ou est introuvable</target> <note /> </trans-unit> <trans-unit id="WRN_IndirectRefToLinkedAssembly2"> <source>A reference was created to embedded interop assembly '{0}' because of an indirect reference to that assembly from assembly '{1}'. Consider changing the 'Embed Interop Types' property on either assembly.</source> <target state="translated">Une référence a été créée pour l'assembly d'interopérabilité incorporé '{0}' en raison d'une référence indirecte à cet assembly à partir de l'assembly '{1}'. Modifiez la propriété 'Incorporer les types interop' pour l'un des assemblys.</target> <note /> </trans-unit> <trans-unit id="WRN_IndirectRefToLinkedAssembly2_Title"> <source>A reference was created to embedded interop assembly because of an indirect reference to that assembly</source> <target state="translated">Une référence a été créée pour l’assembly d’interopérabilité incorporé en raison d’une référence indirecte à cet assembly</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase3"> <source>Class '{0}' should declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car le '{1}' dans sa classe de base '{2}' est marqué comme obsolète.</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase3_Title"> <source>Class should declare a 'Sub New' because the constructor in its base class is marked obsolete</source> <target state="translated">La classe doit déclarer un 'Sub New', car le constructeur dans sa classe de base est marqué comme obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase4"> <source>Class '{0}' should declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete: '{3}'.</source> <target state="translated">La classe '{0}' doit déclarer un 'Sub New', car le '{1}' dans sa classe de base '{2}' est marqué comme obsolète : '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase4_Title"> <source>Class should declare a 'Sub New' because the constructor in its base class is marked obsolete</source> <target state="translated">La classe doit déclarer un 'Sub New', car le constructeur dans sa classe de base est marqué comme obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall3"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete.</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le '{0}' dans la classe de base '{1}' de '{2}' est marquée comme obsolète.</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall3_Title"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the constructor in the base class is marked obsolete</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le constructeur de la classe de base est marqué comme obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall4"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete: '{3}'</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le '{0}' dans la classe de base '{1}' de '{2}' est marquée comme obsolète : '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall4_Title"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the constructor in the base class is marked obsolete</source> <target state="translated">La première instruction de ce 'Sub New' doit être un appel explicite à 'MyBase.New' ou 'MyClass.New', car le constructeur de la classe de base est marqué comme obsolète</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinOperator"> <source>Operator without an 'As' clause; type of Object assumed.</source> <target state="translated">Opérateur sans clause 'As' ; type Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinOperator_Title"> <source>Operator without an 'As' clause</source> <target state="translated">Opérateur sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_ConstraintsFailedForInferredArgs2"> <source>Type arguments inferred for method '{0}' result in the following warnings :{1}</source> <target state="translated">Les arguments de type déduits pour la méthode '{0}' donnent les avertissements suivants : {1}</target> <note /> </trans-unit> <trans-unit id="WRN_ConstraintsFailedForInferredArgs2_Title"> <source>Type arguments inferred for method result in warnings</source> <target state="translated">Les arguments de type déduits pour la méthode entraînent des avertissements</target> <note /> </trans-unit> <trans-unit id="WRN_ConditionalNotValidOnFunction"> <source>Attribute 'Conditional' is only valid on 'Sub' declarations.</source> <target state="translated">L'attribut 'Conditional' est valide uniquement dans les déclarations 'Sub'.</target> <note /> </trans-unit> <trans-unit id="WRN_ConditionalNotValidOnFunction_Title"> <source>Attribute 'Conditional' is only valid on 'Sub' declarations</source> <target state="translated">L'attribut 'Conditional' est valide uniquement dans les déclarations 'Sub'</target> <note /> </trans-unit> <trans-unit id="WRN_UseSwitchInsteadOfAttribute"> <source>Use command-line option '{0}' or appropriate project settings instead of '{1}'.</source> <target state="translated">Utilisez l'option de ligne de commande '{0}' ou les paramètres de projet appropriés plutôt que '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UseSwitchInsteadOfAttribute_Title"> <source>Use command-line option /keyfile, /keycontainer, or /delaysign instead of AssemblyKeyFileAttribute, AssemblyKeyNameAttribute, or AssemblyDelaySignAttribute</source> <target state="translated">Utilisez l’option de ligne de commande /keyfile, /keycontainer ou /delaysign au lieu de AssemblyKeyFileAttribute, AssemblyKeyNameAttribute ou AssemblyDelaySignAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveAddHandlerCall"> <source>Statement recursively calls the containing '{0}' for event '{1}'.</source> <target state="translated">L'instruction appelle de manière récursive le '{0}' conteneur pour l'événement '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveAddHandlerCall_Title"> <source>Statement recursively calls the event's containing AddHandler</source> <target state="translated">L’instruction appelle de manière récursive l’élément AddHandler contenant l’événement</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionCopyBack"> <source>Implicit conversion from '{1}' to '{2}' in copying the value of 'ByRef' parameter '{0}' back to the matching argument.</source> <target state="translated">Conversion implicite de '{1}' en '{2}' lors de la recopie de la valeur du paramètre 'ByRef' '{0}' dans l'argument correspondant.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionCopyBack_Title"> <source>Implicit conversion in copying the value of 'ByRef' parameter back to the matching argument</source> <target state="translated">Conversion implicite lors de la copie de la valeur du paramètre 'ByRef dans l’argument correspondant</target> <note /> </trans-unit> <trans-unit id="WRN_MustShadowOnMultipleInheritance2"> <source>{0} '{1}' conflicts with other members of the same name across the inheritance hierarchy and so should be declared 'Shadows'.</source> <target state="translated">{0} '{1}' est en conflit avec d'autres membres du même nom dans la hiérarchie d'héritage et doit être déclaré 'Shadows'.</target> <note /> </trans-unit> <trans-unit id="WRN_MustShadowOnMultipleInheritance2_Title"> <source>Method conflicts with other members of the same name across the inheritance hierarchy and so should be declared 'Shadows'</source> <target state="translated">La méthode est en conflit avec d’autres membres du même nom dans la hiérarchie d’héritage. Par conséquent, elle devrait être déclarée 'Shadows'</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveOperatorCall"> <source>Expression recursively calls the containing Operator '{0}'.</source> <target state="translated">L'expression appelle de manière récursive l'opérateur conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveOperatorCall_Title"> <source>Expression recursively calls the containing Operator</source> <target state="translated">L’expression appelle de manière récursive l’opérateur conteneur</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversion2"> <source>Implicit conversion from '{0}' to '{1}'.</source> <target state="translated">Conversion implicite de '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversion2_Title"> <source>Implicit conversion</source> <target state="translated">Conversion implicite</target> <note /> </trans-unit> <trans-unit id="WRN_MutableStructureInUsing"> <source>Local variable '{0}' is read-only and its type is a structure. Invoking its members or passing it ByRef does not change its content and might lead to unexpected results. Consider declaring this variable outside of the 'Using' block.</source> <target state="translated">La variable locale '{0}' est en lecture seule et son type est une structure. L'appel de ses membres ou le passage de ByRef ne modifie pas son contenu et peut provoquer des résultats inattendus. Déclarez cette variable en dehors du bloc 'Using'.</target> <note /> </trans-unit> <trans-unit id="WRN_MutableStructureInUsing_Title"> <source>Local variable declared by Using statement is read-only and its type is a structure</source> <target state="translated">La variable locale déclarée à l’aide d’une instruction Using est en lecture seule et son type est une structure</target> <note /> </trans-unit> <trans-unit id="WRN_MutableGenericStructureInUsing"> <source>Local variable '{0}' is read-only. When its type is a structure, invoking its members or passing it ByRef does not change its content and might lead to unexpected results. Consider declaring this variable outside of the 'Using' block.</source> <target state="translated">La variable locale '{0}' est en lecture seule. Lorsque son type est une structure, l'appel de ses membres ou le passage de ByRef ne modifie pas son contenu et peut provoquer des résultats inattendus. Déclarez cette variable en dehors du bloc 'Using'.</target> <note /> </trans-unit> <trans-unit id="WRN_MutableGenericStructureInUsing_Title"> <source>Local variable declared by Using statement is read-only and its type may be a structure</source> <target state="translated">La variable locale déclarée à l’aide d’une instruction Using est en lecture seule et son type peut être une structure</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionSubst1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionSubst1_Title"> <source>Implicit conversion</source> <target state="translated">Conversion implicite</target> <note /> </trans-unit> <trans-unit id="WRN_LateBindingResolution"> <source>Late bound resolution; runtime errors could occur.</source> <target state="translated">Résolution à liaison tardive ; des erreurs d'exécution peuvent se produire.</target> <note /> </trans-unit> <trans-unit id="WRN_LateBindingResolution_Title"> <source>Late bound resolution</source> <target state="translated">Résolution à liaison tardive</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1"> <source>Operands of type Object used for operator '{0}'; use the 'Is' operator to test object identity.</source> <target state="translated">Opérandes de type Object utilisés pour l'opérateur '{0}' ; utilisez l'opérateur 'Is' pour tester l'identité de l'objet.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1_Title"> <source>Operands of type Object used for operator</source> <target state="translated">Opérandes de type Object utilisés pour l’opérateur</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath2"> <source>Operands of type Object used for operator '{0}'; runtime errors could occur.</source> <target state="translated">Opérandes de type Object utilisés pour l'opérateur '{0}' ; des erreurs d'exécution peuvent se produire.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath2_Title"> <source>Operands of type Object used for operator</source> <target state="translated">Opérandes de type Object utilisés pour l’opérateur</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedVar1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedVar1_Title"> <source>Variable declaration without an 'As' clause</source> <target state="translated">Déclaration de variable sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumed1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumed1_Title"> <source>Function without an 'As' clause</source> <target state="translated">Fonction sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedProperty1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedProperty1_Title"> <source>Property without an 'As' clause</source> <target state="translated">Propriété sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinVarDecl"> <source>Variable declaration without an 'As' clause; type of Object assumed.</source> <target state="translated">Déclaration de variable sans clause 'As' ; type Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinVarDecl_Title"> <source>Variable declaration without an 'As' clause</source> <target state="translated">Déclaration de variable sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinFunction"> <source>Function without an 'As' clause; return type of Object assumed.</source> <target state="translated">Fonction sans clause 'As' ; type de retour Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinFunction_Title"> <source>Function without an 'As' clause</source> <target state="translated">Fonction sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinProperty"> <source>Property without an 'As' clause; type of Object assumed.</source> <target state="translated">Propriété sans clause 'As' ; type Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinProperty_Title"> <source>Property without an 'As' clause</source> <target state="translated">Propriété sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocal"> <source>Unused local variable: '{0}'.</source> <target state="translated">Variable locale inutilisée : '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocal_Title"> <source>Unused local variable</source> <target state="translated">Variable locale non utilisée</target> <note /> </trans-unit> <trans-unit id="WRN_SharedMemberThroughInstance"> <source>Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.</source> <target state="translated">Accès d'un membre partagé, d'un membre de constante, d'un membre enum ou d'un type imbriqué via une instance ; l'expression qualifiante ne sera pas évaluée.</target> <note /> </trans-unit> <trans-unit id="WRN_SharedMemberThroughInstance_Title"> <source>Access of shared member, constant member, enum member or nested type through an instance</source> <target state="translated">Accès d’un membre partagé, d’un membre de constante, d’un membre enum ou d’un type imbriqué via une instance</target> <note /> </trans-unit> <trans-unit id="WRN_RecursivePropertyCall"> <source>Expression recursively calls the containing property '{0}'.</source> <target state="translated">L'expression appelle de manière récursive la propriété conteneur '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursivePropertyCall_Title"> <source>Expression recursively calls the containing property</source> <target state="translated">L’expression appelle de manière récursive la propriété conteneur</target> <note /> </trans-unit> <trans-unit id="WRN_OverlappingCatch"> <source>'Catch' block never reached, because '{0}' inherits from '{1}'.</source> <target state="translated">'Le bloc 'Catch' n'a jamais été atteint, car '{0}' hérite de '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_OverlappingCatch_Title"> <source>'Catch' block never reached; exception type's base type handled above in the same Try statement</source> <target state="translated">'Le bloc 'Catch' n'a jamais été atteint. Le type de base du type d'exception est géré au-dessus dans la même instruction Try</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRef"> <source>Variable '{0}' is passed by reference before it has been assigned a value. A null reference exception could result at runtime.</source> <target state="translated">La variable '{0}' est passée par référence avant qu'une valeur lui ait été attribuée. Cela peut provoquer une exception de référence null au moment de l'exécution.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRef_Title"> <source>Variable is passed by reference before it has been assigned a value</source> <target state="translated">La variable est transmise par référence avant de se voir attribuer une valeur</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateCatch"> <source>'Catch' block never reached; '{0}' handled above in the same Try statement.</source> <target state="translated">'Bloc 'Catch' jamais atteint ; '{0}' géré au-dessus dans la même instruction Try.</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateCatch_Title"> <source>'Catch' block never reached; exception type handled above in the same Try statement</source> <target state="translated">'Le bloc 'Catch' n’a jamais été atteint. Le type d’exception est traité au-dessus dans la même instruction Try</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1Not"> <source>Operands of type Object used for operator '{0}'; use the 'IsNot' operator to test object identity.</source> <target state="translated">Opérandes de type Object utilisés pour l'opérateur '{0}' ; utilisez l'opérateur 'IsNot' pour tester l'identité de l'objet.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1Not_Title"> <source>Operands of type Object used for operator &lt;&gt;</source> <target state="translated">Opérandes de type Object utilisés pour l’opérateur &lt;&gt;</target> <note /> </trans-unit> <trans-unit id="WRN_BadChecksumValExtChecksum"> <source>Bad checksum value, non hex digits or odd number of hex digits.</source> <target state="translated">Valeur de checksum erronée, pas de chiffre hexadécimal ou de nombre impair de chiffres hexadécimaux.</target> <note /> </trans-unit> <trans-unit id="WRN_BadChecksumValExtChecksum_Title"> <source>Bad checksum value, non hex digits or odd number of hex digits</source> <target state="translated">Valeur de checksum erronée, pas de chiffre hexadécimal ou de nombre impair de chiffres hexadécimaux</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleDeclFileExtChecksum"> <source>File name already declared with a different GUID and checksum value.</source> <target state="translated">Le nom de fichier est déjà déclaré avec un GUID et une valeur de checksum différents.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleDeclFileExtChecksum_Title"> <source>File name already declared with a different GUID and checksum value</source> <target state="translated">Le nom de fichier est déjà déclaré avec un GUID et une valeur de checksum différents</target> <note /> </trans-unit> <trans-unit id="WRN_BadGUIDFormatExtChecksum"> <source>Bad GUID format.</source> <target state="translated">Format de GUID incorrect.</target> <note /> </trans-unit> <trans-unit id="WRN_BadGUIDFormatExtChecksum_Title"> <source>Bad GUID format</source> <target state="translated">Format de GUID incorrect</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMathSelectCase"> <source>Operands of type Object used in expressions for 'Select', 'Case' statements; runtime errors could occur.</source> <target state="translated">Opérandes de type Object utilisés dans les expressions pour les instructions 'Select', 'Case' ; des erreurs au moment de l'exécution peuvent se produire.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMathSelectCase_Title"> <source>Operands of type Object used in expressions for 'Select', 'Case' statements</source> <target state="translated">Opérandes de type Object utilisés dans des expressions pour les instructions 'Select' et 'Case'</target> <note /> </trans-unit> <trans-unit id="WRN_EqualToLiteralNothing"> <source>This expression will always evaluate to Nothing (due to null propagation from the equals operator). To check if the value is null consider using 'Is Nothing'.</source> <target state="translated">Cette expression sera toujours évaluée en Nothing (en raison de la propagation nulle à partir de l'opérateur égal). Pour vérifier si la valeur est null, utilisez 'Is Nothing'.</target> <note /> </trans-unit> <trans-unit id="WRN_EqualToLiteralNothing_Title"> <source>This expression will always evaluate to Nothing</source> <target state="translated">Cette expression sera toujours évaluée en Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_NotEqualToLiteralNothing"> <source>This expression will always evaluate to Nothing (due to null propagation from the equals operator). To check if the value is not null consider using 'IsNot Nothing'.</source> <target state="translated">Cette expression sera toujours évaluée en Nothing (en raison de la propagation nulle à partir de l'opérateur égal). Pour vérifier si la valeur n'est pas null, utilisez 'IsNot Nothing'.</target> <note /> </trans-unit> <trans-unit id="WRN_NotEqualToLiteralNothing_Title"> <source>This expression will always evaluate to Nothing</source> <target state="translated">Cette expression sera toujours évaluée en Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocalConst"> <source>Unused local constant: '{0}'.</source> <target state="translated">Constante locale inutilisée : '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocalConst_Title"> <source>Unused local constant</source> <target state="translated">Constante locale non utilisée</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassInterfaceShadows5"> <source>'Microsoft.VisualBasic.ComClassAttribute' on class '{0}' implicitly declares {1} '{2}', which conflicts with a member of the same name in {3} '{4}'. Use 'Microsoft.VisualBasic.ComClassAttribute(InterfaceShadows:=True)' if you want to hide the name on the base {4}.</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' dans la classe '{0}' déclare implicitement {1} '{2}', qui est en conflit avec un membre du même nom dans {3} '{4}'. Utilisez 'Microsoft.VisualBasic.ComClassAttribute(InterfaceShadows:=True)' si vous voulez masquer le nom dans le {4} de base.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassInterfaceShadows5_Title"> <source>'Microsoft.VisualBasic.ComClassAttribute' on class implicitly declares member, which conflicts with a member of the same name</source> <target state="translated">'Microsoft.VisualBasic.ComClassAttribute' sur la classe déclare le membre de manière implicite, ce qui provoque un conflit avec un membre du même nom</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassPropertySetObject1"> <source>'{0}' cannot be exposed to COM as a property 'Let'. You will not be able to assign non-object values (such as numbers or strings) to this property from Visual Basic 6.0 using a 'Let' statement.</source> <target state="translated">'{0}' ne peut pas être exposé à COM en tant que propriété 'Let'. Vous ne serez pas en mesure d'assigner des valeurs qui ne sont pas des objets (telles que des nombres ou des chaînes) à cette propriété à partir de Visual Basic 6.0 à l'aide d'une instruction 'Let'.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassPropertySetObject1_Title"> <source>Property cannot be exposed to COM as a property 'Let'</source> <target state="translated">La propriété ne peut pas être exposée à COM en tant que propriété 'Let'</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRef"> <source>Variable '{0}' is used before it has been assigned a value. A null reference exception could result at runtime.</source> <target state="translated">La variable '{0}' est utilisée avant qu'une valeur ne lui ait été assignée. Une exception de référence null peut se produire au moment de l'exécution.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRef_Title"> <source>Variable is used before it has been assigned a value</source> <target state="translated">La variable est utilisée avant de se voir attribuer une valeur</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncRef1"> <source>Function '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">La fonction '{0}' ne retourne pas une valeur pour tous les chemins du code. Une exception de référence null peut se produire au moment de l'exécution lorsque le résultat est utilisé.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncRef1_Title"> <source>Function doesn't return a value on all code paths</source> <target state="translated">La fonction ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpRef1"> <source>Operator '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">L'opérateur '{0}' ne retourne pas une valeur pour tous les chemins du code. Une exception de référence null peut se produire au moment de l'exécution lorsque le résultat est utilisé.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpRef1_Title"> <source>Operator doesn't return a value on all code paths</source> <target state="translated">L’opérateur ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropRef1"> <source>Property '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">La propriété '{0}' ne retourne pas une valeur pour tous les chemins du code. Une exception de référence null peut se produire au moment de l'exécution lorsque le résultat est utilisé.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropRef1_Title"> <source>Property doesn't return a value on all code paths</source> <target state="translated">La propriété ne retourne pas une valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRefStr"> <source>Variable '{0}' is passed by reference before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use</source> <target state="translated">La variable '{0}' est passée par référence avant qu'une valeur lui ait été attribuée. Cela peut provoquer une exception de référence null au moment de l'exécution. Assurez-vous que la structure et tous les membres de référence sont initialisés avant leur utilisation</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRefStr_Title"> <source>Variable is passed by reference before it has been assigned a value</source> <target state="translated">La variable est transmise par référence avant de se voir attribuer une valeur</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefStr"> <source>Variable '{0}' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use</source> <target state="translated">La variable '{0}' est utilisée avant qu'une valeur ne lui ait été assignée. Une exception de référence null peut se produire au moment de l'exécution. Vérifiez que la structure ou que tous les membres de référence sont initialisés avant de les utiliser</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefStr_Title"> <source>Variable is used before it has been assigned a value</source> <target state="translated">La variable est utilisée avant de se voir attribuer une valeur</target> <note /> </trans-unit> <trans-unit id="WRN_StaticLocalNoInference"> <source>Static variable declared without an 'As' clause; type of Object assumed.</source> <target state="translated">Variable Static déclarée sans clause 'As' ; type Object pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_StaticLocalNoInference_Title"> <source>Static variable declared without an 'As' clause</source> <target state="translated">Variable statique déclarée sans clause 'As'</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName"> <source>Assembly reference '{0}' is invalid and cannot be resolved.</source> <target state="translated">La référence d'assembly '{0}' n'est pas valide et ne peut pas être résolue.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName_Title"> <source>Assembly reference is invalid and cannot be resolved</source> <target state="translated">La référence d'assembly n'est pas valide et ne peut pas être résolue</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadXMLLine"> <source>XML comment block must immediately precede the language element to which it applies. XML comment will be ignored.</source> <target state="translated">Le bloc de commentaires XML doit précéder immédiatement l'élément de langage auquel il se rapporte. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadXMLLine_Title"> <source>XML comment block must immediately precede the language element to which it applies</source> <target state="translated">Le bloc de commentaires XML doit précéder immédiatement l’élément de langage auquel il se rapporte</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocMoreThanOneCommentBlock"> <source>Only one XML comment block is allowed per language element.</source> <target state="translated">Un seul bloc de commentaires XML est autorisé par élément de langage.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocMoreThanOneCommentBlock_Title"> <source>Only one XML comment block is allowed per language element</source> <target state="translated">Un seul bloc de commentaires XML est autorisé par élément de langage</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocNotFirstOnLine"> <source>XML comment must be the first statement on a line. XML comment will be ignored.</source> <target state="translated">Le commentaire XML doit être la première instruction sur une ligne. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocNotFirstOnLine_Title"> <source>XML comment must be the first statement on a line</source> <target state="translated">Le commentaire XML doit être la première instruction d’une ligne</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInsideMethod"> <source>XML comment cannot appear within a method or a property. XML comment will be ignored.</source> <target state="translated">Un commentaire XML ne peut pas figurer dans une méthode ou une propriété. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInsideMethod_Title"> <source>XML comment cannot appear within a method or a property</source> <target state="translated">Le commentaire XML ne peut pas apparaître dans une méthode ou une propriété</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParseError1"> <source>XML documentation parse error: {0} XML comment will be ignored.</source> <target state="translated">Erreur d'analyse de la documentation XML : le commentaire XML {0} sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParseError1_Title"> <source>XML documentation parse error</source> <target state="translated">Erreur d'analyse de la documentation XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocDuplicateXMLNode1"> <source>XML comment tag '{0}' appears with identical attributes more than once in the same XML comment block.</source> <target state="translated">La balise de commentaire XML '{0}' s'affiche avec des attributs identiques plusieurs fois dans le même bloc de commentaires XML.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocDuplicateXMLNode1_Title"> <source>XML comment tag appears with identical attributes more than once in the same XML comment block</source> <target state="translated">La balise de commentaire XML apparaît plusieurs fois avec des attributs identiques dans le même bloc de commentaire XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocIllegalTagOnElement2"> <source>XML comment tag '{0}' is not permitted on a '{1}' language element.</source> <target state="translated">La balise de commentaire XML '{0}' n'est pas autorisée dans un élément de langage '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocIllegalTagOnElement2_Title"> <source>XML comment tag is not permitted on language element</source> <target state="translated">La balise de commentaire XML n’est pas autorisée sur un élément de langue</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadParamTag2"> <source>XML comment parameter '{0}' does not match a parameter on the corresponding '{1}' statement.</source> <target state="translated">Le paramètre de commentaire XML '{0}' ne correspond pas à un paramètre pour l'instruction '{1}' correspondante.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadParamTag2_Title"> <source>XML comment parameter does not match a parameter on the corresponding declaration statement</source> <target state="translated">Le paramètre du commentaire XML ne correspond pas à un paramètre pour l’instruction de déclaration correspondante</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParamTagWithoutName"> <source>XML comment parameter must have a 'name' attribute.</source> <target state="translated">Le paramètre de commentaire XML doit avoir un attribut 'name'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParamTagWithoutName_Title"> <source>XML comment parameter must have a 'name' attribute</source> <target state="translated">Le paramètre de commentaire XML doit avoir un attribut 'name'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefAttributeNotFound1"> <source>XML comment has a tag with a 'cref' attribute '{0}' that could not be resolved.</source> <target state="translated">Le commentaire XML a une balise avec un attribut 'cref' '{0}' qui n'a pas pu être résolu.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefAttributeNotFound1_Title"> <source>XML comment has a tag with a 'cref' attribute that could not be resolved</source> <target state="translated">Le commentaire XML possède une balise avec un attribut 'cref' qui n’a pas pu être résolu</target> <note /> </trans-unit> <trans-unit id="WRN_XMLMissingFileOrPathAttribute1"> <source>XML comment tag 'include' must have a '{0}' attribute. XML comment will be ignored.</source> <target state="translated">La balise de commentaire XML 'include' doit avoir un attribut '{0}'. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLMissingFileOrPathAttribute1_Title"> <source>XML comment tag 'include' must have 'file' and 'path' attributes</source> <target state="translated">La balise de commentaire XML 'include' doit comporter les attributs 'file' et 'path'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLCannotWriteToXMLDocFile2"> <source>Unable to create XML documentation file '{0}': {1}</source> <target state="translated">Impossible de créer un fichier de documentation XML '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLCannotWriteToXMLDocFile2_Title"> <source>Unable to create XML documentation file</source> <target state="translated">Impossible de créer un fichier de documentation XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocWithoutLanguageElement"> <source>XML documentation comments must precede member or type declarations.</source> <target state="translated">Les commentaires de documentation XML doivent précéder les déclarations de membre ou de type.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocWithoutLanguageElement_Title"> <source>XML documentation comments must precede member or type declarations</source> <target state="translated">Les commentaires de documentation XML doivent précéder les déclarations de membre ou de type</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnWriteOnlyProperty"> <source>XML comment tag 'returns' is not permitted on a 'WriteOnly' Property.</source> <target state="translated">La balise de commentaire XML 'returns' n'est pas autorisée pour une propriété 'WriteOnly'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnWriteOnlyProperty_Title"> <source>XML comment tag 'returns' is not permitted on a 'WriteOnly' Property</source> <target state="translated">La balise de commentaire XML 'returns' n'est pas autorisée pour une propriété 'WriteOnly'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocOnAPartialType"> <source>XML comment cannot be applied more than once on a partial {0}. XML comments for this {0} will be ignored.</source> <target state="translated">Le commentaire XML ne peut pas être appliqué plusieurs fois pour un {0} partiel. Les commentaires XML pour ce {0} seront ignorés.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocOnAPartialType_Title"> <source>XML comment cannot be applied more than once on a partial type</source> <target state="translated">Le commentaire XML ne peut pas être appliqué plusieurs fois sur un type partiel</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnADeclareSub"> <source>XML comment tag 'returns' is not permitted on a 'declare sub' language element.</source> <target state="translated">La balise de commentaire XML 'returns' n'est pas autorisée pour un élément de langage 'declare sub'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnADeclareSub_Title"> <source>XML comment tag 'returns' is not permitted on a 'declare sub' language element</source> <target state="translated">La balise de commentaire XML 'returns' n’est pas autorisée pour un élément de langage 'declare sub'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocStartTagWithNoEndTag"> <source>XML documentation parse error: Start tag '{0}' doesn't have a matching end tag. XML comment will be ignored.</source> <target state="translated">Erreur d'analyse de la documentation XML : la balise de début '{0}' n'a pas de balise de fin correspondante. Le commentaire XML sera ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocStartTagWithNoEndTag_Title"> <source>XML documentation parse error: Start tag doesn't have a matching end tag</source> <target state="translated">Erreur d’analyse de la documentation XML. La balise de début n’a pas de balise de fin correspondante</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadGenericParamTag2"> <source>XML comment type parameter '{0}' does not match a type parameter on the corresponding '{1}' statement.</source> <target state="translated">Le paramètre de type du commentaire XML '{0}' ne correspond pas à un paramètre de type pour l'instruction '{1}' correspondante.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadGenericParamTag2_Title"> <source>XML comment type parameter does not match a type parameter on the corresponding declaration statement</source> <target state="translated">Le paramètre de type du commentaire XML ne correspond pas à un paramètre de type pour l’instruction de déclaration correspondante</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocGenericParamTagWithoutName"> <source>XML comment type parameter must have a 'name' attribute.</source> <target state="translated">Le paramètre de type de commentaire XML doit avoir un attribut 'name'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocGenericParamTagWithoutName_Title"> <source>XML comment type parameter must have a 'name' attribute</source> <target state="translated">Le paramètre de type de commentaire XML doit avoir un attribut 'name'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocExceptionTagWithoutCRef"> <source>XML comment exception must have a 'cref' attribute.</source> <target state="translated">Une exception de commentaire XML doit avoir un attribut 'cref'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocExceptionTagWithoutCRef_Title"> <source>XML comment exception must have a 'cref' attribute</source> <target state="translated">Une exception de commentaire XML doit avoir un attribut 'cref'</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInvalidXMLFragment"> <source>Unable to include XML fragment '{0}' of file '{1}'.</source> <target state="translated">Impossible d'inclure le fragment XML '{0}' du fichier '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInvalidXMLFragment_Title"> <source>Unable to include XML fragment</source> <target state="translated">Impossible d'inclure le fragment XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadFormedXML"> <source>Unable to include XML fragment '{1}' of file '{0}'. {2}</source> <target state="translated">Impossible d'inclure le fragment XML '{1}' du fichier '{0}'. {2}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadFormedXML_Title"> <source>Unable to include XML fragment</source> <target state="translated">Impossible d'inclure le fragment XML</target> <note /> </trans-unit> <trans-unit id="WRN_InterfaceConversion2"> <source>Runtime errors might occur when converting '{0}' to '{1}'.</source> <target state="translated">Des erreurs d'exécution peuvent se produire lors de la conversion de '{0}' en '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_InterfaceConversion2_Title"> <source>Runtime errors might occur when converting to or from interface type</source> <target state="translated">Des erreurs d’exécution peuvent survenir lors de la conversion vers ou depuis le type d'interface</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableLambda"> <source>Using the iteration variable in a lambda expression may have unexpected results. Instead, create a local variable within the loop and assign it the value of the iteration variable.</source> <target state="translated">L'utilisation de la variable d'itération dans une expression lambda peut provoquer des résultats inattendus. Créez une variable locale dans la boucle et assignez-lui la valeur de la variable d'itération à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableLambda_Title"> <source>Using the iteration variable in a lambda expression may have unexpected results</source> <target state="translated">L’utilisation d’une variable d’itération dans une expression lambda peut avoir des résultats inattendus</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaPassedToRemoveHandler"> <source>Lambda expression will not be removed from this event handler. Assign the lambda expression to a variable and use the variable to add and remove the event.</source> <target state="translated">L'expression lambda ne sera pas supprimée de ce gestionnaire d'événements. Assignez l'expression lambda à une variable et utilisez cette dernière pour ajouter et supprimer l'événement.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaPassedToRemoveHandler_Title"> <source>Lambda expression will not be removed from this event handler</source> <target state="translated">L’expression lambda ne sera pas supprimée de ce gestionnaire d’événements</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableQuery"> <source>Using the iteration variable in a query expression may have unexpected results. Instead, create a local variable within the loop and assign it the value of the iteration variable.</source> <target state="translated">L'utilisation de la variable d'itération dans une expression de requête peut provoquer des résultats inattendus. Créez une variable locale dans la boucle et assignez-lui la valeur de la variable d'itération à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableQuery_Title"> <source>Using the iteration variable in a query expression may have unexpected results</source> <target state="translated">L’utilisation d’une variable d’itération dans une expression de requête peut avoir des résultats inattendus</target> <note /> </trans-unit> <trans-unit id="WRN_RelDelegatePassedToRemoveHandler"> <source>The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event. Assign the 'AddressOf' expression to a variable, and use the variable to add or remove the method as the handler.</source> <target state="translated">L'expression 'AddressOf' n'a pas d'effet dans ce contexte, car l'argument de la méthode pour 'AddressOf' requiert une conversion souple en type délégué de l'événement. Assignez l'expression 'AddressOf' à une variable et utilisez la variable pour ajouter ou supprimer la méthode comme gestionnaire.</target> <note /> </trans-unit> <trans-unit id="WRN_RelDelegatePassedToRemoveHandler_Title"> <source>The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event</source> <target state="translated">L’expression 'AddressOf' n’a pas d’effet dans ce contexte, car l’argument de la méthode pour 'AddressOf' requiert une conversion souple en type délégué de l’événement</target> <note /> </trans-unit> <trans-unit id="WRN_QueryMissingAsClauseinVarDecl"> <source>Range variable is assumed to be of type Object because its type cannot be inferred. Use an 'As' clause to specify a different type.</source> <target state="translated">La variable de portée est considérée comme étant de type Object, car son type ne peut pas être déduit. Utilisez une clause 'As' pour indiquer un type différent.</target> <note /> </trans-unit> <trans-unit id="WRN_QueryMissingAsClauseinVarDecl_Title"> <source>Range variable is assumed to be of type Object because its type cannot be inferred</source> <target state="translated">La variable de portée est considérée être de type Object, car son type ne peut pas être déduit</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdaMissingFunction"> <source>Multiline lambda expression is missing 'End Function'.</source> <target state="translated">L'expression lambda multiligne ne contient pas de 'End Function'.</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdaMissingSub"> <source>Multiline lambda expression is missing 'End Sub'.</source> <target state="translated">L'expression lambda multiligne ne contient pas 'End Sub'.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOnLambdaReturnType"> <source>Attributes cannot be applied to return types of lambda expressions.</source> <target state="translated">Les attributs ne peuvent pas être appliqués aux types de retour des expressions lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_SubDisallowsStatement"> <source>Statement is not valid inside a single-line statement lambda.</source> <target state="translated">L'instruction n'est pas valide au sein d'une lambda-instruction sur une seule ligne.</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesBang"> <source>This single-line statement lambda must be enclosed in parentheses. For example: (Sub() &lt;statement&gt;)!key</source> <target state="translated">Cette lambda-instruction sur une seule ligne doit être mise entre parenthèses. Par exemple : (Sub() &lt;instruction&gt;)!key</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesDot"> <source>This single-line statement lambda must be enclosed in parentheses. For example: (Sub() &lt;statement&gt;).Invoke()</source> <target state="translated">Cette lambda-instruction sur une seule ligne doit être mise entre parenthèses. Par exemple : (Sub() &lt;instruction&gt;).Invoke()</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesLParen"> <source>This single-line statement lambda must be enclosed in parentheses. For example: Call (Sub() &lt;statement&gt;) ()</source> <target state="translated">Cette lambda-instruction sur une seule ligne doit être mise entre parenthèses. Par exemple : Call (Sub() &lt;instruction&gt;) ()</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresSingleStatement"> <source>Single-line statement lambdas must include exactly one statement.</source> <target state="translated">Les lambda-instructions sur une seule ligne doivent inclure exactement une instruction.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticInLambda"> <source>Static local variables cannot be declared inside lambda expressions.</source> <target state="translated">Les variables locales static ne peuvent pas être déclarées dans des expressions lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializedExpandedProperty"> <source>Expanded Properties cannot be initialized.</source> <target state="translated">Les propriétés développées ne peuvent pas être initialisées.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCantHaveParams"> <source>Auto-implemented properties cannot have parameters.</source> <target state="translated">Les propriétés implémentées automatiquement ne peuvent pas avoir de paramètres.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCantBeWriteOnly"> <source>Auto-implemented properties cannot be WriteOnly.</source> <target state="translated">Les propriétés implémentées automatiquement ne peuvent pas être WriteOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFCount"> <source>'If' operator requires either two or three operands.</source> <target state="translated">'L'opérateur 'If' requiert deux ou trois opérandes.</target> <note /> </trans-unit> <trans-unit id="ERR_NotACollection1"> <source>Cannot initialize the type '{0}' with a collection initializer because it is not a collection type.</source> <target state="translated">Impossible d'initialiser le type '{0}' avec un initialiseur de collection, car il ne s'agit pas d'un type de collection.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAddMethod1"> <source>Cannot initialize the type '{0}' with a collection initializer because it does not have an accessible 'Add' method.</source> <target state="translated">Impossible d'initialiser le type '{0}' avec un initialiseur de collection, car il n'a pas de méthode 'Add' accessible.</target> <note /> </trans-unit> <trans-unit id="ERR_CantCombineInitializers"> <source>An Object Initializer and a Collection Initializer cannot be combined in the same initialization.</source> <target state="translated">Un initialiseur d'objet et un initialiseur de collection ne peuvent pas être combinés dans la même initialisation.</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyAggregateInitializer"> <source>An aggregate collection initializer entry must contain at least one element.</source> <target state="translated">Une entrée d'initialiseur de collection d'agrégation doit contenir au moins un élément.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEndElementNoMatchingStart"> <source>XML end element must be preceded by a matching start element.</source> <target state="translated">Un élément de fin XML doit être précédé d'un élément de début correspondant.</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdasCannotContainOnError"> <source>'On Error' and 'Resume' cannot appear inside a lambda expression.</source> <target state="translated">'On Error' et 'Resume' ne peuvent pas être utilisés dans une expression lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceDisallowedHere"> <source>Keywords 'Out' and 'In' can only be used in interface and delegate declarations.</source> <target state="translated">Les mots clés 'Out' et 'In' peuvent uniquement être utilisés dans des déclarations interface et delegate.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEndCDataNotAllowedInContent"> <source>The literal string ']]&gt;' is not allowed in element content.</source> <target state="translated">La chaîne littérale ']]&gt;' n'est pas autorisée dans le contenu de l'élément.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadsModifierInModule"> <source>Inappropriate use of '{0}' keyword in a module.</source> <target state="translated">Utilisation inappropriée du mot clé '{0}' dans un module.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedTypeOrNamespace1"> <source>Type or namespace '{0}' is not defined.</source> <target state="translated">Le type ou l'espace de noms '{0}' n'est pas défini.</target> <note /> </trans-unit> <trans-unit id="ERR_IdentityDirectCastForFloat"> <source>Using DirectCast operator to cast a floating-point value to the same type is not supported.</source> <target state="translated">L'opérateur DirectCast ne peut pas être utilisé pour effectuer un cast d'une valeur à virgule flottante en un type identique.</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteIdentityDirectCastForValueType"> <source>Using DirectCast operator to cast a value-type to the same type is obsolete.</source> <target state="translated">L’opérateur DirectCast ne peut plus être utilisé pour effectuer un cast d’un type valeur en un type identique.</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteIdentityDirectCastForValueType_Title"> <source>Using DirectCast operator to cast a value-type to the same type is obsolete</source> <target state="translated">L’opérateur DirectCast ne peut plus être utilisé pour effectuer un cast d’un type valeur en un type identique</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode"> <source>Unreachable code detected.</source> <target state="translated">Code inatteignable détecté.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode_Title"> <source>Unreachable code detected</source> <target state="translated">Code inaccessible détecté</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncVal1"> <source>Function '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">La fonction '{0}' ne retourne pas une valeur pour tous les chemins du code. Une instruction 'Return' est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncVal1_Title"> <source>Function doesn't return a value on all code paths</source> <target state="translated">La fonction ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpVal1"> <source>Operator '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">L'opérateur '{0}' ne retourne pas une valeur pour tous les chemins du code. Une instruction 'Return' est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpVal1_Title"> <source>Operator doesn't return a value on all code paths</source> <target state="translated">L’opérateur ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropVal1"> <source>Property '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">La propriété '{0}' ne retourne pas une valeur pour tous les chemins du code. Une instruction 'Return' est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropVal1_Title"> <source>Property doesn't return a value on all code paths</source> <target state="translated">La propriété ne retourne pas une valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="ERR_NestedGlobalNamespace"> <source>Global namespace may not be nested in another namespace.</source> <target state="translated">Un espace de noms global ne peut pas être imbriqué dans un autre espace de noms.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatch6"> <source>'{0}' cannot expose type '{1}' in {2} '{3}' through {4} '{5}'.</source> <target state="translated">'{0}' ne peut pas exposer le type '{1}' dans {2} '{3}' via {4} '{5}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadMetaDataReference1"> <source>'{0}' cannot be referenced because it is not a valid assembly.</source> <target state="translated">'Impossible de référencer '{0}', car il ne s'agit pas d'un assembly valide.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyDoesntImplementAllAccessors"> <source>'{0}' cannot be implemented by a {1} property.</source> <target state="translated">'{0}' ne peut pas être implémenté par une propriété {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedMustOverride"> <source> {0}: {1}</source> <target state="translated"> {0}: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_IfTooManyTypesObjectDisallowed"> <source>Cannot infer a common type because more than one type is possible.</source> <target state="translated">Impossible de déduire un type commun, car plusieurs types sont possibles.</target> <note /> </trans-unit> <trans-unit id="WRN_IfTooManyTypesObjectAssumed"> <source>Cannot infer a common type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type commun, car plusieurs types sont possibles. Type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_IfTooManyTypesObjectAssumed_Title"> <source>Cannot infer a common type because more than one type is possible</source> <target state="translated">Impossible de déduire un type commun, car plusieurs types sont possibles</target> <note /> </trans-unit> <trans-unit id="ERR_IfNoTypeObjectDisallowed"> <source>Cannot infer a common type, and Option Strict On does not allow 'Object' to be assumed.</source> <target state="translated">Impossible de déduire un type commun, et Option Strict On n'autorise pas l'utilisation par défaut de 'Object'.</target> <note /> </trans-unit> <trans-unit id="WRN_IfNoTypeObjectAssumed"> <source>Cannot infer a common type; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type commun ; type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_IfNoTypeObjectAssumed_Title"> <source>Cannot infer a common type</source> <target state="translated">Impossible de déduire un type commun</target> <note /> </trans-unit> <trans-unit id="ERR_IfNoType"> <source>Cannot infer a common type.</source> <target state="translated">Impossible de déduire un type commun.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyFileFailure"> <source>Error extracting public key from file '{0}': {1}</source> <target state="translated">Erreur d'extraction de la clé publique du fichier '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyContainerFailure"> <source>Error extracting public key from container '{0}': {1}</source> <target state="translated">Erreur d'extraction de la clé publique du conteneur '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefNotEqualToThis"> <source>Friend access was granted by '{0}', but the public key of the output assembly does not match that specified by the attribute in the granting assembly.</source> <target state="translated">Un accès Friend a été concédé par '{0}', mais la clé publique de l'assembly de sortie ne correspond pas à celle spécifiée par l'attribut concédant.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefSigningMismatch"> <source>Friend access was granted by '{0}', but the strong name signing state of the output assembly does not match that of the granting assembly.</source> <target state="translated">Un accès Friend a été concédé par '{0}', mais l'état de signature avec nom fort de l'assembly de sortie ne correspond pas à celui de l'assembly concédant.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNoKey"> <source>Public sign was specified and requires a public key, but no public key was specified</source> <target state="translated">La signature publique a été spécifiée et nécessite une clé publique. Toutefois, aucune clé publique n'a été spécifiée</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNetModule"> <source>Public signing is not supported for netmodules.</source> <target state="translated">La signature publique n'est pas prise en charge pour les netmodules.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning"> <source>Attribute '{0}' is ignored when public signing is specified.</source> <target state="translated">L'attribut '{0}' est ignoré quand une signature publique est spécifiée.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning_Title"> <source>Attribute is ignored when public signing is specified.</source> <target state="translated">L'attribut est ignoré quand une signature publique est spécifiée.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey"> <source>Delay signing was specified and requires a public key, but no public key was specified.</source> <target state="translated">La signature différée a été spécifiée et nécessite une clé publique, mais aucune clé publique n’a été spécifiée.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey_Title"> <source>Delay signing was specified and requires a public key, but no public key was specified</source> <target state="translated">La signature différée a été spécifiée et nécessite une clé publique, mais aucune clé publique n'a été spécifiée</target> <note /> </trans-unit> <trans-unit id="ERR_SignButNoPrivateKey"> <source>Key file '{0}' is missing the private key needed for signing.</source> <target state="translated">Le fichier de clé '{0}' ne comprend pas la clé privée nécessaire à la signature.</target> <note /> </trans-unit> <trans-unit id="ERR_FailureSigningAssembly"> <source>Error signing assembly '{0}': {1}</source> <target state="translated">Erreur lors de la signature de l'assembly '{0}' : {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat"> <source>The specified version string does not conform to the required format - major[.minor[.build|*[.revision|*]]]</source> <target state="translated">Le format de la chaîne de version spécifiée n'est pas conforme au format requis - major[.minor[.build|*[.revision|*]]]</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">Le format de la chaîne de version spécifiée n'est pas conforme au format requis - major.minor.build.revision</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat_Title"> <source>The specified version string does not conform to the recommended format</source> <target state="translated">La chaîne de version spécifiée n’est pas conforme au format recommandé</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat2"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">Le format de la chaîne de version spécifiée n'est pas conforme au format requis - major.minor.build.revision</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCultureForExe"> <source>Executables cannot be satellite assemblies; culture should always be empty</source> <target state="translated">Les exécutables ne peuvent pas être des assemblys satellites ; la culture doit toujours être vide</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored"> <source>The entry point of the program is global script code; ignoring '{0}' entry point.</source> <target state="translated">Le point d'entrée du programme est du code de script global ; point d'entrée '{0}' ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored_Title"> <source>The entry point of the program is global script code; ignoring entry point</source> <target state="translated">Le point d'entrée du programme est du code de script global ; ce point d'entrée est ignoré</target> <note /> </trans-unit> <trans-unit id="WRN_EmptyPrefixAndXmlnsLocalName"> <source>The xmlns attribute has special meaning and should not be written with a prefix.</source> <target state="translated">L’attribut xmlns a une signification particulière et ne doit pas être écrit avec un préfixe.</target> <note /> </trans-unit> <trans-unit id="WRN_EmptyPrefixAndXmlnsLocalName_Title"> <source>The xmlns attribute has special meaning and should not be written with a prefix</source> <target state="translated">L’attribut xmlns a une signification particulière et ne doit pas être écrit avec un préfixe</target> <note /> </trans-unit> <trans-unit id="WRN_PrefixAndXmlnsLocalName"> <source>It is not recommended to have attributes named xmlns. Did you mean to write 'xmlns:{0}' to define a prefix named '{0}'?</source> <target state="translated">Il n'est pas recommandé de nommer des attributs xmlns. Vouliez-vous écrire 'xmlns:{0}' pour définir un préfixe nommé '{0}' ?</target> <note /> </trans-unit> <trans-unit id="WRN_PrefixAndXmlnsLocalName_Title"> <source>It is not recommended to have attributes named xmlns</source> <target state="translated">Il n’est pas recommandé de nommer des attributs xmlns</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSingleScript"> <source>Expected a single script (.vbx file)</source> <target state="translated">Un seul script est attendu (fichier .vbx)</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedAssemblyName"> <source>The assembly name '{0}' is reserved and cannot be used as a reference in an interactive session</source> <target state="translated">Le nom d'assembly '{0}' est réservé et ne peut pas servir de référence dans une session interactive</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceDirectiveOnlyAllowedInScripts"> <source>#R is only allowed in scripts</source> <target state="translated">#R n'est autorisé que dans les scripts</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAllowedInScript"> <source>You cannot declare Namespace in script code</source> <target state="translated">Impossible de déclarer un espace de noms dans le code de script</target> <note /> </trans-unit> <trans-unit id="ERR_KeywordNotAllowedInScript"> <source>You cannot use '{0}' in top-level script code</source> <target state="translated">Vous ne pouvez pas utiliser '{0}' dans du code de script de premier niveau</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNoType"> <source>Cannot infer a return type. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Impossible de déduire un type de retour. Ajoutez une clause 'As' pour spécifier le type de retour.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaNoTypeObjectAssumed"> <source>Cannot infer a return type; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type de retour ; type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaNoTypeObjectAssumed_Title"> <source>Cannot infer a return type</source> <target state="translated">Impossible de déduire un type de retour</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaTooManyTypesObjectAssumed"> <source>Cannot infer a return type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type de retour, car plusieurs types sont possibles. Type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaTooManyTypesObjectAssumed_Title"> <source>Cannot infer a return type because more than one type is possible</source> <target state="translated">Impossible de déduire un type de retour car plusieurs types sont possibles</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNoTypeObjectDisallowed"> <source>Cannot infer a return type. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Impossible de déduire un type de retour. Ajoutez une clause 'As' pour spécifier le type de retour.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaTooManyTypesObjectDisallowed"> <source>Cannot infer a return type because more than one type is possible. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Impossible de déduire un type de retour, car plusieurs types sont possibles. Ajoutez une clause 'As' pour spécifier le type de retour.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch"> <source>The command line switch '{0}' is not yet implemented and was ignored.</source> <target state="translated">Le commutateur de ligne de commande '{0}' n'est pas encore implémenté et a été ignoré.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch_Title"> <source>Command line switch is not yet implemented</source> <target state="translated">Le commutateur de ligne de commande n’est pas encore implémenté</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitNoTypeObjectDisallowed"> <source>Cannot infer an element type, and Option Strict On does not allow 'Object' to be assumed. Specifying the type of the array might correct this error.</source> <target state="translated">Impossible de déduire un type d'élément, et Option Strict On n'autorise pas l'utilisation par défaut de 'Object'. La spécification du type du tableau peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitNoType"> <source>Cannot infer an element type. Specifying the type of the array might correct this error.</source> <target state="translated">Impossible de déduire un type d'élément. La spécification du type de tableau peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitTooManyTypesObjectDisallowed"> <source>Cannot infer an element type because more than one type is possible. Specifying the type of the array might correct this error.</source> <target state="translated">Impossible de déduire un type d'élément, car plusieurs types sont possibles. La spécification du type du tableau peut permettre de corriger cette erreur.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitNoTypeObjectAssumed"> <source>Cannot infer an element type; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type d'élément ; type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitNoTypeObjectAssumed_Title"> <source>Cannot infer an element type</source> <target state="translated">Impossible de déduire un type d’élément</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitTooManyTypesObjectAssumed"> <source>Cannot infer an element type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Impossible de déduire un type d'élément, car plusieurs types sont possibles. Type 'Object' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitTooManyTypesObjectAssumed_Title"> <source>Cannot infer an element type because more than one type is possible</source> <target state="translated">Impossible de déduire un type d’élément car plusieurs types sont possibles</target> <note /> </trans-unit> <trans-unit id="WRN_TypeInferenceAssumed3"> <source>Data type of '{0}' in '{1}' could not be inferred. '{2}' assumed.</source> <target state="translated">Impossible de déduire le type de données de '{0}' dans '{1}'. '{2}' pris par défaut.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeInferenceAssumed3_Title"> <source>Data type could not be inferred</source> <target state="translated">Le type de données n’a pas pu être déduit</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousCastConversion2"> <source>Option Strict On does not allow implicit conversions from '{0}' to '{1}' because the conversion is ambiguous.</source> <target state="translated">Option Strict On n'autorise pas les conversions implicites de '{0}' en '{1}', car la conversion est ambiguë.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousCastConversion2"> <source>Conversion from '{0}' to '{1}' may be ambiguous.</source> <target state="translated">La conversion de '{0}' en '{1}' peut être ambiguë.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousCastConversion2_Title"> <source>Conversion may be ambiguous</source> <target state="translated">La conversion est peut-être ambiguë</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceIEnumerableSuggestion3"> <source>'{0}' cannot be converted to '{1}'. Consider using '{2}' instead.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Utilisez '{2}' à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceIEnumerableSuggestion3"> <source>'{0}' cannot be converted to '{1}'. Consider using '{2}' instead.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Utilisez '{2}' à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceIEnumerableSuggestion3_Title"> <source>Type cannot be converted to target collection type</source> <target state="translated">Le type ne peut pas être converti en type de collection cible</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedIn6"> <source>'{4}' cannot be converted to '{5}' because '{0}' is not derived from '{1}', as required for the 'In' generic parameter '{2}' in '{3}'.</source> <target state="translated">'Impossible de convertir '{4}' en '{5}', car '{0}' n'est pas dérivé de '{1}', comme le requiert le paramètre générique 'In' '{2}' dans '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedOut6"> <source>'{4}' cannot be converted to '{5}' because '{0}' is not derived from '{1}', as required for the 'Out' generic parameter '{2}' in '{3}'.</source> <target state="translated">'Impossible de convertir '{4}' en '{5}', car '{0}' n'est pas dérivé de '{1}', comme le requiert le paramètre générique 'Out' '{2}' dans '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedIn6"> <source>Implicit conversion from '{4}' to '{5}'; this conversion may fail because '{0}' is not derived from '{1}', as required for the 'In' generic parameter '{2}' in '{3}'.</source> <target state="translated">Conversion implicite de '{4}' en '{5}' ; cette conversion peut échouer car '{0}' ne dérive pas de '{1}', comme cela est requis pour le paramètre générique 'In' '{2}' dans '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedIn6_Title"> <source>Implicit conversion; this conversion may fail because the target type is not derived from the source type, as required for 'In' generic parameter</source> <target state="translated">Conversion implicite. Il est possible que cette conversion échoue, car le type cible n’est pas dérivé d’un type source, comme le requiert le paramètre générique 'In'</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedOut6"> <source>Implicit conversion from '{4}' to '{5}'; this conversion may fail because '{0}' is not derived from '{1}', as required for the 'Out' generic parameter '{2}' in '{3}'.</source> <target state="translated">Conversion implicite de '{4}' en '{5}' ; cette conversion peut échouer car '{0}' ne dérive pas de '{1}', comme cela est requis pour le paramètre générique 'Out' '{2}' dans '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedOut6_Title"> <source>Implicit conversion; this conversion may fail because the target type is not derived from the source type, as required for 'Out' generic parameter</source> <target state="translated">Conversion implicite. Il est possible que cette conversion échoue, car le type cible n’est pas dérivé du type source, comme le requiert le paramètre générique 'Out'</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedTryIn4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an In type parameter, 'In {2}'.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Changez '{2}' dans la définition de '{3}' en paramètre de type In, 'In {2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedTryOut4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an Out type parameter, 'Out {2}'.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Changez '{2}' dans la définition de '{3}' en paramètre de type Out, 'Out {2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryIn4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an In type parameter, 'In {2}'.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Changez '{2}' dans la définition de '{3}' en paramètre de type In, 'In {2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryIn4_Title"> <source>Type cannot be converted to target type</source> <target state="translated">Le type ne peut pas être converti en type cible</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryOut4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an Out type parameter, 'Out {2}'.</source> <target state="translated">'Impossible de convertir '{0}' en '{1}'. Changez '{2}' dans la définition de '{3}' en paramètre de type Out, 'Out {2}'.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryOut4_Title"> <source>Type cannot be converted to target type</source> <target state="translated">Le type ne peut pas être converti en type cible</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceDeclarationAmbiguous3"> <source>Interface '{0}' is ambiguous with another implemented interface '{1}' due to the 'In' and 'Out' parameters in '{2}'.</source> <target state="translated">La présence des paramètres 'In' et 'Out' dans '{2}' crée une ambiguïté entre l'interface '{0}' et une autre interface '{1}' implémentée.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceDeclarationAmbiguous3_Title"> <source>Interface is ambiguous with another implemented interface due to 'In' and 'Out' parameters</source> <target state="translated">La présence des paramètres 'In' et 'Out' crée une ambiguïté entre l’interface et une autre interface implémentée</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInterfaceNesting"> <source>Enumerations, classes, and structures cannot be declared in an interface that has an 'In' or 'Out' type parameter.</source> <target state="translated">Les énumérations, les classes et les structures ne peuvent pas être déclarées dans une interface comportant un paramètre de type 'In' ou 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VariancePreventsSynthesizedEvents2"> <source>Event definitions with parameters are not allowed in an interface such as '{0}' that has 'In' or 'Out' type parameters. Consider declaring the event by using a delegate type which is not defined within '{0}'. For example, 'Event {1} As Action(Of ...)'.</source> <target state="translated">Les définitions d'événement avec des paramètres ne sont pas autorisées dans une interface '{0}' qui a des paramètres de type 'In' ou 'Out'. Déclarez l'événement à l'aide d'un type délégué qui n'est pas défini dans '{0}'. Par exemple, 'Event {1} As Action(Of ...)'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInByRefDisallowed1"> <source>Type '{0}' cannot be used in this context because 'In' and 'Out' type parameters cannot be used for ByRef parameter types, and '{0}' is an 'In' type parameter.</source> <target state="translated">Le type '{0}' ne peut pas être utilisé dans ce contexte, car les paramètres de type 'In' et 'Out' ne peuvent pas être utilisés pour les types de paramètre ByRef et '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInNullableDisallowed2"> <source>Type '{0}' cannot be used in '{1}' because 'In' and 'Out' type parameters cannot be made nullable, and '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{1}', car les paramètres de type 'In' et 'Out' ne peuvent pas être rendus Nullable et '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowed1"> <source>Type '{0}' cannot be used in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans ce contexte, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedForGeneric3"> <source>Type '{0}' cannot be used for the '{1}' in '{2}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{1}' dans '{2}' dans ce contexte, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedHere2"> <source>Type '{0}' cannot be used in '{1}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{1}' dans ce contexte, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedHereForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' of '{3}' in '{1}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{2}' de '{3}' dans '{1}' dans ce contexte, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInPropertyDisallowed1"> <source>Type '{0}' cannot be used as a property type in this context because '{0}' is an 'In' type parameter and the property is not marked WriteOnly.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de propriété dans ce contexte, car '{0}' est un paramètre de type 'In' et la propriété n'est pas marquée WriteOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInReadOnlyPropertyDisallowed1"> <source>Type '{0}' cannot be used as a ReadOnly property type because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de propriété ReadOnly, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInReturnDisallowed1"> <source>Type '{0}' cannot be used as a return type because '{0}' is an 'In' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de retour, car '{0}' est un paramètre de type 'In'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutByRefDisallowed1"> <source>Type '{0}' cannot be used in this context because 'In' and 'Out' type parameters cannot be used for ByRef parameter types, and '{0}' is an 'Out' type parameter.</source> <target state="translated">Le type '{0}' ne peut pas être utilisé dans ce contexte, car les paramètres de type 'In' et 'Out' ne peuvent pas être utilisés pour les types de paramètre ByRef et '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutByValDisallowed1"> <source>Type '{0}' cannot be used as a ByVal parameter type because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de paramètre ByVal, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutConstraintDisallowed1"> <source>Type '{0}' cannot be used as a generic type constraint because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que contrainte de type générique, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutNullableDisallowed2"> <source>Type '{0}' cannot be used in '{1}' because 'In' and 'Out' type parameters cannot be made nullable, and '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{1}', car les paramètres de type 'In' et 'Out' ne peuvent pas être rendus Nullable et '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowed1"> <source>Type '{0}' cannot be used in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans ce contexte, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedForGeneric3"> <source>Type '{0}' cannot be used for the '{1}' in '{2}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{1}' dans '{2}' dans ce contexte, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedHere2"> <source>Type '{0}' cannot be used in '{1}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{1}' dans ce contexte, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedHereForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' of '{3}' in '{1}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{2}' de '{3}' dans '{1}' dans ce contexte, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutPropertyDisallowed1"> <source>Type '{0}' cannot be used as a property type in this context because '{0}' is an 'Out' type parameter and the property is not marked ReadOnly.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de propriété dans ce contexte, car '{0}' est un paramètre de type 'Out' et la propriété n'est pas marquée ReadOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutWriteOnlyPropertyDisallowed1"> <source>Type '{0}' cannot be used as a WriteOnly property type because '{0}' is an 'Out' type parameter.</source> <target state="translated">Impossible d'utiliser le type '{0}' en tant que type de propriété WriteOnly, car '{0}' est un paramètre de type 'Out'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowed2"> <source>Type '{0}' cannot be used in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans ce contexte, car le contexte et la définition de '{0}' sont tous les deux imbriqués dans l'interface '{1}', et '{1}' a des paramètres de type 'In' ou 'Out'. Déplacez la définition de '{0}' en dehors de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' in '{3}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{2}' dans '{3}' dans ce contexte, car le contexte et la définition de '{0}' sont tous les deux imbriqués dans l'interface '{1}', et '{1}' a des paramètres de type 'In' ou 'Out'. Déplacez la définition de '{0}' en dehors de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedHere3"> <source>Type '{0}' cannot be used in '{2}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Impossible d'utiliser le type '{0}' dans '{2}' dans ce contexte, car le contexte et la définition de '{0}' sont tous les deux imbriqués dans l'interface '{1}', et '{1}' a des paramètres de type 'In' ou 'Out'. Déplacez la définition de '{0}' en dehors de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedHereForGeneric5"> <source>Type '{0}' cannot be used for the '{3}' of '{4}' in '{2}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Impossible d'utiliser le type '{0}' pour le '{3}' de '{4}' dans '{2}' dans ce contexte, car le contexte et la définition de '{0}' sont tous les deux imbriqués dans l'interface '{1}', et '{1}' a des paramètres de type 'In' ou 'Out'. Déplacez la définition de '{0}' en dehors de '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterNotValidForType"> <source>Parameter not valid for the specified unmanaged type.</source> <target state="translated">Paramètre non valide pour le type non managé spécifié.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeNotValidForFields"> <source>Unmanaged type '{0}' not valid for fields.</source> <target state="translated">Type non managé '{0}' non valide pour les champs.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeOnlyValidForFields"> <source>Unmanaged type '{0}' is only valid for fields.</source> <target state="translated">Le type non managé '{0}' n'est valide que pour les champs.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired1"> <source>Attribute parameter '{0}' must be specified.</source> <target state="translated">Le paramètre d'attribut '{0}' doit être spécifié.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired2"> <source>Attribute parameter '{0}' or '{1}' must be specified.</source> <target state="translated">Le paramètre d'attribut '{0}' ou '{1}' doit être spécifié.</target> <note /> </trans-unit> <trans-unit id="ERR_MemberConflictWithSynth4"> <source>Conflicts with '{0}', which is implicitly declared for '{1}' in {2} '{3}'.</source> <target state="translated">Conflit avec '{0}', qui est déclaré implicitement pour '{1}' dans {2} '{3}'.</target> <note /> </trans-unit> <trans-unit id="IDS_ProjectSettingsLocationName"> <source>&lt;project settings&gt;</source> <target state="translated">&lt;paramètres de projet&gt;</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeAttributeOnWriteOnlyProperty"> <source>Attributes applied on a return type of a WriteOnly Property have no effect.</source> <target state="translated">Les attributs appliqués sur un type de retour d'une propriété WriteOnly sont sans effet.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeAttributeOnWriteOnlyProperty_Title"> <source>Attributes applied on a return type of a WriteOnly Property have no effect</source> <target state="translated">Les attributs appliqués sur un type de retour d'une propriété WriteOnly sont sans effet</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidTarget"> <source>Security attribute '{0}' is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations.</source> <target state="translated">L'attribut de sécurité '{0}' n'est pas valide dans ce type de déclaration. Les attributs de sécurité ne sont valides que dans les déclarations d'assembly, de type et de méthode.</target> <note /> </trans-unit> <trans-unit id="ERR_AbsentReferenceToPIA1"> <source>Cannot find the interop type that matches the embedded type '{0}'. Are you missing an assembly reference?</source> <target state="translated">Impossible de trouver le type interop qui correspond au type incorporé '{0}'. Une référence d'assembly est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLinkClassWithNoPIA1"> <source>Reference to class '{0}' is not allowed when its assembly is configured to embed interop types.</source> <target state="translated">Une référence à la classe '{0}' n'est pas autorisée lorsque son assembly est configuré pour incorporer les types interop.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidStructMemberNoPIA1"> <source>Embedded interop structure '{0}' can contain only public instance fields.</source> <target state="translated">La structure d'interopérabilité incorporée '{0}' ne peut contenir que des champs d'instance publics.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIAAttributeMissing2"> <source>Interop type '{0}' cannot be embedded because it is missing the required '{1}' attribute.</source> <target state="translated">Impossible d'incorporer le type interop '{0}', car il lui manque l'attribut '{1}' obligatoire.</target> <note /> </trans-unit> <trans-unit id="ERR_PIAHasNoAssemblyGuid1"> <source>Cannot embed interop types from assembly '{0}' because it is missing the '{1}' attribute.</source> <target state="translated">Impossible d'incorporer les types interop de l'assembly '{0}', car l'attribut '{1}' est manquant.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocalTypes3"> <source>Cannot embed interop type '{0}' found in both assembly '{1}' and '{2}'. Consider disabling the embedding of interop types.</source> <target state="translated">Impossible d'incorporer le type interop '{0}' trouvé dans les assemblys '{1}' et '{2}'. Désactivez l'incorporation des types interop.</target> <note /> </trans-unit> <trans-unit id="ERR_PIAHasNoTypeLibAttribute1"> <source>Cannot embed interop types from assembly '{0}' because it is missing either the '{1}' attribute or the '{2}' attribute.</source> <target state="translated">Impossible d'incorporer les types interop de l'assembly '{0}', car l'attribut '{1}' ou '{2}' est manquant.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceInterfaceMustBeInterface"> <source>Interface '{0}' has an invalid source interface which is required to embed event '{1}'.</source> <target state="translated">L'interface '{0}' a une interface source non valide qui est nécessaire à l'incorporation de l'événement '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventNoPIANoBackingMember"> <source>Source interface '{0}' is missing method '{1}', which is required to embed event '{2}'.</source> <target state="translated">L'interface source '{0}' n'a pas de méthode '{1}', qui est requise pour incorporer l'événement '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedInteropType"> <source>Nested type '{0}' cannot be embedded.</source> <target state="translated">Le type imbriqué '{0}' ne peut pas être incorporé.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalTypeNameClash2"> <source>Embedding the interop type '{0}' from assembly '{1}' causes a name clash in the current assembly. Consider disabling the embedding of interop types.</source> <target state="translated">L'incorporation du type interop '{0}' de l'assembly '{1}' entraîne un conflit de noms dans l'assembly actuel. Désactivez l'incorporation des types interop.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropMethodWithBody1"> <source>Embedded interop method '{0}' contains a body.</source> <target state="translated">La méthode interop incorporée '{0}' contient un corps.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncInQuery"> <source>'Await' may only be used in a query expression within the first collection expression of the initial 'From' clause or within the collection expression of a 'Join' clause.</source> <target state="translated">'Await' peut uniquement être utilisé dans une expression de requête contenue dans la première expression de collection de la clause 'From' initiale ou dans l'expression de collection d'une clause 'Join'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGetAwaiterMethod1"> <source>'Await' requires that the type '{0}' have a suitable GetAwaiter method.</source> <target state="translated">'Await' nécessite que le type '{0}' ait une méthode GetAwaiter appropriée.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIsCompletedOnCompletedGetResult2"> <source>'Await' requires that the return type '{0}' of '{1}.GetAwaiter()' have suitable IsCompleted, OnCompleted and GetResult members, and implement INotifyCompletion or ICriticalNotifyCompletion.</source> <target state="translated">'Await' nécessite que le type de retour '{0}' de '{1}.GetAwaiter()' ait des membres IsCompleted, OnCompleted et GetResult appropriés et qu'ils implémentent INotifyCompletion ou ICriticalNotifyCompletion.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesntImplementAwaitInterface2"> <source>'{0}' does not implement '{1}'.</source> <target state="translated">'{0}' n'implémente pas '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitNothing"> <source>Cannot await Nothing. Consider awaiting 'Task.Yield()' instead.</source> <target state="translated">Impossible d'attendre Nothing. Attendez plutôt 'Task.Yield()'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncByRefParam"> <source>Async methods cannot have ByRef parameters.</source> <target state="translated">Les méthodes Async n'acceptent pas les paramètres ByRef.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAsyncIteratorModifiers"> <source>'Async' and 'Iterator' modifiers cannot be used together.</source> <target state="translated">'Les modificateurs 'Async' et 'Iterator' ne peuvent pas être utilisés en même temps.</target> <note /> </trans-unit> <trans-unit id="ERR_BadResumableAccessReturnVariable"> <source>The implicit return variable of an Iterator or Async method cannot be accessed.</source> <target state="translated">Impossible d'accéder à la variable de retour implicite d'une méthode Iterator ou Async.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnFromNonGenericTaskAsync"> <source>'Return' statements in this Async method cannot return a value since the return type of the function is 'Task'. Consider changing the function's return type to 'Task(Of T)'.</source> <target state="translated">'Les instructions 'Return' de cette méthode Async ne peuvent pas retourner de valeur puisque que le retour de la fonction est de type 'Task'. Convertissez le type de retour de la fonction en 'Task(Of T)'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturnOperand1"> <source>Since this is an async method, the return expression must be of type '{0}' rather than 'Task(Of {0})'.</source> <target state="translated">Étant donné qu'il s'agit d'une méthode Async, l'expression de retour doit être de type '{0}' plutôt que 'Task(Of {0})'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturn"> <source>The 'Async' modifier can only be used on Subs, or on Functions that return Task or Task(Of T).</source> <target state="translated">Le modificateur 'Async' peut uniquement être utilisé dans les procédures Sub, ou dans les fonctions retournant Task ou Task(Of T).</target> <note /> </trans-unit> <trans-unit id="ERR_CantAwaitAsyncSub1"> <source>'{0}' does not return a Task and cannot be awaited. Consider changing it to an Async Function.</source> <target state="translated">'{0}' ne peut pas retourner de tâche ni être attendu. Utilisez plutôt une fonction Async.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLambdaModifier"> <source>'Only the 'Async' or 'Iterator' modifier is valid on a lambda.</source> <target state="translated">'Seuls les modificateurs 'Async' et 'Iterator' sont valides dans les expressions lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncMethod"> <source>'Await' can only be used within an Async method. Consider marking this method with the 'Async' modifier and changing its return type to 'Task(Of {0})'.</source> <target state="translated">'Await' peut uniquement être utilisé dans une méthode Async. Marquez cette méthode avec le modificateur 'Async' et changez son type de retour en 'Task(Of {0})'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncVoidMethod"> <source>'Await' can only be used within an Async method. Consider marking this method with the 'Async' modifier and changing its return type to 'Task'.</source> <target state="translated">'Await' peut uniquement être utilisé dans une méthode Async. Marquez cette méthode avec le modificateur 'Async' et changez son type de retour en 'Task'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncLambda"> <source>'Await' can only be used within an Async lambda expression. Consider marking this lambda expression with the 'Async' modifier.</source> <target state="translated">'Await' peut uniquement être utilisé dans une expression lambda Async. Marquez cette expression lambda avec le modificateur 'Async'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitNotInAsyncMethodOrLambda"> <source>'Await' can only be used when contained within a method or lambda expression marked with the 'Async' modifier.</source> <target state="translated">'Await' peut uniquement être utilisé lorsqu'il est contenu dans une méthode ou une expression lambda marquée avec le modificateur 'Async'.</target> <note /> </trans-unit> <trans-unit id="ERR_StatementLambdaInExpressionTree"> <source>Statement lambdas cannot be converted to expression trees.</source> <target state="translated">Des lambda-instructions ne peuvent pas être converties en arborescences de l'expression.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression"> <source>Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the Await operator to the result of the call.</source> <target state="translated">Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel. Envisagez d'appliquer l'opérateur Await au résultat de l'appel.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression_Title"> <source>Because this call is not awaited, execution of the current method continues before the call is completed</source> <target state="translated">Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel</target> <note /> </trans-unit> <trans-unit id="ERR_LoopControlMustNotAwait"> <source>Loop control variable cannot include an 'Await'.</source> <target state="translated">La variable de contrôle de boucle ne peut pas inclure un 'Await'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticInitializerInResumable"> <source>Static variables cannot appear inside Async or Iterator methods.</source> <target state="translated">Les méthodes Async et Iterator ne peuvent pas contenir de variables statiques.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedResumableType1"> <source>'{0}' cannot be used as a parameter type for an Iterator or Async method.</source> <target state="translated">'{0}' ne peut pas être utilisé en tant que type de paramètre pour une méthode Iterator ou Async.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorAsync"> <source>Constructor must not have the 'Async' modifier.</source> <target state="translated">Le constructeur doit être associé au modificateur 'Async'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustNotBeAsync1"> <source>'{0}' cannot be declared 'Partial' because it has the 'Async' modifier.</source> <target state="translated">'{0}' ne peut pas être déclaré comme 'Partial', car son modificateur est de type 'Async'.</target> <note /> </trans-unit> <trans-unit id="ERR_ResumablesCannotContainOnError"> <source>'On Error' and 'Resume' cannot appear inside async or iterator methods.</source> <target state="translated">'Les méthodes Async et Iterator ne peuvent pas contenir d'instructions 'On Error' et 'Resume' .</target> <note /> </trans-unit> <trans-unit id="ERR_ResumableLambdaInExpressionTree"> <source>Lambdas with the 'Async' or 'Iterator' modifiers cannot be converted to expression trees.</source> <target state="translated">Les expressions lambda avec un modificateur 'Async' ou 'Iterator' ne peuvent pas être converties en arborescences d'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeResumable1"> <source>Variable of restricted type '{0}' cannot be declared in an Async or Iterator method.</source> <target state="translated">Les variables du type restreint '{0}' ne peuvent pas être déclarées dans les méthodes Async ou Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInTryHandler"> <source>'Await' cannot be used inside a 'Catch' statement, a 'Finally' statement, or a 'SyncLock' statement.</source> <target state="translated">'Await' ne peut pas être utilisé dans une instruction 'Catch', 'Finally' ou 'SyncLock'.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits"> <source>This async method lacks 'Await' operators and so will run synchronously. Consider using the 'Await' operator to await non-blocking API calls, or 'Await Task.Run(...)' to do CPU-bound work on a background thread.</source> <target state="translated">Aucun opérateur 'Await' ne se trouve dans cette méthode Async, par conséquent, elle sera exécutée de façon synchrone. Utilisez un opérateur 'Await' pour attendre les appels non bloquants d'API, ou un opérateur 'Await Task.Run(...)' pour les tâches utilisant le processeur de façon intensive effectuées sur un thread d'arrière-plan.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits_Title"> <source>This async method lacks 'Await' operators and so will run synchronously</source> <target state="translated">Cette méthode asynchrone n’a pas d’opérateurs 'Await' et sera exécutée de manière synchrone</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableDelegate"> <source>The Task returned from this Async Function will be dropped, and any exceptions in it ignored. Consider changing it to an Async Sub so its exceptions are propagated.</source> <target state="translated">La tâche retournée à partir de cette fonction asynchrone sera supprimée et toutes les exceptions qu'elle contient seront ignorées. Envisagez de la transformer en une procédure Sub asynchrone afin que ses exceptions soient propagées.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableDelegate_Title"> <source>The Task returned from this Async Function will be dropped, and any exceptions in it ignored</source> <target state="translated">La tâche renvoyée à partir de cette fonction asynchrone sera supprimée et toutes les exceptions qu’elle contient seront ignorées</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalAsyncInClassOrStruct"> <source>Async and Iterator methods are not allowed in a [Class|Structure|Interface|Module] that has the 'SecurityCritical' or 'SecuritySafeCritical' attribute.</source> <target state="translated">Les méthodes Async et Iterator ne sont pas autorisées dans un(e) [Classe|Structure|Interface|Module] qui a l'attribut 'SecurityCritical' ou 'SecuritySafeCritical'.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalAsync"> <source>Security attribute '{0}' cannot be applied to an Async or Iterator method.</source> <target state="translated">L'attribut de sécurité '{0}' ne peut pas être appliqué à une méthode Async ou Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnResumableMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to an Async or Iterator method.</source> <target state="translated">'System.Runtime.InteropServices.DllImportAttribute' ne peut pas être appliqué aux méthodes Async et Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_SynchronizedAsyncMethod"> <source>'MethodImplOptions.Synchronized' cannot be applied to an Async method.</source> <target state="translated">'MethodImplOptions.Synchronized' ne peut pas être appliqué à une méthode Async.</target> <note /> </trans-unit> <trans-unit id="ERR_AsyncSubMain"> <source>The 'Main' method cannot be marked 'Async'.</source> <target state="translated">La méthode 'Main' ne peut pas être marquée comme 'Async'.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncSubCouldBeFunction"> <source>Some overloads here take an Async Function rather than an Async Sub. Consider either using an Async Function, or casting this Async Sub explicitly to the desired type.</source> <target state="translated">Certaines surcharges doivent être associées à une fonction Async plutôt qu'à une procédure Sub Async. Utilisez une fonction Async ou effectuez une conversion explicite de la procédure Sub Async vers le type désiré.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncSubCouldBeFunction_Title"> <source>Some overloads here take an Async Function rather than an Async Sub</source> <target state="translated">Certaines surcharges doivent être associées à une fonction Async plutôt qu’à une procédure Sub Async</target> <note /> </trans-unit> <trans-unit id="ERR_MyGroupCollectionAttributeCycle"> <source>MyGroupCollectionAttribute cannot be applied to itself.</source> <target state="translated">MyGroupCollectionAttribute ne peut pas être appliqué à lui-même.</target> <note /> </trans-unit> <trans-unit id="ERR_LiteralExpected"> <source>Literal expected.</source> <target state="translated">Littéral attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_WinRTEventWithoutDelegate"> <source>Event declarations that target WinMD must specify a delegate type. Add an As clause to the event declaration.</source> <target state="translated">Les déclarations d'événement qui ciblent WinMD doivent spécifier un type de délégué. Ajoutez une clause As à la déclaration d'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_MixingWinRTAndNETEvents"> <source>Event '{0}' cannot implement a Windows Runtime event '{1}' and a regular .NET event '{2}'</source> <target state="translated">L'événement '{0}' ne peut pas implémenter un événement Windows Runtime '{1}' et un événement .NET régulier '{2}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EventImplRemoveHandlerParamWrong"> <source>Event '{0}' cannot implement event '{1}' on interface '{2}' because the parameters of their 'RemoveHandler' methods do not match.</source> <target state="translated">L'événement '{0}' ne peut pas implémenter l'événement '{1}' dans l'interface '{2}', car les paramètres de leurs méthodes 'RemoveHandler' respectives ne sont pas les mêmes.</target> <note /> </trans-unit> <trans-unit id="ERR_AddParamWrongForWinRT"> <source>The type of the 'AddHandler' method's parameter must be the same as the type of the event.</source> <target state="translated">Le type du paramètre de la méthode 'AddHandler' doit être identique au type de l'événement.</target> <note /> </trans-unit> <trans-unit id="ERR_RemoveParamWrongForWinRT"> <source>In a Windows Runtime event, the type of the 'RemoveHandler' method parameter must be 'EventRegistrationToken'</source> <target state="translated">Dans un événement Windows Runtime, le type du paramètre de méthode 'RemoveHandler' doit être 'EventRegistrationToken'</target> <note /> </trans-unit> <trans-unit id="ERR_ReImplementingWinRTInterface5"> <source>'{0}.{1}' from 'implements {2}' is already implemented by the base class '{3}'. Re-implementation of Windows Runtime Interface '{4}' is not allowed</source> <target state="translated">'{0}.{1}' issu de 'implements {2}' est déjà implémenté par la classe de base '{3}'. Vous n'êtes pas autorisé à réimplémenter l'interface Windows Runtime '{4}'</target> <note /> </trans-unit> <trans-unit id="ERR_ReImplementingWinRTInterface4"> <source>'{0}.{1}' is already implemented by the base class '{2}'. Re-implementation of Windows Runtime Interface '{3}' is not allowed</source> <target state="translated">'{0}.{1}' est déjà implémenté par la classe de base '{2}'. Vous n'êtes pas autorisé à réimplémenter l'interface Windows Runtime '{3}'</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorByRefParam"> <source>Iterator methods cannot have ByRef parameters.</source> <target state="translated">Les méthodes Iterator n'acceptent pas les paramètres ByRef.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorExpressionLambda"> <source>Single-line lambdas cannot have the 'Iterator' modifier. Use a multiline lambda instead.</source> <target state="translated">Les expressions lambda sur une seule ligne ne peuvent pas avoir de modificateur 'Iterator'. Utilisez une expression lambda multiligne à la place.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorReturn"> <source>Iterator functions must return either IEnumerable(Of T), or IEnumerator(Of T), or the non-generic forms IEnumerable or IEnumerator.</source> <target state="translated">Les fonctions Iterator doivent retourner IEnumerable(Of T) ou IEnumerator(Of T), ou bien les formulaires non génériques IEnumerable ou IEnumerator.</target> <note /> </trans-unit> <trans-unit id="ERR_BadReturnValueInIterator"> <source>To return a value from an Iterator function, use 'Yield' rather than 'Return'.</source> <target state="translated">Pour retourner une valeur depuis une fonction Iterator, utilisez 'Yield' plutôt que 'Return'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInNonIteratorMethod"> <source>'Yield' can only be used in a method marked with the 'Iterator' modifier.</source> <target state="translated">'Yield' peut uniquement être utilisé dans une méthode marquée à l'aide du modificateur 'Iterator'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInTryHandler"> <source>'Yield' cannot be used inside a 'Catch' statement or a 'Finally' statement.</source> <target state="translated">'Yield' ne peut pas être utilisé dans une instruction 'Catch' ou 'Finally'.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValWinRtEventVal1"> <source>The AddHandler for Windows Runtime event '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">L'événement AddHandler pour Windows Runtime '{0}' ne retourne pas une valeur pour tous les chemins du code. Une instruction 'Return' est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValWinRtEventVal1_Title"> <source>The AddHandler for Windows Runtime event doesn't return a value on all code paths</source> <target state="translated">L’événement AddHandler pour Windows Runtime ne retourne pas de valeur sur tous les chemins du code</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodDefaultParameterValueMismatch2"> <source>Optional parameter of a method '{0}' does not have the same default value as the corresponding parameter of the partial method '{1}'.</source> <target state="translated">Le paramètre facultatif d'une méthode '{0}' n'a pas la même valeur par défaut que le paramètre correspondant de la méthode partielle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamArrayMismatch2"> <source>Parameter of a method '{0}' differs by ParamArray modifier from the corresponding parameter of the partial method '{1}'.</source> <target state="translated">Le paramètre d'une méthode '{0}' diffère par son modificateur ParamArray du paramètre correspondant de la méthode partielle '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMismatch"> <source>Module name '{0}' stored in '{1}' must match its filename.</source> <target state="translated">Le nom de module '{0}' stocké dans '{1}' doit correspondre à son nom de fichier.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleName"> <source>Invalid module name: {0}</source> <target state="translated">Nom de module non valide : {0}</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden"> <source>Attribute '{0}' from module '{1}' will be ignored in favor of the instance appearing in source.</source> <target state="translated">L'attribut '{0}' du module '{1}' sera ignoré au profit de l'instance présente dans la source.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden_Title"> <source>Attribute from module will be ignored in favor of the instance appearing in source</source> <target state="translated">L’attribut du module sera ignoré en faveur de l’instance qui apparaît dans la source</target> <note /> </trans-unit> <trans-unit id="ERR_CmdOptionConflictsSource"> <source>Attribute '{0}' given in a source file conflicts with option '{1}'.</source> <target state="translated">L'attribut '{0}' spécifié dans un fichier source est en conflit avec l'option '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName"> <source>Referenced assembly '{0}' does not have a strong name.</source> <target state="translated">L'assembly référencé '{0}' n'a pas de nom fort.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName_Title"> <source>Referenced assembly does not have a strong name</source> <target state="translated">L'assembly référencé n'a pas de nom fort</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSignaturePublicKey"> <source>Invalid signature public key specified in AssemblySignatureKeyAttribute.</source> <target state="translated">Une clé publique de signature non valide a été spécifiée dans AssemblySignatureKeyAttribute.</target> <note /> </trans-unit> <trans-unit id="ERR_CollisionWithPublicTypeInModule"> <source>Type '{0}' conflicts with public type defined in added module '{1}'.</source> <target state="translated">Le type '{0}' est en conflit avec le type public défini dans le module '{1}' ajouté.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypeConflictsWithDeclaration"> <source>Type '{0}' exported from module '{1}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Le type '{0}' exporté à partir du module '{1}' est en conflit avec le type déclaré dans le module principal de cet assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypesConflict"> <source>Type '{0}' exported from module '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Le type '{0}' exporté à partir du module '{1}' est en conflit avec le type '{2}' exporté à partir du module '{3}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch"> <source>Referenced assembly '{0}' has different culture setting of '{1}'.</source> <target state="translated">L'assembly référencé '{0}' a un paramètre de culture différent : '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch_Title"> <source>Referenced assembly has different culture setting</source> <target state="translated">L'assembly référencé a un paramètre de culture différent</target> <note /> </trans-unit> <trans-unit id="ERR_AgnosticToMachineModule"> <source>Agnostic assembly cannot have a processor specific module '{0}'.</source> <target state="translated">Un assembly agnostique ne peut pas avoir un module '{0}' propre au processeur.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingMachineModule"> <source>Assembly and module '{0}' cannot target different processors.</source> <target state="translated">L'assembly et le module '{0}' ne peuvent pas cibler des processeurs différents.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly"> <source>Referenced assembly '{0}' targets a different processor.</source> <target state="translated">L'assembly référencé '{0}' cible un processeur différent.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly_Title"> <source>Referenced assembly targets a different processor</source> <target state="translated">L'assembly référencé cible un processeur différent</target> <note /> </trans-unit> <trans-unit id="ERR_CryptoHashFailed"> <source>Cryptographic failure while creating hashes.</source> <target state="translated">Échec de chiffrement pendant la création de hachages.</target> <note /> </trans-unit> <trans-unit id="ERR_CantHaveWin32ResAndManifest"> <source>Conflicting options specified: Win32 resource file; Win32 manifest.</source> <target state="translated">Options spécifiées en conflit : fichier de ressources Win32 ; manifeste Win32.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithDeclaration"> <source>Forwarded type '{0}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Le type transmis '{0}' est en conflit avec le type déclaré dans le module principal de cet assembly.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypesConflict"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' forwarded to assembly '{3}'.</source> <target state="translated">Le type '{0}' transmis à l'assembly '{1}' est en conflit avec le type '{2}' transmis à l'assembly '{3}'.</target> <note /> </trans-unit> <trans-unit id="ERR_TooLongMetadataName"> <source>Name '{0}' exceeds the maximum length allowed in metadata.</source> <target state="translated">Le nom '{0}' dépasse la longueur maximale autorisée dans les métadonnées.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNetModuleReference"> <source>Reference to '{0}' netmodule missing.</source> <target state="translated">Référence à netmodule '{0}' manquante.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMustBeUnique"> <source>Module '{0}' is already defined in this assembly. Each module must have a unique filename.</source> <target state="translated">Le module '{0}' est déjà défini dans cet assembly. Chaque module doit avoir un nom de fichier unique.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithExportedType"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Le type '{0}' transmis à l'assembly '{1}' est en conflit avec le type '{2}' exporté à partir du module '{3}'.</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDREFERENCE"> <source>Adding assembly reference '{0}'</source> <target state="translated">Ajout de la référence d'assembly '{0}'</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDLINKREFERENCE"> <source>Adding embedded assembly reference '{0}'</source> <target state="translated">Ajout de la référence d'assembly incorporé '{0}'</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDMODULE"> <source>Adding module reference '{0}'</source> <target state="translated">Ajout de la référence de module '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_NestingViolatesCLS1"> <source>Type '{0}' does not inherit the generic type parameters of its container.</source> <target state="translated">Le type '{0}' n'hérite pas des paramètres de type générique de son conteneur.</target> <note /> </trans-unit> <trans-unit id="ERR_PDBWritingFailed"> <source>Failure writing debug information: {0}</source> <target state="translated">Échec de l'écriture des informations de débogage : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_ParamDefaultValueDiffersFromAttribute"> <source>The parameter has multiple distinct default values.</source> <target state="translated">Le paramètre contient plusieurs valeurs par défaut distinctes.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldHasMultipleDistinctConstantValues"> <source>The field has multiple distinct constant values.</source> <target state="translated">Le champ contient plusieurs valeurs de constante distinctes.</target> <note /> </trans-unit> <trans-unit id="ERR_EncNoPIAReference"> <source>Cannot continue since the edit includes a reference to an embedded type: '{0}'.</source> <target state="translated">Impossible de continuer, car la modification inclut une référence à un type incorporé : '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_EncReferenceToAddedMember"> <source>Member '{0}' added during the current debug session can only be accessed from within its declaring assembly '{1}'.</source> <target state="translated">Le membre '{0}' ajouté durant la session de débogage actuelle est uniquement accessible à partir de son assembly de déclaration '{1}'.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedModule1"> <source>'{0}' is an unsupported .NET module.</source> <target state="translated">'{0}' est un module .NET non pris en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedEvent1"> <source>'{0}' is an unsupported event.</source> <target state="translated">'{0}' est un événement non pris en charge.</target> <note /> </trans-unit> <trans-unit id="PropertiesCanNotHaveTypeArguments"> <source>Properties can not have type arguments</source> <target state="translated">Les propriétés ne peuvent pas avoir d'arguments de type</target> <note /> </trans-unit> <trans-unit id="IdentifierSyntaxNotWithinSyntaxTree"> <source>IdentifierSyntax not within syntax tree</source> <target state="translated">IdentifierSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="AnonymousObjectCreationExpressionSyntaxNotWithinTree"> <source>AnonymousObjectCreationExpressionSyntax not within syntax tree</source> <target state="translated">AnonymousObjectCreationExpressionSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="FieldInitializerSyntaxNotWithinSyntaxTree"> <source>FieldInitializerSyntax not within syntax tree</source> <target state="translated">FieldInitializerSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="IDS_TheSystemCannotFindThePathSpecified"> <source>The system cannot find the path specified</source> <target state="translated">Le système ne trouve pas le chemin indiqué</target> <note /> </trans-unit> <trans-unit id="ThereAreNoPointerTypesInVB"> <source>There are no pointer types in VB.</source> <target state="translated">Les types pointer n'existent pas en VB.</target> <note /> </trans-unit> <trans-unit id="ThereIsNoDynamicTypeInVB"> <source>There is no dynamic type in VB.</source> <target state="translated">Les types dynamiques n'existent pas en VB.</target> <note /> </trans-unit> <trans-unit id="VariableSyntaxNotWithinSyntaxTree"> <source>variableSyntax not within syntax tree</source> <target state="translated">variableSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="AggregateSyntaxNotWithinSyntaxTree"> <source>AggregateSyntax not within syntax tree</source> <target state="translated">AggregateSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="FunctionSyntaxNotWithinSyntaxTree"> <source>FunctionSyntax not within syntax tree</source> <target state="translated">FunctionSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="PositionIsNotWithinSyntax"> <source>Position is not within syntax tree</source> <target state="translated">La position ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="RangeVariableSyntaxNotWithinSyntaxTree"> <source>RangeVariableSyntax not within syntax tree</source> <target state="translated">RangeVariableSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="DeclarationSyntaxNotWithinSyntaxTree"> <source>DeclarationSyntax not within syntax tree</source> <target state="translated">DeclarationSyntax ne se trouve pas dans l'arborescence de syntaxe</target> <note /> </trans-unit> <trans-unit id="StatementOrExpressionIsNotAValidType"> <source>StatementOrExpression is not an ExecutableStatementSyntax or an ExpressionSyntax</source> <target state="translated">StatementOrExpression n'est pas un ExecutableStatementSyntax ou un ExpressionSyntax</target> <note /> </trans-unit> <trans-unit id="DeclarationSyntaxNotWithinTree"> <source>DeclarationSyntax not within tree</source> <target state="translated">DeclarationSyntax ne se trouve pas dans l'arborescence</target> <note /> </trans-unit> <trans-unit id="TypeParameterNotWithinTree"> <source>TypeParameter not within tree</source> <target state="translated">TypeParameter ne se trouve dans l'arborescence</target> <note /> </trans-unit> <trans-unit id="NotWithinTree"> <source> not within tree</source> <target state="translated"> ne se trouve pas dans l'arborescence</target> <note /> </trans-unit> <trans-unit id="LocationMustBeProvided"> <source>Location must be provided in order to provide minimal type qualification.</source> <target state="translated">L'emplacement doit être indiqué pour fournir une qualification de type minimale.</target> <note /> </trans-unit> <trans-unit id="SemanticModelMustBeProvided"> <source>SemanticModel must be provided in order to provide minimal type qualification.</source> <target state="translated">SemanticModel doit être indiqué afin de fournir une qualification de type minimale.</target> <note /> </trans-unit> <trans-unit id="NumberOfTypeParametersAndArgumentsMustMatch"> <source>the number of type parameters and arguments should be the same</source> <target state="translated">le nombre de paramètres et d'arguments de type doit être identique</target> <note /> </trans-unit> <trans-unit id="ERR_ResourceInModule"> <source>Cannot link resource files when building a module</source> <target state="translated">Impossible de lier des fichiers de ressources lors de la création d'un module</target> <note /> </trans-unit> <trans-unit id="NotAVbSymbol"> <source>Not a VB symbol.</source> <target state="translated">Symbole VB non valide.</target> <note /> </trans-unit> <trans-unit id="ElementsCannotBeNull"> <source>Elements cannot be null.</source> <target state="translated">Les éléments ne peuvent pas avoir la valeur null.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportClause"> <source>Unused import clause.</source> <target state="translated">Clause d’importation inutilisée.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportStatement"> <source>Unused import statement.</source> <target state="translated">Instruction d’importation inutilisée.</target> <note /> </trans-unit> <trans-unit id="WrongSemanticModelType"> <source>Expected a {0} SemanticModel.</source> <target state="translated">SemanticModel {0} attendu.</target> <note /> </trans-unit> <trans-unit id="PositionNotWithinTree"> <source>Position must be within span of the syntax tree.</source> <target state="translated">La position doit se trouver dans l'étendue de l'arborescence de syntaxe.</target> <note /> </trans-unit> <trans-unit id="SpeculatedSyntaxNodeCannotBelongToCurrentCompilation"> <source>Syntax node to be speculated cannot belong to a syntax tree from the current compilation.</source> <target state="translated">Le nœud de syntaxe à extrapoler ne peut pas appartenir à une arborescence de syntaxe de la compilation actuelle.</target> <note /> </trans-unit> <trans-unit id="ChainingSpeculativeModelIsNotSupported"> <source>Chaining speculative semantic model is not supported. You should create a speculative model from the non-speculative ParentModel.</source> <target state="translated">Le chaînage d'un modèle sémantique spéculatif n'est pas pris en charge. Vous devez créer un modèle spéculatif à partir du ParentModel non spéculatif.</target> <note /> </trans-unit> <trans-unit id="IDS_ToolName"> <source>Microsoft (R) Visual Basic Compiler</source> <target state="translated">Compilateur Microsoft (R) Visual Basic</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine1"> <source>{0} version {1}</source> <target state="translated">{0} version {1}</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine2"> <source>Copyright (C) Microsoft Corporation. All rights reserved.</source> <target state="translated">Copyright (C) Microsoft Corporation. Tous droits réservés.</target> <note /> </trans-unit> <trans-unit id="IDS_LangVersions"> <source>Supported language versions:</source> <target state="translated">Versions de langage prises en charge :</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong"> <source>Local name '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">Le nom local '{0}' est trop long pour PDB. Raccourcissez-le ou compilez sans /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong_Title"> <source>Local name is too long for PDB</source> <target state="translated">Le nom local est trop long pour PDB</target> <note /> </trans-unit> <trans-unit id="WRN_PdbUsingNameTooLong"> <source>Import string '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">La chaîne d'importation '{0}' est trop longue pour PDB. Raccourcissez-la ou compilez sans /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbUsingNameTooLong_Title"> <source>Import string is too long for PDB</source> <target state="translated">La chaîne d’importation est trop longue pour PDB</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefToTypeParameter"> <source>XML comment has a tag with a 'cref' attribute '{0}' that bound to a type parameter. Use the &lt;typeparamref&gt; tag instead.</source> <target state="translated">Le commentaire XML a une balise avec un attribut 'cref' '{0}' qui est lié à un paramètre de type. Utilisez la balise &lt;typeparamref&gt; à la place.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefToTypeParameter_Title"> <source>XML comment has a tag with a 'cref' attribute that bound to a type parameter</source> <target state="translated">Le commentaire XML possède une balise avec un attribut 'cref' lié à un paramètre de type</target> <note /> </trans-unit> <trans-unit id="ERR_LinkedNetmoduleMetadataMustProvideFullPEImage"> <source>Linked netmodule metadata must provide a full PE image: '{0}'.</source> <target state="translated">Les métadonnées netmodule liées doivent fournir une image PE complète : '{0}'.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated"> <source>An instance of analyzer {0} cannot be created from {1} : {2}.</source> <target state="translated">Impossible de créer une instance de l'analyseur {0} à partir de {1} : {2}.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated_Title"> <source>Instance of analyzer cannot be created</source> <target state="translated">L’instance de l’analyseur ne peut pas être créée</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly"> <source>The assembly {0} does not contain any analyzers.</source> <target state="translated">L'assembly {0} ne contient pas d'analyseurs.</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly_Title"> <source>Assembly does not contain any analyzers</source> <target state="translated">L'assembly ne contient pas d'analyseur</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer"> <source>Unable to load analyzer assembly {0} : {1}.</source> <target state="translated">Impossible de charger l'assembly d'analyseur {0} : {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer_Title"> <source>Unable to load analyzer assembly</source> <target state="translated">Impossible de charger l’assembly de l’analyseur</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer"> <source>Skipping some types in analyzer assembly {0} due to a ReflectionTypeLoadException : {1}.</source> <target state="translated">Certains types contenus dans l'assembly analyseur {0} ont été ignorés pour cause de ReflectionTypeLoadException : {1}.</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer_Title"> <source>Skip loading types in analyzer assembly that fail due to a ReflectionTypeLoadException</source> <target state="translated">Ignorer le chargement de types dans un assembly d’analyseur qui échouent en raison d’une ReflectionTypeLoadException</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadRulesetFile"> <source>Error reading ruleset file {0} - {1}</source> <target state="translated">Erreur lors de la lecture du fichier ruleset {0} - {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PlatformDoesntSupport"> <source>{0} is not supported in current project type.</source> <target state="translated">{0} n'est pas pris en charge dans le type de projet actif.</target> <note /> </trans-unit> <trans-unit id="ERR_CantUseRequiredAttribute"> <source>The RequiredAttribute attribute is not permitted on Visual Basic types.</source> <target state="translated">L'attribut RequiredAttribute n'est pas autorisé dans des types Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ERR_EncodinglessSyntaxTree"> <source>Cannot emit debug information for a source text without encoding.</source> <target state="translated">Impossible d'émettre des informations de débogage pour un texte source sans encodage.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatSpecifier"> <source>'{0}' is not a valid format specifier</source> <target state="translated">'{0}' n'est pas un spécificateur de format valide</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPreprocessorConstantType"> <source>Preprocessor constant '{0}' of type '{1}' is not supported, only primitive types are allowed.</source> <target state="translated">La constante de préprocesseur '{0}' de type '{1}' n'est pas prise en charge, seuls les types primitifs sont autorisés.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedWarningKeyword"> <source>'Warning' expected.</source> <target state="translated">'Warning' attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotBeMadeNullable1"> <source>'{0}' cannot be made nullable.</source> <target state="translated">'{0}' ne peut pas être null.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConditionalWithRef"> <source>Leading '?' can only appear inside a 'With' statement, but not inside an object member initializer.</source> <target state="translated">Un '?' de début ne peut s'afficher que dans une instruction 'With', et pas dans un initialiseur de membre d'objet.</target> <note /> </trans-unit> <trans-unit id="ERR_NullPropagatingOpInExpressionTree"> <source>A null propagating operator cannot be converted into an expression tree.</source> <target state="translated">Impossible de convertir un opérateur de propagation null en une arborescence d'expression.</target> <note /> </trans-unit> <trans-unit id="ERR_TooLongOrComplexExpression"> <source>An expression is too long or complex to compile</source> <target state="translated">Une expression est trop longue ou complexe à compiler</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionDoesntHaveName"> <source>This expression does not have a name.</source> <target state="translated">Cette expression n'a pas de nom.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNameOfSubExpression"> <source>This sub-expression cannot be used inside NameOf argument.</source> <target state="translated">Cette sous-expression ne peut pas être utilisée dans un argument NameOf.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodTypeArgsUnexpected"> <source>Method type arguments unexpected.</source> <target state="translated">Arguments de type de méthode inattendus.</target> <note /> </trans-unit> <trans-unit id="NoNoneSearchCriteria"> <source>SearchCriteria is expected.</source> <target state="translated">SearchCriteria est attendu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCulture"> <source>Assembly culture strings may not contain embedded NUL characters.</source> <target state="translated">Les chaînes de culture d'assembly ne peuvent pas contenir de caractères null incorporés.</target> <note /> </trans-unit> <trans-unit id="ERR_InReferencedAssembly"> <source>There is an error in a referenced assembly '{0}'.</source> <target state="translated">Il existe une erreur dans un assembly référencé '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolationFormatWhitespace"> <source>Format specifier may not contain trailing whitespace.</source> <target state="translated">Le spécificateur de format ne peut pas contenir d’espaces blancs de fin.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolationAlignmentOutOfRange"> <source>Alignment value is outside of the supported range.</source> <target state="translated">La valeur de l'alignement est en dehors de la plage prise en charge.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringFactoryError"> <source>There were one or more errors emitting a call to {0}.{1}. Method or its return type may be missing or malformed.</source> <target state="translated">Une ou plusieurs erreurs se sont produites lors de l'émission de l'appel à {0}.{1}. La méthode ou son type de retour peuvent être manquants ou incorrects.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportClause_Title"> <source>Unused import clause</source> <target state="translated">Clause import inutilisée</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportStatement_Title"> <source>Unused import statement</source> <target state="translated">Instruction import inutilisée</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantStringTooLong"> <source>Length of String constant resulting from concatenation exceeds System.Int32.MaxValue. Try splitting the string into multiple constants.</source> <target state="translated">La longueur de la constante de chaîne qui résulte de la concaténation dépasse System.Int32.MaxValue. Essayez de diviser la chaîne en plusieurs constantes.</target> <note /> </trans-unit> <trans-unit id="ERR_LanguageVersion"> <source>Visual Basic {0} does not support {1}.</source> <target state="translated">Visual Basic {0} ne prend pas en charge {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPdbData"> <source>Error reading debug information for '{0}'</source> <target state="translated">Erreur lors de la lecture des informations de débogage pour '{0}'</target> <note /> </trans-unit> <trans-unit id="FEATURE_ArrayLiterals"> <source>array literal expressions</source> <target state="translated">expressions littérales de tableaux</target> <note /> </trans-unit> <trans-unit id="FEATURE_AsyncExpressions"> <source>async methods or lambdas</source> <target state="translated">méthodes Async ou expressions lambda</target> <note /> </trans-unit> <trans-unit id="FEATURE_AutoProperties"> <source>auto-implemented properties</source> <target state="translated">propriétés implémentées automatiquement</target> <note /> </trans-unit> <trans-unit id="FEATURE_ReadonlyAutoProperties"> <source>readonly auto-implemented properties</source> <target state="translated">propriétés implémentées automatiquement en lecture seule</target> <note /> </trans-unit> <trans-unit id="FEATURE_CoContraVariance"> <source>variance</source> <target state="translated">variance</target> <note /> </trans-unit> <trans-unit id="FEATURE_CollectionInitializers"> <source>collection initializers</source> <target state="translated">initialiseurs de collections</target> <note /> </trans-unit> <trans-unit id="FEATURE_GlobalNamespace"> <source>declaring a Global namespace</source> <target state="translated">déclaration d'un espace de noms global</target> <note /> </trans-unit> <trans-unit id="FEATURE_Iterators"> <source>iterators</source> <target state="translated">itérateurs</target> <note /> </trans-unit> <trans-unit id="FEATURE_LineContinuation"> <source>implicit line continuation</source> <target state="translated">continuation de ligne implicite</target> <note /> </trans-unit> <trans-unit id="FEATURE_StatementLambdas"> <source>multi-line lambda expressions</source> <target state="translated">Expressions lambda multilignes</target> <note /> </trans-unit> <trans-unit id="FEATURE_SubLambdas"> <source>'Sub' lambda expressions</source> <target state="translated">'Expressions lambda 'Sub'</target> <note /> </trans-unit> <trans-unit id="FEATURE_NullPropagatingOperator"> <source>null conditional operations</source> <target state="translated">Opérations conditionnelles null</target> <note /> </trans-unit> <trans-unit id="FEATURE_NameOfExpressions"> <source>'nameof' expressions</source> <target state="translated">'Expressions 'nameof'</target> <note /> </trans-unit> <trans-unit id="FEATURE_RegionsEverywhere"> <source>region directives within method bodies or regions crossing boundaries of declaration blocks</source> <target state="translated">directives region dans des corps de méthodes ou régions traversant les limites de blocs de déclaration</target> <note /> </trans-unit> <trans-unit id="FEATURE_MultilineStringLiterals"> <source>multiline string literals</source> <target state="translated">littéraux de chaîne multiligne</target> <note /> </trans-unit> <trans-unit id="FEATURE_CObjInAttributeArguments"> <source>CObj in attribute arguments</source> <target state="translated">CObj dans les arguments d'attribut</target> <note /> </trans-unit> <trans-unit id="FEATURE_LineContinuationComments"> <source>line continuation comments</source> <target state="translated">commentaires de continuation de ligne</target> <note /> </trans-unit> <trans-unit id="FEATURE_TypeOfIsNot"> <source>TypeOf IsNot expression</source> <target state="translated">Expression TypeOf IsNot</target> <note /> </trans-unit> <trans-unit id="FEATURE_YearFirstDateLiterals"> <source>year-first date literals</source> <target state="translated">littéraux de date avec année en premier</target> <note /> </trans-unit> <trans-unit id="FEATURE_WarningDirectives"> <source>warning directives</source> <target state="translated">directives warning</target> <note /> </trans-unit> <trans-unit id="FEATURE_PartialModules"> <source>partial modules</source> <target state="translated">modules partiels</target> <note /> </trans-unit> <trans-unit id="FEATURE_PartialInterfaces"> <source>partial interfaces</source> <target state="translated">interfaces partielles</target> <note /> </trans-unit> <trans-unit id="FEATURE_ImplementingReadonlyOrWriteonlyPropertyWithReadwrite"> <source>implementing read-only or write-only property with read-write property</source> <target state="translated">implémentation d'une propriété en lecture seule ou en écriture seule avec une propriété en lecture/écriture</target> <note /> </trans-unit> <trans-unit id="FEATURE_DigitSeparators"> <source>digit separators</source> <target state="translated">séparateurs numériques</target> <note /> </trans-unit> <trans-unit id="FEATURE_BinaryLiterals"> <source>binary literals</source> <target state="translated">littéraux binaires</target> <note /> </trans-unit> <trans-unit id="FEATURE_Tuples"> <source>tuples</source> <target state="translated">tuples</target> <note /> </trans-unit> <trans-unit id="FEATURE_PrivateProtected"> <source>Private Protected</source> <target state="translated">Private Protected</target> <note /> </trans-unit> <trans-unit id="ERR_DebugEntryPointNotSourceMethodDefinition"> <source>Debug entry point must be a definition of a method declared in the current compilation.</source> <target state="translated">Le point d'entrée de débogage doit être une définition d'une méthode déclarée dans la compilation actuelle.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPathMap"> <source>The pathmap option was incorrectly formatted.</source> <target state="translated">Le format de l'option pathmap est incorrect.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeIsNotASubmission"> <source>Syntax tree should be created from a submission.</source> <target state="translated">L'arborescence de syntaxe doit être créée à partir d'une soumission.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyUserStrings"> <source>Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string or XML literals.</source> <target state="translated">La longueur combinée des chaînes utilisateur que le programme utilise dépasse la limite autorisée. Essayez de réduire le nombre de littéraux de chaîne ou XML.</target> <note /> </trans-unit> <trans-unit id="ERR_PeWritingFailure"> <source>An error occurred while writing the output file: {0}</source> <target state="translated">Une erreur s'est produite durant l'écriture du fichier de sortie : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_OptionMustBeAbsolutePath"> <source>Option '{0}' must be an absolute path.</source> <target state="translated">L'option '{0}' doit être un chemin absolu.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceLinkRequiresPdb"> <source>/sourcelink switch is only supported when emitting PDB.</source> <target state="translated">Le commutateur /sourcelink est uniquement pris en charge durant l'émission d'un fichier PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleDuplicateElementName"> <source>Tuple element names must be unique.</source> <target state="translated">Les noms d'éléments d'un tuple doivent être uniques.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch"> <source>The tuple element name '{0}' is ignored because a different name or no name is specified by the target type '{1}'.</source> <target state="translated">Le nom d'élément tuple '{0}' est ignoré, car un autre nom est spécifié ou aucun nom n'est spécifié par le type cible '{1}'.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch_Title"> <source>The tuple element name is ignored because a different name or no name is specified by the assignment target.</source> <target state="translated">Le nom d'élément tuple est ignoré, car un autre nom est spécifié ou aucun nom n'est spécifié par la cible de l'assignation.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementName"> <source>Tuple element name '{0}' is only allowed at position {1}.</source> <target state="translated">Le nom d'élément de tuple '{0}' est uniquement autorisé à la position {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementNameAnyPosition"> <source>Tuple element name '{0}' is disallowed at any position.</source> <target state="translated">Le nom d'élément de tuple '{0}' est interdit à toutes les positions.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleTooFewElements"> <source>Tuple must contain at least two elements.</source> <target state="translated">Le tuple doit contenir au moins deux éléments.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNamesAttributeMissing"> <source>Cannot define a class or member that utilizes tuples because the compiler required type '{0}' cannot be found. Are you missing a reference?</source> <target state="translated">Impossible de définir une classe ou un membre qui utilise des tuples, car le type '{0}' nécessaire au compilateur est introuvable. Une référence est-elle manquante ?</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitTupleElementNamesAttribute"> <source>Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.</source> <target state="translated">Impossible de référencer 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitement. Utilisez la syntaxe des tuples pour définir les noms de tuples.</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturningCallInExpressionTree"> <source>An expression tree may not contain a call to a method or property that returns by reference.</source> <target state="translated">Une arborescence de l'expression ne peut pas contenir un appel à une méthode ou une propriété qui effectue un retour par référence.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedWithoutPdb"> <source>/embed switch is only supported when emitting a PDB.</source> <target state="translated">Le commutateur /embed est uniquement pris en charge durant l'émission d'un fichier PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInstrumentationKind"> <source>Invalid instrumentation kind: {0}</source> <target state="translated">Genre d'instrumentation non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_DocFileGen"> <source>Error writing to XML documentation file: {0}</source> <target state="translated">Erreur d'écriture dans le fichier de documentation XML : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadAssemblyName"> <source>Invalid assembly name: {0}</source> <target state="translated">Nom d'assembly non valide : {0}</target> <note /> </trans-unit> <trans-unit id="ERR_TypeForwardedToMultipleAssemblies"> <source>Module '{0}' in assembly '{1}' is forwarding the type '{2}' to multiple assemblies: '{3}' and '{4}'.</source> <target state="translated">Le module '{0}' dans l'assembly '{1}' transfère le type '{2}' à plusieurs assemblys : '{3}' et '{4}'.</target> <note /> </trans-unit> <trans-unit id="ERR_Merge_conflict_marker_encountered"> <source>Merge conflict marker encountered</source> <target state="translated">Marqueur de conflit de fusion rencontré</target> <note /> </trans-unit> <trans-unit id="ERR_NoRefOutWhenRefOnly"> <source>Do not use refout when using refonly.</source> <target state="translated">N'utilisez pas refout quand vous utilisez refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNetModuleOutputWhenRefOutOrRefOnly"> <source>Cannot compile net modules when using /refout or /refonly.</source> <target state="translated">Impossible de compiler les modules net en utilisant /refout ou /refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNonTrailingNamedArgument"> <source>Named argument '{0}' is used out-of-position but is followed by an unnamed argument</source> <target state="translated">L'argument nommé '{0}' est utilisé hors-position mais est suivi d'un argument sans nom</target> <note /> </trans-unit> <trans-unit id="ERR_BadDocumentationMode"> <source>Provided documentation mode is unsupported or invalid: '{0}'.</source> <target state="translated">Le mode de documentation fourni n'est pas pris en charge ou est non valide : '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLanguageVersion"> <source>Provided language version is unsupported or invalid: '{0}'.</source> <target state="translated">La version de langage fournie n'est pas prise en charge ou est non valide : '{0}'.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSourceCodeKind"> <source>Provided source code kind is unsupported or invalid: '{0}'</source> <target state="translated">Le genre de code source fourni n'est pas pris en charge ou est non valide : '{0}'</target> <note /> </trans-unit> <trans-unit id="ERR_TupleInferredNamesNotAvailable"> <source>Tuple element name '{0}' is inferred. Please use language version {1} or greater to access an element by its inferred name.</source> <target state="translated">Le nom d'élément de tuple '{0}' est déduit. Utilisez la version de langage {1} ou une version supérieure pour accéder à un élément par son nom déduit.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental"> <source>'{0}' is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">'{0}' est utilisé à des fins d'évaluation uniquement. Il sera peut-être changé ou supprimé au cours des prochaines mises à jour.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental_Title"> <source>Type is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">Le type est utilisé à des fins d'évaluation uniquement. Il sera peut-être changé ou supprimé au cours des prochaines mises à jour.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInfo"> <source>Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}'</source> <target state="translated">Impossible de lire les informations de débogage de la méthode '{0}' (jeton 0x{1}) dans l'assembly '{2}'</target> <note /> </trans-unit> <trans-unit id="IConversionExpressionIsNotVisualBasicConversion"> <source>{0} is not a valid Visual Basic conversion expression</source> <target state="translated">{0} n'est pas une expression de conversion Visual Basic valide</target> <note /> </trans-unit> <trans-unit id="IArgumentIsNotVisualBasicArgument"> <source>{0} is not a valid Visual Basic argument</source> <target state="translated">{0} n'est pas un argument Visual Basic valide</target> <note /> </trans-unit> <trans-unit id="FEATURE_LeadingDigitSeparator"> <source>leading digit separator</source> <target state="translated">séparateur numérique de début</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTupleResolutionAmbiguous3"> <source>Predefined type '{0}' is declared in multiple referenced assemblies: '{1}' and '{2}'</source> <target state="translated">Le type prédéfini '{0}' est déclaré dans plusieurs assemblys référencés : '{1}' et '{2}'</target> <note /> </trans-unit> <trans-unit id="ICompoundAssignmentOperationIsNotVisualBasicCompoundAssignment"> <source>{0} is not a valid Visual Basic compound assignment operation</source> <target state="translated">{0} n'est pas une opération d'assignation composée Visual Basic valide</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHashAlgorithmName"> <source>Invalid hash algorithm name: '{0}'</source> <target state="translated">Nom d'algorithme de hachage non valide : '{0}'</target> <note /> </trans-unit> <trans-unit id="FEATURE_InterpolatedStrings"> <source>interpolated strings</source> <target state="translated">chaînes interpolées</target> <note /> </trans-unit> <trans-unit id="FTL_InvalidInputFileName"> <source>File name '{0}' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long</source> <target state="translated">Le nom de fichier '{0}' est vide, contient des caractères non valides, spécifie un lecteur sans chemin d'accès absolu ou est trop long</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeNotSupportedInVB"> <source>'{0}' is not supported in VB.</source> <target state="translated">'{0}' n’est pas pris en charge dans VB.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeNotSupportedInVB_Title"> <source>Attribute is not supported in VB</source> <target state="translated">L’attribut n’est pas pris en charge dans VB</target> <note /> </trans-unit> </body> </file> </xliff>
-1
dotnet/roslyn
55,696
Have inheritance-margin hold onto data that does *not* point back at Solution instances.
Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
CyrusNajmabadi
2021-08-18T16:22:09Z
2021-08-20T04:50:45Z
16efcb29a0cb8be060ab3bfd9e60c9192c6604bf
6ce4dc34664b63672aeac58683ed9c9e73fa2102
Have inheritance-margin hold onto data that does *not* point back at Solution instances.. Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
./src/Features/LanguageServer/Protocol/Handler/SignatureHelp/SignatureHelpHandler.cs
// 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 System; using System.Collections.Generic; using System.Composition; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.VisualStudio.Text.Adornments; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { [ExportRoslynLanguagesLspRequestHandlerProvider, Shared] [ProvidesMethod(LSP.Methods.TextDocumentSignatureHelpName)] internal class SignatureHelpHandler : AbstractStatelessRequestHandler<LSP.TextDocumentPositionParams, LSP.SignatureHelp?> { private readonly IEnumerable<Lazy<ISignatureHelpProvider, OrderableLanguageMetadata>> _allProviders; public override string Method => LSP.Methods.TextDocumentSignatureHelpName; public override bool MutatesSolutionState => false; public override bool RequiresLSPSolution => true; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public SignatureHelpHandler([ImportMany] IEnumerable<Lazy<ISignatureHelpProvider, OrderableLanguageMetadata>> allProviders) { _allProviders = allProviders; } public override LSP.TextDocumentIdentifier? GetTextDocumentIdentifier(LSP.TextDocumentPositionParams request) => request.TextDocument; public override async Task<LSP.SignatureHelp?> HandleRequestAsync(LSP.TextDocumentPositionParams request, RequestContext context, CancellationToken cancellationToken) { var document = context.Document; if (document == null) { return null; } var position = await document.GetPositionFromLinePositionAsync(ProtocolConversions.PositionToLinePosition(request.Position), cancellationToken).ConfigureAwait(false); var providers = _allProviders.Where(p => p.Metadata.Language == document.Project.Language); var triggerInfo = new SignatureHelpTriggerInfo(SignatureHelpTriggerReason.InvokeSignatureHelpCommand); foreach (var provider in providers) { var items = await provider.Value.GetItemsAsync(document, position, triggerInfo, cancellationToken).ConfigureAwait(false); if (items != null) { var sigInfos = new ArrayBuilder<LSP.SignatureInformation>(); foreach (var item in items.Items) { LSP.SignatureInformation sigInfo; if (context.ClientCapabilities?.HasVisualStudioLspCapability() == true) { sigInfo = new LSP.VSInternalSignatureInformation { ColorizedLabel = GetSignatureClassifiedText(item) }; } else { sigInfo = new LSP.SignatureInformation(); } sigInfo.Label = GetSignatureText(item); sigInfo.Documentation = new LSP.MarkupContent { Kind = LSP.MarkupKind.PlainText, Value = item.DocumentationFactory(cancellationToken).GetFullText() }; sigInfo.Parameters = item.Parameters.Select(p => new LSP.ParameterInformation { Label = p.Name, Documentation = new LSP.MarkupContent { Kind = LSP.MarkupKind.PlainText, Value = p.DocumentationFactory(cancellationToken).GetFullText() } }).ToArray(); sigInfos.Add(sigInfo); } var sigHelp = new LSP.SignatureHelp { ActiveSignature = GetActiveSignature(items), ActiveParameter = items.ArgumentIndex, Signatures = sigInfos.ToArrayAndFree() }; return sigHelp; } } return null; } private static int GetActiveSignature(SignatureHelpItems items) { if (items.SelectedItemIndex.HasValue) { return items.SelectedItemIndex.Value; } // From Roslyn's doc comments for SelectedItemIndex: // If this is null, then the controller will pick the first item that has enough arguments // to be viable based on what argument position the user is currently inside of. // However, the LSP spec expects the language server to make this decision. // So implement the logic of picking a signature that has enough arguments here. var matchingSignature = items.Items.FirstOrDefault(sig => sig.Parameters.Length > items.ArgumentIndex); return matchingSignature != null ? items.Items.IndexOf(matchingSignature) : 0; } /// <summary> /// The <see cref="SignatureHelpItem"/> contains a prefix, parameters separated by a /// separator and a suffix. Parameters themselves have a prefix, display and suffix. /// Concatenate them all to get the text. /// </summary> private static string GetSignatureText(SignatureHelpItem item) { var sb = new StringBuilder(); sb.Append(item.PrefixDisplayParts.GetFullText()); var separators = item.SeparatorDisplayParts.GetFullText(); for (var i = 0; i < item.Parameters.Length; i++) { var param = item.Parameters[i]; if (i > 0) { sb.Append(separators); } sb.Append(param.PrefixDisplayParts.GetFullText()); sb.Append(param.DisplayParts.GetFullText()); sb.Append(param.SuffixDisplayParts.GetFullText()); } sb.Append(item.SuffixDisplayParts.GetFullText()); sb.Append(item.DescriptionParts.GetFullText()); return sb.ToString(); } private static ClassifiedTextElement GetSignatureClassifiedText(SignatureHelpItem item) { var taggedTexts = new ArrayBuilder<TaggedText>(); taggedTexts.AddRange(item.PrefixDisplayParts); var separators = item.SeparatorDisplayParts; for (var i = 0; i < item.Parameters.Length; i++) { var param = item.Parameters[i]; if (i > 0) { taggedTexts.AddRange(separators); } taggedTexts.AddRange(param.PrefixDisplayParts); taggedTexts.AddRange(param.DisplayParts); taggedTexts.AddRange(param.SuffixDisplayParts); } taggedTexts.AddRange(item.SuffixDisplayParts); taggedTexts.AddRange(item.DescriptionParts); return new ClassifiedTextElement(taggedTexts.ToArrayAndFree().Select(part => new ClassifiedTextRun(part.Tag.ToClassificationTypeName(), part.Text))); } } }
// 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 System; using System.Collections.Generic; using System.Composition; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.VisualStudio.Text.Adornments; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.Handler { [ExportRoslynLanguagesLspRequestHandlerProvider, Shared] [ProvidesMethod(LSP.Methods.TextDocumentSignatureHelpName)] internal class SignatureHelpHandler : AbstractStatelessRequestHandler<LSP.TextDocumentPositionParams, LSP.SignatureHelp?> { private readonly IEnumerable<Lazy<ISignatureHelpProvider, OrderableLanguageMetadata>> _allProviders; public override string Method => LSP.Methods.TextDocumentSignatureHelpName; public override bool MutatesSolutionState => false; public override bool RequiresLSPSolution => true; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public SignatureHelpHandler([ImportMany] IEnumerable<Lazy<ISignatureHelpProvider, OrderableLanguageMetadata>> allProviders) { _allProviders = allProviders; } public override LSP.TextDocumentIdentifier? GetTextDocumentIdentifier(LSP.TextDocumentPositionParams request) => request.TextDocument; public override async Task<LSP.SignatureHelp?> HandleRequestAsync(LSP.TextDocumentPositionParams request, RequestContext context, CancellationToken cancellationToken) { var document = context.Document; if (document == null) { return null; } var position = await document.GetPositionFromLinePositionAsync(ProtocolConversions.PositionToLinePosition(request.Position), cancellationToken).ConfigureAwait(false); var providers = _allProviders.Where(p => p.Metadata.Language == document.Project.Language); var triggerInfo = new SignatureHelpTriggerInfo(SignatureHelpTriggerReason.InvokeSignatureHelpCommand); foreach (var provider in providers) { var items = await provider.Value.GetItemsAsync(document, position, triggerInfo, cancellationToken).ConfigureAwait(false); if (items != null) { var sigInfos = new ArrayBuilder<LSP.SignatureInformation>(); foreach (var item in items.Items) { LSP.SignatureInformation sigInfo; if (context.ClientCapabilities?.HasVisualStudioLspCapability() == true) { sigInfo = new LSP.VSInternalSignatureInformation { ColorizedLabel = GetSignatureClassifiedText(item) }; } else { sigInfo = new LSP.SignatureInformation(); } sigInfo.Label = GetSignatureText(item); sigInfo.Documentation = new LSP.MarkupContent { Kind = LSP.MarkupKind.PlainText, Value = item.DocumentationFactory(cancellationToken).GetFullText() }; sigInfo.Parameters = item.Parameters.Select(p => new LSP.ParameterInformation { Label = p.Name, Documentation = new LSP.MarkupContent { Kind = LSP.MarkupKind.PlainText, Value = p.DocumentationFactory(cancellationToken).GetFullText() } }).ToArray(); sigInfos.Add(sigInfo); } var sigHelp = new LSP.SignatureHelp { ActiveSignature = GetActiveSignature(items), ActiveParameter = items.ArgumentIndex, Signatures = sigInfos.ToArrayAndFree() }; return sigHelp; } } return null; } private static int GetActiveSignature(SignatureHelpItems items) { if (items.SelectedItemIndex.HasValue) { return items.SelectedItemIndex.Value; } // From Roslyn's doc comments for SelectedItemIndex: // If this is null, then the controller will pick the first item that has enough arguments // to be viable based on what argument position the user is currently inside of. // However, the LSP spec expects the language server to make this decision. // So implement the logic of picking a signature that has enough arguments here. var matchingSignature = items.Items.FirstOrDefault(sig => sig.Parameters.Length > items.ArgumentIndex); return matchingSignature != null ? items.Items.IndexOf(matchingSignature) : 0; } /// <summary> /// The <see cref="SignatureHelpItem"/> contains a prefix, parameters separated by a /// separator and a suffix. Parameters themselves have a prefix, display and suffix. /// Concatenate them all to get the text. /// </summary> private static string GetSignatureText(SignatureHelpItem item) { var sb = new StringBuilder(); sb.Append(item.PrefixDisplayParts.GetFullText()); var separators = item.SeparatorDisplayParts.GetFullText(); for (var i = 0; i < item.Parameters.Length; i++) { var param = item.Parameters[i]; if (i > 0) { sb.Append(separators); } sb.Append(param.PrefixDisplayParts.GetFullText()); sb.Append(param.DisplayParts.GetFullText()); sb.Append(param.SuffixDisplayParts.GetFullText()); } sb.Append(item.SuffixDisplayParts.GetFullText()); sb.Append(item.DescriptionParts.GetFullText()); return sb.ToString(); } private static ClassifiedTextElement GetSignatureClassifiedText(SignatureHelpItem item) { var taggedTexts = new ArrayBuilder<TaggedText>(); taggedTexts.AddRange(item.PrefixDisplayParts); var separators = item.SeparatorDisplayParts; for (var i = 0; i < item.Parameters.Length; i++) { var param = item.Parameters[i]; if (i > 0) { taggedTexts.AddRange(separators); } taggedTexts.AddRange(param.PrefixDisplayParts); taggedTexts.AddRange(param.DisplayParts); taggedTexts.AddRange(param.SuffixDisplayParts); } taggedTexts.AddRange(item.SuffixDisplayParts); taggedTexts.AddRange(item.DescriptionParts); return new ClassifiedTextElement(taggedTexts.ToArrayAndFree().Select(part => new ClassifiedTextRun(part.Tag.ToClassificationTypeName(), part.Text))); } } }
-1
dotnet/roslyn
55,696
Have inheritance-margin hold onto data that does *not* point back at Solution instances.
Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
CyrusNajmabadi
2021-08-18T16:22:09Z
2021-08-20T04:50:45Z
16efcb29a0cb8be060ab3bfd9e60c9192c6604bf
6ce4dc34664b63672aeac58683ed9c9e73fa2102
Have inheritance-margin hold onto data that does *not* point back at Solution instances.. Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
./src/EditorFeatures/Core.Wpf/Interactive/xlf/InteractiveEditorFeaturesResources.ru.xlf
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="ru" original="../InteractiveEditorFeaturesResources.resx"> <body> <trans-unit id="Building_Project"> <source>Building Project</source> <target state="translated">Сборка проекта</target> <note /> </trans-unit> <trans-unit id="Copying_selection_to_Interactive_Window"> <source>Copying selection to Interactive Window.</source> <target state="translated">Копирование выделенного фрагмента в интерактивное окно.</target> <note /> </trans-unit> <trans-unit id="Executing_selection_in_Interactive_Window"> <source>Executing selection in Interactive Window.</source> <target state="translated">Выполнение выделенного фрагмента в Интерактивном окне.</target> <note /> </trans-unit> <trans-unit id="Interactive_host_process_platform"> <source>Interactive host process platform</source> <target state="translated">Интерактивная платформа хост-процесса</target> <note /> </trans-unit> <trans-unit id="Print_a_list_of_referenced_assemblies"> <source>Print a list of referenced assemblies.</source> <target state="translated">Печать списка сборок, на которые указывают ссылки.</target> <note /> </trans-unit> <trans-unit id="The_references_command_is_not_supported_in_this_Interactive_Window_implementation"> <source>The references command is not supported in this Interactive Window implementation.</source> <target state="translated">Команда, на которую указывает ссылка, не поддерживается в этой реализации Интерактивного окна.</target> <note /> </trans-unit> <trans-unit id="Reset_the_execution_environment_to_the_initial_state_keep_history"> <source>Reset the execution environment to the initial state, keep history.</source> <target state="translated">Сброс окружения выполнения до первоначального состояния с сохранением журнала.</target> <note /> </trans-unit> <trans-unit id="Reset_to_a_clean_environment_only_mscorlib_referenced_do_not_run_initialization_script"> <source>Reset to a clean environment (only mscorlib referenced), do not run initialization script.</source> <target state="translated">Сброс до состояния чистого окружения (есть только ссылка на mscorlib) без запуска скрипта инициализации.</target> <note /> </trans-unit> <trans-unit id="Resetting_execution_engine"> <source>Resetting execution engine.</source> <target state="translated">Идет сброс подсистемы выполнения.</target> <note /> </trans-unit> <trans-unit id="Resetting_Interactive"> <source>Resetting Interactive</source> <target state="translated">Сброс интерактивного режима</target> <note /> </trans-unit> <trans-unit id="The_CurrentWindow_property_may_only_be_assigned_once"> <source>The CurrentWindow property may only be assigned once.</source> <target state="translated">Свойство CurrentWindow может быть назначено только один раз.</target> <note /> </trans-unit> </body> </file> </xliff>
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="ru" original="../InteractiveEditorFeaturesResources.resx"> <body> <trans-unit id="Building_Project"> <source>Building Project</source> <target state="translated">Сборка проекта</target> <note /> </trans-unit> <trans-unit id="Copying_selection_to_Interactive_Window"> <source>Copying selection to Interactive Window.</source> <target state="translated">Копирование выделенного фрагмента в интерактивное окно.</target> <note /> </trans-unit> <trans-unit id="Executing_selection_in_Interactive_Window"> <source>Executing selection in Interactive Window.</source> <target state="translated">Выполнение выделенного фрагмента в Интерактивном окне.</target> <note /> </trans-unit> <trans-unit id="Interactive_host_process_platform"> <source>Interactive host process platform</source> <target state="translated">Интерактивная платформа хост-процесса</target> <note /> </trans-unit> <trans-unit id="Print_a_list_of_referenced_assemblies"> <source>Print a list of referenced assemblies.</source> <target state="translated">Печать списка сборок, на которые указывают ссылки.</target> <note /> </trans-unit> <trans-unit id="The_references_command_is_not_supported_in_this_Interactive_Window_implementation"> <source>The references command is not supported in this Interactive Window implementation.</source> <target state="translated">Команда, на которую указывает ссылка, не поддерживается в этой реализации Интерактивного окна.</target> <note /> </trans-unit> <trans-unit id="Reset_the_execution_environment_to_the_initial_state_keep_history"> <source>Reset the execution environment to the initial state, keep history.</source> <target state="translated">Сброс окружения выполнения до первоначального состояния с сохранением журнала.</target> <note /> </trans-unit> <trans-unit id="Reset_to_a_clean_environment_only_mscorlib_referenced_do_not_run_initialization_script"> <source>Reset to a clean environment (only mscorlib referenced), do not run initialization script.</source> <target state="translated">Сброс до состояния чистого окружения (есть только ссылка на mscorlib) без запуска скрипта инициализации.</target> <note /> </trans-unit> <trans-unit id="Resetting_execution_engine"> <source>Resetting execution engine.</source> <target state="translated">Идет сброс подсистемы выполнения.</target> <note /> </trans-unit> <trans-unit id="Resetting_Interactive"> <source>Resetting Interactive</source> <target state="translated">Сброс интерактивного режима</target> <note /> </trans-unit> <trans-unit id="The_CurrentWindow_property_may_only_be_assigned_once"> <source>The CurrentWindow property may only be assigned once.</source> <target state="translated">Свойство CurrentWindow может быть назначено только один раз.</target> <note /> </trans-unit> </body> </file> </xliff>
-1
dotnet/roslyn
55,696
Have inheritance-margin hold onto data that does *not* point back at Solution instances.
Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
CyrusNajmabadi
2021-08-18T16:22:09Z
2021-08-20T04:50:45Z
16efcb29a0cb8be060ab3bfd9e60c9192c6604bf
6ce4dc34664b63672aeac58683ed9c9e73fa2102
Have inheritance-margin hold onto data that does *not* point back at Solution instances.. Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
./src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj
<?xml version="1.0" encoding="utf-8"?> <!-- 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. --> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Library</OutputType> <RootNamespace>Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests</RootNamespace> <TargetFrameworks>net5.0;net472</TargetFrameworks> <GenerateMicrosoftCodeAnalysisCommitHashAttribute>true</GenerateMicrosoftCodeAnalysisCommitHashAttribute> </PropertyGroup> <ItemGroup> <Compile Include="..\..\..\Test\Resources\Core\ResourceLoader.cs" Link="ResourceLoader.cs" /> </ItemGroup> <ItemGroup Label="Project References"> <ProjectReference Include="..\..\..\Test\Core\Microsoft.CodeAnalysis.Test.Utilities.csproj" /> <ProjectReference Include="..\..\..\Test\Utilities\CSharp\Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj" /> <ProjectReference Include="..\..\csc\csc.csproj" ReferenceOutputAssembly="false" OutputItemType="RoslynReferenceToDependencyDirectory" /> <ProjectReference Include="..\..\..\..\Interactive\csi\csi.csproj" ReferenceOutputAssembly="false" OutputItemType="CsiReferenceToDependencyDirectory" /> <ProjectReference Include="..\..\..\Core\Portable\Microsoft.CodeAnalysis.csproj" /> <ProjectReference Include="..\..\..\Test\Resources\Core\Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj" /> <ProjectReference Include="..\..\Portable\Microsoft.CodeAnalysis.CSharp.csproj" /> <ProjectReference Include="..\..\..\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj" /> <ProjectReference Include="..\..\..\..\Test\PdbUtilities\Roslyn.Test.PdbUtilities.csproj" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="..\..\csc\csc.rsp" LogicalName="csc.rsp" /> </ItemGroup> <ItemGroup> <PackageReference Include="Xunit.Combinatorial" Version="$(XunitCombinatorialVersion)" /> </ItemGroup> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> </ItemGroup> <Target Name="CopyCsiReferencedProjectToDependenciesDirectory" Condition="'@(CsiReferenceToDependencyDirectory)' != ''" AfterTargets="ResolveProjectReferences"> <PropertyGroup> <_CsiReferenceOutputPath>@(CsiReferenceToDependencyDirectory->'%(RootDir)%(Directory)*.*')</_CsiReferenceOutputPath> </PropertyGroup> <ItemGroup> <_CsiReferenceContent Include="$(_CsiReferenceOutputPath)" /> <Content Include="@(_CsiReferenceContent)" Link="dependency\csi\%(_CsiReferenceContent.Filename)%(_CsiReferenceContent.Extension)" CopyToOutputDirectory="PreserveNewest" /> </ItemGroup> </Target> </Project>
<?xml version="1.0" encoding="utf-8"?> <!-- 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. --> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Library</OutputType> <RootNamespace>Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests</RootNamespace> <TargetFrameworks>net5.0;net472</TargetFrameworks> <GenerateMicrosoftCodeAnalysisCommitHashAttribute>true</GenerateMicrosoftCodeAnalysisCommitHashAttribute> </PropertyGroup> <ItemGroup> <Compile Include="..\..\..\Test\Resources\Core\ResourceLoader.cs" Link="ResourceLoader.cs" /> </ItemGroup> <ItemGroup Label="Project References"> <ProjectReference Include="..\..\..\Test\Core\Microsoft.CodeAnalysis.Test.Utilities.csproj" /> <ProjectReference Include="..\..\..\Test\Utilities\CSharp\Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj" /> <ProjectReference Include="..\..\csc\csc.csproj" ReferenceOutputAssembly="false" OutputItemType="RoslynReferenceToDependencyDirectory" /> <ProjectReference Include="..\..\..\..\Interactive\csi\csi.csproj" ReferenceOutputAssembly="false" OutputItemType="CsiReferenceToDependencyDirectory" /> <ProjectReference Include="..\..\..\Core\Portable\Microsoft.CodeAnalysis.csproj" /> <ProjectReference Include="..\..\..\Test\Resources\Core\Microsoft.CodeAnalysis.Compiler.Test.Resources.csproj" /> <ProjectReference Include="..\..\Portable\Microsoft.CodeAnalysis.CSharp.csproj" /> <ProjectReference Include="..\..\..\VisualBasic\Portable\Microsoft.CodeAnalysis.VisualBasic.vbproj" /> <ProjectReference Include="..\..\..\..\Test\PdbUtilities\Roslyn.Test.PdbUtilities.csproj" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="..\..\csc\csc.rsp" LogicalName="csc.rsp" /> </ItemGroup> <ItemGroup> <PackageReference Include="Xunit.Combinatorial" Version="$(XunitCombinatorialVersion)" /> </ItemGroup> <ItemGroup> <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> </ItemGroup> <Target Name="CopyCsiReferencedProjectToDependenciesDirectory" Condition="'@(CsiReferenceToDependencyDirectory)' != ''" AfterTargets="ResolveProjectReferences"> <PropertyGroup> <_CsiReferenceOutputPath>@(CsiReferenceToDependencyDirectory->'%(RootDir)%(Directory)*.*')</_CsiReferenceOutputPath> </PropertyGroup> <ItemGroup> <_CsiReferenceContent Include="$(_CsiReferenceOutputPath)" /> <Content Include="@(_CsiReferenceContent)" Link="dependency\csi\%(_CsiReferenceContent.Filename)%(_CsiReferenceContent.Extension)" CopyToOutputDirectory="PreserveNewest" /> </ItemGroup> </Target> </Project>
-1
dotnet/roslyn
55,696
Have inheritance-margin hold onto data that does *not* point back at Solution instances.
Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
CyrusNajmabadi
2021-08-18T16:22:09Z
2021-08-20T04:50:45Z
16efcb29a0cb8be060ab3bfd9e60c9192c6604bf
6ce4dc34664b63672aeac58683ed9c9e73fa2102
Have inheritance-margin hold onto data that does *not* point back at Solution instances.. Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
./src/VisualStudio/Core/Test/CodeModel/CSharp/EventCollectorTests.vb
' 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. Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Test.Utilities Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp Public Class EventCollectorTests Inherits AbstractEventCollectorTests <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_Rename() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> class D { } </Code> Await TestAsync(code, changedCode, Rename("D")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddStaticModifier() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> static class C { } </Code> Await TestAsync(code, changedCode, Unknown("C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_ChangeToStruct() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> struct C { } </Code> Await TestAsync(code, changedCode, Remove("C", Nothing), Add("C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddField() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> class C { int i; } </Code> Await TestAsync(code, changedCode, Add("i", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddSecondField() As Task Dim code = <Code> class C { int i; } </Code> Dim changedCode = <Code> class C { int i, j; } </Code> Await TestAsync(code, changedCode, Add("j", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddTwoDisjointFields() As Task Dim code = <Code> class C { int i, j; } </Code> Dim changedCode = <Code> class C { int i, x, j, y; } </Code> Await TestAsync(code, changedCode, Unknown("C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddTwoContiguousFields() As Task Dim code = <Code> class C { int i, x, j, y; } </Code> Dim changedCode = <Code> class C { int i, x, a, b, j, y; } </Code> Await TestAsync(code, changedCode, Add("a", "C"), Add("b", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_RemoveTwoDisjointFields() As Task Dim code = <Code> class C { int i, x, j, y; } </Code> Dim changedCode = <Code> class C { int i, j; } </Code> Await TestAsync(code, changedCode, Unknown("C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_ReplaceFourFieldsWithProperty() As Task Dim code = <Code> class C { int i, x, j, y; } </Code> Dim changedCode = <Code> class C { int Goo { get; set; } } </Code> Await TestAsync(code, changedCode, Remove("i", "C"), Remove("x", "C"), Remove("j", "C"), Remove("y", "C"), Add("Goo", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_RemoveTwoContiguousFields() As Task Dim code = <Code> class C { int i, x, a, b, j, y; } </Code> Dim changedCode = <Code> class C { int i, x, j, y; } </Code> Await TestAsync(code, changedCode, Remove("a", "C"), Remove("b", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_RemoveField() As Task Dim code = <Code> class C { int i; } </Code> Dim changedCode = <Code> class C { } </Code> Await TestAsync(code, changedCode, Remove("i", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_ReplaceFieldWithEvent() As Task Dim code = <Code> class C { System.EventHandler E; } </Code> Dim changedCode = <Code> class C { event System.EventHandler E; } </Code> Await TestAsync(code, changedCode, Remove("E", "C"), Add("E", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddAutoProperty() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> class C { int Goo { get; set; } } </Code> Await TestAsync(code, changedCode, Add("Goo", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddIndexer() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> class C { int this[int index] { get { return 0; } } } </Code> Await TestAsync(code, changedCode, Add("this", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_AddConstModifier() As Task Dim code = <Code> class C { int i; } </Code> Dim changedCode = <Code> class C { const int i; } </Code> Await TestAsync(code, changedCode, Unknown("i")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddAccessModifier() As Task Dim code = <Code> class C { void M() { } } </Code> Dim changedCode = <Code> class C { private void M() { } } </Code> Await TestAsync(code, changedCode, Unknown("M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddParameter1() As Task Dim code = <Code> class C { void M() { } } </Code> Dim changedCode = <Code> class C { void M(int i) { } } </Code> Await TestAsync(code, changedCode, Add("i", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddParameter2() As Task Dim code = <Code> class C { void M(int i) { } } </Code> Dim changedCode = <Code> class C { void M(int i, int j) { } } </Code> Await TestAsync(code, changedCode, Add("j", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_RemoveParameter() As Task Dim code = <Code> class C { void M(int i) { } } </Code> Dim changedCode = <Code> class C { void M() { } } </Code> Await TestAsync(code, changedCode, Remove("i", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddAttribute1() As Task Dim code = <Code> class C { void M(int i) { } } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(true)] void M(int i) { } } </Code> Await TestAsync(code, changedCode, Add("System.CLSCompliant", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddAttribute2() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] void M(int i) { } } </Code> Dim changedCode = <Code> class C { [System.Diagnostics.Conditional("DEBUG"), System.CLSCompliant(true)] void M(int i) { } } </Code> Await TestAsync(code, changedCode, Add("System.Diagnostics.Conditional", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_RemoveAttributes() As Task Dim code = <Code> class C { [System.Diagnostics.Conditional("DEBUG"), System.CLSCompliant(true)] void M(int i) { } } </Code> Dim changedCode = <Code> class C { void M(int i) { } } </Code> Await TestAsync(code, changedCode, Remove("System.Diagnostics.Conditional", "M"), Remove("System.CLSCompliant", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_ChangeAttribute() As Task Dim code = <Code> class C { [System.Diagnostics.Conditional("DEBUG")] void M(int i) { } } </Code> Dim changedCode = <Code> class C { [System.Diagnostics.Conditional("TRACE")] void M(int i) { } } </Code> Await TestAsync(code, changedCode, ArgChange("System.Diagnostics.Conditional")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestLargeTopLevelReplace() As Task Dim code = <Code> class A { } </Code> Dim changedCode = <Code> class B { } class C { } class D { } class E { } class F { } class G { } class H { } class I { } class J { } class K { } </Code> Await TestAsync(code, changedCode, Unknown(Nothing)) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestReplaceWithTwoClasses() As Task Dim code = <Code> namespace N { class A { } } </Code> Dim changedCode = <Code> namespace N { class B { } class C { } } </Code> Await TestAsync(code, changedCode, Unknown("N")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestChangingClassClassToPartial1() As Task Dim code = <Code> namespace N { class C { } } </Code> Dim changedCode = <Code> namespace N { parclass C { } } </Code> Await TestAsync(code, changedCode, Remove("C", "N")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestChangingClassClassToPartial2() As Task Dim code = <Code> namespace N { parclass C { } } </Code> Dim changedCode = <Code> namespace N { partial class C { } } </Code> Await TestAsync(code, changedCode, Add("C", "N")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestRenameDelegate() As Task Dim code = <Code> namespace N { public delegate void Goo(); } </Code> Dim changedCode = <Code> namespace N { public delegate void Bar(); } </Code> Await TestAsync(code, changedCode, Rename("Bar")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestBug788750() As Task Dim code = <Code> class C { public int X; void Bar() { var b = new B() { ID = 0; } X = 0; } } class B { public int ID { get; set; } } </Code> Dim changedCode = <Code> class C { public int X; void Bar() { var b = new B() { ID = 0; }; X = 0; } } class B { public int ID { get; set; } } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_AddAttributeToField() As Task Dim code = <Code> class C { int goo; } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(true)] int goo; } </Code> Await TestAsync(code, changedCode, Add("System.CLSCompliant", "goo")) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_AddAttributeToTwoFields() As Task Dim code = <Code> class C { int goo, bar; } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(true)] int goo, bar; } </Code> Await TestAsync(code, changedCode, Add("System.CLSCompliant", "goo"), Add("System.CLSCompliant", "bar")) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_RemoveAttributeFromField() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] int goo; } </Code> Dim changedCode = <Code> class C { int goo; } </Code> Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "goo")) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_RemoveAttributeFromTwoFields() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] int goo, bar; } </Code> Dim changedCode = <Code> class C { int goo, bar; } </Code> Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "goo"), Remove("System.CLSCompliant", "bar")) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_ChangeAttributeOnField() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] int goo; } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(false)] int goo; } </Code> Await TestAsync(code, changedCode, ArgChange("System.CLSCompliant", "goo")) End Function <WorkItem(1147865, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1147865")> <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_ChangeAttributeOnTwoFields() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] int goo, bar; } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(false)] int goo, bar; } </Code> Await TestAsync(code, changedCode, ArgChange("System.CLSCompliant", "goo"), ArgChange("System.CLSCompliant", "bar")) End Function <WorkItem(1147865, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1147865")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_AddOneMoreAttribute() As Task Dim code = <Code> using System; class Program { [System.NonSerialized()] public int bar; } </Code> Dim changedCode = <Code> using System; class Program { [System.NonSerialized(), System.CLSCompliant(true)] public int bar; } </Code> Await TestAsync(code, changedCode, Add("System.CLSCompliant", "bar")) End Function <WorkItem(1147865, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1147865")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_RemoveOneAttribute() As Task Dim code = <Code> using System; class Program { [System.NonSerialized(), System.CLSCompliant(true)] public int bar; } </Code> Dim changedCode = <Code> using System; class Program { [System.NonSerialized()] public int bar; } </Code> Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "bar")) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontFireEventForMethodAddedInsideNamespace() As Task Dim code = <Code> namespace N { } </Code> Dim changedCode = <Code> namespace N { void M() { } } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontCrashOnDuplicatedMethodsInNamespace() As Task Dim code = <Code> namespace N { void M() { } } </Code> Dim changedCode = <Code> namespace N { void M() { } void M() { } } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontCrashOnDuplicatedPropertiesInNamespace() As Task Dim code = <Code> namespace N { int P { get { return 42; } } } </Code> Dim changedCode = <Code> namespace N { int P { get { return 42; } } int P { get { return 42; } } } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontCrashOnDuplicatedEventsInNamespace1() As Task Dim code = <Code> namespace N { event System.EventHandler E; } </Code> Dim changedCode = <Code> namespace N { event System.EventHandler E; event System.EventHandler E; } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontCrashOnDuplicatedEventsInNamespace2() As Task Dim code = <Code> namespace N { event System.EventHandler E { add { } remove { } } } </Code> Dim changedCode = <Code> namespace N { event System.EventHandler E { add { } remove { } } event System.EventHandler E { add { } remove { } } } </Code> Await TestAsync(code, changedCode) End Function Protected Overrides ReadOnly Property LanguageName As String Get Return LanguageNames.CSharp End Get End Property End Class End Namespace
' 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. Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Test.Utilities Imports Roslyn.Test.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.CSharp Public Class EventCollectorTests Inherits AbstractEventCollectorTests <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_Rename() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> class D { } </Code> Await TestAsync(code, changedCode, Rename("D")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddStaticModifier() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> static class C { } </Code> Await TestAsync(code, changedCode, Unknown("C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_ChangeToStruct() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> struct C { } </Code> Await TestAsync(code, changedCode, Remove("C", Nothing), Add("C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddField() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> class C { int i; } </Code> Await TestAsync(code, changedCode, Add("i", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddSecondField() As Task Dim code = <Code> class C { int i; } </Code> Dim changedCode = <Code> class C { int i, j; } </Code> Await TestAsync(code, changedCode, Add("j", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddTwoDisjointFields() As Task Dim code = <Code> class C { int i, j; } </Code> Dim changedCode = <Code> class C { int i, x, j, y; } </Code> Await TestAsync(code, changedCode, Unknown("C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddTwoContiguousFields() As Task Dim code = <Code> class C { int i, x, j, y; } </Code> Dim changedCode = <Code> class C { int i, x, a, b, j, y; } </Code> Await TestAsync(code, changedCode, Add("a", "C"), Add("b", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_RemoveTwoDisjointFields() As Task Dim code = <Code> class C { int i, x, j, y; } </Code> Dim changedCode = <Code> class C { int i, j; } </Code> Await TestAsync(code, changedCode, Unknown("C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_ReplaceFourFieldsWithProperty() As Task Dim code = <Code> class C { int i, x, j, y; } </Code> Dim changedCode = <Code> class C { int Goo { get; set; } } </Code> Await TestAsync(code, changedCode, Remove("i", "C"), Remove("x", "C"), Remove("j", "C"), Remove("y", "C"), Add("Goo", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_RemoveTwoContiguousFields() As Task Dim code = <Code> class C { int i, x, a, b, j, y; } </Code> Dim changedCode = <Code> class C { int i, x, j, y; } </Code> Await TestAsync(code, changedCode, Remove("a", "C"), Remove("b", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_RemoveField() As Task Dim code = <Code> class C { int i; } </Code> Dim changedCode = <Code> class C { } </Code> Await TestAsync(code, changedCode, Remove("i", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_ReplaceFieldWithEvent() As Task Dim code = <Code> class C { System.EventHandler E; } </Code> Dim changedCode = <Code> class C { event System.EventHandler E; } </Code> Await TestAsync(code, changedCode, Remove("E", "C"), Add("E", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddAutoProperty() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> class C { int Goo { get; set; } } </Code> Await TestAsync(code, changedCode, Add("Goo", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestClass_AddIndexer() As Task Dim code = <Code> class C { } </Code> Dim changedCode = <Code> class C { int this[int index] { get { return 0; } } } </Code> Await TestAsync(code, changedCode, Add("this", "C")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_AddConstModifier() As Task Dim code = <Code> class C { int i; } </Code> Dim changedCode = <Code> class C { const int i; } </Code> Await TestAsync(code, changedCode, Unknown("i")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddAccessModifier() As Task Dim code = <Code> class C { void M() { } } </Code> Dim changedCode = <Code> class C { private void M() { } } </Code> Await TestAsync(code, changedCode, Unknown("M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddParameter1() As Task Dim code = <Code> class C { void M() { } } </Code> Dim changedCode = <Code> class C { void M(int i) { } } </Code> Await TestAsync(code, changedCode, Add("i", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddParameter2() As Task Dim code = <Code> class C { void M(int i) { } } </Code> Dim changedCode = <Code> class C { void M(int i, int j) { } } </Code> Await TestAsync(code, changedCode, Add("j", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_RemoveParameter() As Task Dim code = <Code> class C { void M(int i) { } } </Code> Dim changedCode = <Code> class C { void M() { } } </Code> Await TestAsync(code, changedCode, Remove("i", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddAttribute1() As Task Dim code = <Code> class C { void M(int i) { } } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(true)] void M(int i) { } } </Code> Await TestAsync(code, changedCode, Add("System.CLSCompliant", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_AddAttribute2() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] void M(int i) { } } </Code> Dim changedCode = <Code> class C { [System.Diagnostics.Conditional("DEBUG"), System.CLSCompliant(true)] void M(int i) { } } </Code> Await TestAsync(code, changedCode, Add("System.Diagnostics.Conditional", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_RemoveAttributes() As Task Dim code = <Code> class C { [System.Diagnostics.Conditional("DEBUG"), System.CLSCompliant(true)] void M(int i) { } } </Code> Dim changedCode = <Code> class C { void M(int i) { } } </Code> Await TestAsync(code, changedCode, Remove("System.Diagnostics.Conditional", "M"), Remove("System.CLSCompliant", "M")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestMethod_ChangeAttribute() As Task Dim code = <Code> class C { [System.Diagnostics.Conditional("DEBUG")] void M(int i) { } } </Code> Dim changedCode = <Code> class C { [System.Diagnostics.Conditional("TRACE")] void M(int i) { } } </Code> Await TestAsync(code, changedCode, ArgChange("System.Diagnostics.Conditional")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestLargeTopLevelReplace() As Task Dim code = <Code> class A { } </Code> Dim changedCode = <Code> class B { } class C { } class D { } class E { } class F { } class G { } class H { } class I { } class J { } class K { } </Code> Await TestAsync(code, changedCode, Unknown(Nothing)) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestReplaceWithTwoClasses() As Task Dim code = <Code> namespace N { class A { } } </Code> Dim changedCode = <Code> namespace N { class B { } class C { } } </Code> Await TestAsync(code, changedCode, Unknown("N")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestChangingClassClassToPartial1() As Task Dim code = <Code> namespace N { class C { } } </Code> Dim changedCode = <Code> namespace N { parclass C { } } </Code> Await TestAsync(code, changedCode, Remove("C", "N")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestChangingClassClassToPartial2() As Task Dim code = <Code> namespace N { parclass C { } } </Code> Dim changedCode = <Code> namespace N { partial class C { } } </Code> Await TestAsync(code, changedCode, Add("C", "N")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestRenameDelegate() As Task Dim code = <Code> namespace N { public delegate void Goo(); } </Code> Dim changedCode = <Code> namespace N { public delegate void Bar(); } </Code> Await TestAsync(code, changedCode, Rename("Bar")) End Function <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestBug788750() As Task Dim code = <Code> class C { public int X; void Bar() { var b = new B() { ID = 0; } X = 0; } } class B { public int ID { get; set; } } </Code> Dim changedCode = <Code> class C { public int X; void Bar() { var b = new B() { ID = 0; }; X = 0; } } class B { public int ID { get; set; } } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_AddAttributeToField() As Task Dim code = <Code> class C { int goo; } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(true)] int goo; } </Code> Await TestAsync(code, changedCode, Add("System.CLSCompliant", "goo")) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_AddAttributeToTwoFields() As Task Dim code = <Code> class C { int goo, bar; } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(true)] int goo, bar; } </Code> Await TestAsync(code, changedCode, Add("System.CLSCompliant", "goo"), Add("System.CLSCompliant", "bar")) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_RemoveAttributeFromField() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] int goo; } </Code> Dim changedCode = <Code> class C { int goo; } </Code> Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "goo")) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_RemoveAttributeFromTwoFields() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] int goo, bar; } </Code> Dim changedCode = <Code> class C { int goo, bar; } </Code> Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "goo"), Remove("System.CLSCompliant", "bar")) End Function <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_ChangeAttributeOnField() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] int goo; } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(false)] int goo; } </Code> Await TestAsync(code, changedCode, ArgChange("System.CLSCompliant", "goo")) End Function <WorkItem(1147865, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1147865")> <WorkItem(844611, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/844611")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_ChangeAttributeOnTwoFields() As Task Dim code = <Code> class C { [System.CLSCompliant(true)] int goo, bar; } </Code> Dim changedCode = <Code> class C { [System.CLSCompliant(false)] int goo, bar; } </Code> Await TestAsync(code, changedCode, ArgChange("System.CLSCompliant", "goo"), ArgChange("System.CLSCompliant", "bar")) End Function <WorkItem(1147865, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1147865")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_AddOneMoreAttribute() As Task Dim code = <Code> using System; class Program { [System.NonSerialized()] public int bar; } </Code> Dim changedCode = <Code> using System; class Program { [System.NonSerialized(), System.CLSCompliant(true)] public int bar; } </Code> Await TestAsync(code, changedCode, Add("System.CLSCompliant", "bar")) End Function <WorkItem(1147865, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1147865")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function TestField_RemoveOneAttribute() As Task Dim code = <Code> using System; class Program { [System.NonSerialized(), System.CLSCompliant(true)] public int bar; } </Code> Dim changedCode = <Code> using System; class Program { [System.NonSerialized()] public int bar; } </Code> Await TestAsync(code, changedCode, Remove("System.CLSCompliant", "bar")) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontFireEventForMethodAddedInsideNamespace() As Task Dim code = <Code> namespace N { } </Code> Dim changedCode = <Code> namespace N { void M() { } } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontCrashOnDuplicatedMethodsInNamespace() As Task Dim code = <Code> namespace N { void M() { } } </Code> Dim changedCode = <Code> namespace N { void M() { } void M() { } } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontCrashOnDuplicatedPropertiesInNamespace() As Task Dim code = <Code> namespace N { int P { get { return 42; } } } </Code> Dim changedCode = <Code> namespace N { int P { get { return 42; } } int P { get { return 42; } } } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontCrashOnDuplicatedEventsInNamespace1() As Task Dim code = <Code> namespace N { event System.EventHandler E; } </Code> Dim changedCode = <Code> namespace N { event System.EventHandler E; event System.EventHandler E; } </Code> Await TestAsync(code, changedCode) End Function <WorkItem(150349, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/150349")> <WpfFact, Trait(Traits.Feature, Traits.Features.CodeModelEvents)> Public Async Function DontCrashOnDuplicatedEventsInNamespace2() As Task Dim code = <Code> namespace N { event System.EventHandler E { add { } remove { } } } </Code> Dim changedCode = <Code> namespace N { event System.EventHandler E { add { } remove { } } event System.EventHandler E { add { } remove { } } } </Code> Await TestAsync(code, changedCode) End Function Protected Overrides ReadOnly Property LanguageName As String Get Return LanguageNames.CSharp End Get End Property End Class End Namespace
-1
dotnet/roslyn
55,696
Have inheritance-margin hold onto data that does *not* point back at Solution instances.
Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
CyrusNajmabadi
2021-08-18T16:22:09Z
2021-08-20T04:50:45Z
16efcb29a0cb8be060ab3bfd9e60c9192c6604bf
6ce4dc34664b63672aeac58683ed9c9e73fa2102
Have inheritance-margin hold onto data that does *not* point back at Solution instances.. Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
./src/Features/Core/Portable/Completion/Providers/Scripting/AbstractDirectivePathCompletionProvider.cs
// 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 System; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Scripting; using Roslyn.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using System.Diagnostics; using Microsoft.CodeAnalysis.Scripting.Hosting; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.Completion.Providers { internal abstract class AbstractDirectivePathCompletionProvider : CompletionProvider { protected static bool IsDirectorySeparator(char ch) => ch == '/' || (ch == '\\' && !PathUtilities.IsUnixLikePlatform); protected abstract bool TryGetStringLiteralToken(SyntaxTree tree, int position, out SyntaxToken stringLiteral, CancellationToken cancellationToken); /// <summary> /// <code>r</code> for metadata reference directive, <code>load</code> for source file directive. /// </summary> protected abstract string DirectiveName { get; } public sealed override async Task ProvideCompletionsAsync(CompletionContext context) { try { var document = context.Document; var position = context.Position; var cancellationToken = context.CancellationToken; var tree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); if (!TryGetStringLiteralToken(tree, position, out var stringLiteral, cancellationToken)) { return; } var literalValue = stringLiteral.ToString(); context.CompletionListSpan = GetTextChangeSpan( quotedPath: literalValue, quotedPathStart: stringLiteral.SpanStart, position: position); var pathThroughLastSlash = GetPathThroughLastSlash( quotedPath: literalValue, quotedPathStart: stringLiteral.SpanStart, position: position); await ProvideCompletionsAsync(context, pathThroughLastSlash).ConfigureAwait(false); } catch (Exception e) when (FatalError.ReportAndCatchUnlessCanceled(e)) { // nop } } public sealed override bool ShouldTriggerCompletion(SourceText text, int caretPosition, CompletionTrigger trigger, OptionSet options) { var lineStart = text.Lines.GetLineFromPosition(caretPosition).Start; // check if the line starts with {whitespace}#{whitespace}{DirectiveName}{whitespace}" var poundIndex = text.IndexOfNonWhiteSpace(lineStart, caretPosition - lineStart); if (poundIndex == -1 || text[poundIndex] != '#') { return false; } var directiveNameStartIndex = text.IndexOfNonWhiteSpace(poundIndex + 1, caretPosition - poundIndex - 1); if (directiveNameStartIndex == -1 || !text.ContentEquals(directiveNameStartIndex, DirectiveName)) { return false; } var directiveNameEndIndex = directiveNameStartIndex + DirectiveName.Length; var quoteIndex = text.IndexOfNonWhiteSpace(directiveNameEndIndex, caretPosition - directiveNameEndIndex); if (quoteIndex == -1 || text[quoteIndex] != '"') { return false; } return true; } private static string GetPathThroughLastSlash(string quotedPath, int quotedPathStart, int position) { Contract.ThrowIfTrue(quotedPath[0] != '"'); const int QuoteLength = 1; var positionInQuotedPath = position - quotedPathStart; var path = quotedPath[QuoteLength..positionInQuotedPath].Trim(); var afterLastSlashIndex = AfterLastSlashIndex(path, path.Length); // We want the portion up to, and including the last slash if there is one. That way if // the user pops up completion in the middle of a path (i.e. "C:\Win") then we'll // consider the path to be "C:\" and we will show appropriate completions. return afterLastSlashIndex >= 0 ? path.Substring(0, afterLastSlashIndex) : path; } private static TextSpan GetTextChangeSpan(string quotedPath, int quotedPathStart, int position) { // We want the text change to be from after the last slash to the end of the quoted // path. If there is no last slash, then we want it from right after the start quote // character. var positionInQuotedPath = position - quotedPathStart; // Where we want to start tracking is right after the slash (if we have one), or else // right after the string starts. var afterLastSlashIndex = AfterLastSlashIndex(quotedPath, positionInQuotedPath); var afterFirstQuote = 1; var startIndex = Math.Max(afterLastSlashIndex, afterFirstQuote); var endIndex = quotedPath.Length; // If the string ends with a quote, the we do not want to consume that. if (EndsWithQuote(quotedPath)) { endIndex--; } return TextSpan.FromBounds(startIndex + quotedPathStart, endIndex + quotedPathStart); } private static bool EndsWithQuote(string quotedPath) => quotedPath.Length >= 2 && quotedPath[quotedPath.Length - 1] == '"'; /// <summary> /// Returns the index right after the last slash that precedes 'position'. If there is no /// slash in the string, -1 is returned. /// </summary> private static int AfterLastSlashIndex(string text, int position) { // Position might be out of bounds of the string (if the string is unterminated. Make // sure it's within bounds. position = Math.Min(position, text.Length - 1); int index; if ((index = text.LastIndexOf('/', position)) >= 0 || !PathUtilities.IsUnixLikePlatform && (index = text.LastIndexOf('\\', position)) >= 0) { return index + 1; } return -1; } protected abstract Task ProvideCompletionsAsync(CompletionContext context, string pathThroughLastSlash); protected static FileSystemCompletionHelper GetFileSystemCompletionHelper( Document document, Glyph itemGlyph, ImmutableArray<string> extensions, CompletionItemRules completionRules) { ImmutableArray<string> referenceSearchPaths; string? baseDirectory; if (document.Project.CompilationOptions?.MetadataReferenceResolver is RuntimeMetadataReferenceResolver resolver) { referenceSearchPaths = resolver.PathResolver.SearchPaths; baseDirectory = resolver.PathResolver.BaseDirectory; } else { referenceSearchPaths = ImmutableArray<string>.Empty; baseDirectory = null; } return new FileSystemCompletionHelper( Glyph.OpenFolder, itemGlyph, referenceSearchPaths, GetBaseDirectory(document, baseDirectory), extensions, completionRules); } private static string? GetBaseDirectory(Document document, string? baseDirectory) { var result = PathUtilities.GetDirectoryName(document.FilePath); if (!PathUtilities.IsAbsolute(result)) { result = baseDirectory; Debug.Assert(result == null || PathUtilities.IsAbsolute(result)); } return result; } } }
// 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 System; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Scripting; using Roslyn.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using System.Diagnostics; using Microsoft.CodeAnalysis.Scripting.Hosting; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.Completion.Providers { internal abstract class AbstractDirectivePathCompletionProvider : CompletionProvider { protected static bool IsDirectorySeparator(char ch) => ch == '/' || (ch == '\\' && !PathUtilities.IsUnixLikePlatform); protected abstract bool TryGetStringLiteralToken(SyntaxTree tree, int position, out SyntaxToken stringLiteral, CancellationToken cancellationToken); /// <summary> /// <code>r</code> for metadata reference directive, <code>load</code> for source file directive. /// </summary> protected abstract string DirectiveName { get; } public sealed override async Task ProvideCompletionsAsync(CompletionContext context) { try { var document = context.Document; var position = context.Position; var cancellationToken = context.CancellationToken; var tree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); if (!TryGetStringLiteralToken(tree, position, out var stringLiteral, cancellationToken)) { return; } var literalValue = stringLiteral.ToString(); context.CompletionListSpan = GetTextChangeSpan( quotedPath: literalValue, quotedPathStart: stringLiteral.SpanStart, position: position); var pathThroughLastSlash = GetPathThroughLastSlash( quotedPath: literalValue, quotedPathStart: stringLiteral.SpanStart, position: position); await ProvideCompletionsAsync(context, pathThroughLastSlash).ConfigureAwait(false); } catch (Exception e) when (FatalError.ReportAndCatchUnlessCanceled(e)) { // nop } } public sealed override bool ShouldTriggerCompletion(SourceText text, int caretPosition, CompletionTrigger trigger, OptionSet options) { var lineStart = text.Lines.GetLineFromPosition(caretPosition).Start; // check if the line starts with {whitespace}#{whitespace}{DirectiveName}{whitespace}" var poundIndex = text.IndexOfNonWhiteSpace(lineStart, caretPosition - lineStart); if (poundIndex == -1 || text[poundIndex] != '#') { return false; } var directiveNameStartIndex = text.IndexOfNonWhiteSpace(poundIndex + 1, caretPosition - poundIndex - 1); if (directiveNameStartIndex == -1 || !text.ContentEquals(directiveNameStartIndex, DirectiveName)) { return false; } var directiveNameEndIndex = directiveNameStartIndex + DirectiveName.Length; var quoteIndex = text.IndexOfNonWhiteSpace(directiveNameEndIndex, caretPosition - directiveNameEndIndex); if (quoteIndex == -1 || text[quoteIndex] != '"') { return false; } return true; } private static string GetPathThroughLastSlash(string quotedPath, int quotedPathStart, int position) { Contract.ThrowIfTrue(quotedPath[0] != '"'); const int QuoteLength = 1; var positionInQuotedPath = position - quotedPathStart; var path = quotedPath[QuoteLength..positionInQuotedPath].Trim(); var afterLastSlashIndex = AfterLastSlashIndex(path, path.Length); // We want the portion up to, and including the last slash if there is one. That way if // the user pops up completion in the middle of a path (i.e. "C:\Win") then we'll // consider the path to be "C:\" and we will show appropriate completions. return afterLastSlashIndex >= 0 ? path.Substring(0, afterLastSlashIndex) : path; } private static TextSpan GetTextChangeSpan(string quotedPath, int quotedPathStart, int position) { // We want the text change to be from after the last slash to the end of the quoted // path. If there is no last slash, then we want it from right after the start quote // character. var positionInQuotedPath = position - quotedPathStart; // Where we want to start tracking is right after the slash (if we have one), or else // right after the string starts. var afterLastSlashIndex = AfterLastSlashIndex(quotedPath, positionInQuotedPath); var afterFirstQuote = 1; var startIndex = Math.Max(afterLastSlashIndex, afterFirstQuote); var endIndex = quotedPath.Length; // If the string ends with a quote, the we do not want to consume that. if (EndsWithQuote(quotedPath)) { endIndex--; } return TextSpan.FromBounds(startIndex + quotedPathStart, endIndex + quotedPathStart); } private static bool EndsWithQuote(string quotedPath) => quotedPath.Length >= 2 && quotedPath[quotedPath.Length - 1] == '"'; /// <summary> /// Returns the index right after the last slash that precedes 'position'. If there is no /// slash in the string, -1 is returned. /// </summary> private static int AfterLastSlashIndex(string text, int position) { // Position might be out of bounds of the string (if the string is unterminated. Make // sure it's within bounds. position = Math.Min(position, text.Length - 1); int index; if ((index = text.LastIndexOf('/', position)) >= 0 || !PathUtilities.IsUnixLikePlatform && (index = text.LastIndexOf('\\', position)) >= 0) { return index + 1; } return -1; } protected abstract Task ProvideCompletionsAsync(CompletionContext context, string pathThroughLastSlash); protected static FileSystemCompletionHelper GetFileSystemCompletionHelper( Document document, Glyph itemGlyph, ImmutableArray<string> extensions, CompletionItemRules completionRules) { ImmutableArray<string> referenceSearchPaths; string? baseDirectory; if (document.Project.CompilationOptions?.MetadataReferenceResolver is RuntimeMetadataReferenceResolver resolver) { referenceSearchPaths = resolver.PathResolver.SearchPaths; baseDirectory = resolver.PathResolver.BaseDirectory; } else { referenceSearchPaths = ImmutableArray<string>.Empty; baseDirectory = null; } return new FileSystemCompletionHelper( Glyph.OpenFolder, itemGlyph, referenceSearchPaths, GetBaseDirectory(document, baseDirectory), extensions, completionRules); } private static string? GetBaseDirectory(Document document, string? baseDirectory) { var result = PathUtilities.GetDirectoryName(document.FilePath); if (!PathUtilities.IsAbsolute(result)) { result = baseDirectory; Debug.Assert(result == null || PathUtilities.IsAbsolute(result)); } return result; } } }
-1
dotnet/roslyn
55,696
Have inheritance-margin hold onto data that does *not* point back at Solution instances.
Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
CyrusNajmabadi
2021-08-18T16:22:09Z
2021-08-20T04:50:45Z
16efcb29a0cb8be060ab3bfd9e60c9192c6604bf
6ce4dc34664b63672aeac58683ed9c9e73fa2102
Have inheritance-margin hold onto data that does *not* point back at Solution instances.. Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
./src/Features/CSharp/Portable/ConvertCast/CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs
// 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 System.Composition; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.ConvertCast; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; namespace Microsoft.CodeAnalysis.CSharp.ConvertCast { /// <summary> /// Refactor: /// var o = 1 as object; /// /// Into: /// var o = (object)1; /// </summary> [ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = PredefinedCodeRefactoringProviderNames.ConvertTryCastToDirectCast), Shared] internal partial class CSharpConvertTryCastToDirectCastCodeRefactoringProvider : AbstractConvertCastCodeRefactoringProvider<TypeSyntax, BinaryExpressionSyntax, CastExpressionSyntax> { [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")] public CSharpConvertTryCastToDirectCastCodeRefactoringProvider() { } protected override string GetTitle() => CSharpFeaturesResources.Change_to_cast; protected override int FromKind => (int)SyntaxKind.AsExpression; protected override TypeSyntax GetTypeNode(BinaryExpressionSyntax expression) => (TypeSyntax)expression.Right; protected override CastExpressionSyntax ConvertExpression(BinaryExpressionSyntax asExpression) { var expression = asExpression.Left; var typeNode = GetTypeNode(asExpression); // Trivia handling: // #0 exp #1 as #2 Type #3 // #0 #2 (Type)exp #1 #3 // Some trivia in the middle (#1 and #2) is moved to the front or behind the expression // #1 and #2 change their position in the expression (#2 goes in front to stay near the type and #1 to the end to stay near the expression) // Some whitespace around the as operator is removed to follow the formatting rules of (Type)expr var openParen = Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty); var closeParen = Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty); var newTrailingTrivia = asExpression.Left.GetTrailingTrivia().SkipInitialWhitespace().ToSyntaxTriviaList().AddRange(asExpression.GetTrailingTrivia()); var newLeadingTrivia = asExpression.GetLeadingTrivia().AddRange(asExpression.OperatorToken.TrailingTrivia.SkipInitialWhitespace()); typeNode = typeNode.WithoutTrailingTrivia(); var castExpression = CastExpression(openParen, typeNode, closeParen, expression.WithoutTrailingTrivia()) .WithLeadingTrivia(newLeadingTrivia) .WithTrailingTrivia(newTrailingTrivia); return castExpression; } } }
// 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 System.Composition; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.ConvertCast; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; namespace Microsoft.CodeAnalysis.CSharp.ConvertCast { /// <summary> /// Refactor: /// var o = 1 as object; /// /// Into: /// var o = (object)1; /// </summary> [ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = PredefinedCodeRefactoringProviderNames.ConvertTryCastToDirectCast), Shared] internal partial class CSharpConvertTryCastToDirectCastCodeRefactoringProvider : AbstractConvertCastCodeRefactoringProvider<TypeSyntax, BinaryExpressionSyntax, CastExpressionSyntax> { [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")] public CSharpConvertTryCastToDirectCastCodeRefactoringProvider() { } protected override string GetTitle() => CSharpFeaturesResources.Change_to_cast; protected override int FromKind => (int)SyntaxKind.AsExpression; protected override TypeSyntax GetTypeNode(BinaryExpressionSyntax expression) => (TypeSyntax)expression.Right; protected override CastExpressionSyntax ConvertExpression(BinaryExpressionSyntax asExpression) { var expression = asExpression.Left; var typeNode = GetTypeNode(asExpression); // Trivia handling: // #0 exp #1 as #2 Type #3 // #0 #2 (Type)exp #1 #3 // Some trivia in the middle (#1 and #2) is moved to the front or behind the expression // #1 and #2 change their position in the expression (#2 goes in front to stay near the type and #1 to the end to stay near the expression) // Some whitespace around the as operator is removed to follow the formatting rules of (Type)expr var openParen = Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty); var closeParen = Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty); var newTrailingTrivia = asExpression.Left.GetTrailingTrivia().SkipInitialWhitespace().ToSyntaxTriviaList().AddRange(asExpression.GetTrailingTrivia()); var newLeadingTrivia = asExpression.GetLeadingTrivia().AddRange(asExpression.OperatorToken.TrailingTrivia.SkipInitialWhitespace()); typeNode = typeNode.WithoutTrailingTrivia(); var castExpression = CastExpression(openParen, typeNode, closeParen, expression.WithoutTrailingTrivia()) .WithLeadingTrivia(newLeadingTrivia) .WithTrailingTrivia(newTrailingTrivia); return castExpression; } } }
-1
dotnet/roslyn
55,696
Have inheritance-margin hold onto data that does *not* point back at Solution instances.
Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
CyrusNajmabadi
2021-08-18T16:22:09Z
2021-08-20T04:50:45Z
16efcb29a0cb8be060ab3bfd9e60c9192c6604bf
6ce4dc34664b63672aeac58683ed9c9e73fa2102
Have inheritance-margin hold onto data that does *not* point back at Solution instances.. Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
./src/EditorFeatures/Test2/FindReferences/FindReferencesTests.NamedTypeSymbols.vb
' 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. Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis.Remote.Testing Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences Partial Public Class FindReferencesTests #Region "FAR on reference types" <WorkItem(541155, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541155")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestInaccessibleVar1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class A { private class {|Definition:$$var|} { } } class B : A { static void Main() { var x = 1; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(541155, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541155")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestInaccessibleVar2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class A { private class var { } } class B : A { static void Main() { $$var x = 1; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(541151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541151")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestGenericVar1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; static class Program { static void Main() { var x = 1; } } class {|Definition:$$var|}<T> { } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(541151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541151")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestGenericVar2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; static class Program { static void Main() { $$var x = 1; } } class var<T> { } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Class(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { private [|C|] c1, c2; void Goo([|C|] c3) { [|C|] c4; } void Bar(System.C c5) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_NestedClass(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { class {|Definition:Nested|} { } void Method() { [|$$Nested|] obj = new [|Nested|](); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ExplicitCast(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:Celsius|} { private float degrees; public {|Definition:Celsius|}(float temp) { degrees = temp; } } class Fahrenheit { private float degrees; public Fahrenheit(float temp) { degrees = temp; } public static explicit operator [|Celsius|](Fahrenheit f) { return new [|Celsius|]((5.0f / 9.0f) * (f.degrees - 32)); } } class MainClass { static void Main() { Fahrenheit f = new Fahrenheit(100.0f); [|Celsius|] c = ([|C$$elsius|])f; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Events(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class CustomEventArgs : System.EventArgs { public CustomEventArgs(string s) { msg = s; } private string msg; public string Message { get { return msg; } } } public class Publisher { public delegate void SampleEventHandler(object sender, CustomEventArgs e); public event SampleEventHandler {|Definition:SampleEvent|}; protected virtual void RaiseSampleEvent() { [|$$SampleEvent|](this, new CustomEventArgs("Hello")); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_TypeOfOperator(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:Celsius|} { public {|Definition:Celsius|}() { System.Type t = typeof([|$$Celsius|]); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539799, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539799")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_InaccessibleType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { private class {|Definition:$$D|} { } } class A { void M() { C.[|D|] d = new C.[|D|](); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_OneDimensionalArray(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void Method() { int[] {|Definition:a|} = {0, 2, 4, 6, 8}; int b = [|$$a|][0]; b = [|a|][1]; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_BaseList(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:Base|} { } class Derived : [|$$Base|] { } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_StaticConstructor(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:S$$impleClass|} { static {|Definition:SimpleClass|}() { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericClass(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:$$C|}<T> { private [|C|] c1; private [|C|]<T> c2; private [|C|]<int> c3; private [|C|]<[|C|]<T>> c4; private [|C|]<int,string> c5; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericClass1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:$$C|} { private [|C|] c1; private [|C|]<T> c2; private [|C|]<int> c3; private [|C|]<[|C|]<T>> c4; private [|C|]<int,string> c5; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericClass2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:$$C|} { private [|C|] c1; private C<T> c2; private C<int> c3; private C<C<T>> c4; private [|C|]<int,string> c5; } class C<T> { }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericClass3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:$$C|}<T> { private C c1; private [|C|]<T> c2; private [|C|]<int> c3; private [|C|]<[|C|]<T>> c4; private [|C|]<int,string> c5; } class C { }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { static void Main(string[] args) { I1<int> m = new Basic(); Console.WriteLine(m.$$[|Add|](1, 1)); } } public interface I1<T> { T {|Definition:Add|}(T arg1, T arg2); } public class Basic : I1<int> { public int {|Definition:Add|}(int arg1, int arg2) { return arg1 + arg2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { static void Main(string[] args) { I1<int> m = new Basic(); Console.WriteLine(m.[|Add|](1, 1)); } } public interface I1<T> { T {|Definition:$$Add|}(T arg1, T arg2); } public class Basic : I1<int> { public int {|Definition:Add|}(int arg1, int arg2) { return arg1 + arg2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { static void Main(string[] args) { I1<int> m = new Basic(); Console.WriteLine(m.[|Add|](1, 1)); } } public interface I1<T> { T {|Definition:Add|}(T arg1, T arg2); } public class Basic : I1<int> { public int {|Definition:$$Add|}(int arg1, int arg2) { return arg1 + arg2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces4(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:$$Goo|}(X x); } class C : I<int>, I<string> { public void {|Definition:Goo|}(int x) { } public void {|Definition:Goo|}(string x) { } } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces5_Api(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:Goo|}(X x); } class C : I<int>, I<string> { public void {|Definition:$$Goo|}(int x) { } public void {|Definition:Goo|}(string x) { } } ]]> </Document> </Project> </Workspace> Await TestAPI(input, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces5_FEature(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:Goo|}(X x); } class C : I<int>, I<string> { public void {|Definition:$$Goo|}(int x) { } public void Goo(string x) { } } ]]> </Document> </Project> </Workspace> Await TestStreamingFeature(input, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces6_Api(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:Goo|}(X x); } class C : I<int>, I<string> { public void {|Definition:Goo|}(int x) { } public void {|Definition:$$Goo|}(string x) { } } ]]> </Document> </Project> </Workspace> Await TestAPI(input, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces6_Feature(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:Goo|}(X x); } class C : I<int>, I<string> { public void Goo(int x) { } public void {|Definition:$$Goo|}(string x) { } } ]]> </Document> </Project> </Workspace> Await TestStreamingFeature(input, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_MultipleFiles(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { } </Document> <Document> class D { private [|C|] c; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_MultipleFiles_InOneFileOnly(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { private [|C|] c; } </Document> <Document> class D { private C c; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host, searchSingleFileOnly:=True) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpImplicitConstructor(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { void Goo() { new [|C|](); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpExplicitConstructor(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { public {|Definition:C|}() { } void Goo() { new [|C|](); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBImplicitConstructor(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class {|Definition:$$C|} Shared Sub Main() Dim c As [|C|] = New [|C|]() End Function End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpConstructorCallUsingNewOperator1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { bool b; C() { [|M|] m = new [|M|]() { b }; } } class {|Definition:$$M|} { public {|Definition:M|}(bool i) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpConstructorCallUsingNewOperator2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { C() { bool b; [|M|] m = new [|M|](b); } } class {|Definition:$$M|} { public {|Definition:M|}(bool i) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBConstructorCallUsingNewOperator(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Sub New() Dim m As [|M|] = New [|M|] (2) End Function End Class Class {|Definition:$$M|} Sub {|Definition:New|}(ByVal i As Integer) End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBModule(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Module {|Definition:Program|} Sub Main(args As String()) End Function End Module Class Test Sub Test() [|$$Program|].Main("") End Function End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_PartialClass(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class {|Definition:$$C|} { public static bool operator ==([|C|] a, [|C|] b) { return a.ToString() == b.ToString(); } } public class M { [|C|] pc; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Interface(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> interface {|Definition:$$IMyInterface|} { } class InterfaceImplementer : [|IMyInterface|] { } </Document> <Document> class C { [|IMyInterface|] iMyInter; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericInterface(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface {|Definition:$$GenericInterface|}<T> { } class GenericClass<T> : [|GenericInterface|]<T> { }]]> </Document> <Document><![CDATA[ class C { [|GenericInterface|]<C> MyGenInt; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539065, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539065")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { delegate void {|Definition:$$MyDelegate|}(); public void F() { [|MyDelegate|] MD1 = new [|MyDelegate|](this.F); [|MyDelegate|] MD2 = MD1 + MD1; [|MyDelegate|] MD3 = new [|MyDelegate|](MD1); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539065, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539065")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { delegate void {|Definition:$$MyDelegate|}(); public void F() { [|MyDelegate|] MD; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539065, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539065")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { delegate void {|Definition:MyDelegate|}(); public void F() { [|$$MyDelegate|] MD; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539614, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539614")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { myDel = new [|TestDelegate|](Goo); } private delegate void {|Definition:$$TestDelegate|}(string s); private static [|TestDelegate|] myDel; static void Goo(string arg) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539614, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539614")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate4(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { myDel = new [|$$TestDelegate|](Goo); } private delegate void {|Definition:TestDelegate|}(string s); private static [|TestDelegate|] myDel; static void Goo(string arg) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539614, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539614")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate5(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { myDel = new [|TestDelegate|](Goo); } private delegate void {|Definition:TestDelegate|}(string s); private static [|$$TestDelegate|] myDel; static void Goo(string arg) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539646, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539646")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate6(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; class Program { delegate R {|Definition:Func|}<T, R>(T t); static void Main(string[] args) { [|Func|]<int, int> f = (arg) => { int s = 3; return s; }; f.[|$$BeginInvoke|](2, null, null); } } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(537966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537966")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledDynamic1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:dyn$$amic|} { } class @static : [|dynamic|] { } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(537966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537966")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledDynamic2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:dyn$$amic|} { } </Document> <Document> class @static : [|dynamic|] { } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(538842, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538842")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledSystemString1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace System { public class {|Definition:St$$ring|} { void Goo(string s) { } void Goo([|String|] s) { } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(538842, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538842")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledSystemString2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace System { public class String { void Goo([|st$$ring|] s) { } void Goo(String s) { } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(538926, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538926")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledSystemString3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace System { public class {|Definition:String|} { void Goo([|Str$$ing|] s) { } void Goo(params [|String|][] s) { } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539299, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539299")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfMemberAccessExpression1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; public class C { void Goo() { [|$$Console|].Write(0); [|Console|].Write(0); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539299, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539299")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfMemberAccessExpression2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; public class C { void Goo() { [|Console$$|].Write(0); [|Console|].Write(0); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539299, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539299")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfMemberAccessExpression3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Public Class C Sub Goo() [|$$Console|].Write(0) [|Console|].Write(0) End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539299, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539299")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfMemberAccessExpression4(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Public Class C Sub Goo() [|Console$$|].Write(0) [|Console|].Write(0) End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCrefNamedType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:Program|} { /// <see cref="[|$$Program|]"/> to start the program. static void Main(string[] args) { } } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCrefNamedType2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:Progr$$am|} { /// <see cref="[|Program|]"/> to start the program. static void Main(string[] args) { } } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(775925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/775925")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfGreaterThanTokenInAttribute(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System <[|Obsolete$$|]> Public Class Class1 <[|Obsolete|]> Dim obsoleteField as Integer End Class ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on primitive types" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_PrimitiveTypeAsMethodParameter(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class D { void Goo([|str$$ing|] s) { } } }]]> </Document> <Document><![CDATA[ using System; class C { [|String|] s; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_PrimitiveTypeAsField(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class D { void Goo([|string|] s) { } } }]]> </Document> <Document><![CDATA[ using System; class C { [|Str$$ing|] s; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on value types" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Struct(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public struct {|Definition:$$S|} { } public class M { [|S|] s; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Enum(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class EnumTest { enum {|Definition:Days|} { Sat = 1, Sun, Mon, Tue, Wed, Thu, Fri }; static void Main() { int x = (int)[|$$Days|].Sun; int y = (int)[|Days|].Fri; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_EnumMembers(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class EnumTest { enum Days { Sat = 1, {|Definition:Sun|}, Mon, Tue, Wed, Thu, Fri }; static void Main() { int x = (int)Days.[|$$Sun|]; int y = (int)Days.Fri; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on across projects" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_NonDependentProjectCSharpRefsCSharp(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class {|Definition:$$C|} { } </Document> </Project> <Project Language="C#" CommonReferences="true"> <Document> class D { private C c; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_NonDependentProjectVBRefsCSharp(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class {|Definition:$$C|} { } </Document> </Project> <Project Language="Visual Basic" CommonReferences="true"> <Document> class D private c as C = nothing end class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_InDependentProjectCSharpRefsCSharp(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly1" CommonReferences="true"> <Document> public class {|Definition:$$C|} { } </Document> </Project> <Project Language="C#" AssemblyName="CSharpAssembly2" CommonReferences="true"> <ProjectReference>CSharpAssembly1</ProjectReference> <Document> class D { private [|C|] c; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_InDependentProjectVBRefsCSharp(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly1" CommonReferences="true"> <Document> public class {|Definition:$$C|} { } </Document> </Project> <Project Language="Visual Basic" CommonReferences="true"> <ProjectReference>CSharpAssembly1</ProjectReference> <Document> class D private c as [|C|] = nothing end class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR in namespaces" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_InNamespace(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class {|Definition:$$C|} { } } class D : N.[|C|] { }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR with case sensitivity" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CaseSensitivity(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly1" CommonReferences="true"> <Document> public class {|Definition:$$C|} { [|C|] c1; } </Document> </Project> <Project Language="C#" AssemblyName="CSharpAssembly2" CommonReferences="true"> <ProjectReference>CSharpAssembly1</ProjectReference> <Document> public class M { [|C|] c1; c c1; } </Document> </Project> <Project Language="Visual Basic" CommonReferences="true"> <ProjectReference>CSharpAssembly1</ProjectReference> <Document> class D private c1 as [|C|] = nothing private c2 as [|c|] = nothing end class </Document> <Document> class E ' Find, even in file without the original symbol name. private c1 as [|c|] = nothing end class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR through alias" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ThroughAlias(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace N { class {|Definition:$$D|} { } } </Document> <Document> using M = N.[|D|]; class C { [|M|] d; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ThroughAliasNestedType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace N { public class {|Definition:$$D|} { public class Inner { } } } </Document> <Document> using M = N.[|D|].Inner; class C { M d; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ThroughAliasGenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class {|Definition:$$D|}<T> { } }]]> </Document> <Document><![CDATA[ using M = N.[|D|]<int>; class C { [|M|] d; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on object initializers" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ReferenceInObjectInitializers(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { bool {|Definition:b|}; C() { new C() {[|$$b|]= false}; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ReferenceInObjectInitializersConstructorTakesNoParms(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { bool b; C() { [|M|] m = new [|M|]() { b }; } } class {|Definition:$$M|} { public {|Definition:M|}(bool i) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on collection initializers" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestLocal_CSharpColInitWithMultipleExpressionContainSameIdentifier(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { void M() { var col = new List<string> {[|Goo|](1), {[|Goo|](2), {[|Goo|](3), {[|Goo|](4) }; } string {|Definition:$$Goo|}(int i) { return "1";} }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestLocal_VBColInitWithMultipleExpressionContainSameIdentifier(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C sub M() Dim col = New List(Of string) From {[|Goo|](1), [|$$Goo|](2), [|Goo|](3), [|Goo|](4) } End Sub Function {|Definition:Goo|}(ByVal i as Integer) as string return "1" End Function End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on array initializers" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpArrayInitializerContainsALongExpression(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { int {|Definition:bravo|} = 35; int charlie = 47; int delta = 314; int echo = -5; void M() { var alpha = new[] { ([|bravo|] + [|bravo|] % charlie) | (/*Ren1*/[|bravo|] * delta) % charlie - 4, echo, delta >> [|$$bravo|] / 5 }; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBArrayInitializerContainsALongExpression(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Dim {|Definition:bravo|} As Integer = 35 Dim charlie As Integer = 47 Dim delta As Integer = 314 Dim echo As Integer = -5 sub M() Dim alpha = {([|bravo|] + [|bravo|] Mod charlie) Or ([|bravo|] * delta) Mod charlie - 4, echo, delta >> [|$$bravo|] \ 5} End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpArrayInitializerContansANestedArrayInitializer(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { var hotel = new[] { 1, 3, 5, 6 }; var india = new[] { 7, 8, 9, 10 }; var juliet = new[] { 1 }; var kilo = new[] { hotel, india, juliet }; int {|Definition:november|} = 5; void M() { var lima = new[] { hotel, india, new[] { 3, [|$$november|],} }; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBArrayInitializerContainsANestedArrayInitializer(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Dim hotel = {1, 3, 5, 6} Dim {|Definition:$$india|} = {7, 8, 9, 10} Dim juliet = {1} Dim kilo = {hotel, [|india|], juliet} sub M() Dim lima = {hotel, [|india|]} End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpArrayInitializerDifferentTypesWithImplicitCasting(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void M() { var {|Definition:$$oscar|} = 350.0 / 72F; int papa = (int) [|oscar|]; var quebec = new[] { [|oscar|], papa, -758, 2007, papa % 4 }; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBArrayInitializerDifferentTypesWithImplicitCasting(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C sub M() Dim {|Definition:$$oscar|} = 350.0 / 72 Dim papa as Integer = [|oscar|] Dim quebec = { [|oscar|], papa, -758, 2007, papa % 4 } End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpImplicitlyTypedArray(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void M() { var v1 = 1.0; var {|Definition:v2|} = -3; var array = new[] { v1, [|$$v2|] }; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBImplicitlyTypedArray(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C sub M() Dim {|Definition:v1|} = 1.0 Dim v2 = -3 Dim array = { [|$$v1|], v2 } End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on query expressions" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpQueryExpressionInitializedViaColInitializer(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { void M() { var {|Definition:$$col|} = new List<int> { 1, 2, 6, 24, 120 }; var query = from i in [|col|] select i * 2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBQueryExpressionInitializedViaColInitializer(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Private Sub M() Dim {|Definition:col|} = New List(Of Integer)() From {1, 2} Dim query = From i In [|$$col|] Where i * 2 > 1 End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpQueryExpressionThatIncludeColInit(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { void M() { int rolf = 732; int {|Definition:$$roark|} = -9; var replicator = from r in new List<int> { 1, 2, 9, rolf, [|roark|] } select r * 2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBQueryExpressionThatIncludeColInit(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Private Sub M() Dim {|Definition:rolf|} As Integer = 7; Dim roark As Integer = -9; Dim query = From i In New List(Of Integer)() From { 1, 2, 9, [|$$rolf|], roark } select r * 2; End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR in Venus Contexts" <WorkItem(545325, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545325")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestHiddenCodeIsNotVisibleFromUI(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class _Default { #line 1 "CSForm1.aspx" [|$$_Default|] a; #line default #line hidden } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host, uiVisibleOnly:=True) End Function <WorkItem(545325, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545325")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestHiddenCodeIsAccessibleViaApis(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class {|Definition:_Default|} { #line 1 "CSForm1.aspx" [|$$_Default|] a; #line default #line hidden } </Document> </Project> </Workspace> Await TestAPI(input, host, uiVisibleOnly:=False) End Function #End Region <WorkItem(542949, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542949")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_DoNotFindDestructor1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$A|} { ~{|Definition:A|}() { Console.WriteLine("A"); }} </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(546229, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546229")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CrossLanguageModule(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" AssemblyName="VBAssembly" CommonReferences="true"> <Document> Public Module {|Definition:$$Goo|} Public Sub Bar() End Sub End Module </Document> </Project> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <ProjectReference>VBAssembly</ProjectReference> <Document> class C { void M() { [|Goo|].Bar(); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestRetargetingType_Basic(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="PortableClassLibrary" CommonReferencesPortable="true"> <Document><![CDATA[ using System.Collections.Generic; namespace PortableClassLibrary { public class Class1 { [|$$int|] x; } }]]> </Document> </Project> <Project Language="C#" AssemblyName="MainLibrary" CommonReferences="true"> <ProjectReference>PortableClassLibrary</ProjectReference> <Document><![CDATA[ class Class2 { [|int|] x; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestRetargetingType_GenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="PortableClassLibrary" CommonReferencesPortable="true"> <Document><![CDATA[ using System; using System.Collections.Generic; namespace PortableClassLibrary { public class Class1 { [|$$Tuple|]<int> x; } }]]> </Document> </Project> <Project Language="C#" AssemblyName="MainLibrary" CommonReferences="true"> <ProjectReference>PortableClassLibrary</ProjectReference> <Document><![CDATA[ using System; class Class2 { [|Tuple|]<int> x; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestDuplicatePublicTypeWithDuplicateConstructors(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="ClassLibrary1" CommonReferences="true"> <Document><![CDATA[ public class {|Definition:$$C|} { public {|Definition:C|}(D d1, D d2) { new [|C|](d1, d2); } } public class D { } ]]> </Document> </Project> <Project Language="C#" AssemblyName="ClassLibrary2" CommonReferences="true"> <ProjectReference>ClassLibrary1</ProjectReference> <Document><![CDATA[ public class C { public C(D d1, D d2) { new C(d1, d2); } } public class D { } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> <WorkItem(1174256, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1174256")> Public Async Function TestFarWithInternalsVisibleToNull(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="ClassLibrary1" CommonReferences="true"> <Document><![CDATA[ [assembly: System.Runtime.CompilerServices.InternalsVisibleTo(null)] internal class {|Definition:$$A|} { }]]> </Document> </Project> <Project Language="C#" AssemblyName="ClassLibrary2" CommonReferences="true"> <ProjectReference>ClassLibrary1</ProjectReference> <Document><![CDATA[ public class B : A { }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_TypeOrNamespaceUsageInfo(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N1 { using Alias1 = N2.{|TypeOrNamespaceUsageInfo.Import:[|Class1|]|}; } namespace N2 { public interface I<T> { } public class {|Definition:$$Class1|} { public static int Field; public class Nested { } } public class Class2 : {|TypeOrNamespaceUsageInfo.Base:[|Class1|]|}, I<{|TypeOrNamespaceUsageInfo.TypeArgument:[|Class1|]|}> { public static int M() => {|TypeOrNamespaceUsageInfo.Qualified:[|Class1|]|}.Field; } } namespace N2.N3 { using Alias2 = N2.{|TypeOrNamespaceUsageInfo.Qualified,Import:[|Class1|]|}.Nested; public class Class3: {|TypeOrNamespaceUsageInfo.Qualified,Base:[|Class1|]|}.Nested, I<{|TypeOrNamespaceUsageInfo.Qualified,TypeArgument:[|Class1|]|}.Nested> { public static {|TypeOrNamespaceUsageInfo.None:[|Class1|]|} M2() => new {|TypeOrNamespaceUsageInfo.ObjectCreation:[|Class1|]|}(); } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ContainingTypeInfo(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N1 { using Alias1 = N2.{|AdditionalProperty.ContainingTypeInfo.:[|Class1|]|}; } namespace N2 { public interface I<T> { } public class {|Definition:$$Class1|} { public static int Field; public class Nested { } } public class Class2 : {|AdditionalProperty.ContainingTypeInfo.Class2:[|Class1|]|}, I<{|AdditionalProperty.ContainingTypeInfo.Class2:[|Class1|]|}> { public static int M() => {|AdditionalProperty.ContainingTypeInfo.Class2:[|Class1|]|}.Field; } } namespace N2.N3 { using Alias2 = N2.{|AdditionalProperty.ContainingTypeInfo.:[|Class1|]|}.Nested; public class Class3: {|AdditionalProperty.ContainingTypeInfo.Class3:[|Class1|]|}.Nested, I<{|AdditionalProperty.ContainingTypeInfo.Class3:[|Class1|]|}.Nested> { public static {|AdditionalProperty.ContainingTypeInfo.Class3:[|Class1|]|} M2() => new {|AdditionalProperty.ContainingTypeInfo.Class3:[|Class1|]|}(); } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ContainingMemberInfo(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N1 { using Alias1 = N2.{|AdditionalProperty.ContainingMemberInfo.N1:[|Class1|]|}; } namespace N2 { public interface I<T> { } public class {|Definition:$$Class1|} { public static int Field; public class Nested { } } public class Class2 : {|AdditionalProperty.ContainingMemberInfo.Class2:[|Class1|]|}, I<{|AdditionalProperty.ContainingMemberInfo.Class2:[|Class1|]|}> { public static int M() => {|AdditionalProperty.ContainingMemberInfo.M:[|Class1|]|}.Field; } } namespace N2.N3 { using Alias2 = N2.{|AdditionalProperty.ContainingMemberInfo.N3:[|Class1|]|}.Nested; public class Class3: {|AdditionalProperty.ContainingMemberInfo.Class3:[|Class1|]|}.Nested, I<{|AdditionalProperty.ContainingMemberInfo.Class3:[|Class1|]|}.Nested> { public static {|AdditionalProperty.ContainingMemberInfo.M2:[|Class1|]|} M2() => new {|AdditionalProperty.ContainingMemberInfo.M2:[|Class1|]|}(); } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppression(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~T:N.[|C|]")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.[|C|].M")] namespace N { class {|Definition:$$C|} { void M() { } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppression_NestedType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~T:N.C1.[|C2|]")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.C1.[|C2|].M")] namespace N { class C1 { private class {|Definition:$$C2|} { void M() { } } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppression_GenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~T:N.[|C|]`1")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.[|C|]`1.M")] namespace N { class {|Definition:$$C|}<T> { void M() { } } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WorkItem(44401, "https://github.com/dotnet/roslyn/issues/44401")> <WpfTheory(Skip:="https://github.com/dotnet/roslyn/issues/44401")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppressionParameter(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.D.M(N.[|C|])")] namespace N { class D { void M([|C|] c) { } } class {|Definition:$$C|} { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WorkItem(44401, "https://github.com/dotnet/roslyn/issues/44401")> <WpfTheory(Skip:="https://github.com/dotnet/roslyn/issues/44401")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppressionParameter_GenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.D.M(N.[|C|]{System.Int32})")] namespace N { class D { void M([|C|]<int> c) { } } class {|Definition:$$C|}<T> { } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WorkItem(44401, "https://github.com/dotnet/roslyn/issues/44401")> <WpfTheory(Skip:="https://github.com/dotnet/roslyn/issues/44401")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppressionTypeParameter_GenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.[|D|].M(N.C{N.[|D|]})")] namespace N { class {|Definition:$$D|} { void M(C<[|D|]> c) { } } class C<T> { } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory> <CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedTypeUsedInSourceGeneratedOutput(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document>class {|Definition:$$C|} { }</Document> <DocumentFromSourceGenerator>class D : [|C|] { }</DocumentFromSourceGenerator> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function End Class End Namespace
' 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. Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis.Remote.Testing Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences Partial Public Class FindReferencesTests #Region "FAR on reference types" <WorkItem(541155, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541155")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestInaccessibleVar1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class A { private class {|Definition:$$var|} { } } class B : A { static void Main() { var x = 1; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(541155, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541155")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestInaccessibleVar2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class A { private class var { } } class B : A { static void Main() { $$var x = 1; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(541151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541151")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestGenericVar1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; static class Program { static void Main() { var x = 1; } } class {|Definition:$$var|}<T> { } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(541151, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541151")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestGenericVar2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; static class Program { static void Main() { $$var x = 1; } } class var<T> { } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Class(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { private [|C|] c1, c2; void Goo([|C|] c3) { [|C|] c4; } void Bar(System.C c5) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_NestedClass(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { class {|Definition:Nested|} { } void Method() { [|$$Nested|] obj = new [|Nested|](); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ExplicitCast(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:Celsius|} { private float degrees; public {|Definition:Celsius|}(float temp) { degrees = temp; } } class Fahrenheit { private float degrees; public Fahrenheit(float temp) { degrees = temp; } public static explicit operator [|Celsius|](Fahrenheit f) { return new [|Celsius|]((5.0f / 9.0f) * (f.degrees - 32)); } } class MainClass { static void Main() { Fahrenheit f = new Fahrenheit(100.0f); [|Celsius|] c = ([|C$$elsius|])f; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Events(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class CustomEventArgs : System.EventArgs { public CustomEventArgs(string s) { msg = s; } private string msg; public string Message { get { return msg; } } } public class Publisher { public delegate void SampleEventHandler(object sender, CustomEventArgs e); public event SampleEventHandler {|Definition:SampleEvent|}; protected virtual void RaiseSampleEvent() { [|$$SampleEvent|](this, new CustomEventArgs("Hello")); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_TypeOfOperator(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:Celsius|} { public {|Definition:Celsius|}() { System.Type t = typeof([|$$Celsius|]); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539799, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539799")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_InaccessibleType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { private class {|Definition:$$D|} { } } class A { void M() { C.[|D|] d = new C.[|D|](); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_OneDimensionalArray(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void Method() { int[] {|Definition:a|} = {0, 2, 4, 6, 8}; int b = [|$$a|][0]; b = [|a|][1]; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_BaseList(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:Base|} { } class Derived : [|$$Base|] { } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_StaticConstructor(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:S$$impleClass|} { static {|Definition:SimpleClass|}() { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericClass(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:$$C|}<T> { private [|C|] c1; private [|C|]<T> c2; private [|C|]<int> c3; private [|C|]<[|C|]<T>> c4; private [|C|]<int,string> c5; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericClass1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:$$C|} { private [|C|] c1; private [|C|]<T> c2; private [|C|]<int> c3; private [|C|]<[|C|]<T>> c4; private [|C|]<int,string> c5; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericClass2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:$$C|} { private [|C|] c1; private C<T> c2; private C<int> c3; private C<C<T>> c4; private [|C|]<int,string> c5; } class C<T> { }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericClass3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:$$C|}<T> { private C c1; private [|C|]<T> c2; private [|C|]<int> c3; private [|C|]<[|C|]<T>> c4; private [|C|]<int,string> c5; } class C { }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { static void Main(string[] args) { I1<int> m = new Basic(); Console.WriteLine(m.$$[|Add|](1, 1)); } } public interface I1<T> { T {|Definition:Add|}(T arg1, T arg2); } public class Basic : I1<int> { public int {|Definition:Add|}(int arg1, int arg2) { return arg1 + arg2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { static void Main(string[] args) { I1<int> m = new Basic(); Console.WriteLine(m.[|Add|](1, 1)); } } public interface I1<T> { T {|Definition:$$Add|}(T arg1, T arg2); } public class Basic : I1<int> { public int {|Definition:Add|}(int arg1, int arg2) { return arg1 + arg2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { static void Main(string[] args) { I1<int> m = new Basic(); Console.WriteLine(m.[|Add|](1, 1)); } } public interface I1<T> { T {|Definition:Add|}(T arg1, T arg2); } public class Basic : I1<int> { public int {|Definition:$$Add|}(int arg1, int arg2) { return arg1 + arg2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces4(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:$$Goo|}(X x); } class C : I<int>, I<string> { public void {|Definition:Goo|}(int x) { } public void {|Definition:Goo|}(string x) { } } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces5_Api(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:Goo|}(X x); } class C : I<int>, I<string> { public void {|Definition:$$Goo|}(int x) { } public void {|Definition:Goo|}(string x) { } } ]]> </Document> </Project> </Workspace> Await TestAPI(input, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces5_FEature(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:Goo|}(X x); } class C : I<int>, I<string> { public void {|Definition:$$Goo|}(int x) { } public void Goo(string x) { } } ]]> </Document> </Project> </Workspace> Await TestStreamingFeature(input, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces6_Api(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:Goo|}(X x); } class C : I<int>, I<string> { public void {|Definition:Goo|}(int x) { } public void {|Definition:$$Goo|}(string x) { } } ]]> </Document> </Project> </Workspace> Await TestAPI(input, host) End Function <WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCascadedMembersFromConstructedInterfaces6_Feature(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I<X> { void {|Definition:Goo|}(X x); } class C : I<int>, I<string> { public void Goo(int x) { } public void {|Definition:$$Goo|}(string x) { } } ]]> </Document> </Project> </Workspace> Await TestStreamingFeature(input, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_MultipleFiles(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { } </Document> <Document> class D { private [|C|] c; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_MultipleFiles_InOneFileOnly(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { private [|C|] c; } </Document> <Document> class D { private C c; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host, searchSingleFileOnly:=True) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpImplicitConstructor(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { void Goo() { new [|C|](); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpExplicitConstructor(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$C|} { public {|Definition:C|}() { } void Goo() { new [|C|](); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBImplicitConstructor(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class {|Definition:$$C|} Shared Sub Main() Dim c As [|C|] = New [|C|]() End Function End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpConstructorCallUsingNewOperator1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { bool b; C() { [|M|] m = new [|M|]() { b }; } } class {|Definition:$$M|} { public {|Definition:M|}(bool i) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpConstructorCallUsingNewOperator2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { C() { bool b; [|M|] m = new [|M|](b); } } class {|Definition:$$M|} { public {|Definition:M|}(bool i) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBConstructorCallUsingNewOperator(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Sub New() Dim m As [|M|] = New [|M|] (2) End Function End Class Class {|Definition:$$M|} Sub {|Definition:New|}(ByVal i As Integer) End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBModule(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Module {|Definition:Program|} Sub Main(args As String()) End Function End Module Class Test Sub Test() [|$$Program|].Main("") End Function End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_PartialClass(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class {|Definition:$$C|} { public static bool operator ==([|C|] a, [|C|] b) { return a.ToString() == b.ToString(); } } public class M { [|C|] pc; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Interface(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> interface {|Definition:$$IMyInterface|} { } class InterfaceImplementer : [|IMyInterface|] { } </Document> <Document> class C { [|IMyInterface|] iMyInter; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_GenericInterface(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface {|Definition:$$GenericInterface|}<T> { } class GenericClass<T> : [|GenericInterface|]<T> { }]]> </Document> <Document><![CDATA[ class C { [|GenericInterface|]<C> MyGenInt; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539065, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539065")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { delegate void {|Definition:$$MyDelegate|}(); public void F() { [|MyDelegate|] MD1 = new [|MyDelegate|](this.F); [|MyDelegate|] MD2 = MD1 + MD1; [|MyDelegate|] MD3 = new [|MyDelegate|](MD1); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539065, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539065")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { delegate void {|Definition:$$MyDelegate|}(); public void F() { [|MyDelegate|] MD; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539065, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539065")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { delegate void {|Definition:MyDelegate|}(); public void F() { [|$$MyDelegate|] MD; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539614, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539614")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { myDel = new [|TestDelegate|](Goo); } private delegate void {|Definition:$$TestDelegate|}(string s); private static [|TestDelegate|] myDel; static void Goo(string arg) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539614, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539614")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate4(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { myDel = new [|$$TestDelegate|](Goo); } private delegate void {|Definition:TestDelegate|}(string s); private static [|TestDelegate|] myDel; static void Goo(string arg) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539614, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539614")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate5(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { myDel = new [|TestDelegate|](Goo); } private delegate void {|Definition:TestDelegate|}(string s); private static [|$$TestDelegate|] myDel; static void Goo(string arg) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539646, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539646")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Delegate6(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; class Program { delegate R {|Definition:Func|}<T, R>(T t); static void Main(string[] args) { [|Func|]<int, int> f = (arg) => { int s = 3; return s; }; f.[|$$BeginInvoke|](2, null, null); } } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(537966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537966")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledDynamic1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:dyn$$amic|} { } class @static : [|dynamic|] { } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(537966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/537966")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledDynamic2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:dyn$$amic|} { } </Document> <Document> class @static : [|dynamic|] { } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(538842, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538842")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledSystemString1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace System { public class {|Definition:St$$ring|} { void Goo(string s) { } void Goo([|String|] s) { } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(538842, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538842")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledSystemString2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace System { public class String { void Goo([|st$$ring|] s) { } void Goo(String s) { } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(538926, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538926")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CalledSystemString3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace System { public class {|Definition:String|} { void Goo([|Str$$ing|] s) { } void Goo(params [|String|][] s) { } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539299, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539299")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfMemberAccessExpression1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; public class C { void Goo() { [|$$Console|].Write(0); [|Console|].Write(0); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539299, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539299")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfMemberAccessExpression2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; public class C { void Goo() { [|Console$$|].Write(0); [|Console|].Write(0); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539299, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539299")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfMemberAccessExpression3(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Public Class C Sub Goo() [|$$Console|].Write(0) [|Console|].Write(0) End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(539299, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539299")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfMemberAccessExpression4(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Public Class C Sub Goo() [|Console$$|].Write(0) [|Console|].Write(0) End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCrefNamedType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:Program|} { /// <see cref="[|$$Program|]"/> to start the program. static void Main(string[] args) { } } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestCrefNamedType2(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Definition:Progr$$am|} { /// <see cref="[|Program|]"/> to start the program. static void Main(string[] args) { } } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(775925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/775925")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_LeftSideOfGreaterThanTokenInAttribute(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System <[|Obsolete$$|]> Public Class Class1 <[|Obsolete|]> Dim obsoleteField as Integer End Class ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on primitive types" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_PrimitiveTypeAsMethodParameter(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class D { void Goo([|str$$ing|] s) { } } }]]> </Document> <Document><![CDATA[ using System; class C { [|String|] s; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_PrimitiveTypeAsField(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class D { void Goo([|string|] s) { } } }]]> </Document> <Document><![CDATA[ using System; class C { [|Str$$ing|] s; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on value types" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Struct(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public struct {|Definition:$$S|} { } public class M { [|S|] s; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_Enum(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class EnumTest { enum {|Definition:Days|} { Sat = 1, Sun, Mon, Tue, Wed, Thu, Fri }; static void Main() { int x = (int)[|$$Days|].Sun; int y = (int)[|Days|].Fri; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_EnumMembers(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class EnumTest { enum Days { Sat = 1, {|Definition:Sun|}, Mon, Tue, Wed, Thu, Fri }; static void Main() { int x = (int)Days.[|$$Sun|]; int y = (int)Days.Fri; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on across projects" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_NonDependentProjectCSharpRefsCSharp(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class {|Definition:$$C|} { } </Document> </Project> <Project Language="C#" CommonReferences="true"> <Document> class D { private C c; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_NonDependentProjectVBRefsCSharp(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class {|Definition:$$C|} { } </Document> </Project> <Project Language="Visual Basic" CommonReferences="true"> <Document> class D private c as C = nothing end class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_InDependentProjectCSharpRefsCSharp(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly1" CommonReferences="true"> <Document> public class {|Definition:$$C|} { } </Document> </Project> <Project Language="C#" AssemblyName="CSharpAssembly2" CommonReferences="true"> <ProjectReference>CSharpAssembly1</ProjectReference> <Document> class D { private [|C|] c; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_InDependentProjectVBRefsCSharp(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly1" CommonReferences="true"> <Document> public class {|Definition:$$C|} { } </Document> </Project> <Project Language="Visual Basic" CommonReferences="true"> <ProjectReference>CSharpAssembly1</ProjectReference> <Document> class D private c as [|C|] = nothing end class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR in namespaces" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_InNamespace(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class {|Definition:$$C|} { } } class D : N.[|C|] { }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR with case sensitivity" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CaseSensitivity(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly1" CommonReferences="true"> <Document> public class {|Definition:$$C|} { [|C|] c1; } </Document> </Project> <Project Language="C#" AssemblyName="CSharpAssembly2" CommonReferences="true"> <ProjectReference>CSharpAssembly1</ProjectReference> <Document> public class M { [|C|] c1; c c1; } </Document> </Project> <Project Language="Visual Basic" CommonReferences="true"> <ProjectReference>CSharpAssembly1</ProjectReference> <Document> class D private c1 as [|C|] = nothing private c2 as [|c|] = nothing end class </Document> <Document> class E ' Find, even in file without the original symbol name. private c1 as [|c|] = nothing end class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR through alias" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ThroughAlias(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace N { class {|Definition:$$D|} { } } </Document> <Document> using M = N.[|D|]; class C { [|M|] d; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ThroughAliasNestedType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace N { public class {|Definition:$$D|} { public class Inner { } } } </Document> <Document> using M = N.[|D|].Inner; class C { M d; } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ThroughAliasGenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class {|Definition:$$D|}<T> { } }]]> </Document> <Document><![CDATA[ using M = N.[|D|]<int>; class C { [|M|] d; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on object initializers" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ReferenceInObjectInitializers(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { bool {|Definition:b|}; C() { new C() {[|$$b|]= false}; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ReferenceInObjectInitializersConstructorTakesNoParms(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { bool b; C() { [|M|] m = new [|M|]() { b }; } } class {|Definition:$$M|} { public {|Definition:M|}(bool i) { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on collection initializers" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestLocal_CSharpColInitWithMultipleExpressionContainSameIdentifier(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { void M() { var col = new List<string> {[|Goo|](1), {[|Goo|](2), {[|Goo|](3), {[|Goo|](4) }; } string {|Definition:$$Goo|}(int i) { return "1";} }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestLocal_VBColInitWithMultipleExpressionContainSameIdentifier(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C sub M() Dim col = New List(Of string) From {[|Goo|](1), [|$$Goo|](2), [|Goo|](3), [|Goo|](4) } End Sub Function {|Definition:Goo|}(ByVal i as Integer) as string return "1" End Function End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on array initializers" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpArrayInitializerContainsALongExpression(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { int {|Definition:bravo|} = 35; int charlie = 47; int delta = 314; int echo = -5; void M() { var alpha = new[] { ([|bravo|] + [|bravo|] % charlie) | (/*Ren1*/[|bravo|] * delta) % charlie - 4, echo, delta >> [|$$bravo|] / 5 }; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBArrayInitializerContainsALongExpression(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Dim {|Definition:bravo|} As Integer = 35 Dim charlie As Integer = 47 Dim delta As Integer = 314 Dim echo As Integer = -5 sub M() Dim alpha = {([|bravo|] + [|bravo|] Mod charlie) Or ([|bravo|] * delta) Mod charlie - 4, echo, delta >> [|$$bravo|] \ 5} End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpArrayInitializerContansANestedArrayInitializer(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { var hotel = new[] { 1, 3, 5, 6 }; var india = new[] { 7, 8, 9, 10 }; var juliet = new[] { 1 }; var kilo = new[] { hotel, india, juliet }; int {|Definition:november|} = 5; void M() { var lima = new[] { hotel, india, new[] { 3, [|$$november|],} }; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBArrayInitializerContainsANestedArrayInitializer(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Dim hotel = {1, 3, 5, 6} Dim {|Definition:$$india|} = {7, 8, 9, 10} Dim juliet = {1} Dim kilo = {hotel, [|india|], juliet} sub M() Dim lima = {hotel, [|india|]} End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpArrayInitializerDifferentTypesWithImplicitCasting(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void M() { var {|Definition:$$oscar|} = 350.0 / 72F; int papa = (int) [|oscar|]; var quebec = new[] { [|oscar|], papa, -758, 2007, papa % 4 }; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBArrayInitializerDifferentTypesWithImplicitCasting(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C sub M() Dim {|Definition:$$oscar|} = 350.0 / 72 Dim papa as Integer = [|oscar|] Dim quebec = { [|oscar|], papa, -758, 2007, papa % 4 } End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpImplicitlyTypedArray(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void M() { var v1 = 1.0; var {|Definition:v2|} = -3; var array = new[] { v1, [|$$v2|] }; } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBImplicitlyTypedArray(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C sub M() Dim {|Definition:v1|} = 1.0 Dim v2 = -3 Dim array = { [|$$v1|], v2 } End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR on query expressions" <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpQueryExpressionInitializedViaColInitializer(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { void M() { var {|Definition:$$col|} = new List<int> { 1, 2, 6, 24, 120 }; var query = from i in [|col|] select i * 2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBQueryExpressionInitializedViaColInitializer(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Private Sub M() Dim {|Definition:col|} = New List(Of Integer)() From {1, 2} Dim query = From i In [|$$col|] Where i * 2 > 1 End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CSharpQueryExpressionThatIncludeColInit(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { void M() { int rolf = 732; int {|Definition:$$roark|} = -9; var replicator = from r in new List<int> { 1, 2, 9, rolf, [|roark|] } select r * 2; } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_VBQueryExpressionThatIncludeColInit(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Private Sub M() Dim {|Definition:rolf|} As Integer = 7; Dim roark As Integer = -9; Dim query = From i In New List(Of Integer)() From { 1, 2, 9, [|$$rolf|], roark } select r * 2; End Sub End Class </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function #End Region #Region "FAR in Venus Contexts" <WorkItem(545325, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545325")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestHiddenCodeIsNotVisibleFromUI(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class _Default { #line 1 "CSForm1.aspx" [|$$_Default|] a; #line default #line hidden } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host, uiVisibleOnly:=True) End Function <WorkItem(545325, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545325")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestHiddenCodeIsAccessibleViaApis(host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public class {|Definition:_Default|} { #line 1 "CSForm1.aspx" [|$$_Default|] a; #line default #line hidden } </Document> </Project> </Workspace> Await TestAPI(input, host, uiVisibleOnly:=False) End Function #End Region <WorkItem(542949, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542949")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_DoNotFindDestructor1(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|Definition:$$A|} { ~{|Definition:A|}() { Console.WriteLine("A"); }} </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(546229, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546229")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_CrossLanguageModule(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="Visual Basic" AssemblyName="VBAssembly" CommonReferences="true"> <Document> Public Module {|Definition:$$Goo|} Public Sub Bar() End Sub End Module </Document> </Project> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <ProjectReference>VBAssembly</ProjectReference> <Document> class C { void M() { [|Goo|].Bar(); } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestRetargetingType_Basic(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="PortableClassLibrary" CommonReferencesPortable="true"> <Document><![CDATA[ using System.Collections.Generic; namespace PortableClassLibrary { public class Class1 { [|$$int|] x; } }]]> </Document> </Project> <Project Language="C#" AssemblyName="MainLibrary" CommonReferences="true"> <ProjectReference>PortableClassLibrary</ProjectReference> <Document><![CDATA[ class Class2 { [|int|] x; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestRetargetingType_GenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="PortableClassLibrary" CommonReferencesPortable="true"> <Document><![CDATA[ using System; using System.Collections.Generic; namespace PortableClassLibrary { public class Class1 { [|$$Tuple|]<int> x; } }]]> </Document> </Project> <Project Language="C#" AssemblyName="MainLibrary" CommonReferences="true"> <ProjectReference>PortableClassLibrary</ProjectReference> <Document><![CDATA[ using System; class Class2 { [|Tuple|]<int> x; }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestDuplicatePublicTypeWithDuplicateConstructors(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="ClassLibrary1" CommonReferences="true"> <Document><![CDATA[ public class {|Definition:$$C|} { public {|Definition:C|}(D d1, D d2) { new [|C|](d1, d2); } } public class D { } ]]> </Document> </Project> <Project Language="C#" AssemblyName="ClassLibrary2" CommonReferences="true"> <ProjectReference>ClassLibrary1</ProjectReference> <Document><![CDATA[ public class C { public C(D d1, D d2) { new C(d1, d2); } } public class D { } ]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> <WorkItem(1174256, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1174256")> Public Async Function TestFarWithInternalsVisibleToNull(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" AssemblyName="ClassLibrary1" CommonReferences="true"> <Document><![CDATA[ [assembly: System.Runtime.CompilerServices.InternalsVisibleTo(null)] internal class {|Definition:$$A|} { }]]> </Document> </Project> <Project Language="C#" AssemblyName="ClassLibrary2" CommonReferences="true"> <ProjectReference>ClassLibrary1</ProjectReference> <Document><![CDATA[ public class B : A { }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_TypeOrNamespaceUsageInfo(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N1 { using Alias1 = N2.{|TypeOrNamespaceUsageInfo.Import:[|Class1|]|}; } namespace N2 { public interface I<T> { } public class {|Definition:$$Class1|} { public static int Field; public class Nested { } } public class Class2 : {|TypeOrNamespaceUsageInfo.Base:[|Class1|]|}, I<{|TypeOrNamespaceUsageInfo.TypeArgument:[|Class1|]|}> { public static int M() => {|TypeOrNamespaceUsageInfo.Qualified:[|Class1|]|}.Field; } } namespace N2.N3 { using Alias2 = N2.{|TypeOrNamespaceUsageInfo.Qualified,Import:[|Class1|]|}.Nested; public class Class3: {|TypeOrNamespaceUsageInfo.Qualified,Base:[|Class1|]|}.Nested, I<{|TypeOrNamespaceUsageInfo.Qualified,TypeArgument:[|Class1|]|}.Nested> { public static {|TypeOrNamespaceUsageInfo.None:[|Class1|]|} M2() => new {|TypeOrNamespaceUsageInfo.ObjectCreation:[|Class1|]|}(); } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ContainingTypeInfo(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N1 { using Alias1 = N2.{|AdditionalProperty.ContainingTypeInfo.:[|Class1|]|}; } namespace N2 { public interface I<T> { } public class {|Definition:$$Class1|} { public static int Field; public class Nested { } } public class Class2 : {|AdditionalProperty.ContainingTypeInfo.Class2:[|Class1|]|}, I<{|AdditionalProperty.ContainingTypeInfo.Class2:[|Class1|]|}> { public static int M() => {|AdditionalProperty.ContainingTypeInfo.Class2:[|Class1|]|}.Field; } } namespace N2.N3 { using Alias2 = N2.{|AdditionalProperty.ContainingTypeInfo.:[|Class1|]|}.Nested; public class Class3: {|AdditionalProperty.ContainingTypeInfo.Class3:[|Class1|]|}.Nested, I<{|AdditionalProperty.ContainingTypeInfo.Class3:[|Class1|]|}.Nested> { public static {|AdditionalProperty.ContainingTypeInfo.Class3:[|Class1|]|} M2() => new {|AdditionalProperty.ContainingTypeInfo.Class3:[|Class1|]|}(); } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedType_ContainingMemberInfo(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N1 { using Alias1 = N2.{|AdditionalProperty.ContainingMemberInfo.N1:[|Class1|]|}; } namespace N2 { public interface I<T> { } public class {|Definition:$$Class1|} { public static int Field; public class Nested { } } public class Class2 : {|AdditionalProperty.ContainingMemberInfo.Class2:[|Class1|]|}, I<{|AdditionalProperty.ContainingMemberInfo.Class2:[|Class1|]|}> { public static int M() => {|AdditionalProperty.ContainingMemberInfo.M:[|Class1|]|}.Field; } } namespace N2.N3 { using Alias2 = N2.{|AdditionalProperty.ContainingMemberInfo.N3:[|Class1|]|}.Nested; public class Class3: {|AdditionalProperty.ContainingMemberInfo.Class3:[|Class1|]|}.Nested, I<{|AdditionalProperty.ContainingMemberInfo.Class3:[|Class1|]|}.Nested> { public static {|AdditionalProperty.ContainingMemberInfo.M2:[|Class1|]|} M2() => new {|AdditionalProperty.ContainingMemberInfo.M2:[|Class1|]|}(); } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppression(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~T:N.[|C|]")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.[|C|].M")] namespace N { class {|Definition:$$C|} { void M() { } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppression_NestedType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~T:N.C1.[|C2|]")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.C1.[|C2|].M")] namespace N { class C1 { private class {|Definition:$$C2|} { void M() { } } } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppression_GenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~T:N.[|C|]`1")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.[|C|]`1.M")] namespace N { class {|Definition:$$C|}<T> { void M() { } } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WorkItem(44401, "https://github.com/dotnet/roslyn/issues/44401")> <WpfTheory(Skip:="https://github.com/dotnet/roslyn/issues/44401")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppressionParameter(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.D.M(N.[|C|])")] namespace N { class D { void M([|C|] c) { } } class {|Definition:$$C|} { } } </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WorkItem(44401, "https://github.com/dotnet/roslyn/issues/44401")> <WpfTheory(Skip:="https://github.com/dotnet/roslyn/issues/44401")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppressionParameter_GenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.D.M(N.[|C|]{System.Int32})")] namespace N { class D { void M([|C|]<int> c) { } } class {|Definition:$$C|}<T> { } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WorkItem(44288, "https://github.com/dotnet/roslyn/issues/44288")> <WorkItem(44401, "https://github.com/dotnet/roslyn/issues/44401")> <WpfTheory(Skip:="https://github.com/dotnet/roslyn/issues/44401")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestTypeReferenceInGlobalSuppressionTypeParameter_GenericType(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Category", "RuleId", Scope = "member", Target = "~M:N.[|D|].M(N.C{N.[|D|]})")] namespace N { class {|Definition:$$D|} { void M(C<[|D|]> c) { } } class C<T> { } }]]> </Document> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function <WpfTheory> <CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)> Public Async Function TestNamedTypeUsedInSourceGeneratedOutput(kind As TestKind, host As TestHost) As Task Dim input = <Workspace> <Project Language="C#" CommonReferences="true"> <Document>class {|Definition:$$C|} { }</Document> <DocumentFromSourceGenerator>class D : [|C|] { }</DocumentFromSourceGenerator> </Project> </Workspace> Await TestAPIAndFeature(input, kind, host) End Function End Class End Namespace
-1
dotnet/roslyn
55,696
Have inheritance-margin hold onto data that does *not* point back at Solution instances.
Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
CyrusNajmabadi
2021-08-18T16:22:09Z
2021-08-20T04:50:45Z
16efcb29a0cb8be060ab3bfd9e60c9192c6604bf
6ce4dc34664b63672aeac58683ed9c9e73fa2102
Have inheritance-margin hold onto data that does *not* point back at Solution instances.. Fixes [AB#1371724](https://devdiv.visualstudio.com/0bdbc590-a062-4c3f-b0f6-9383f67865ee/_workitems/edit/1371724)
./src/EditorFeatures/Core/ReferenceHighlighting/Tags/ReferenceHighlightTag.cs
// 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. #nullable disable using Microsoft.CodeAnalysis.Editor.Shared.Tagging; namespace Microsoft.CodeAnalysis.Editor.ReferenceHighlighting { internal class ReferenceHighlightTag : NavigableHighlightTag { internal const string TagId = "MarkerFormatDefinition/HighlightedReference"; public static readonly ReferenceHighlightTag Instance = new(); private ReferenceHighlightTag() : base(TagId) { } } }
// 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. #nullable disable using Microsoft.CodeAnalysis.Editor.Shared.Tagging; namespace Microsoft.CodeAnalysis.Editor.ReferenceHighlighting { internal class ReferenceHighlightTag : NavigableHighlightTag { internal const string TagId = "MarkerFormatDefinition/HighlightedReference"; public static readonly ReferenceHighlightTag Instance = new(); private ReferenceHighlightTag() : base(TagId) { } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/Core/Implementation/EditorLayerExtensionManager.cs
// 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 System; using System.Collections.Generic; using System.Composition; using System.Linq; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Editor.Options; using Microsoft.CodeAnalysis.ErrorLogger; using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.Text; using Roslyn.Utilities; using static Microsoft.CodeAnalysis.Internal.Log.FunctionId; using static Microsoft.CodeAnalysis.Internal.Log.Logger; using static Microsoft.CodeAnalysis.RoslynAssemblyHelper; namespace Microsoft.CodeAnalysis.Editor { [ExportWorkspaceServiceFactory(typeof(IExtensionManager), ServiceLayer.Editor), Shared] internal class EditorLayerExtensionManager : IWorkspaceServiceFactory { private readonly List<IExtensionErrorHandler> _errorHandlers; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public EditorLayerExtensionManager( [ImportMany] IEnumerable<IExtensionErrorHandler> errorHandlers) { _errorHandlers = errorHandlers.ToList(); } public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var optionService = workspaceServices.GetRequiredService<IOptionService>(); var errorReportingService = workspaceServices.GetRequiredService<IErrorReportingService>(); var errorLoggerService = workspaceServices.GetRequiredService<IErrorLoggerService>(); return new ExtensionManager(optionService, errorReportingService, errorLoggerService, _errorHandlers); } internal class ExtensionManager : AbstractExtensionManager { private readonly List<IExtensionErrorHandler> _errorHandlers; private readonly IOptionService _optionsService; private readonly IErrorReportingService _errorReportingService; private readonly IErrorLoggerService _errorLoggerService; public ExtensionManager( IOptionService optionsService, IErrorReportingService errorReportingService, IErrorLoggerService errorLoggerService, List<IExtensionErrorHandler> errorHandlers) { _optionsService = optionsService; _errorHandlers = errorHandlers; _errorReportingService = errorReportingService; _errorLoggerService = errorLoggerService; } public override void HandleException(object provider, Exception exception) { if (provider is CodeFixProvider || provider is FixAllProvider || provider is CodeRefactoringProvider) { if (!IsIgnored(provider) && _optionsService.GetOption(ExtensionManagerOptions.DisableCrashingExtensions)) { base.HandleException(provider, exception); _errorReportingService?.ShowGlobalErrorInfo(String.Format(WorkspacesResources._0_encountered_an_error_and_has_been_disabled, provider.GetType().Name), new InfoBarUI(WorkspacesResources.Show_Stack_Trace, InfoBarUI.UIKind.HyperLink, () => ShowDetailedErrorInfo(exception), closeAfterAction: false), new InfoBarUI(WorkspacesResources.Enable, InfoBarUI.UIKind.Button, () => { EnableProvider(provider); LogEnableProvider(provider); }), new InfoBarUI(WorkspacesResources.Enable_and_ignore_future_errors, InfoBarUI.UIKind.Button, () => { EnableProvider(provider); IgnoreProvider(provider); LogEnableAndIgnoreProvider(provider); }), new InfoBarUI(String.Empty, InfoBarUI.UIKind.Close, () => LogLeaveDisabled(provider))); } else { LogAction(CodefixInfobar_ErrorIgnored, provider); } } else { if (_optionsService.GetOption(ExtensionManagerOptions.DisableCrashingExtensions)) { base.HandleException(provider, exception); } _errorHandlers.Do(h => h.HandleError(provider, exception)); } _errorLoggerService?.LogException(provider, exception); } private void ShowDetailedErrorInfo(Exception exception) => _errorReportingService.ShowDetailedErrorInfo(exception); private static void LogLeaveDisabled(object provider) => LogAction(CodefixInfobar_LeaveDisabled, provider); private static void LogEnableAndIgnoreProvider(object provider) => LogAction(CodefixInfobar_EnableAndIgnoreFutureErrors, provider); private static void LogEnableProvider(object provider) => LogAction(CodefixInfobar_Enable, provider); private static void LogAction(FunctionId functionId, object provider) { if (IsRoslynCodefix(provider)) { Log(functionId, $"Name: {provider.GetType().FullName} Assembly Version: {provider.GetType().Assembly.GetName().Version}"); } else { Log(functionId); } } private static bool IsRoslynCodefix(object source) => HasRoslynPublicKey(source); } } }
// 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 System; using System.Collections.Generic; using System.Composition; using System.Linq; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Editor.Options; using Microsoft.CodeAnalysis.ErrorLogger; using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.Text; using Roslyn.Utilities; using static Microsoft.CodeAnalysis.Internal.Log.FunctionId; using static Microsoft.CodeAnalysis.Internal.Log.Logger; using static Microsoft.CodeAnalysis.RoslynAssemblyHelper; namespace Microsoft.CodeAnalysis.Editor { [ExportWorkspaceServiceFactory(typeof(IExtensionManager), ServiceLayer.Editor), Shared] internal class EditorLayerExtensionManager : IWorkspaceServiceFactory { private readonly List<IExtensionErrorHandler> _errorHandlers; private readonly IGlobalOptionService _optionService; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public EditorLayerExtensionManager( IGlobalOptionService optionService, [ImportMany] IEnumerable<IExtensionErrorHandler> errorHandlers) { _optionService = optionService; _errorHandlers = errorHandlers.ToList(); } public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var errorReportingService = workspaceServices.GetRequiredService<IErrorReportingService>(); var errorLoggerService = workspaceServices.GetRequiredService<IErrorLoggerService>(); return new ExtensionManager(_optionService, errorReportingService, errorLoggerService, _errorHandlers); } internal class ExtensionManager : AbstractExtensionManager { private readonly List<IExtensionErrorHandler> _errorHandlers; private readonly IGlobalOptionService _optionsService; private readonly IErrorReportingService _errorReportingService; private readonly IErrorLoggerService _errorLoggerService; public ExtensionManager( IGlobalOptionService optionsService, IErrorReportingService errorReportingService, IErrorLoggerService errorLoggerService, List<IExtensionErrorHandler> errorHandlers) { _optionsService = optionsService; _errorHandlers = errorHandlers; _errorReportingService = errorReportingService; _errorLoggerService = errorLoggerService; } public override void HandleException(object provider, Exception exception) { if (provider is CodeFixProvider || provider is FixAllProvider || provider is CodeRefactoringProvider) { if (!IsIgnored(provider) && _optionsService.GetOption(ExtensionManagerOptions.DisableCrashingExtensions)) { base.HandleException(provider, exception); _errorReportingService?.ShowGlobalErrorInfo(String.Format(WorkspacesResources._0_encountered_an_error_and_has_been_disabled, provider.GetType().Name), new InfoBarUI(WorkspacesResources.Show_Stack_Trace, InfoBarUI.UIKind.HyperLink, () => ShowDetailedErrorInfo(exception), closeAfterAction: false), new InfoBarUI(WorkspacesResources.Enable, InfoBarUI.UIKind.Button, () => { EnableProvider(provider); LogEnableProvider(provider); }), new InfoBarUI(WorkspacesResources.Enable_and_ignore_future_errors, InfoBarUI.UIKind.Button, () => { EnableProvider(provider); IgnoreProvider(provider); LogEnableAndIgnoreProvider(provider); }), new InfoBarUI(String.Empty, InfoBarUI.UIKind.Close, () => LogLeaveDisabled(provider))); } else { LogAction(CodefixInfobar_ErrorIgnored, provider); } } else { if (_optionsService.GetOption(ExtensionManagerOptions.DisableCrashingExtensions)) { base.HandleException(provider, exception); } _errorHandlers.Do(h => h.HandleError(provider, exception)); } _errorLoggerService?.LogException(provider, exception); } private void ShowDetailedErrorInfo(Exception exception) => _errorReportingService.ShowDetailedErrorInfo(exception); private static void LogLeaveDisabled(object provider) => LogAction(CodefixInfobar_LeaveDisabled, provider); private static void LogEnableAndIgnoreProvider(object provider) => LogAction(CodefixInfobar_EnableAndIgnoreFutureErrors, provider); private static void LogEnableProvider(object provider) => LogAction(CodefixInfobar_Enable, provider); private static void LogAction(FunctionId functionId, object provider) { if (IsRoslynCodefix(provider)) { Log(functionId, $"Name: {provider.GetType().FullName} Assembly Version: {provider.GetType().Assembly.GetName().Version}"); } else { Log(functionId); } } private static bool IsRoslynCodefix(object source) => HasRoslynPublicKey(source); } } }
1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Def/Implementation/FindReferences/StreamingFindUsagesPresenter.cs
// 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 System; using System.Collections.Generic; using System.Collections.Immutable; using System.ComponentModel.Composition.Hosting; using System.Composition; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.FindUsages; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServices.Implementation.FindReferences; using Microsoft.VisualStudio.Shell.FindAllReferences; using Microsoft.VisualStudio.Shell.TableControl; using Microsoft.VisualStudio.Shell.TableManager; using Microsoft.VisualStudio.Text.Classification; namespace Microsoft.VisualStudio.LanguageServices.FindUsages { [Export(typeof(IStreamingFindUsagesPresenter)), Shared] internal partial class StreamingFindUsagesPresenter : ForegroundThreadAffinitizedObject, IStreamingFindUsagesPresenter { public const string RoslynFindUsagesTableDataSourceIdentifier = nameof(RoslynFindUsagesTableDataSourceIdentifier); public const string RoslynFindUsagesTableDataSourceSourceTypeIdentifier = nameof(RoslynFindUsagesTableDataSourceSourceTypeIdentifier); private readonly IServiceProvider _serviceProvider; public readonly ClassificationTypeMap TypeMap; public readonly IEditorFormatMapService FormatMapService; private readonly IAsynchronousOperationListener _asyncListener; public readonly IClassificationFormatMap ClassificationFormatMap; private readonly Workspace _workspace; private readonly HashSet<AbstractTableDataSourceFindUsagesContext> _currentContexts = new(); private readonly ImmutableArray<ITableColumnDefinition> _customColumns; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public StreamingFindUsagesPresenter( IThreadingContext threadingContext, VisualStudioWorkspace workspace, Shell.SVsServiceProvider serviceProvider, ClassificationTypeMap typeMap, IEditorFormatMapService formatMapService, IClassificationFormatMapService classificationFormatMapService, IAsynchronousOperationListenerProvider asynchronousOperationListenerProvider, [ImportMany] IEnumerable<Lazy<ITableColumnDefinition, NameMetadata>> columns) : this(workspace, threadingContext, serviceProvider, typeMap, formatMapService, classificationFormatMapService, GetCustomColumns(columns), asynchronousOperationListenerProvider) { } // Test only [SuppressMessage("RoslynDiagnosticsReliability", "RS0034:Exported parts should have [ImportingConstructor]", Justification = "Used incorrectly by tests")] public StreamingFindUsagesPresenter( Workspace workspace, ExportProvider exportProvider) : this(workspace, exportProvider.GetExportedValue<IThreadingContext>(), exportProvider.GetExportedValue<Shell.SVsServiceProvider>(), exportProvider.GetExportedValue<ClassificationTypeMap>(), exportProvider.GetExportedValue<IEditorFormatMapService>(), exportProvider.GetExportedValue<IClassificationFormatMapService>(), exportProvider.GetExportedValues<ITableColumnDefinition>(), exportProvider.GetExportedValue<IAsynchronousOperationListenerProvider>()) { } [SuppressMessage("RoslynDiagnosticsReliability", "RS0034:Exported parts should have [ImportingConstructor]", Justification = "Used incorrectly by tests")] private StreamingFindUsagesPresenter( Workspace workspace, IThreadingContext threadingContext, Shell.SVsServiceProvider serviceProvider, ClassificationTypeMap typeMap, IEditorFormatMapService formatMapService, IClassificationFormatMapService classificationFormatMapService, IEnumerable<ITableColumnDefinition> columns, IAsynchronousOperationListenerProvider asyncListenerProvider) : base(threadingContext, assertIsForeground: false) { _workspace = workspace; _serviceProvider = serviceProvider; TypeMap = typeMap; FormatMapService = formatMapService; _asyncListener = asyncListenerProvider.GetListener(FeatureAttribute.FindReferences); ClassificationFormatMap = classificationFormatMapService.GetClassificationFormatMap("tooltip"); _customColumns = columns.ToImmutableArray(); } private static IEnumerable<ITableColumnDefinition> GetCustomColumns(IEnumerable<Lazy<ITableColumnDefinition, NameMetadata>> columns) { foreach (var column in columns) { // PERF: Filter the columns by metadata name before selecting our custom columns. // This is done to ensure that we do not load every single table control column // that implements ITableColumnDefinition, which will cause unwanted assembly loads. switch (column.Metadata.Name) { case StandardTableKeyNames2.SymbolKind: case ContainingTypeColumnDefinition.ColumnName: case ContainingMemberColumnDefinition.ColumnName: case StandardTableKeyNames.Repository: case StandardTableKeyNames.ItemOrigin: yield return column.Value; break; } } } public void ClearAll() { this.AssertIsForeground(); foreach (var context in _currentContexts) { context.Clear(); } } /// <summary> /// Starts a search that will not include Containing Type, Containing Member, or Kind columns /// </summary> /// <param name="title"></param> /// <param name="supportsReferences"></param> /// <returns></returns> public (FindUsagesContext context, CancellationToken cancellationToken) StartSearch(string title, bool supportsReferences) => StartSearchWithCustomColumns(title, supportsReferences, includeContainingTypeAndMemberColumns: false, includeKindColumn: false); /// <summary> /// Start a search that may include Containing Type, Containing Member, or Kind information about the reference /// </summary> public (FindUsagesContext context, CancellationToken cancellationToken) StartSearchWithCustomColumns( string title, bool supportsReferences, bool includeContainingTypeAndMemberColumns, bool includeKindColumn) { this.AssertIsForeground(); var context = StartSearchWorker(title, supportsReferences, includeContainingTypeAndMemberColumns, includeKindColumn); // Keep track of this context object as long as it is being displayed in the UI. // That way we can Clear it out if requested by a client. When the context is // no longer being displayed, VS will dispose it and it will remove itself from // this set. _currentContexts.Add(context); return (context, context.CancellationTokenSource!.Token); } private AbstractTableDataSourceFindUsagesContext StartSearchWorker( string title, bool supportsReferences, bool includeContainingTypeAndMemberColumns, bool includeKindColumn) { this.AssertIsForeground(); var vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences)); // Get the appropriate window for FAR results to go into. var window = vsFindAllReferencesService.StartSearch(title); // Keep track of the users preference for grouping by definition if we don't already know it. // We need this because we disable the Definition column when we're not showing references // (i.e. GoToImplementation/GoToDef). However, we want to restore the user's choice if they // then do another FindAllReferences. var desiredGroupingPriority = _workspace.Options.GetOption(FindUsagesOptions.DefinitionGroupingPriority); if (desiredGroupingPriority < 0) { StoreCurrentGroupingPriority(window); } return supportsReferences ? StartSearchWithReferences(window, desiredGroupingPriority, includeContainingTypeAndMemberColumns, includeKindColumn) : StartSearchWithoutReferences(window, includeContainingTypeAndMemberColumns, includeKindColumn); } private AbstractTableDataSourceFindUsagesContext StartSearchWithReferences( IFindAllReferencesWindow window, int desiredGroupingPriority, bool includeContainingTypeAndMemberColumns, bool includeKindColumn) { // Ensure that the window's definition-grouping reflects what the user wants. // i.e. we may have disabled this column for a previous GoToImplementation call. // We want to still show the column as long as the user has not disabled it themselves. var definitionColumn = window.GetDefinitionColumn(); if (definitionColumn.GroupingPriority != desiredGroupingPriority) { SetDefinitionGroupingPriority(window, desiredGroupingPriority); } // If the user changes the grouping, then store their current preference. var tableControl = (IWpfTableControl2)window.TableControl; tableControl.GroupingsChanged += (s, e) => StoreCurrentGroupingPriority(window); return new WithReferencesFindUsagesContext(this, window, _customColumns, includeContainingTypeAndMemberColumns, includeKindColumn); } private AbstractTableDataSourceFindUsagesContext StartSearchWithoutReferences( IFindAllReferencesWindow window, bool includeContainingTypeAndMemberColumns, bool includeKindColumn) { // If we're not showing references, then disable grouping by definition, as that will // just lead to a poor experience. i.e. we'll have the definition entry buckets, // with the same items showing underneath them. SetDefinitionGroupingPriority(window, 0); return new WithoutReferencesFindUsagesContext(this, window, _customColumns, includeContainingTypeAndMemberColumns, includeKindColumn); } private void StoreCurrentGroupingPriority(IFindAllReferencesWindow window) { var definitionColumn = window.GetDefinitionColumn(); _workspace.TryApplyChanges(_workspace.CurrentSolution.WithOptions(_workspace.Options .WithChangedOption(FindUsagesOptions.DefinitionGroupingPriority, definitionColumn.GroupingPriority))); } private void SetDefinitionGroupingPriority(IFindAllReferencesWindow window, int priority) { this.AssertIsForeground(); using var _ = ArrayBuilder<ColumnState>.GetInstance(out var newColumns); var tableControl = (IWpfTableControl2)window.TableControl; foreach (var columnState in window.TableControl.ColumnStates) { var columnState2 = columnState as ColumnState2; if (columnState2?.Name == StandardTableColumnDefinitions2.Definition) { newColumns.Add(new ColumnState2( columnState2.Name, isVisible: false, width: columnState2.Width, sortPriority: columnState2.SortPriority, descendingSort: columnState2.DescendingSort, groupingPriority: priority)); } else { newColumns.Add(columnState); } } tableControl.SetColumnStates(newColumns); } protected static (Guid, string projectName, string? projectFlavor) GetGuidAndProjectInfo(Document document) { // The FAR system needs to know the guid for the project that a def/reference is // from (to support features like filtering). Normally that would mean we could // only support this from a VisualStudioWorkspace. However, we want till work // in cases like Any-Code (which does not use a VSWorkspace). So we are tolerant // when we have another type of workspace. This means we will show results, but // certain features (like filtering) may not work in that context. var vsWorkspace = document.Project.Solution.Workspace as VisualStudioWorkspace; var (projectName, projectFlavor) = document.Project.State.NameAndFlavor; projectName ??= document.Project.Name; var guid = vsWorkspace?.GetProjectGuid(document.Project.Id) ?? Guid.Empty; return (guid, projectName, projectFlavor); } } }
// 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 System; using System.Collections.Generic; using System.Collections.Immutable; using System.ComponentModel.Composition.Hosting; using System.Composition; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.FindUsages; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.LanguageServices.Implementation.FindReferences; using Microsoft.VisualStudio.Shell.FindAllReferences; using Microsoft.VisualStudio.Shell.TableControl; using Microsoft.VisualStudio.Shell.TableManager; using Microsoft.VisualStudio.Text.Classification; namespace Microsoft.VisualStudio.LanguageServices.FindUsages { [Export(typeof(IStreamingFindUsagesPresenter)), Shared] internal partial class StreamingFindUsagesPresenter : ForegroundThreadAffinitizedObject, IStreamingFindUsagesPresenter { public const string RoslynFindUsagesTableDataSourceIdentifier = nameof(RoslynFindUsagesTableDataSourceIdentifier); public const string RoslynFindUsagesTableDataSourceSourceTypeIdentifier = nameof(RoslynFindUsagesTableDataSourceSourceTypeIdentifier); private readonly IServiceProvider _serviceProvider; public readonly ClassificationTypeMap TypeMap; public readonly IEditorFormatMapService FormatMapService; private readonly IAsynchronousOperationListener _asyncListener; public readonly IClassificationFormatMap ClassificationFormatMap; private readonly Workspace _workspace; private readonly IGlobalOptionService _optionService; private readonly HashSet<AbstractTableDataSourceFindUsagesContext> _currentContexts = new(); private readonly ImmutableArray<ITableColumnDefinition> _customColumns; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public StreamingFindUsagesPresenter( IThreadingContext threadingContext, VisualStudioWorkspace workspace, IGlobalOptionService optionService, Shell.SVsServiceProvider serviceProvider, ClassificationTypeMap typeMap, IEditorFormatMapService formatMapService, IClassificationFormatMapService classificationFormatMapService, IAsynchronousOperationListenerProvider asynchronousOperationListenerProvider, [ImportMany] IEnumerable<Lazy<ITableColumnDefinition, NameMetadata>> columns) : this(workspace, threadingContext, serviceProvider, optionService, typeMap, formatMapService, classificationFormatMapService, GetCustomColumns(columns), asynchronousOperationListenerProvider) { } // Test only [SuppressMessage("RoslynDiagnosticsReliability", "RS0034:Exported parts should have [ImportingConstructor]", Justification = "Used incorrectly by tests")] public StreamingFindUsagesPresenter( Workspace workspace, ExportProvider exportProvider) : this(workspace, exportProvider.GetExportedValue<IThreadingContext>(), exportProvider.GetExportedValue<Shell.SVsServiceProvider>(), exportProvider.GetExportedValue<IGlobalOptionService>(), exportProvider.GetExportedValue<ClassificationTypeMap>(), exportProvider.GetExportedValue<IEditorFormatMapService>(), exportProvider.GetExportedValue<IClassificationFormatMapService>(), exportProvider.GetExportedValues<ITableColumnDefinition>(), exportProvider.GetExportedValue<IAsynchronousOperationListenerProvider>()) { } [SuppressMessage("RoslynDiagnosticsReliability", "RS0034:Exported parts should have [ImportingConstructor]", Justification = "Used incorrectly by tests")] private StreamingFindUsagesPresenter( Workspace workspace, IThreadingContext threadingContext, Shell.SVsServiceProvider serviceProvider, IGlobalOptionService optionService, ClassificationTypeMap typeMap, IEditorFormatMapService formatMapService, IClassificationFormatMapService classificationFormatMapService, IEnumerable<ITableColumnDefinition> columns, IAsynchronousOperationListenerProvider asyncListenerProvider) : base(threadingContext, assertIsForeground: false) { _workspace = workspace; _optionService = optionService; _serviceProvider = serviceProvider; TypeMap = typeMap; FormatMapService = formatMapService; _asyncListener = asyncListenerProvider.GetListener(FeatureAttribute.FindReferences); ClassificationFormatMap = classificationFormatMapService.GetClassificationFormatMap("tooltip"); _customColumns = columns.ToImmutableArray(); } private static IEnumerable<ITableColumnDefinition> GetCustomColumns(IEnumerable<Lazy<ITableColumnDefinition, NameMetadata>> columns) { foreach (var column in columns) { // PERF: Filter the columns by metadata name before selecting our custom columns. // This is done to ensure that we do not load every single table control column // that implements ITableColumnDefinition, which will cause unwanted assembly loads. switch (column.Metadata.Name) { case StandardTableKeyNames2.SymbolKind: case ContainingTypeColumnDefinition.ColumnName: case ContainingMemberColumnDefinition.ColumnName: case StandardTableKeyNames.Repository: case StandardTableKeyNames.ItemOrigin: yield return column.Value; break; } } } public void ClearAll() { this.AssertIsForeground(); foreach (var context in _currentContexts) { context.Clear(); } } /// <summary> /// Starts a search that will not include Containing Type, Containing Member, or Kind columns /// </summary> /// <param name="title"></param> /// <param name="supportsReferences"></param> /// <returns></returns> public (FindUsagesContext context, CancellationToken cancellationToken) StartSearch(string title, bool supportsReferences) => StartSearchWithCustomColumns(title, supportsReferences, includeContainingTypeAndMemberColumns: false, includeKindColumn: false); /// <summary> /// Start a search that may include Containing Type, Containing Member, or Kind information about the reference /// </summary> public (FindUsagesContext context, CancellationToken cancellationToken) StartSearchWithCustomColumns( string title, bool supportsReferences, bool includeContainingTypeAndMemberColumns, bool includeKindColumn) { this.AssertIsForeground(); var context = StartSearchWorker(title, supportsReferences, includeContainingTypeAndMemberColumns, includeKindColumn); // Keep track of this context object as long as it is being displayed in the UI. // That way we can Clear it out if requested by a client. When the context is // no longer being displayed, VS will dispose it and it will remove itself from // this set. _currentContexts.Add(context); return (context, context.CancellationTokenSource!.Token); } private AbstractTableDataSourceFindUsagesContext StartSearchWorker( string title, bool supportsReferences, bool includeContainingTypeAndMemberColumns, bool includeKindColumn) { this.AssertIsForeground(); var vsFindAllReferencesService = (IFindAllReferencesService)_serviceProvider.GetService(typeof(SVsFindAllReferences)); // Get the appropriate window for FAR results to go into. var window = vsFindAllReferencesService.StartSearch(title); // Keep track of the users preference for grouping by definition if we don't already know it. // We need this because we disable the Definition column when we're not showing references // (i.e. GoToImplementation/GoToDef). However, we want to restore the user's choice if they // then do another FindAllReferences. var desiredGroupingPriority = _optionService.GetOption(FindUsagesOptions.DefinitionGroupingPriority); if (desiredGroupingPriority < 0) { StoreCurrentGroupingPriority(window); } return supportsReferences ? StartSearchWithReferences(window, desiredGroupingPriority, includeContainingTypeAndMemberColumns, includeKindColumn) : StartSearchWithoutReferences(window, includeContainingTypeAndMemberColumns, includeKindColumn); } private AbstractTableDataSourceFindUsagesContext StartSearchWithReferences( IFindAllReferencesWindow window, int desiredGroupingPriority, bool includeContainingTypeAndMemberColumns, bool includeKindColumn) { // Ensure that the window's definition-grouping reflects what the user wants. // i.e. we may have disabled this column for a previous GoToImplementation call. // We want to still show the column as long as the user has not disabled it themselves. var definitionColumn = window.GetDefinitionColumn(); if (definitionColumn.GroupingPriority != desiredGroupingPriority) { SetDefinitionGroupingPriority(window, desiredGroupingPriority); } // If the user changes the grouping, then store their current preference. var tableControl = (IWpfTableControl2)window.TableControl; tableControl.GroupingsChanged += (s, e) => StoreCurrentGroupingPriority(window); return new WithReferencesFindUsagesContext(this, window, _customColumns, includeContainingTypeAndMemberColumns, includeKindColumn); } private AbstractTableDataSourceFindUsagesContext StartSearchWithoutReferences( IFindAllReferencesWindow window, bool includeContainingTypeAndMemberColumns, bool includeKindColumn) { // If we're not showing references, then disable grouping by definition, as that will // just lead to a poor experience. i.e. we'll have the definition entry buckets, // with the same items showing underneath them. SetDefinitionGroupingPriority(window, 0); return new WithoutReferencesFindUsagesContext(this, window, _customColumns, includeContainingTypeAndMemberColumns, includeKindColumn); } private void StoreCurrentGroupingPriority(IFindAllReferencesWindow window) { _optionService.SetGlobalOption(FindUsagesOptions.DefinitionGroupingPriority, window.GetDefinitionColumn().GroupingPriority); } private void SetDefinitionGroupingPriority(IFindAllReferencesWindow window, int priority) { this.AssertIsForeground(); using var _ = ArrayBuilder<ColumnState>.GetInstance(out var newColumns); var tableControl = (IWpfTableControl2)window.TableControl; foreach (var columnState in window.TableControl.ColumnStates) { var columnState2 = columnState as ColumnState2; if (columnState2?.Name == StandardTableColumnDefinitions2.Definition) { newColumns.Add(new ColumnState2( columnState2.Name, isVisible: false, width: columnState2.Width, sortPriority: columnState2.SortPriority, descendingSort: columnState2.DescendingSort, groupingPriority: priority)); } else { newColumns.Add(columnState); } } tableControl.SetColumnStates(newColumns); } protected static (Guid, string projectName, string? projectFlavor) GetGuidAndProjectInfo(Document document) { // The FAR system needs to know the guid for the project that a def/reference is // from (to support features like filtering). Normally that would mean we could // only support this from a VisualStudioWorkspace. However, we want till work // in cases like Any-Code (which does not use a VSWorkspace). So we are tolerant // when we have another type of workspace. This means we will show results, but // certain features (like filtering) may not work in that context. var vsWorkspace = document.Project.Solution.Workspace as VisualStudioWorkspace; var (projectName, projectFlavor) = document.Project.State.NameAndFlavor; projectName ??= document.Project.Name; var guid = vsWorkspace?.GetProjectGuid(document.Project.Id) ?? Guid.Empty; return (guid, projectName, projectFlavor); } } }
1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Def/Implementation/InfoBar/VisualStudioInfoBarService.cs
// 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. #nullable disable using System; using System.Collections.Generic; using System.Composition; using System.Linq; using Microsoft.CodeAnalysis.Editor; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation { [ExportWorkspaceService(typeof(IInfoBarService), layer: ServiceLayer.Host), Shared] internal class VisualStudioInfoBarService : ForegroundThreadAffinitizedObject, IInfoBarService { private readonly SVsServiceProvider _serviceProvider; private readonly IAsynchronousOperationListener _listener; /// <summary> /// Keep track of the messages that are currently being shown to the user. If we would /// show the same message again, block that from happening so we don't spam the user with /// the same message. When the info bar item is dismissed though, we then may show the /// same message in the future. This is important for user clarity as it's possible for /// a feature to fail for some reason, then work fine for a while, then fail again. We want /// the second failure message to be reported to ensure the user is not confused. /// </summary> private readonly HashSet<string> _currentlyShowingMessages = new(); [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioInfoBarService( IThreadingContext threadingContext, SVsServiceProvider serviceProvider, IAsynchronousOperationListenerProvider listenerProvider) : base(threadingContext) { _serviceProvider = serviceProvider; _listener = listenerProvider.GetListener(FeatureAttribute.InfoBar); } public void ShowInfoBar(string message, params InfoBarUI[] items) { ThisCanBeCalledOnAnyThread(); // We can be called from any thread since errors can occur anywhere, however we can only construct and InfoBar from the UI thread. this.ThreadingContext.JoinableTaskFactory.RunAsync(async () => { using var _ = _listener.BeginAsyncOperation(nameof(ShowInfoBar)); await this.ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(ThreadingContext.DisposalToken); if (TryGetInfoBarData(out var infoBarHost)) CreateInfoBar(infoBarHost, message, items); }); } private bool TryGetInfoBarData(out IVsInfoBarHost infoBarHost) { AssertIsForeground(); infoBarHost = null; // global error info, show it on main window info bar if (_serviceProvider.GetService(typeof(SVsShell)) is not IVsShell shell || ErrorHandler.Failed(shell.GetProperty((int)__VSSPROPID7.VSSPROPID_MainWindowInfoBarHost, out var globalInfoBar))) { return false; } infoBarHost = globalInfoBar as IVsInfoBarHost; return infoBarHost != null; } private void CreateInfoBar(IVsInfoBarHost infoBarHost, string message, InfoBarUI[] items) { this.AssertIsForeground(); if (!(_serviceProvider.GetService(typeof(SVsInfoBarUIFactory)) is IVsInfoBarUIFactory factory)) { // no info bar factory, don't do anything return; } // If we're already shown this same message to the user, then do not bother showing it // to them again. It will just be noisy. if (_currentlyShowingMessages.Contains(message)) return; var textSpans = new List<IVsInfoBarTextSpan>() { new InfoBarTextSpan(message) }; // create action item list var actionItems = new List<IVsInfoBarActionItem>(); foreach (var item in items) { switch (item.Kind) { case InfoBarUI.UIKind.Button: actionItems.Add(new InfoBarButton(item.Title)); break; case InfoBarUI.UIKind.HyperLink: actionItems.Add(new InfoBarHyperlink(item.Title)); break; case InfoBarUI.UIKind.Close: break; default: throw ExceptionUtilities.UnexpectedValue(item.Kind); } } var infoBarModel = new InfoBarModel( textSpans, actionItems, KnownMonikers.StatusInformation, isCloseButtonVisible: true); var infoBarUI = factory.CreateInfoBar(infoBarModel); if (infoBarUI == null) return; uint? infoBarCookie = null; var eventSink = new InfoBarEvents(items, onClose: () => { // Remove the message from the list that we're keeping track of. Future identical // messages can now be shown. _currentlyShowingMessages.Remove(message); // Run given onClose action if there is one. items.FirstOrDefault(i => i.Kind == InfoBarUI.UIKind.Close).Action?.Invoke(); if (infoBarCookie.HasValue) { infoBarUI.Unadvise(infoBarCookie.Value); } }); infoBarUI.Advise(eventSink, out var cookie); infoBarCookie = cookie; infoBarHost.AddInfoBar(infoBarUI); _currentlyShowingMessages.Add(message); } private class InfoBarEvents : IVsInfoBarUIEvents { private readonly InfoBarUI[] _items; private readonly Action _onClose; public InfoBarEvents(InfoBarUI[] items, Action onClose) { Contract.ThrowIfNull(onClose); _items = items; _onClose = onClose; } public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) { var item = _items.FirstOrDefault(i => i.Title == actionItem.Text); if (item.IsDefault) { return; } item.Action?.Invoke(); if (!item.CloseAfterAction) { return; } infoBarUIElement.Close(); } public void OnClosed(IVsInfoBarUIElement infoBarUIElement) => _onClose(); } } }
// 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. #nullable disable using System; using System.Collections.Generic; using System.Composition; using System.Linq; using Microsoft.CodeAnalysis.Editor; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Imaging; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation { [Export(typeof(VisualStudioInfoBarService)), Shared] internal sealed class VisualStudioInfoBarService : ForegroundThreadAffinitizedObject { private readonly SVsServiceProvider _serviceProvider; private readonly IAsynchronousOperationListener _listener; /// <summary> /// Keep track of the messages that are currently being shown to the user. If we would /// show the same message again, block that from happening so we don't spam the user with /// the same message. When the info bar item is dismissed though, we then may show the /// same message in the future. This is important for user clarity as it's possible for /// a feature to fail for some reason, then work fine for a while, then fail again. We want /// the second failure message to be reported to ensure the user is not confused. /// </summary> private readonly HashSet<string> _currentlyShowingMessages = new(); [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioInfoBarService( IThreadingContext threadingContext, SVsServiceProvider serviceProvider, IAsynchronousOperationListenerProvider listenerProvider) : base(threadingContext) { _serviceProvider = serviceProvider; _listener = listenerProvider.GetListener(FeatureAttribute.InfoBar); } public void ShowInfoBar(string message, params InfoBarUI[] items) { ThisCanBeCalledOnAnyThread(); // We can be called from any thread since errors can occur anywhere, however we can only construct and InfoBar from the UI thread. this.ThreadingContext.JoinableTaskFactory.RunAsync(async () => { using var _ = _listener.BeginAsyncOperation(nameof(ShowInfoBar)); await this.ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(ThreadingContext.DisposalToken); if (TryGetInfoBarData(out var infoBarHost)) CreateInfoBar(infoBarHost, message, items); }); } private bool TryGetInfoBarData(out IVsInfoBarHost infoBarHost) { AssertIsForeground(); infoBarHost = null; // global error info, show it on main window info bar if (_serviceProvider.GetService(typeof(SVsShell)) is not IVsShell shell || ErrorHandler.Failed(shell.GetProperty((int)__VSSPROPID7.VSSPROPID_MainWindowInfoBarHost, out var globalInfoBar))) { return false; } infoBarHost = globalInfoBar as IVsInfoBarHost; return infoBarHost != null; } private void CreateInfoBar(IVsInfoBarHost infoBarHost, string message, InfoBarUI[] items) { this.AssertIsForeground(); if (!(_serviceProvider.GetService(typeof(SVsInfoBarUIFactory)) is IVsInfoBarUIFactory factory)) { // no info bar factory, don't do anything return; } // If we're already shown this same message to the user, then do not bother showing it // to them again. It will just be noisy. if (_currentlyShowingMessages.Contains(message)) return; var textSpans = new List<IVsInfoBarTextSpan>() { new InfoBarTextSpan(message) }; // create action item list var actionItems = new List<IVsInfoBarActionItem>(); foreach (var item in items) { switch (item.Kind) { case InfoBarUI.UIKind.Button: actionItems.Add(new InfoBarButton(item.Title)); break; case InfoBarUI.UIKind.HyperLink: actionItems.Add(new InfoBarHyperlink(item.Title)); break; case InfoBarUI.UIKind.Close: break; default: throw ExceptionUtilities.UnexpectedValue(item.Kind); } } var infoBarModel = new InfoBarModel( textSpans, actionItems, KnownMonikers.StatusInformation, isCloseButtonVisible: true); var infoBarUI = factory.CreateInfoBar(infoBarModel); if (infoBarUI == null) return; uint? infoBarCookie = null; var eventSink = new InfoBarEvents(items, onClose: () => { // Remove the message from the list that we're keeping track of. Future identical // messages can now be shown. _currentlyShowingMessages.Remove(message); // Run given onClose action if there is one. items.FirstOrDefault(i => i.Kind == InfoBarUI.UIKind.Close).Action?.Invoke(); if (infoBarCookie.HasValue) { infoBarUI.Unadvise(infoBarCookie.Value); } }); infoBarUI.Advise(eventSink, out var cookie); infoBarCookie = cookie; infoBarHost.AddInfoBar(infoBarUI); _currentlyShowingMessages.Add(message); } private class InfoBarEvents : IVsInfoBarUIEvents { private readonly InfoBarUI[] _items; private readonly Action _onClose; public InfoBarEvents(InfoBarUI[] items, Action onClose) { Contract.ThrowIfNull(onClose); _items = items; _onClose = onClose; } public void OnActionItemClicked(IVsInfoBarUIElement infoBarUIElement, IVsInfoBarActionItem actionItem) { var item = _items.FirstOrDefault(i => i.Title == actionItem.Text); if (item.IsDefault) { return; } item.Action?.Invoke(); if (!item.CloseAfterAction) { return; } infoBarUIElement.Close(); } public void OnClosed(IVsInfoBarUIElement infoBarUIElement) => _onClose(); } } }
1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Def/RoslynPackage.cs
// 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 System; using System.Collections.Immutable; using System.ComponentModel.Design; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.ChangeSignature; using Microsoft.CodeAnalysis.Completion.Log; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Logging; using Microsoft.CodeAnalysis.Notification; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.SolutionCrawler; using Microsoft.CodeAnalysis.Telemetry; using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.LanguageServices.ColorSchemes; using Microsoft.VisualStudio.LanguageServices.EditorConfigSettings; using Microsoft.VisualStudio.LanguageServices.Experimentation; using Microsoft.VisualStudio.LanguageServices.Implementation; using Microsoft.VisualStudio.LanguageServices.Implementation.Diagnostics; using Microsoft.VisualStudio.LanguageServices.Implementation.Interactive; using Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.RuleSets; using Microsoft.VisualStudio.LanguageServices.Implementation.SyncNamespaces; using Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource; using Microsoft.VisualStudio.LanguageServices.Implementation.UnusedReferences; using Microsoft.VisualStudio.LanguageServices.Telemetry; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.TaskStatusCenter; using Microsoft.VisualStudio.Telemetry; using Microsoft.VisualStudio.TextManager.Interop; using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; using Task = System.Threading.Tasks.Task; namespace Microsoft.VisualStudio.LanguageServices.Setup { [Guid(Guids.RoslynPackageIdString)] // The option page configuration is duplicated in PackageRegistration.pkgdef [ProvideToolWindow(typeof(ValueTracking.ValueTrackingToolWindow))] internal sealed class RoslynPackage : AbstractPackage { // The randomly-generated key name is used for serializing the Background Analysis Scope preference to the .SUO // file. It doesn't have any semantic meaning, but is intended to not conflict with any other extension that // might be saving an "AnalysisScope" named stream to the same file. // note: must be <= 31 characters long private const string BackgroundAnalysisScopeOptionKey = "AnalysisScope-DCE33A29A768"; private const byte BackgroundAnalysisScopeOptionVersion = 1; private static RoslynPackage? _lazyInstance; private VisualStudioWorkspace? _workspace; private IComponentModel? _componentModel; private RuleSetEventHandler? _ruleSetEventHandler; private ColorSchemeApplier? _colorSchemeApplier; private IDisposable? _solutionEventMonitor; private BackgroundAnalysisScope? _analysisScope; public RoslynPackage() { // We need to register an option in order for OnLoadOptions/OnSaveOptions to be called AddOptionKey(BackgroundAnalysisScopeOptionKey); } public BackgroundAnalysisScope? AnalysisScope { get { return _analysisScope; } set { if (_analysisScope == value) return; _analysisScope = value; AnalysisScopeChanged?.Invoke(this, EventArgs.Empty); } } public event EventHandler? AnalysisScopeChanged; internal static async ValueTask<RoslynPackage?> GetOrLoadAsync(IThreadingContext threadingContext, IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { if (_lazyInstance is null) { await threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var shell = (IVsShell7?)await serviceProvider.GetServiceAsync(typeof(SVsShell)).ConfigureAwait(true); Assumes.Present(shell); await shell.LoadPackageAsync(typeof(RoslynPackage).GUID); if (ErrorHandler.Succeeded(((IVsShell)shell).IsPackageLoaded(typeof(RoslynPackage).GUID, out var package))) { _lazyInstance = (RoslynPackage)package; } } return _lazyInstance; } protected override void OnLoadOptions(string key, Stream stream) { if (key == BackgroundAnalysisScopeOptionKey) { if (stream.ReadByte() == BackgroundAnalysisScopeOptionVersion) { var hasValue = stream.ReadByte() == 1; AnalysisScope = hasValue ? (BackgroundAnalysisScope)stream.ReadByte() : null; } else { AnalysisScope = null; } } base.OnLoadOptions(key, stream); } protected override void OnSaveOptions(string key, Stream stream) { if (key == BackgroundAnalysisScopeOptionKey) { stream.WriteByte(BackgroundAnalysisScopeOptionVersion); stream.WriteByte(AnalysisScope.HasValue ? (byte)1 : (byte)0); stream.WriteByte((byte)AnalysisScope.GetValueOrDefault()); } base.OnSaveOptions(key, stream); } protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress) { await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true); await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); _componentModel = (IComponentModel)await GetServiceAsync(typeof(SComponentModel)).ConfigureAwait(true); cancellationToken.ThrowIfCancellationRequested(); Assumes.Present(_componentModel); // Ensure the options persisters are loaded since we have to fetch options from the shell LoadOptionPersistersAsync(_componentModel, cancellationToken).Forget(); _workspace = _componentModel.GetService<VisualStudioWorkspace>(); // Fetch the session synchronously on the UI thread; if this doesn't happen before we try using this on // the background thread then we will experience hangs like we see in this bug: // https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?_a=edit&id=190808 or // https://devdiv.visualstudio.com/DevDiv/_workitems?id=296981&_a=edit var telemetryService = (VisualStudioWorkspaceTelemetryService)_workspace.Services.GetRequiredService<IWorkspaceTelemetryService>(); telemetryService.InitializeTelemetrySession(TelemetryService.DefaultSession); Logger.Log(FunctionId.Run_Environment, KeyValueLogMessage.Create(m => m["Version"] = FileVersionInfo.GetVersionInfo(typeof(VisualStudioWorkspace).Assembly.Location).FileVersion)); InitializeColors(); // load some services that have to be loaded in UI thread LoadComponentsInUIContextOnceSolutionFullyLoadedAsync(cancellationToken).Forget(); _solutionEventMonitor = new SolutionEventMonitor(_workspace); TrackBulkFileOperations(); var settingsEditorFactory = _componentModel.GetService<SettingsEditorFactory>(); RegisterEditorFactory(settingsEditorFactory); } private async Task LoadOptionPersistersAsync(IComponentModel componentModel, CancellationToken cancellationToken) { var listenerProvider = componentModel.GetService<IAsynchronousOperationListenerProvider>(); using var token = listenerProvider.GetListener(FeatureAttribute.Workspace).BeginAsyncOperation(nameof(LoadOptionPersistersAsync)); // Switch to a background thread to ensure assembly loads don't show up as UI delays attributed to // InitializeAsync. await TaskScheduler.Default; var persisterProviders = componentModel.GetExtensions<IOptionPersisterProvider>().ToImmutableArray(); foreach (var provider in persisterProviders) { _ = await provider.GetOrCreatePersisterAsync(cancellationToken).ConfigureAwait(true); } } private void InitializeColors() { // Initialize ColorScheme support _colorSchemeApplier = ComponentModel.GetService<ColorSchemeApplier>(); _colorSchemeApplier.Initialize(); } protected override async Task LoadComponentsAsync(CancellationToken cancellationToken) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await GetServiceAsync(typeof(SVsTaskStatusCenterService)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsErrorList)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsSolution)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsShell)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsRunningDocumentTable)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsTextManager)).ConfigureAwait(true); // we need to load it as early as possible since we can have errors from // package from each language very early this.ComponentModel.GetService<TaskCenterSolutionAnalysisProgressReporter>(); this.ComponentModel.GetService<VisualStudioDiagnosticListTableCommandHandler>().Initialize(this); this.ComponentModel.GetService<VisualStudioMetadataAsSourceFileSupportService>(); // The misc files workspace needs to be loaded on the UI thread. This way it will have // the appropriate task scheduler to report events on. this.ComponentModel.GetService<MiscellaneousFilesWorkspace>(); // Load and initialize the add solution item service so ConfigurationUpdater can use it to create editorconfig files. this.ComponentModel.GetService<VisualStudioAddSolutionItemService>().Initialize(this); this.ComponentModel.GetService<IVisualStudioDiagnosticAnalyzerService>().Initialize(this); this.ComponentModel.GetService<RemoveUnusedReferencesCommandHandler>().Initialize(this); this.ComponentModel.GetService<SyncNamespacesCommandHandler>().Initialize(this); LoadAnalyzerNodeComponents(); LoadComponentsBackgroundAsync(cancellationToken).Forget(); } // Overrides for VSSDK003 fix // See https://github.com/Microsoft/VSSDK-Analyzers/blob/main/doc/VSSDK003.md public override IVsAsyncToolWindowFactory GetAsyncToolWindowFactory(Guid toolWindowType) => toolWindowType == typeof(ValueTracking.ValueTrackingToolWindow).GUID ? this : base.GetAsyncToolWindowFactory(toolWindowType); protected override string GetToolWindowTitle(Type toolWindowType, int id) => base.GetToolWindowTitle(toolWindowType, id); protected override Task<object?> InitializeToolWindowAsync(Type toolWindowType, int id, CancellationToken cancellationToken) => Task.FromResult((object?)null); private async Task LoadComponentsBackgroundAsync(CancellationToken cancellationToken) { await TaskScheduler.Default; await LoadInteractiveMenusAsync(cancellationToken).ConfigureAwait(true); // Initialize any experiments async var experiments = this.ComponentModel.DefaultExportProvider.GetExportedValues<IExperiment>(); foreach (var experiment in experiments) { await experiment.InitializeAsync().ConfigureAwait(true); } } private async Task LoadInteractiveMenusAsync(CancellationToken cancellationToken) { // Obtain services and QueryInterface from the main thread await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var menuCommandService = (OleMenuCommandService)await GetServiceAsync(typeof(IMenuCommandService)).ConfigureAwait(true); var monitorSelectionService = (IVsMonitorSelection)await GetServiceAsync(typeof(SVsShellMonitorSelection)).ConfigureAwait(true); // Switch to the background object for constructing commands await TaskScheduler.Default; await new CSharpResetInteractiveMenuCommand(menuCommandService, monitorSelectionService, ComponentModel) .InitializeResetInteractiveFromProjectCommandAsync() .ConfigureAwait(true); await new VisualBasicResetInteractiveMenuCommand(menuCommandService, monitorSelectionService, ComponentModel) .InitializeResetInteractiveFromProjectCommandAsync() .ConfigureAwait(true); } internal IComponentModel ComponentModel { get { return _componentModel ?? throw new InvalidOperationException($"Cannot use {nameof(RoslynPackage)}.{nameof(ComponentModel)} prior to initialization."); } } protected override void Dispose(bool disposing) { DisposeVisualStudioServices(); UnregisterAnalyzerTracker(); UnregisterRuleSetEventHandler(); ReportSessionWideTelemetry(); if (_solutionEventMonitor != null) { _solutionEventMonitor.Dispose(); _solutionEventMonitor = null; } base.Dispose(disposing); } private void ReportSessionWideTelemetry() { SolutionLogger.ReportTelemetry(); AsyncCompletionLogger.ReportTelemetry(); CompletionProvidersLogger.ReportTelemetry(); ChangeSignatureLogger.ReportTelemetry(); } private void DisposeVisualStudioServices() { if (_workspace != null) { _workspace.Services.GetRequiredService<VisualStudioMetadataReferenceManager>().DisconnectFromVisualStudioNativeServices(); } } private void LoadAnalyzerNodeComponents() { this.ComponentModel.GetService<IAnalyzerNodeSetup>().Initialize(this); _ruleSetEventHandler = this.ComponentModel.GetService<RuleSetEventHandler>(); if (_ruleSetEventHandler != null) { _ruleSetEventHandler.Register(); } } private void UnregisterAnalyzerTracker() => this.ComponentModel.GetService<IAnalyzerNodeSetup>().Unregister(); private void UnregisterRuleSetEventHandler() { if (_ruleSetEventHandler != null) { _ruleSetEventHandler.Unregister(); _ruleSetEventHandler = null; } } private void TrackBulkFileOperations() { RoslynDebug.AssertNotNull(_workspace); // we will pause whatever ambient work loads we have that are tied to IGlobalOperationNotificationService // such as solution crawler, pre-emptive remote host synchronization and etc. any background work users didn't // explicitly asked for. // // this should give all resources to BulkFileOperation. we do same for things like build, // debugging, wait dialog and etc. BulkFileOperation is used for things like git branch switching and etc. var globalNotificationService = _workspace.Services.GetRequiredService<IGlobalOperationNotificationService>(); // BulkFileOperation can't have nested events. there will be ever only 1 events (Begin/End) // so we only need simple tracking. var gate = new object(); GlobalOperationRegistration? localRegistration = null; BulkFileOperation.End += (s, a) => { StopBulkFileOperationNotification(); }; BulkFileOperation.Begin += (s, a) => { StartBulkFileOperationNotification(); }; void StartBulkFileOperationNotification() { RoslynDebug.Assert(gate != null); RoslynDebug.Assert(globalNotificationService != null); lock (gate) { // this shouldn't happen, but we are using external component // so guarding us from them if (localRegistration != null) { FatalError.ReportAndCatch(new InvalidOperationException("BulkFileOperation already exist")); return; } localRegistration = globalNotificationService.Start("BulkFileOperation"); } } void StopBulkFileOperationNotification() { RoslynDebug.Assert(gate != null); lock (gate) { // this can happen if BulkFileOperation was already in the middle // of running. to make things simpler, decide to not use IsInProgress // which we need to worry about race case. if (localRegistration == null) { return; } localRegistration.Dispose(); localRegistration = null; } } } } }
// 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 System; using System.Collections.Immutable; using System.ComponentModel.Design; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.ChangeSignature; using Microsoft.CodeAnalysis.Completion.Log; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Logging; using Microsoft.CodeAnalysis.Notification; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.SolutionCrawler; using Microsoft.CodeAnalysis.Telemetry; using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.LanguageServices.ColorSchemes; using Microsoft.VisualStudio.LanguageServices.EditorConfigSettings; using Microsoft.VisualStudio.LanguageServices.Implementation; using Microsoft.VisualStudio.LanguageServices.Implementation.Diagnostics; using Microsoft.VisualStudio.LanguageServices.Implementation.Interactive; using Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.RuleSets; using Microsoft.VisualStudio.LanguageServices.Implementation.SyncNamespaces; using Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource; using Microsoft.VisualStudio.LanguageServices.Implementation.UnusedReferences; using Microsoft.VisualStudio.LanguageServices.Telemetry; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.TaskStatusCenter; using Microsoft.VisualStudio.Telemetry; using Microsoft.VisualStudio.TextManager.Interop; using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; using Task = System.Threading.Tasks.Task; namespace Microsoft.VisualStudio.LanguageServices.Setup { [Guid(Guids.RoslynPackageIdString)] // The option page configuration is duplicated in PackageRegistration.pkgdef [ProvideToolWindow(typeof(ValueTracking.ValueTrackingToolWindow))] internal sealed class RoslynPackage : AbstractPackage { // The randomly-generated key name is used for serializing the Background Analysis Scope preference to the .SUO // file. It doesn't have any semantic meaning, but is intended to not conflict with any other extension that // might be saving an "AnalysisScope" named stream to the same file. // note: must be <= 31 characters long private const string BackgroundAnalysisScopeOptionKey = "AnalysisScope-DCE33A29A768"; private const byte BackgroundAnalysisScopeOptionVersion = 1; private static RoslynPackage? _lazyInstance; private VisualStudioWorkspace? _workspace; private IComponentModel? _componentModel; private RuleSetEventHandler? _ruleSetEventHandler; private ColorSchemeApplier? _colorSchemeApplier; private IDisposable? _solutionEventMonitor; private BackgroundAnalysisScope? _analysisScope; public RoslynPackage() { // We need to register an option in order for OnLoadOptions/OnSaveOptions to be called AddOptionKey(BackgroundAnalysisScopeOptionKey); } public BackgroundAnalysisScope? AnalysisScope { get { return _analysisScope; } set { if (_analysisScope == value) return; _analysisScope = value; AnalysisScopeChanged?.Invoke(this, EventArgs.Empty); } } public event EventHandler? AnalysisScopeChanged; internal static async ValueTask<RoslynPackage?> GetOrLoadAsync(IThreadingContext threadingContext, IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { if (_lazyInstance is null) { await threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var shell = (IVsShell7?)await serviceProvider.GetServiceAsync(typeof(SVsShell)).ConfigureAwait(true); Assumes.Present(shell); await shell.LoadPackageAsync(typeof(RoslynPackage).GUID); if (ErrorHandler.Succeeded(((IVsShell)shell).IsPackageLoaded(typeof(RoslynPackage).GUID, out var package))) { _lazyInstance = (RoslynPackage)package; } } return _lazyInstance; } protected override void OnLoadOptions(string key, Stream stream) { if (key == BackgroundAnalysisScopeOptionKey) { if (stream.ReadByte() == BackgroundAnalysisScopeOptionVersion) { var hasValue = stream.ReadByte() == 1; AnalysisScope = hasValue ? (BackgroundAnalysisScope)stream.ReadByte() : null; } else { AnalysisScope = null; } } base.OnLoadOptions(key, stream); } protected override void OnSaveOptions(string key, Stream stream) { if (key == BackgroundAnalysisScopeOptionKey) { stream.WriteByte(BackgroundAnalysisScopeOptionVersion); stream.WriteByte(AnalysisScope.HasValue ? (byte)1 : (byte)0); stream.WriteByte((byte)AnalysisScope.GetValueOrDefault()); } base.OnSaveOptions(key, stream); } protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress) { await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true); await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); _componentModel = (IComponentModel)await GetServiceAsync(typeof(SComponentModel)).ConfigureAwait(true); cancellationToken.ThrowIfCancellationRequested(); Assumes.Present(_componentModel); // Ensure the options persisters are loaded since we have to fetch options from the shell LoadOptionPersistersAsync(_componentModel, cancellationToken).Forget(); _workspace = _componentModel.GetService<VisualStudioWorkspace>(); // Fetch the session synchronously on the UI thread; if this doesn't happen before we try using this on // the background thread then we will experience hangs like we see in this bug: // https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems?_a=edit&id=190808 or // https://devdiv.visualstudio.com/DevDiv/_workitems?id=296981&_a=edit var telemetryService = (VisualStudioWorkspaceTelemetryService)_workspace.Services.GetRequiredService<IWorkspaceTelemetryService>(); telemetryService.InitializeTelemetrySession(TelemetryService.DefaultSession); Logger.Log(FunctionId.Run_Environment, KeyValueLogMessage.Create(m => m["Version"] = FileVersionInfo.GetVersionInfo(typeof(VisualStudioWorkspace).Assembly.Location).FileVersion)); InitializeColors(); // load some services that have to be loaded in UI thread LoadComponentsInUIContextOnceSolutionFullyLoadedAsync(cancellationToken).Forget(); _solutionEventMonitor = new SolutionEventMonitor(_workspace); TrackBulkFileOperations(); var settingsEditorFactory = _componentModel.GetService<SettingsEditorFactory>(); RegisterEditorFactory(settingsEditorFactory); } private async Task LoadOptionPersistersAsync(IComponentModel componentModel, CancellationToken cancellationToken) { var listenerProvider = componentModel.GetService<IAsynchronousOperationListenerProvider>(); using var token = listenerProvider.GetListener(FeatureAttribute.Workspace).BeginAsyncOperation(nameof(LoadOptionPersistersAsync)); // Switch to a background thread to ensure assembly loads don't show up as UI delays attributed to // InitializeAsync. await TaskScheduler.Default; var persisterProviders = componentModel.GetExtensions<IOptionPersisterProvider>().ToImmutableArray(); foreach (var provider in persisterProviders) { _ = await provider.GetOrCreatePersisterAsync(cancellationToken).ConfigureAwait(true); } } private void InitializeColors() { // Initialize ColorScheme support _colorSchemeApplier = ComponentModel.GetService<ColorSchemeApplier>(); _colorSchemeApplier.Initialize(); } protected override async Task LoadComponentsAsync(CancellationToken cancellationToken) { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await GetServiceAsync(typeof(SVsTaskStatusCenterService)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsErrorList)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsSolution)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsShell)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsRunningDocumentTable)).ConfigureAwait(true); await GetServiceAsync(typeof(SVsTextManager)).ConfigureAwait(true); // we need to load it as early as possible since we can have errors from // package from each language very early this.ComponentModel.GetService<TaskCenterSolutionAnalysisProgressReporter>(); this.ComponentModel.GetService<VisualStudioDiagnosticListTableCommandHandler>().Initialize(this); this.ComponentModel.GetService<VisualStudioMetadataAsSourceFileSupportService>(); // The misc files workspace needs to be loaded on the UI thread. This way it will have // the appropriate task scheduler to report events on. this.ComponentModel.GetService<MiscellaneousFilesWorkspace>(); // Load and initialize the add solution item service so ConfigurationUpdater can use it to create editorconfig files. this.ComponentModel.GetService<VisualStudioAddSolutionItemService>().Initialize(this); this.ComponentModel.GetService<IVisualStudioDiagnosticAnalyzerService>().Initialize(this); this.ComponentModel.GetService<RemoveUnusedReferencesCommandHandler>().Initialize(this); this.ComponentModel.GetService<SyncNamespacesCommandHandler>().Initialize(this); LoadAnalyzerNodeComponents(); LoadComponentsBackgroundAsync(cancellationToken).Forget(); } // Overrides for VSSDK003 fix // See https://github.com/Microsoft/VSSDK-Analyzers/blob/main/doc/VSSDK003.md public override IVsAsyncToolWindowFactory GetAsyncToolWindowFactory(Guid toolWindowType) => toolWindowType == typeof(ValueTracking.ValueTrackingToolWindow).GUID ? this : base.GetAsyncToolWindowFactory(toolWindowType); protected override string GetToolWindowTitle(Type toolWindowType, int id) => base.GetToolWindowTitle(toolWindowType, id); protected override Task<object?> InitializeToolWindowAsync(Type toolWindowType, int id, CancellationToken cancellationToken) => Task.FromResult((object?)null); private async Task LoadComponentsBackgroundAsync(CancellationToken cancellationToken) { await TaskScheduler.Default; await LoadInteractiveMenusAsync(cancellationToken).ConfigureAwait(true); // Initialize keybinding reset detector await ComponentModel.DefaultExportProvider.GetExportedValue<KeybindingReset.KeybindingResetDetector>().InitializeAsync().ConfigureAwait(true); } private async Task LoadInteractiveMenusAsync(CancellationToken cancellationToken) { // Obtain services and QueryInterface from the main thread await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var menuCommandService = (OleMenuCommandService)await GetServiceAsync(typeof(IMenuCommandService)).ConfigureAwait(true); var monitorSelectionService = (IVsMonitorSelection)await GetServiceAsync(typeof(SVsShellMonitorSelection)).ConfigureAwait(true); // Switch to the background object for constructing commands await TaskScheduler.Default; await new CSharpResetInteractiveMenuCommand(menuCommandService, monitorSelectionService, ComponentModel) .InitializeResetInteractiveFromProjectCommandAsync() .ConfigureAwait(true); await new VisualBasicResetInteractiveMenuCommand(menuCommandService, monitorSelectionService, ComponentModel) .InitializeResetInteractiveFromProjectCommandAsync() .ConfigureAwait(true); } internal IComponentModel ComponentModel { get { return _componentModel ?? throw new InvalidOperationException($"Cannot use {nameof(RoslynPackage)}.{nameof(ComponentModel)} prior to initialization."); } } protected override void Dispose(bool disposing) { DisposeVisualStudioServices(); UnregisterAnalyzerTracker(); UnregisterRuleSetEventHandler(); ReportSessionWideTelemetry(); if (_solutionEventMonitor != null) { _solutionEventMonitor.Dispose(); _solutionEventMonitor = null; } base.Dispose(disposing); } private void ReportSessionWideTelemetry() { SolutionLogger.ReportTelemetry(); AsyncCompletionLogger.ReportTelemetry(); CompletionProvidersLogger.ReportTelemetry(); ChangeSignatureLogger.ReportTelemetry(); } private void DisposeVisualStudioServices() { if (_workspace != null) { _workspace.Services.GetRequiredService<VisualStudioMetadataReferenceManager>().DisconnectFromVisualStudioNativeServices(); } } private void LoadAnalyzerNodeComponents() { this.ComponentModel.GetService<IAnalyzerNodeSetup>().Initialize(this); _ruleSetEventHandler = this.ComponentModel.GetService<RuleSetEventHandler>(); if (_ruleSetEventHandler != null) { _ruleSetEventHandler.Register(); } } private void UnregisterAnalyzerTracker() => this.ComponentModel.GetService<IAnalyzerNodeSetup>().Unregister(); private void UnregisterRuleSetEventHandler() { if (_ruleSetEventHandler != null) { _ruleSetEventHandler.Unregister(); _ruleSetEventHandler = null; } } private void TrackBulkFileOperations() { RoslynDebug.AssertNotNull(_workspace); // we will pause whatever ambient work loads we have that are tied to IGlobalOperationNotificationService // such as solution crawler, pre-emptive remote host synchronization and etc. any background work users didn't // explicitly asked for. // // this should give all resources to BulkFileOperation. we do same for things like build, // debugging, wait dialog and etc. BulkFileOperation is used for things like git branch switching and etc. var globalNotificationService = _workspace.Services.GetRequiredService<IGlobalOperationNotificationService>(); // BulkFileOperation can't have nested events. there will be ever only 1 events (Begin/End) // so we only need simple tracking. var gate = new object(); GlobalOperationRegistration? localRegistration = null; BulkFileOperation.End += (s, a) => { StopBulkFileOperationNotification(); }; BulkFileOperation.Begin += (s, a) => { StartBulkFileOperationNotification(); }; void StartBulkFileOperationNotification() { RoslynDebug.Assert(gate != null); RoslynDebug.Assert(globalNotificationService != null); lock (gate) { // this shouldn't happen, but we are using external component // so guarding us from them if (localRegistration != null) { FatalError.ReportAndCatch(new InvalidOperationException("BulkFileOperation already exist")); return; } localRegistration = globalNotificationService.Start("BulkFileOperation"); } } void StopBulkFileOperationNotification() { RoslynDebug.Assert(gate != null); lock (gate) { // this can happen if BulkFileOperation was already in the middle // of running. to make things simpler, decide to not use IsInProgress // which we need to worry about race case. if (localRegistration == null) { return; } localRegistration.Dispose(); localRegistration = null; } } } } }
1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/Core/Portable/Options/GlobalOptionService.cs
// 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 System; using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options.Providers; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Utilities; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Options { [Export(typeof(IGlobalOptionService)), Shared] internal class GlobalOptionService : IGlobalOptionService { private static readonly ImmutableDictionary<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)> s_emptyEditorConfigKeysToOptions = ImmutableDictionary.Create<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)>(AnalyzerConfigOptions.KeyComparer); private readonly IWorkspaceThreadingService? _workspaceThreadingService; private readonly Lazy<ImmutableHashSet<IOption>> _lazyAllOptions; private readonly ImmutableArray<Lazy<IOptionPersisterProvider>> _optionSerializerProviders; private readonly ImmutableDictionary<string, Lazy<ImmutableHashSet<IOption>>> _serializableOptionsByLanguage; private readonly HashSet<string> _forceComputedLanguages; private readonly object _gate = new(); #pragma warning disable IDE0044 // Add readonly modifier - https://github.com/dotnet/roslyn/issues/33009 private ImmutableDictionary<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)> _neutralEditorConfigKeysToOptions = s_emptyEditorConfigKeysToOptions; private ImmutableDictionary<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)> _csharpEditorConfigKeysToOptions = s_emptyEditorConfigKeysToOptions; private ImmutableDictionary<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)> _visualBasicEditorConfigKeysToOptions = s_emptyEditorConfigKeysToOptions; #pragma warning restore IDE0044 // Add readonly modifier private ImmutableArray<IOptionPersister> _lazyOptionSerializers; private ImmutableDictionary<OptionKey, object?> _currentValues; private ImmutableHashSet<OptionKey> _changedOptionKeys; private ImmutableArray<Workspace> _registeredWorkspaces; [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")] public GlobalOptionService( [Import(AllowDefault = true)] IWorkspaceThreadingService? workspaceThreadingService, [ImportMany] IEnumerable<Lazy<IOptionProvider, LanguageMetadata>> optionProviders, [ImportMany] IEnumerable<Lazy<IOptionPersisterProvider>> optionSerializers) { _workspaceThreadingService = workspaceThreadingService; _lazyAllOptions = new Lazy<ImmutableHashSet<IOption>>(() => optionProviders.SelectMany(p => p.Value.Options).ToImmutableHashSet()); _optionSerializerProviders = optionSerializers.ToImmutableArray(); _serializableOptionsByLanguage = CreateLazySerializableOptionsByLanguage(optionProviders); _forceComputedLanguages = new HashSet<string>(); _registeredWorkspaces = ImmutableArray<Workspace>.Empty; _currentValues = ImmutableDictionary.Create<OptionKey, object?>(); _changedOptionKeys = ImmutableHashSet<OptionKey>.Empty; } private static ImmutableDictionary<string, Lazy<ImmutableHashSet<IOption>>> CreateLazySerializableOptionsByLanguage(IEnumerable<Lazy<IOptionProvider, LanguageMetadata>> optionProviders) { var builder = ImmutableDictionary.CreateBuilder<string, Lazy<ImmutableHashSet<IOption>>>(); foreach (var (language, lazyProvidersAndMetadata) in optionProviders.ToPerLanguageMap()) { builder.Add(language, new Lazy<ImmutableHashSet<IOption>>(() => ComputeSerializableOptionsFromProviders(lazyProvidersAndMetadata))); } return builder.ToImmutable(); // Local functions static ImmutableHashSet<IOption> ComputeSerializableOptionsFromProviders(ImmutableArray<Lazy<IOptionProvider, LanguageMetadata>> lazyProvidersAndMetadata) { var builder = ImmutableHashSet.CreateBuilder<IOption>(); foreach (var lazyProviderAndMetadata in lazyProvidersAndMetadata) { // We only consider the options defined in the the DefaultAssemblies (Workspaces and Features) as serializable. // This is due to the fact that other layers above are VS specific and do not execute in OOP. var provider = lazyProviderAndMetadata.Value; if (!MefHostServices.IsDefaultAssembly(provider.GetType().Assembly)) { continue; } builder.AddRange(provider.Options); } return builder.ToImmutable(); } } private ImmutableArray<IOptionPersister> GetOptionPersisters() { // If _lazyOptionSerializers is already initialized, return its value directly. if (_lazyOptionSerializers is { IsDefault: false } optionSerializers) { return optionSerializers; } // Option persisters cannot be initialized while holding the global options lock // https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1353715 Debug.Assert(!Monitor.IsEntered(_gate)); ImmutableInterlocked.InterlockedInitialize( ref _lazyOptionSerializers, GetOptionPersistersSlow(_workspaceThreadingService, _optionSerializerProviders, CancellationToken.None)); return _lazyOptionSerializers; // Local functions static ImmutableArray<IOptionPersister> GetOptionPersistersSlow( IWorkspaceThreadingService? workspaceThreadingService, ImmutableArray<Lazy<IOptionPersisterProvider>> optionSerializerProviders, CancellationToken cancellationToken) { if (workspaceThreadingService is not null) { return workspaceThreadingService.Run(() => GetOptionPersistersAsync(optionSerializerProviders, cancellationToken)); } else { return GetOptionPersistersAsync(optionSerializerProviders, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); } } static async Task<ImmutableArray<IOptionPersister>> GetOptionPersistersAsync( ImmutableArray<Lazy<IOptionPersisterProvider>> optionSerializerProviders, CancellationToken cancellationToken) { return await optionSerializerProviders.SelectAsArrayAsync( static (lazyProvider, cancellationToken) => lazyProvider.Value.GetOrCreatePersisterAsync(cancellationToken), cancellationToken).ConfigureAwait(false); } } private static object? LoadOptionFromSerializerOrGetDefault(OptionKey optionKey, ImmutableArray<IOptionPersister> persisters) { foreach (var serializer in persisters) { // We have a deserializer, so deserialize and use that value. if (serializer.TryFetch(optionKey, out var deserializedValue)) { return deserializedValue; } } // Just use the default. We will still cache this so we aren't trying to deserialize // over and over. return optionKey.Option.DefaultValue; } public IEnumerable<IOption> GetRegisteredOptions() => _lazyAllOptions.Value; public bool TryMapEditorConfigKeyToOption(string key, string? language, [NotNullWhen(true)] out IEditorConfigStorageLocation2? storageLocation, out OptionKey optionKey) { var temporaryOptions = s_emptyEditorConfigKeysToOptions; ref var editorConfigToOptionsStorage = ref temporaryOptions; switch (language) { case LanguageNames.CSharp: // Suppression required due to https://github.com/dotnet/roslyn/issues/42018 editorConfigToOptionsStorage = ref _csharpEditorConfigKeysToOptions!; break; case LanguageNames.VisualBasic: // Suppression required due to https://github.com/dotnet/roslyn/issues/42018 editorConfigToOptionsStorage = ref _visualBasicEditorConfigKeysToOptions!; break; case null: case "": // Suppression required due to https://github.com/dotnet/roslyn/issues/42018 editorConfigToOptionsStorage = ref _neutralEditorConfigKeysToOptions!; break; } var (option, storage) = ImmutableInterlocked.GetOrAdd( ref editorConfigToOptionsStorage, key, (key, arg) => MapToOptionIgnorePerLanguage(arg.self, key, arg.language), (self: this, language)); if (option is object) { RoslynDebug.AssertNotNull(storage); storageLocation = storage; optionKey = option.IsPerLanguage ? new OptionKey(option, language) : new OptionKey(option); return true; } storageLocation = null; optionKey = default; return false; // Local function static (IOption? option, IEditorConfigStorageLocation2? storageLocation) MapToOptionIgnorePerLanguage(GlobalOptionService service, string key, string? language) { // Use GetRegisteredSerializableOptions instead of GetRegisteredOptions to avoid loading assemblies for // inactive languages. foreach (var option in service.GetRegisteredSerializableOptions(ImmutableHashSet.Create(language ?? ""))) { foreach (var storage in option.StorageLocations) { if (!(storage is IEditorConfigStorageLocation2 editorConfigStorage)) continue; if (!AnalyzerConfigOptions.KeyComparer.Equals(key, editorConfigStorage.KeyName)) continue; return (option, editorConfigStorage); } } return (null, null); } } public ImmutableHashSet<IOption> GetRegisteredSerializableOptions(ImmutableHashSet<string> languages) { if (languages.IsEmpty) { return ImmutableHashSet<IOption>.Empty; } var builder = ImmutableHashSet.CreateBuilder<IOption>(); // "string.Empty" for options from language agnostic option providers. builder.AddRange(GetSerializableOptionsForLanguage(string.Empty)); foreach (var language in languages) { builder.AddRange(GetSerializableOptionsForLanguage(language)); } return builder.ToImmutable(); // Local functions. ImmutableHashSet<IOption> GetSerializableOptionsForLanguage(string language) { if (_serializableOptionsByLanguage.TryGetValue(language, out var lazyOptions)) { return lazyOptions.Value; } return ImmutableHashSet<IOption>.Empty; } } /// <summary> /// Gets force computed serializable options with prefetched values for all the registered options applicable to the given <paramref name="languages"/> by quering the option persisters. /// </summary> public SerializableOptionSet GetSerializableOptionsSnapshot(ImmutableHashSet<string> languages, IOptionService optionService) { Debug.Assert(languages.All(RemoteSupportedLanguages.IsSupported)); var serializableOptions = GetRegisteredSerializableOptions(languages); var serializableOptionValues = GetSerializableOptionValues(serializableOptions, languages); var changedOptionsKeysSerializable = _changedOptionKeys .Where(key => serializableOptions.Contains(key.Option) && (!key.Option.IsPerLanguage || languages.Contains(key.Language!))) .ToImmutableHashSet(); return new SerializableOptionSet(languages, optionService, serializableOptions, serializableOptionValues, changedOptionsKeysSerializable); } private ImmutableDictionary<OptionKey, object?> GetSerializableOptionValues(ImmutableHashSet<IOption> optionKeys, ImmutableHashSet<string> languages) { if (optionKeys.IsEmpty) { return ImmutableDictionary<OptionKey, object?>.Empty; } // Ensure the option persisters are available before taking the global lock var persisters = GetOptionPersisters(); lock (_gate) { // Force compute the option values for languages, if required. if (!languages.All(_forceComputedLanguages.Contains)) { foreach (var option in optionKeys) { if (!option.IsPerLanguage) { var key = new OptionKey(option); var _ = GetOption_NoLock(key, persisters); continue; } foreach (var language in languages) { var key = new OptionKey(option, language); var _ = GetOption_NoLock(key, persisters); } } _forceComputedLanguages.AddRange(languages); } return ImmutableDictionary.CreateRange(_currentValues .Where(kvp => optionKeys.Contains(kvp.Key.Option) && (!kvp.Key.Option.IsPerLanguage || languages.Contains(kvp.Key.Language!)))); } } public T GetOption<T>(Option<T> option) => OptionsHelpers.GetOption(option, GetOption); public T GetOption<T>(Option2<T> option) => OptionsHelpers.GetOption(option, GetOption); public T GetOption<T>(PerLanguageOption<T> option, string? language) => OptionsHelpers.GetOption(option, language, GetOption); public T GetOption<T>(PerLanguageOption2<T> option, string? language) => OptionsHelpers.GetOption(option, language, GetOption); public object? GetOption(OptionKey optionKey) { // Ensure the option persisters are available before taking the global lock var persisters = GetOptionPersisters(); lock (_gate) { return GetOption_NoLock(optionKey, persisters); } } private object? GetOption_NoLock(OptionKey optionKey, ImmutableArray<IOptionPersister> persisters) { if (_currentValues.TryGetValue(optionKey, out var value)) { return value; } value = LoadOptionFromSerializerOrGetDefault(optionKey, persisters); _currentValues = _currentValues.Add(optionKey, value); // Track options with non-default values from serializers as changed options. if (!object.Equals(value, optionKey.Option.DefaultValue)) { _changedOptionKeys = _changedOptionKeys.Add(optionKey); } return value; } private void SetOptionCore(OptionKey optionKey, object? newValue) { _currentValues = _currentValues.SetItem(optionKey, newValue); _changedOptionKeys = _changedOptionKeys.Add(optionKey); } public void SetOptions(OptionSet optionSet) { var changedOptionKeys = optionSet switch { null => throw new ArgumentNullException(nameof(optionSet)), SerializableOptionSet serializableOptionSet => serializableOptionSet.GetChangedOptions(), _ => throw new ArgumentException(WorkspacesResources.Options_did_not_come_from_specified_Solution, paramName: nameof(optionSet)) }; var changedOptions = new List<OptionChangedEventArgs>(); // Ensure the option persisters are available before taking the global lock var persisters = GetOptionPersisters(); lock (_gate) { foreach (var optionKey in changedOptionKeys) { var setValue = optionSet.GetOption(optionKey); var currentValue = this.GetOption(optionKey); if (object.Equals(currentValue, setValue)) { // Identical, so nothing is changing continue; } // The value is actually changing, so update changedOptions.Add(new OptionChangedEventArgs(optionKey, setValue)); SetOptionCore(optionKey, setValue); foreach (var serializer in persisters) { if (serializer.TryPersist(optionKey, setValue)) { break; } } } } // Outside of the lock, raise the events on our task queue. UpdateRegisteredWorkspacesAndRaiseEvents(changedOptions); } public void RefreshOption(OptionKey optionKey, object? newValue) { lock (_gate) { if (_currentValues.TryGetValue(optionKey, out var oldValue)) { if (object.Equals(oldValue, newValue)) { // Value is still the same, no reason to raise events return; } } SetOptionCore(optionKey, newValue); } UpdateRegisteredWorkspacesAndRaiseEvents(new List<OptionChangedEventArgs> { new OptionChangedEventArgs(optionKey, newValue) }); } private void UpdateRegisteredWorkspacesAndRaiseEvents(List<OptionChangedEventArgs> changedOptions) { if (changedOptions.Count == 0) { return; } // Ensure that the Workspace's CurrentSolution snapshot is updated with new options for all registered workspaces // prior to raising option changed event handlers. using var disposer = ArrayBuilder<Workspace>.GetInstance(out var workspacesBuilder); lock (_gate) { workspacesBuilder.AddRange(_registeredWorkspaces); } foreach (var workspace in workspacesBuilder) { workspace.UpdateCurrentSolutionOnOptionsChanged(); } // Raise option changed events. var optionChanged = OptionChanged; if (optionChanged != null) { foreach (var changedOption in changedOptions) { optionChanged(this, changedOption); } } } public void RegisterWorkspace(Workspace workspace) { lock (_gate) { _registeredWorkspaces = _registeredWorkspaces.Add(workspace); } } public void UnregisterWorkspace(Workspace workspace) { lock (_gate) { _registeredWorkspaces = _registeredWorkspaces.Remove(workspace); } } public event EventHandler<OptionChangedEventArgs>? OptionChanged; } }
// 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 System; using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options.Providers; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.Collections; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Utilities; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Options { [Export(typeof(IGlobalOptionService)), Shared] internal sealed class GlobalOptionService : IGlobalOptionService { private static readonly ImmutableDictionary<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)> s_emptyEditorConfigKeysToOptions = ImmutableDictionary.Create<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)>(AnalyzerConfigOptions.KeyComparer); private readonly IWorkspaceThreadingService? _workspaceThreadingService; private readonly Lazy<ImmutableHashSet<IOption>> _lazyAllOptions; private readonly ImmutableArray<Lazy<IOptionPersisterProvider>> _optionPersisterProviders; private readonly ImmutableDictionary<string, Lazy<ImmutableHashSet<IOption>>> _serializableOptionsByLanguage; private readonly HashSet<string> _forceComputedLanguages; // access is interlocked private ImmutableArray<Workspace> _registeredWorkspaces; private readonly object _gate = new(); #region Guarded by _gate #pragma warning disable IDE0044 // Add readonly modifier - https://github.com/dotnet/roslyn/issues/46785 private ImmutableDictionary<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)> _neutralEditorConfigKeysToOptions = s_emptyEditorConfigKeysToOptions; private ImmutableDictionary<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)> _csharpEditorConfigKeysToOptions = s_emptyEditorConfigKeysToOptions; private ImmutableDictionary<string, (IOption? option, IEditorConfigStorageLocation2? storageLocation)> _visualBasicEditorConfigKeysToOptions = s_emptyEditorConfigKeysToOptions; #pragma warning restore IDE0044 // Add readonly modifier private ImmutableArray<IOptionPersister> _lazyOptionPersisters; private ImmutableDictionary<OptionKey, object?> _currentValues; private ImmutableHashSet<OptionKey> _changedOptionKeys; #endregion [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")] public GlobalOptionService( [Import(AllowDefault = true)] IWorkspaceThreadingService? workspaceThreadingService, [ImportMany] IEnumerable<Lazy<IOptionProvider, LanguageMetadata>> optionProviders, [ImportMany] IEnumerable<Lazy<IOptionPersisterProvider>> optionPersisters) { _workspaceThreadingService = workspaceThreadingService; _lazyAllOptions = new Lazy<ImmutableHashSet<IOption>>(() => optionProviders.SelectMany(p => p.Value.Options).ToImmutableHashSet()); _optionPersisterProviders = optionPersisters.ToImmutableArray(); _serializableOptionsByLanguage = CreateLazySerializableOptionsByLanguage(optionProviders); _forceComputedLanguages = new HashSet<string>(); _registeredWorkspaces = ImmutableArray<Workspace>.Empty; _currentValues = ImmutableDictionary.Create<OptionKey, object?>(); _changedOptionKeys = ImmutableHashSet<OptionKey>.Empty; } private static ImmutableDictionary<string, Lazy<ImmutableHashSet<IOption>>> CreateLazySerializableOptionsByLanguage(IEnumerable<Lazy<IOptionProvider, LanguageMetadata>> optionProviders) { var builder = ImmutableDictionary.CreateBuilder<string, Lazy<ImmutableHashSet<IOption>>>(); foreach (var (language, lazyProvidersAndMetadata) in optionProviders.ToPerLanguageMap()) { builder.Add(language, new Lazy<ImmutableHashSet<IOption>>(() => ComputeSerializableOptionsFromProviders(lazyProvidersAndMetadata))); } return builder.ToImmutable(); // Local functions static ImmutableHashSet<IOption> ComputeSerializableOptionsFromProviders(ImmutableArray<Lazy<IOptionProvider, LanguageMetadata>> lazyProvidersAndMetadata) { var builder = ImmutableHashSet.CreateBuilder<IOption>(); foreach (var lazyProviderAndMetadata in lazyProvidersAndMetadata) { var provider = lazyProviderAndMetadata.Value; if (!IsSolutionOptionProvider(provider)) { continue; } builder.AddRange(provider.Options); } return builder.ToImmutable(); } } // We only consider the options defined in the the DefaultAssemblies (Workspaces and Features) as serializable. // This is due to the fact that other layers above are VS specific and do not execute in OOP. internal static bool IsSolutionOptionProvider(IOptionProvider provider) => MefHostServices.IsDefaultAssembly(provider.GetType().Assembly); private ImmutableArray<IOptionPersister> GetOptionPersisters() { if (_lazyOptionPersisters.IsDefault) { // Option persisters cannot be initialized while holding the global options lock // https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1353715 Debug.Assert(!Monitor.IsEntered(_gate)); ImmutableInterlocked.InterlockedInitialize( ref _lazyOptionPersisters, GetOptionPersistersSlow(_workspaceThreadingService, _optionPersisterProviders, CancellationToken.None)); } return _lazyOptionPersisters; // Local functions static ImmutableArray<IOptionPersister> GetOptionPersistersSlow( IWorkspaceThreadingService? workspaceThreadingService, ImmutableArray<Lazy<IOptionPersisterProvider>> persisterProviders, CancellationToken cancellationToken) { if (workspaceThreadingService is not null) { return workspaceThreadingService.Run(() => GetOptionPersistersAsync(persisterProviders, cancellationToken)); } else { return GetOptionPersistersAsync(persisterProviders, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); } } static async Task<ImmutableArray<IOptionPersister>> GetOptionPersistersAsync( ImmutableArray<Lazy<IOptionPersisterProvider>> persisterProviders, CancellationToken cancellationToken) { return await persisterProviders.SelectAsArrayAsync( static (lazyProvider, cancellationToken) => lazyProvider.Value.GetOrCreatePersisterAsync(cancellationToken), cancellationToken).ConfigureAwait(false); } } private static object? LoadOptionFromPersisterOrGetDefault(OptionKey optionKey, ImmutableArray<IOptionPersister> persisters) { foreach (var persister in persisters) { if (persister.TryFetch(optionKey, out var persistedValue)) { return persistedValue; } } // Just use the default. We will still cache this so we aren't trying to deserialize // over and over. return optionKey.Option.DefaultValue; } public IEnumerable<IOption> GetRegisteredOptions() => _lazyAllOptions.Value; public bool TryMapEditorConfigKeyToOption(string key, string? language, [NotNullWhen(true)] out IEditorConfigStorageLocation2? storageLocation, out OptionKey optionKey) { var temporaryOptions = s_emptyEditorConfigKeysToOptions; ref var editorConfigToOptionsStorage = ref temporaryOptions; switch (language) { case LanguageNames.CSharp: editorConfigToOptionsStorage = ref _csharpEditorConfigKeysToOptions!; break; case LanguageNames.VisualBasic: editorConfigToOptionsStorage = ref _visualBasicEditorConfigKeysToOptions!; break; case null: case "": editorConfigToOptionsStorage = ref _neutralEditorConfigKeysToOptions!; break; } var (option, storage) = ImmutableInterlocked.GetOrAdd( ref editorConfigToOptionsStorage, key, (key, arg) => MapToOptionIgnorePerLanguage(arg.self, key, arg.language), (self: this, language)); if (option is object) { RoslynDebug.AssertNotNull(storage); storageLocation = storage; optionKey = option.IsPerLanguage ? new OptionKey(option, language) : new OptionKey(option); return true; } storageLocation = null; optionKey = default; return false; // Local function static (IOption? option, IEditorConfigStorageLocation2? storageLocation) MapToOptionIgnorePerLanguage(GlobalOptionService service, string key, string? language) { // Use GetRegisteredSerializableOptions instead of GetRegisteredOptions to avoid loading assemblies for // inactive languages. foreach (var option in service.GetRegisteredSerializableOptions(ImmutableHashSet.Create(language ?? ""))) { foreach (var storage in option.StorageLocations) { if (storage is not IEditorConfigStorageLocation2 editorConfigStorage) continue; if (!AnalyzerConfigOptions.KeyComparer.Equals(key, editorConfigStorage.KeyName)) continue; return (option, editorConfigStorage); } } return (null, null); } } public ImmutableHashSet<IOption> GetRegisteredSerializableOptions(ImmutableHashSet<string> languages) { if (languages.IsEmpty) { return ImmutableHashSet<IOption>.Empty; } var builder = ImmutableHashSet.CreateBuilder<IOption>(); // "string.Empty" for options from language agnostic option providers. builder.AddRange(GetSerializableOptionsForLanguage(string.Empty)); foreach (var language in languages) { builder.AddRange(GetSerializableOptionsForLanguage(language)); } return builder.ToImmutable(); // Local functions. ImmutableHashSet<IOption> GetSerializableOptionsForLanguage(string language) { if (_serializableOptionsByLanguage.TryGetValue(language, out var lazyOptions)) { return lazyOptions.Value; } return ImmutableHashSet<IOption>.Empty; } } /// <summary> /// Gets force computed serializable options with prefetched values for all the registered options applicable to the given <paramref name="languages"/> by quering the option persisters. /// </summary> public SerializableOptionSet GetSerializableOptionsSnapshot(ImmutableHashSet<string> languages, IOptionService optionService) { Debug.Assert(languages.All(RemoteSupportedLanguages.IsSupported)); var serializableOptions = GetRegisteredSerializableOptions(languages); var serializableOptionValues = GetSerializableOptionValues(serializableOptions, languages); var changedOptionsKeysSerializable = _changedOptionKeys .Where(key => serializableOptions.Contains(key.Option) && (!key.Option.IsPerLanguage || languages.Contains(key.Language!))) .ToImmutableHashSet(); return new SerializableOptionSet(languages, optionService, serializableOptions, serializableOptionValues, changedOptionsKeysSerializable); } private ImmutableDictionary<OptionKey, object?> GetSerializableOptionValues(ImmutableHashSet<IOption> optionKeys, ImmutableHashSet<string> languages) { if (optionKeys.IsEmpty) { return ImmutableDictionary<OptionKey, object?>.Empty; } // Ensure the option persisters are available before taking the global lock var persisters = GetOptionPersisters(); lock (_gate) { // Force compute the option values for languages, if required. if (!languages.All(_forceComputedLanguages.Contains)) { foreach (var option in optionKeys) { if (!option.IsPerLanguage) { var key = new OptionKey(option); var _ = GetOption_NoLock(key, persisters); continue; } foreach (var language in languages) { var key = new OptionKey(option, language); var _ = GetOption_NoLock(key, persisters); } } _forceComputedLanguages.AddRange(languages); } return ImmutableDictionary.CreateRange(_currentValues .Where(kvp => optionKeys.Contains(kvp.Key.Option) && (!kvp.Key.Option.IsPerLanguage || languages.Contains(kvp.Key.Language!)))); } } public T GetOption<T>(Option<T> option) => OptionsHelpers.GetOption(option, GetOption); public T GetOption<T>(Option2<T> option) => OptionsHelpers.GetOption(option, GetOption); public T GetOption<T>(PerLanguageOption<T> option, string? language) => OptionsHelpers.GetOption(option, language, GetOption); public T GetOption<T>(PerLanguageOption2<T> option, string? language) => OptionsHelpers.GetOption(option, language, GetOption); public object? GetOption(OptionKey optionKey) { // Ensure the option persisters are available before taking the global lock var persisters = GetOptionPersisters(); lock (_gate) { return GetOption_NoLock(optionKey, persisters); } } public ImmutableArray<object?> GetOptions(ImmutableArray<OptionKey> optionKeys) { // Ensure the option persisters are available before taking the global lock var persisters = GetOptionPersisters(); using var values = TemporaryArray<object?>.Empty; lock (_gate) { foreach (var optionKey in optionKeys) { values.Add(GetOption_NoLock(optionKey, persisters)); } } return values.ToImmutableAndClear(); } private object? GetOption_NoLock(OptionKey optionKey, ImmutableArray<IOptionPersister> persisters) { if (_currentValues.TryGetValue(optionKey, out var value)) { return value; } value = LoadOptionFromPersisterOrGetDefault(optionKey, persisters); _currentValues = _currentValues.Add(optionKey, value); // Track options with non-default values from serializers as changed options. if (!object.Equals(value, optionKey.Option.DefaultValue)) { _changedOptionKeys = _changedOptionKeys.Add(optionKey); } return value; } private void SetOptionCore(OptionKey optionKey, object? newValue) { _currentValues = _currentValues.SetItem(optionKey, newValue); _changedOptionKeys = _changedOptionKeys.Add(optionKey); } public void SetGlobalOption(OptionKey optionKey, object? value) => SetGlobalOptions(ImmutableArray.Create(optionKey), ImmutableArray.Create(value)); public void SetGlobalOptions(ImmutableArray<OptionKey> optionKeys, ImmutableArray<object?> values) { Contract.ThrowIfFalse(optionKeys.Length == values.Length); var changedOptions = new List<OptionChangedEventArgs>(); var persisters = GetOptionPersisters(); lock (_gate) { for (var i = 0; i < optionKeys.Length; i++) { var optionKey = optionKeys[i]; var value = values[i]; var existingValue = GetOption_NoLock(optionKey, persisters); if (Equals(value, existingValue)) { continue; } // not updating _changedOptionKeys since that's only relevant for serializable options, not global ones _currentValues = _currentValues.SetItem(optionKey, value); changedOptions.Add(new OptionChangedEventArgs(optionKey, value)); } } for (var i = 0; i < optionKeys.Length; i++) { PersistOption(persisters, optionKeys[i], values[i]); } RaiseOptionChangedEvent(changedOptions); } public void SetOptions(OptionSet optionSet) { var changedOptionKeys = optionSet switch { null => throw new ArgumentNullException(nameof(optionSet)), SerializableOptionSet serializableOptionSet => serializableOptionSet.GetChangedOptions(), _ => throw new ArgumentException(WorkspacesResources.Options_did_not_come_from_specified_Solution, paramName: nameof(optionSet)) }; var changedOptions = new List<OptionChangedEventArgs>(); lock (_gate) { foreach (var optionKey in changedOptionKeys) { var newValue = optionSet.GetOption(optionKey); var currentValue = this.GetOption(optionKey); if (object.Equals(currentValue, newValue)) { // Identical, so nothing is changing continue; } // The value is actually changing, so update changedOptions.Add(new OptionChangedEventArgs(optionKey, newValue)); SetOptionCore(optionKey, newValue); } } var persisters = GetOptionPersisters(); foreach (var changedOption in changedOptions) { PersistOption(persisters, changedOption.OptionKey, changedOption.Value); } // Outside of the lock, raise the events on our task queue. UpdateRegisteredWorkspacesAndRaiseEvents(changedOptions); } private static void PersistOption(ImmutableArray<IOptionPersister> persisters, OptionKey optionKey, object? value) { foreach (var persister in persisters) { if (persister.TryPersist(optionKey, value)) { break; } } } public void RefreshOption(OptionKey optionKey, object? newValue) { lock (_gate) { if (_currentValues.TryGetValue(optionKey, out var oldValue)) { if (object.Equals(oldValue, newValue)) { // Value is still the same, no reason to raise events return; } } SetOptionCore(optionKey, newValue); } UpdateRegisteredWorkspacesAndRaiseEvents(new List<OptionChangedEventArgs> { new OptionChangedEventArgs(optionKey, newValue) }); } private void UpdateRegisteredWorkspacesAndRaiseEvents(List<OptionChangedEventArgs> changedOptions) { if (changedOptions.Count == 0) { return; } // Ensure that the Workspace's CurrentSolution snapshot is updated with new options for all registered workspaces // prior to raising option changed event handlers. foreach (var workspace in _registeredWorkspaces) { workspace.UpdateCurrentSolutionOnOptionsChanged(); } RaiseOptionChangedEvent(changedOptions); } private void RaiseOptionChangedEvent(List<OptionChangedEventArgs> changedOptions) { // Raise option changed events. var optionChanged = OptionChanged; if (optionChanged != null) { foreach (var changedOption in changedOptions) { optionChanged(this, changedOption); } } } public void RegisterWorkspace(Workspace workspace) => ImmutableInterlocked.Update(ref _registeredWorkspaces, (workspaces, workspace) => workspaces.Add(workspace), workspace); public void UnregisterWorkspace(Workspace workspace) => ImmutableInterlocked.Update(ref _registeredWorkspaces, (workspaces, workspace) => workspaces.Remove(workspace), workspace); public event EventHandler<OptionChangedEventArgs>? OptionChanged; } }
1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/Core/Portable/Options/IGlobalOptionService.cs
// 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 System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; namespace Microsoft.CodeAnalysis.Options { /// <summary> /// Provides services for reading and writing options. /// This will provide support for options at the global level (i.e. shared among /// all workspaces/services). /// /// In general you should not import this type directly, and should instead get an /// <see cref="IOptionService"/> from <see cref="Workspace.Services"/> /// </summary> internal interface IGlobalOptionService { /// <summary> /// Gets the current value of the specific option. /// </summary> T? GetOption<T>(Option<T> option); /// <summary> /// Gets the current value of the specific option. /// </summary> T? GetOption<T>(Option2<T> option); /// <summary> /// Gets the current value of the specific option. /// </summary> T? GetOption<T>(PerLanguageOption<T> option, string? languageName); /// <summary> /// Gets the current value of the specific option. /// </summary> T? GetOption<T>(PerLanguageOption2<T> option, string? languageName); /// <summary> /// Gets the current value of the specific option. /// </summary> object? GetOption(OptionKey optionKey); /// <summary> /// Applies a set of options, invoking serializers if needed. /// </summary> void SetOptions(OptionSet optionSet); /// <summary> /// Gets force computed serializable options snapshot with prefetched values for the registered options applicable to the given <paramref name="languages"/> by quering the option persisters. /// </summary> SerializableOptionSet GetSerializableOptionsSnapshot(ImmutableHashSet<string> languages, IOptionService optionService); /// <summary> /// Returns the set of all registered options. /// </summary> IEnumerable<IOption> GetRegisteredOptions(); /// <summary> /// Map an <strong>.editorconfig</strong> key to a corresponding <see cref="IEditorConfigStorageLocation2"/> and /// <see cref="OptionKey"/> that can be used to read and write the value stored in an <see cref="OptionSet"/>. /// </summary> /// <param name="key">The <strong>.editorconfig</strong> key.</param> /// <param name="language">The language to use for the <paramref name="optionKey"/>, if the matching option has /// <see cref="IOption.IsPerLanguage"/> set.</param> /// <param name="storageLocation">The <see cref="IEditorConfigStorageLocation2"/> for the key.</param> /// <param name="optionKey">The <see cref="OptionKey"/> for the key and language.</param> /// <returns><see langword="true"/> if a matching option was found; otherwise, <see langword="false"/>.</returns> bool TryMapEditorConfigKeyToOption(string key, string? language, [NotNullWhen(true)] out IEditorConfigStorageLocation2? storageLocation, out OptionKey optionKey); /// <summary> /// Returns the set of all registered serializable options applicable for the given <paramref name="languages"/>. /// </summary> ImmutableHashSet<IOption> GetRegisteredSerializableOptions(ImmutableHashSet<string> languages); event EventHandler<OptionChangedEventArgs>? OptionChanged; /// <summary> /// Refreshes the stored value of a serialized option. This should only be called from serializers. /// </summary> void RefreshOption(OptionKey optionKey, object? newValue); /// <summary> /// Registers a workspace with the option service. /// </summary> void RegisterWorkspace(Workspace workspace); /// <summary> /// Unregisters a workspace from the option service. /// </summary> void UnregisterWorkspace(Workspace workspace); } }
// 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 System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; namespace Microsoft.CodeAnalysis.Options { /// <summary> /// Provides services for reading and writing options. /// This will provide support for options at the global level (i.e. shared among /// all workspaces/services). /// /// In general you should not import this type directly, and should instead get an /// <see cref="IOptionService"/> from <see cref="Workspace.Services"/> /// </summary> internal interface IGlobalOptionService { /// <summary> /// Gets the current value of the specific option. /// </summary> T? GetOption<T>(Option<T> option); /// <summary> /// Gets the current value of the specific option. /// </summary> T? GetOption<T>(Option2<T> option); /// <summary> /// Gets the current value of the specific option. /// </summary> T? GetOption<T>(PerLanguageOption<T> option, string? languageName); /// <summary> /// Gets the current value of the specific option. /// </summary> T? GetOption<T>(PerLanguageOption2<T> option, string? languageName); /// <summary> /// Gets the current value of the specific option. /// </summary> object? GetOption(OptionKey optionKey); /// <summary> /// Gets the current values of specified options. /// All options are read atomically. /// </summary> ImmutableArray<object?> GetOptions(ImmutableArray<OptionKey> optionKeys); /// <summary> /// Applies a set of options. /// If any option changed its value invokes registered option persisters, updates current solutions of all registered workspaces and triggers <see cref="OptionChanged"/>. /// </summary> void SetOptions(OptionSet optionSet); /// <summary> /// Sets and persists the value of a global option. /// Does not update any workspace (since this option is not a solution option). /// Does not trigger <see cref="OptionChanged"/>. /// </summary> void SetGlobalOption(OptionKey optionKey, object? value); /// <summary> /// Atomically sets the values of specified global options. The option values are persisted. /// Does not update any workspace (since this option is not a solution option). /// Does not trigger <see cref="OptionChanged"/>. /// </summary> void SetGlobalOptions(ImmutableArray<OptionKey> optionKeys, ImmutableArray<object?> values); /// <summary> /// Gets force computed serializable options snapshot with prefetched values for the registered options applicable to the given <paramref name="languages"/> by quering the option persisters. /// </summary> SerializableOptionSet GetSerializableOptionsSnapshot(ImmutableHashSet<string> languages, IOptionService optionService); /// <summary> /// Returns the set of all registered options. /// </summary> IEnumerable<IOption> GetRegisteredOptions(); /// <summary> /// Map an <strong>.editorconfig</strong> key to a corresponding <see cref="IEditorConfigStorageLocation2"/> and /// <see cref="OptionKey"/> that can be used to read and write the value stored in an <see cref="OptionSet"/>. /// </summary> /// <param name="key">The <strong>.editorconfig</strong> key.</param> /// <param name="language">The language to use for the <paramref name="optionKey"/>, if the matching option has /// <see cref="IOption.IsPerLanguage"/> set.</param> /// <param name="storageLocation">The <see cref="IEditorConfigStorageLocation2"/> for the key.</param> /// <param name="optionKey">The <see cref="OptionKey"/> for the key and language.</param> /// <returns><see langword="true"/> if a matching option was found; otherwise, <see langword="false"/>.</returns> bool TryMapEditorConfigKeyToOption(string key, string? language, [NotNullWhen(true)] out IEditorConfigStorageLocation2? storageLocation, out OptionKey optionKey); /// <summary> /// Returns the set of all registered serializable options applicable for the given <paramref name="languages"/>. /// </summary> ImmutableHashSet<IOption> GetRegisteredSerializableOptions(ImmutableHashSet<string> languages); event EventHandler<OptionChangedEventArgs>? OptionChanged; /// <summary> /// Refreshes the stored value of a serialized option. This should only be called from serializers. /// </summary> void RefreshOption(OptionKey optionKey, object? newValue); /// <summary> /// Registers a workspace with the option service. /// </summary> void RegisterWorkspace(Workspace workspace); /// <summary> /// Unregisters a workspace from the option service. /// </summary> void UnregisterWorkspace(Workspace workspace); } }
1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/Core/Portable/Options/OptionChangedEventArgs.cs
// 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 System; namespace Microsoft.CodeAnalysis.Options { internal sealed class OptionChangedEventArgs : EventArgs { public IOption Option { get; } public string? Language { get; } public object? Value { get; } internal OptionChangedEventArgs(OptionKey optionKey, object? value) { Option = optionKey.Option; Language = optionKey.Language; Value = value; } } }
// 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 System; namespace Microsoft.CodeAnalysis.Options { internal sealed class OptionChangedEventArgs : EventArgs { public OptionKey OptionKey { get; } public object? Value { get; } internal OptionChangedEventArgs(OptionKey optionKey, object? value) { OptionKey = optionKey; Value = value; } public IOption Option => OptionKey.Option; public string? Language => OptionKey.Language; } }
1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/CoreTest/Host/WorkspaceServices/TestOptionService.cs
// 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 System; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; namespace Microsoft.CodeAnalysis.UnitTests { internal static class TestOptionService { public static OptionServiceFactory.OptionService GetService(Workspace workspace, IOptionProvider? optionProvider = null, IOptionPersisterProvider? optionPersisterProvider = null) { var mefHostServices = (IMefHostExportProvider)workspace.Services.HostServices; var workspaceThreadingService = mefHostServices.GetExportedValues<IWorkspaceThreadingService>().SingleOrDefault(); return new OptionServiceFactory.OptionService(new GlobalOptionService( workspaceThreadingService, new[] { new Lazy<IOptionProvider, LanguageMetadata>(() => optionProvider ??= new TestOptionsProvider(), new LanguageMetadata(LanguageNames.CSharp)) }, new[] { new Lazy<IOptionPersisterProvider>(() => optionPersisterProvider ??= new TestOptionsPersisterProvider()) }), workspaceServices: workspace.Services); } internal class TestOptionsProvider : IOptionProvider { public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>( new Option<bool>("Test Feature", "Test Name", false)); } internal sealed class TestOptionsPersisterProvider : IOptionPersisterProvider { private readonly ValueTask<IOptionPersister> _optionPersisterTask; public TestOptionsPersisterProvider(IOptionPersister? optionPersister = null) => _optionPersisterTask = new(optionPersister ?? new TestOptionsPersister()); public ValueTask<IOptionPersister> GetOrCreatePersisterAsync(CancellationToken cancellationToken) => _optionPersisterTask; } internal sealed class TestOptionsPersister : IOptionPersister { private ImmutableDictionary<OptionKey, object?> _options = ImmutableDictionary<OptionKey, object?>.Empty; public bool TryFetch(OptionKey optionKey, out object? value) => _options.TryGetValue(optionKey, out value); public bool TryPersist(OptionKey optionKey, object? value) { _options = _options.SetItem(optionKey, value); return true; } } } }
// 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 System; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; namespace Microsoft.CodeAnalysis.UnitTests { internal static class TestOptionService { public static IGlobalOptionService GetGlobalOptionService(HostWorkspaceServices services, IOptionProvider? optionProvider = null, IOptionPersisterProvider? optionPersisterProvider = null) { var mefHostServices = (IMefHostExportProvider)services.HostServices; var workspaceThreadingService = mefHostServices.GetExportedValues<IWorkspaceThreadingService>().SingleOrDefault(); return new GlobalOptionService( workspaceThreadingService, new[] { new Lazy<IOptionProvider, LanguageMetadata>(() => optionProvider ??= new TestOptionsProvider(), new LanguageMetadata(LanguageNames.CSharp)) }, new[] { new Lazy<IOptionPersisterProvider>(() => optionPersisterProvider ??= new TestOptionsPersisterProvider()) }); } public static OptionServiceFactory.OptionService GetService(Workspace workspace, IOptionProvider? optionProvider = null, IOptionPersisterProvider? optionPersisterProvider = null) => new OptionServiceFactory.OptionService(GetGlobalOptionService(workspace.Services, optionProvider, optionPersisterProvider), workspaceServices: workspace.Services); internal class TestOptionsProvider : IOptionProvider { public ImmutableArray<IOption> Options { get; } = ImmutableArray.Create<IOption>( new Option<bool>("Test Feature", "Test Name", false)); } internal sealed class TestOptionsPersisterProvider : IOptionPersisterProvider { private readonly ValueTask<IOptionPersister> _optionPersisterTask; public TestOptionsPersisterProvider(IOptionPersister? optionPersister = null) => _optionPersisterTask = new(optionPersister ?? new TestOptionsPersister()); public ValueTask<IOptionPersister> GetOrCreatePersisterAsync(CancellationToken cancellationToken) => _optionPersisterTask; } internal sealed class TestOptionsPersister : IOptionPersister { private ImmutableDictionary<OptionKey, object?> _options = ImmutableDictionary<OptionKey, object?>.Empty; public bool TryFetch(OptionKey optionKey, out object? value) => _options.TryGetValue(optionKey, out value); public bool TryPersist(OptionKey optionKey, object? value) { _options = _options.SetItem(optionKey, value); return true; } } } }
1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/CoreTest/WorkspaceServiceTests/OptionServiceTests.cs
// 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 System.Collections.Immutable; using System.IO; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Editor.Implementation.TodoComments; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.WorkspaceServices { [UseExportProvider] public class OptionServiceTests { [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void OptionWithNullOrWhitespace() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); Assert.Throws<System.ArgumentException>(delegate { var option = new Option<bool>("Test Feature", "", false); }); Assert.Throws<System.ArgumentException>(delegate { var option2 = new Option<bool>("Test Feature", null!, false); }); Assert.Throws<System.ArgumentNullException>(delegate { var option3 = new Option<bool>(" ", "Test Name", false); }); Assert.Throws<System.ArgumentNullException>(delegate { var option4 = new Option<bool>(null!, "Test Name", false); }); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void OptionPerLanguageOption() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); Assert.Throws<System.ArgumentException>(delegate { var option = new PerLanguageOption<bool>("Test Feature", "", false); }); Assert.Throws<System.ArgumentException>(delegate { var option2 = new PerLanguageOption<bool>("Test Feature", null!, false); }); Assert.Throws<System.ArgumentNullException>(delegate { var option3 = new PerLanguageOption<bool>(" ", "Test Name", false); }); Assert.Throws<System.ArgumentNullException>(delegate { var option4 = new PerLanguageOption<bool>(null!, "Test Name", false); }); var optionvalid = new PerLanguageOption<bool>("Test Feature", "Test Name", false); Assert.False(optionSet.GetOption(optionvalid, "CS")); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GettingOptionReturnsOption() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); var option = new Option<bool>("Test Feature", "Test Name", false); Assert.False(optionSet.GetOption(option)); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GettingOptionWithChangedOption() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); OptionSet optionSet = optionService.GetOptions(); var option = new Option<bool>("Test Feature", "Test Name", false); var key = new OptionKey(option); Assert.False(optionSet.GetOption(option)); optionSet = optionSet.WithChangedOption(key, true); Assert.True((bool?)optionSet.GetOption(key)); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GettingOptionWithoutChangedOption() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); var optionFalse = new Option<bool>("Test Feature", "Test Name", false); Assert.False(optionSet.GetOption(optionFalse)); var optionTrue = new Option<bool>("Test Feature", "Test Name", true); Assert.True(optionSet.GetOption(optionTrue)); var falseKey = new OptionKey(optionFalse); Assert.False((bool?)optionSet.GetOption(falseKey)); var trueKey = new OptionKey(optionTrue); Assert.True((bool?)optionSet.GetOption(trueKey)); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GetKnownOptions() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var option = new Option<bool>("Test Feature", "Test Name", defaultValue: true); optionService.GetOption(option); var optionSet = optionService.GetOptions(); var value = optionSet.GetOption(option); Assert.True(value); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GetKnownOptionsKey() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var option = new Option<bool>("Test Feature", "Test Name", defaultValue: true); optionService.GetOption(option); var optionSet = optionService.GetOptions(); var optionKey = new OptionKey(option); var value = (bool?)optionSet.GetOption(optionKey); Assert.True(value); } [Fact] public void SetKnownOptions() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); var option = new Option<bool>("Test Feature", "Test Name", defaultValue: true); var optionKey = new OptionKey(option); var newOptionSet = optionSet.WithChangedOption(optionKey, false); optionService.SetOptions(newOptionSet); var isOptionSet = (bool?)optionService.GetOptions().GetOption(optionKey); Assert.False(isOptionSet); } [Fact] public void OptionSetIsImmutable() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); var option = new Option<bool>("Test Feature", "Test Name", defaultValue: true); var optionKey = new OptionKey(option); var newOptionSet = optionSet.WithChangedOption(optionKey, false); Assert.NotSame(optionSet, newOptionSet); Assert.NotEqual(optionSet, newOptionSet); } [Fact] public void TestChangedOptions() { using var workspace = new AdhocWorkspace(); // Apply a serializable changed option to the option service // and verify that serializable options snapshot contains this changed option. TestChangedOptionsCore( workspace, GenerationOptions.PlaceSystemNamespaceFirst, optionProvider: ((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValues<IOptionProvider>().OfType<GenerationOptionsProvider>().Single(), isSerializable: true); // Apply a non-serializable changed option to the option service // and verify that serializable options snapshot does not contain this changed option TestChangedOptionsCore( workspace, new PerLanguageOption2<bool>("Test Feature", "Test Name", defaultValue: true), optionProvider: new TestOptionService.TestOptionsProvider(), isSerializable: false); return; static void TestChangedOptionsCore(Workspace workspace, PerLanguageOption2<bool> option, IOptionProvider optionProvider, bool isSerializable) { var optionService = TestOptionService.GetService(workspace, optionProvider); var optionSet = optionService.GetOptions(); var optionKey = new OptionKey(option, LanguageNames.CSharp); var currentOptionValue = optionSet.GetOption(option, LanguageNames.CSharp); var newOptionValue = !currentOptionValue; var newOptionSet = (SerializableOptionSet)optionSet.WithChangedOption(optionKey, newOptionValue); optionService.SetOptions(newOptionSet); var isOptionSet = (bool?)optionService.GetOptions().GetOption(optionKey); Assert.Equal(newOptionValue, isOptionSet); // Verify the serializable option snapshot obtained option service has the changed option only if the option key is serializable. var languages = ImmutableHashSet.Create(LanguageNames.CSharp); var serializableOptionSet = optionService.GetSerializableOptionsSnapshot(languages); VerifyChangedOptionsCore(serializableOptionSet, optionKey, expectedChangedOption: isSerializable); // Serialize/deserialize the option set to test round tripping. serializableOptionSet = (SerializableOptionSet)serializableOptionSet.WithChangedOption(optionKey, newOptionValue); using var memoryStream = new MemoryStream(); using var writer = new ObjectWriter(memoryStream, leaveOpen: true); serializableOptionSet.Serialize(writer, CancellationToken.None); memoryStream.Position = 0; var originalChecksum = Checksum.Create(memoryStream); memoryStream.Position = 0; using var reader = ObjectReader.TryGetReader(memoryStream); serializableOptionSet = SerializableOptionSet.Deserialize(reader, optionService, CancellationToken.None); // Verify the option set obtained from round trip has the changed option only if the option key is serializable. VerifyChangedOptionsCore(serializableOptionSet, optionKey, expectedChangedOption: isSerializable); using var newMemoryStream = new MemoryStream(); using var newWriter = new ObjectWriter(newMemoryStream, leaveOpen: true); serializableOptionSet.Serialize(newWriter, CancellationToken.None); newMemoryStream.Position = 0; var newChecksum = Checksum.Create(newMemoryStream); Assert.Equal(originalChecksum, newChecksum); return; static void VerifyChangedOptionsCore(SerializableOptionSet serializableOptionSet, OptionKey optionKey, bool expectedChangedOption) { var changedOptions = serializableOptionSet.GetChangedOptions(); if (expectedChangedOption) { var changedOptionKey = Assert.Single(changedOptions); Assert.Equal(optionKey, changedOptionKey); } else { Assert.Empty(changedOptions); } } } } [Fact, WorkItem(43788, "https://github.com/dotnet/roslyn/issues/43788")] public void TestChangedTodoCommentOptions() { var hostServices = FeaturesTestCompositions.Features.AddParts(typeof(TestOptionsServiceFactory)).GetHostServices(); using var workspace = new AdhocWorkspace(hostServices); var option = TodoCommentOptions.TokenList; var provider = ((IMefHostExportProvider)hostServices).GetExportedValues<IOptionProvider>().OfType<TodoCommentOptionsProvider>().FirstOrDefault(); var optionService = TestOptionService.GetService(workspace, provider); var optionSet = optionService.GetOptions(); var optionKey = new OptionKey(option); var currentOptionValue = optionSet.GetOption(option); var newOptionValue = currentOptionValue + "newValue"; var newOptionSet = optionSet.WithChangedOption(optionKey, newOptionValue); optionService.SetOptions(newOptionSet); Assert.Equal(newOptionValue, (string?)optionService.GetOptions().GetOption(optionKey)); var languages = ImmutableHashSet.Create(LanguageNames.CSharp); var serializableOptionSet = optionService.GetSerializableOptionsSnapshot(languages); var changedOptions = serializableOptionSet.GetChangedOptions(); var changedOptionKey = Assert.Single(changedOptions); Assert.Equal(optionKey, changedOptionKey); Assert.Equal(newOptionValue, serializableOptionSet.GetOption(changedOptionKey)); } [Fact, WorkItem(1128126, "https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1128126")] public void TestPersistedTodoCommentOptions() { var hostServices = FeaturesTestCompositions.Features.AddParts(typeof(TestOptionsServiceFactory)).GetHostServices(); using var workspace = new AdhocWorkspace(hostServices); var option = TodoCommentOptions.TokenList; var newOptionValue = option.DefaultValue + "|name:value"; var persister = new TestOptionService.TestOptionsPersister(); var persisted = persister.TryPersist(option, newOptionValue); Assert.True(persisted); Assert.True(persister.TryFetch(option, out var persistedValue)); Assert.Equal(newOptionValue, persistedValue); var provider = ((IMefHostExportProvider)hostServices).GetExportedValues<IOptionProvider>().OfType<TodoCommentOptionsProvider>().FirstOrDefault(); var persisterProvider = new TestOptionService.TestOptionsPersisterProvider(persister); var optionService = TestOptionService.GetService(workspace, provider, persisterProvider); var optionSet = optionService.GetOptions(); var optionKey = new OptionKey(option); Assert.Equal(newOptionValue, (string?)optionSet.GetOption(optionKey)); var languages = ImmutableHashSet.Create(LanguageNames.CSharp); var serializableOptionSet = optionService.GetSerializableOptionsSnapshot(languages); var changedOptions = serializableOptionSet.GetChangedOptions(); var changedOptionKey = Assert.Single(changedOptions); Assert.Equal(optionKey, changedOptionKey); Assert.Equal(newOptionValue, serializableOptionSet.GetOption(changedOptionKey)); } [Fact] public void TestPerLanguageCodeStyleOptions() { using var workspace = new AdhocWorkspace(); var perLanguageOption2 = new PerLanguageOption2<CodeStyleOption2<bool>>("test", "test", new CodeStyleOption2<bool>(false, NotificationOption2.Warning)); var perLanguageOption = perLanguageOption2.ToPublicOption(); var newValueCodeStyleOption2 = new CodeStyleOption2<bool>(!perLanguageOption2.DefaultValue.Value, perLanguageOption2.DefaultValue.Notification); var newValueCodeStyleOption = (CodeStyleOption<bool>)newValueCodeStyleOption2!; // Test "OptionKey" based overloads for get/set options on OptionSet and OptionService using different public and internal type combinations. // 1. { PerLanguageOption, CodeStyleOption } TestCodeStyleOptionsCommon(workspace, perLanguageOption, LanguageNames.CSharp, newValueCodeStyleOption); // 2. { PerLanguageOption2, CodeStyleOption } TestCodeStyleOptionsCommon(workspace, perLanguageOption2, LanguageNames.CSharp, newValueCodeStyleOption); // 3. { PerLanguageOption, CodeStyleOption2 } TestCodeStyleOptionsCommon(workspace, perLanguageOption, LanguageNames.CSharp, newValueCodeStyleOption2); // 4. { PerLanguageOption2, CodeStyleOption2 } TestCodeStyleOptionsCommon(workspace, perLanguageOption2, LanguageNames.CSharp, newValueCodeStyleOption2); var optionService = TestOptionService.GetService(workspace); var originalOptionSet = optionService.GetOptions(); // Test "PerLanguageOption" and "PerLanguageOption2" overloads for OptionSet and OptionService. // 1. Verify default value. Assert.Equal(perLanguageOption.DefaultValue, originalOptionSet.GetOption(perLanguageOption, LanguageNames.CSharp)); Assert.Equal(perLanguageOption2.DefaultValue, originalOptionSet.GetOption(perLanguageOption2, LanguageNames.CSharp)); // 2. OptionSet validations. var newOptionSet = originalOptionSet.WithChangedOption(perLanguageOption, LanguageNames.CSharp, newValueCodeStyleOption); Assert.Equal(newValueCodeStyleOption, newOptionSet.GetOption(perLanguageOption, LanguageNames.CSharp)); Assert.Equal(newValueCodeStyleOption2, newOptionSet.GetOption(perLanguageOption2, LanguageNames.CSharp)); newOptionSet = originalOptionSet.WithChangedOption(perLanguageOption2, LanguageNames.CSharp, newValueCodeStyleOption2); Assert.Equal(newValueCodeStyleOption, newOptionSet.GetOption(perLanguageOption, LanguageNames.CSharp)); Assert.Equal(newValueCodeStyleOption2, newOptionSet.GetOption(perLanguageOption2, LanguageNames.CSharp)); // 3. IOptionService validation optionService.SetOptions(newOptionSet); Assert.Equal(newValueCodeStyleOption, optionService.GetOption(perLanguageOption, LanguageNames.CSharp)); Assert.Equal(newValueCodeStyleOption2, optionService.GetOption(perLanguageOption2, LanguageNames.CSharp)); } [Fact] public void TestLanguageSpecificCodeStyleOptions() { using var workspace = new AdhocWorkspace(); var option2 = new Option2<CodeStyleOption2<bool>>("test", "test", new CodeStyleOption2<bool>(false, NotificationOption2.Warning)); var option = option2.ToPublicOption(); var newValueCodeStyleOption2 = new CodeStyleOption2<bool>(!option2.DefaultValue.Value, option2.DefaultValue.Notification); var newValueCodeStyleOption = (CodeStyleOption<bool>)newValueCodeStyleOption2!; // Test "OptionKey" based overloads for get/set options on OptionSet and OptionService using different public and internal type combinations. // 1. { Option, CodeStyleOption } TestCodeStyleOptionsCommon(workspace, option, language: null, newValueCodeStyleOption); // 2. { Option2, CodeStyleOption } TestCodeStyleOptionsCommon(workspace, option2, language: null, newValueCodeStyleOption); // 3. { Option, CodeStyleOption2 } TestCodeStyleOptionsCommon(workspace, option, language: null, newValueCodeStyleOption2); // 4. { Option2, CodeStyleOption2 } TestCodeStyleOptionsCommon(workspace, option2, language: null, newValueCodeStyleOption2); var optionService = TestOptionService.GetService(workspace); var originalOptionSet = optionService.GetOptions(); // Test "Option" and "Option2" overloads for OptionSet and OptionService. // 1. Verify default value. Assert.Equal(option.DefaultValue, originalOptionSet.GetOption(option)); Assert.Equal(option2.DefaultValue, originalOptionSet.GetOption(option2)); // 2. OptionSet validations. var newOptionSet = originalOptionSet.WithChangedOption(option, newValueCodeStyleOption); Assert.Equal(newValueCodeStyleOption, newOptionSet.GetOption(option)); Assert.Equal(newValueCodeStyleOption2, newOptionSet.GetOption(option2)); newOptionSet = originalOptionSet.WithChangedOption(option2, newValueCodeStyleOption2); Assert.Equal(newValueCodeStyleOption, newOptionSet.GetOption(option)); Assert.Equal(newValueCodeStyleOption2, newOptionSet.GetOption(option2)); // 3. IOptionService validation optionService.SetOptions(newOptionSet); Assert.Equal(newValueCodeStyleOption, optionService.GetOption(option)); Assert.Equal(newValueCodeStyleOption2, optionService.GetOption(option2)); } private static void TestCodeStyleOptionsCommon<TCodeStyleOption>(Workspace workspace, IOption2 option, string? language, TCodeStyleOption newValue) where TCodeStyleOption : ICodeStyleOption { var optionService = TestOptionService.GetService(workspace); var originalOptionSet = optionService.GetOptions(); // Test matrix using different OptionKey and OptionKey2 get/set operations. var optionKey = new OptionKey(option, language); var optionKey2 = new OptionKey2(option, language); // Value return from "object GetOption(OptionKey)" should always be public CodeStyleOption type. var newPublicValue = newValue.AsPublicCodeStyleOption(); // 1. WithChangedOption(OptionKey), GetOption(OptionKey)/GetOption<T>(OptionKey) var newOptionSet = originalOptionSet.WithChangedOption(optionKey, newValue); Assert.Equal(newPublicValue, newOptionSet.GetOption(optionKey)); // Value returned from public API should always be castable to public CodeStyleOption type. Assert.NotNull((CodeStyleOption<bool>)newOptionSet.GetOption(optionKey)!); // Verify "T GetOption<T>(OptionKey)" works for both cases of T being a public and internal code style option type. Assert.Equal(newPublicValue, newOptionSet.GetOption<CodeStyleOption<bool>>(optionKey)); Assert.Equal(newValue, newOptionSet.GetOption<TCodeStyleOption>(optionKey)); // 2. WithChangedOption(OptionKey), GetOption(OptionKey2)/GetOption<T>(OptionKey2) newOptionSet = originalOptionSet.WithChangedOption(optionKey, newValue); Assert.Equal(newPublicValue, newOptionSet.GetOption(optionKey2)); // Verify "T GetOption<T>(OptionKey2)" works for both cases of T being a public and internal code style option type. Assert.Equal(newPublicValue, newOptionSet.GetOption<CodeStyleOption<bool>>(optionKey2)); Assert.Equal(newValue, newOptionSet.GetOption<TCodeStyleOption>(optionKey2)); // 3. WithChangedOption(OptionKey2), GetOption(OptionKey)/GetOption<T>(OptionKey) newOptionSet = originalOptionSet.WithChangedOption(optionKey2, newValue); Assert.Equal(newPublicValue, newOptionSet.GetOption(optionKey)); // Value returned from public API should always be castable to public CodeStyleOption type. Assert.NotNull((CodeStyleOption<bool>)newOptionSet.GetOption(optionKey)!); // Verify "T GetOption<T>(OptionKey)" works for both cases of T being a public and internal code style option type. Assert.Equal(newPublicValue, newOptionSet.GetOption<CodeStyleOption<bool>>(optionKey)); Assert.Equal(newValue, newOptionSet.GetOption<TCodeStyleOption>(optionKey)); // 4. WithChangedOption(OptionKey2), GetOption(OptionKey2)/GetOption<T>(OptionKey2) newOptionSet = originalOptionSet.WithChangedOption(optionKey2, newValue); Assert.Equal(newPublicValue, newOptionSet.GetOption(optionKey2)); // Verify "T GetOption<T>(OptionKey2)" works for both cases of T being a public and internal code style option type. Assert.Equal(newPublicValue, newOptionSet.GetOption<CodeStyleOption<bool>>(optionKey2)); Assert.Equal(newValue, newOptionSet.GetOption<TCodeStyleOption>(optionKey2)); // 5. IOptionService.GetOption(OptionKey) optionService.SetOptions(newOptionSet); Assert.Equal(newPublicValue, optionService.GetOption(optionKey)); } } }
// 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 System; using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Editor.Implementation.TodoComments; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.WorkspaceServices { [UseExportProvider] public class OptionServiceTests { [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void OptionWithNullOrWhitespace() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); Assert.Throws<System.ArgumentException>(delegate { var option = new Option<bool>("Test Feature", "", false); }); Assert.Throws<System.ArgumentException>(delegate { var option2 = new Option<bool>("Test Feature", null!, false); }); Assert.Throws<System.ArgumentNullException>(delegate { var option3 = new Option<bool>(" ", "Test Name", false); }); Assert.Throws<System.ArgumentNullException>(delegate { var option4 = new Option<bool>(null!, "Test Name", false); }); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void OptionPerLanguageOption() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); Assert.Throws<System.ArgumentException>(delegate { var option = new PerLanguageOption<bool>("Test Feature", "", false); }); Assert.Throws<System.ArgumentException>(delegate { var option2 = new PerLanguageOption<bool>("Test Feature", null!, false); }); Assert.Throws<System.ArgumentNullException>(delegate { var option3 = new PerLanguageOption<bool>(" ", "Test Name", false); }); Assert.Throws<System.ArgumentNullException>(delegate { var option4 = new PerLanguageOption<bool>(null!, "Test Name", false); }); var optionvalid = new PerLanguageOption<bool>("Test Feature", "Test Name", false); Assert.False(optionSet.GetOption(optionvalid, "CS")); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GettingOptionReturnsOption() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); var option = new Option<bool>("Test Feature", "Test Name", false); Assert.False(optionSet.GetOption(option)); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GlobalOptions() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetGlobalOptionService(workspace.Services); var option1 = new Option<int>("Feature1", "Name1", defaultValue: 1); var option2 = new Option<int>("Feature2", "Name2", defaultValue: 2); var option3 = new Option<int>("Feature3", "Name3", defaultValue: 3); var changedOptions = new List<OptionChangedEventArgs>(); var handler = new EventHandler<OptionChangedEventArgs>((_, e) => changedOptions.Add(e)); optionService.OptionChanged += handler; var values = optionService.GetOptions(ImmutableArray.Create<OptionKey>(option1, option2)); Assert.Equal(1, values[0]); Assert.Equal(2, values[1]); optionService.SetGlobalOptions( ImmutableArray.Create<OptionKey>(option1, option2, option3), ImmutableArray.Create<object?>(5, 6, 3)); AssertEx.Equal(new[] { "Name1=5", "Name2=6", }, changedOptions.Select(e => $"{e.OptionKey.Option.Name}={e.Value}")); values = optionService.GetOptions(ImmutableArray.Create<OptionKey>(option1, option2, option3)); Assert.Equal(5, values[0]); Assert.Equal(6, values[1]); Assert.Equal(3, values[2]); Assert.Equal(5, optionService.GetOption(option1)); Assert.Equal(6, optionService.GetOption(option2)); Assert.Equal(3, optionService.GetOption(option3)); optionService.OptionChanged -= handler; } private void OptionService_OptionChanged(object? sender, OptionChangedEventArgs e) { throw new System.NotImplementedException(); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GettingOptionWithChangedOption() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); OptionSet optionSet = optionService.GetOptions(); var option = new Option<bool>("Test Feature", "Test Name", false); var key = new OptionKey(option); Assert.False(optionSet.GetOption(option)); optionSet = optionSet.WithChangedOption(key, true); Assert.True((bool?)optionSet.GetOption(key)); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GettingOptionWithoutChangedOption() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); var optionFalse = new Option<bool>("Test Feature", "Test Name", false); Assert.False(optionSet.GetOption(optionFalse)); var optionTrue = new Option<bool>("Test Feature", "Test Name", true); Assert.True(optionSet.GetOption(optionTrue)); var falseKey = new OptionKey(optionFalse); Assert.False((bool?)optionSet.GetOption(falseKey)); var trueKey = new OptionKey(optionTrue); Assert.True((bool?)optionSet.GetOption(trueKey)); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GetKnownOptions() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var option = new Option<bool>("Test Feature", "Test Name", defaultValue: true); optionService.GetOption(option); var optionSet = optionService.GetOptions(); var value = optionSet.GetOption(option); Assert.True(value); } [Fact, Trait(Traits.Feature, Traits.Features.Workspace)] public void GetKnownOptionsKey() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var option = new Option<bool>("Test Feature", "Test Name", defaultValue: true); optionService.GetOption(option); var optionSet = optionService.GetOptions(); var optionKey = new OptionKey(option); var value = (bool?)optionSet.GetOption(optionKey); Assert.True(value); } [Fact] public void SetKnownOptions() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); var option = new Option<bool>("Test Feature", "Test Name", defaultValue: true); var optionKey = new OptionKey(option); var newOptionSet = optionSet.WithChangedOption(optionKey, false); optionService.SetOptions(newOptionSet); var isOptionSet = (bool?)optionService.GetOptions().GetOption(optionKey); Assert.False(isOptionSet); } [Fact] public void OptionSetIsImmutable() { using var workspace = new AdhocWorkspace(); var optionService = TestOptionService.GetService(workspace); var optionSet = optionService.GetOptions(); var option = new Option<bool>("Test Feature", "Test Name", defaultValue: true); var optionKey = new OptionKey(option); var newOptionSet = optionSet.WithChangedOption(optionKey, false); Assert.NotSame(optionSet, newOptionSet); Assert.NotEqual(optionSet, newOptionSet); } [Fact] public void TestChangedOptions() { using var workspace = new AdhocWorkspace(); // Apply a serializable changed option to the option service // and verify that serializable options snapshot contains this changed option. TestChangedOptionsCore( workspace, GenerationOptions.PlaceSystemNamespaceFirst, optionProvider: ((IMefHostExportProvider)workspace.Services.HostServices).GetExportedValues<IOptionProvider>().OfType<GenerationOptionsProvider>().Single(), isSerializable: true); // Apply a non-serializable changed option to the option service // and verify that serializable options snapshot does not contain this changed option TestChangedOptionsCore( workspace, new PerLanguageOption2<bool>("Test Feature", "Test Name", defaultValue: true), optionProvider: new TestOptionService.TestOptionsProvider(), isSerializable: false); return; static void TestChangedOptionsCore(Workspace workspace, PerLanguageOption2<bool> option, IOptionProvider optionProvider, bool isSerializable) { var optionService = TestOptionService.GetService(workspace, optionProvider); var optionSet = optionService.GetOptions(); var optionKey = new OptionKey(option, LanguageNames.CSharp); var currentOptionValue = optionSet.GetOption(option, LanguageNames.CSharp); var newOptionValue = !currentOptionValue; var newOptionSet = (SerializableOptionSet)optionSet.WithChangedOption(optionKey, newOptionValue); optionService.SetOptions(newOptionSet); var isOptionSet = (bool?)optionService.GetOptions().GetOption(optionKey); Assert.Equal(newOptionValue, isOptionSet); // Verify the serializable option snapshot obtained option service has the changed option only if the option key is serializable. var languages = ImmutableHashSet.Create(LanguageNames.CSharp); var serializableOptionSet = optionService.GetSerializableOptionsSnapshot(languages); VerifyChangedOptionsCore(serializableOptionSet, optionKey, expectedChangedOption: isSerializable); // Serialize/deserialize the option set to test round tripping. serializableOptionSet = (SerializableOptionSet)serializableOptionSet.WithChangedOption(optionKey, newOptionValue); using var memoryStream = new MemoryStream(); using var writer = new ObjectWriter(memoryStream, leaveOpen: true); serializableOptionSet.Serialize(writer, CancellationToken.None); memoryStream.Position = 0; var originalChecksum = Checksum.Create(memoryStream); memoryStream.Position = 0; using var reader = ObjectReader.TryGetReader(memoryStream); serializableOptionSet = SerializableOptionSet.Deserialize(reader, optionService, CancellationToken.None); // Verify the option set obtained from round trip has the changed option only if the option key is serializable. VerifyChangedOptionsCore(serializableOptionSet, optionKey, expectedChangedOption: isSerializable); using var newMemoryStream = new MemoryStream(); using var newWriter = new ObjectWriter(newMemoryStream, leaveOpen: true); serializableOptionSet.Serialize(newWriter, CancellationToken.None); newMemoryStream.Position = 0; var newChecksum = Checksum.Create(newMemoryStream); Assert.Equal(originalChecksum, newChecksum); return; static void VerifyChangedOptionsCore(SerializableOptionSet serializableOptionSet, OptionKey optionKey, bool expectedChangedOption) { var changedOptions = serializableOptionSet.GetChangedOptions(); if (expectedChangedOption) { var changedOptionKey = Assert.Single(changedOptions); Assert.Equal(optionKey, changedOptionKey); } else { Assert.Empty(changedOptions); } } } } [Fact, WorkItem(43788, "https://github.com/dotnet/roslyn/issues/43788")] public void TestChangedTodoCommentOptions() { var hostServices = FeaturesTestCompositions.Features.AddParts(typeof(TestOptionsServiceFactory)).GetHostServices(); using var workspace = new AdhocWorkspace(hostServices); var option = TodoCommentOptions.TokenList; var provider = ((IMefHostExportProvider)hostServices).GetExportedValues<IOptionProvider>().OfType<TodoCommentOptionsProvider>().FirstOrDefault(); var optionService = TestOptionService.GetService(workspace, provider); var optionSet = optionService.GetOptions(); var optionKey = new OptionKey(option); var currentOptionValue = optionSet.GetOption(option); var newOptionValue = currentOptionValue + "newValue"; var newOptionSet = optionSet.WithChangedOption(optionKey, newOptionValue); optionService.SetOptions(newOptionSet); Assert.Equal(newOptionValue, (string?)optionService.GetOptions().GetOption(optionKey)); var languages = ImmutableHashSet.Create(LanguageNames.CSharp); var serializableOptionSet = optionService.GetSerializableOptionsSnapshot(languages); var changedOptions = serializableOptionSet.GetChangedOptions(); var changedOptionKey = Assert.Single(changedOptions); Assert.Equal(optionKey, changedOptionKey); Assert.Equal(newOptionValue, serializableOptionSet.GetOption(changedOptionKey)); } [Fact, WorkItem(1128126, "https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1128126")] public void TestPersistedTodoCommentOptions() { var hostServices = FeaturesTestCompositions.Features.AddParts(typeof(TestOptionsServiceFactory)).GetHostServices(); using var workspace = new AdhocWorkspace(hostServices); var option = TodoCommentOptions.TokenList; var newOptionValue = option.DefaultValue + "|name:value"; var persister = new TestOptionService.TestOptionsPersister(); var persisted = persister.TryPersist(option, newOptionValue); Assert.True(persisted); Assert.True(persister.TryFetch(option, out var persistedValue)); Assert.Equal(newOptionValue, persistedValue); var provider = ((IMefHostExportProvider)hostServices).GetExportedValues<IOptionProvider>().OfType<TodoCommentOptionsProvider>().FirstOrDefault(); var persisterProvider = new TestOptionService.TestOptionsPersisterProvider(persister); var optionService = TestOptionService.GetService(workspace, provider, persisterProvider); var optionSet = optionService.GetOptions(); var optionKey = new OptionKey(option); Assert.Equal(newOptionValue, (string?)optionSet.GetOption(optionKey)); var languages = ImmutableHashSet.Create(LanguageNames.CSharp); var serializableOptionSet = optionService.GetSerializableOptionsSnapshot(languages); var changedOptions = serializableOptionSet.GetChangedOptions(); var changedOptionKey = Assert.Single(changedOptions); Assert.Equal(optionKey, changedOptionKey); Assert.Equal(newOptionValue, serializableOptionSet.GetOption(changedOptionKey)); } [Fact] public void TestPerLanguageCodeStyleOptions() { using var workspace = new AdhocWorkspace(); var perLanguageOption2 = new PerLanguageOption2<CodeStyleOption2<bool>>("test", "test", new CodeStyleOption2<bool>(false, NotificationOption2.Warning)); var perLanguageOption = perLanguageOption2.ToPublicOption(); var newValueCodeStyleOption2 = new CodeStyleOption2<bool>(!perLanguageOption2.DefaultValue.Value, perLanguageOption2.DefaultValue.Notification); var newValueCodeStyleOption = (CodeStyleOption<bool>)newValueCodeStyleOption2!; // Test "OptionKey" based overloads for get/set options on OptionSet and OptionService using different public and internal type combinations. // 1. { PerLanguageOption, CodeStyleOption } TestCodeStyleOptionsCommon(workspace, perLanguageOption, LanguageNames.CSharp, newValueCodeStyleOption); // 2. { PerLanguageOption2, CodeStyleOption } TestCodeStyleOptionsCommon(workspace, perLanguageOption2, LanguageNames.CSharp, newValueCodeStyleOption); // 3. { PerLanguageOption, CodeStyleOption2 } TestCodeStyleOptionsCommon(workspace, perLanguageOption, LanguageNames.CSharp, newValueCodeStyleOption2); // 4. { PerLanguageOption2, CodeStyleOption2 } TestCodeStyleOptionsCommon(workspace, perLanguageOption2, LanguageNames.CSharp, newValueCodeStyleOption2); var optionService = TestOptionService.GetService(workspace); var originalOptionSet = optionService.GetOptions(); // Test "PerLanguageOption" and "PerLanguageOption2" overloads for OptionSet and OptionService. // 1. Verify default value. Assert.Equal(perLanguageOption.DefaultValue, originalOptionSet.GetOption(perLanguageOption, LanguageNames.CSharp)); Assert.Equal(perLanguageOption2.DefaultValue, originalOptionSet.GetOption(perLanguageOption2, LanguageNames.CSharp)); // 2. OptionSet validations. var newOptionSet = originalOptionSet.WithChangedOption(perLanguageOption, LanguageNames.CSharp, newValueCodeStyleOption); Assert.Equal(newValueCodeStyleOption, newOptionSet.GetOption(perLanguageOption, LanguageNames.CSharp)); Assert.Equal(newValueCodeStyleOption2, newOptionSet.GetOption(perLanguageOption2, LanguageNames.CSharp)); newOptionSet = originalOptionSet.WithChangedOption(perLanguageOption2, LanguageNames.CSharp, newValueCodeStyleOption2); Assert.Equal(newValueCodeStyleOption, newOptionSet.GetOption(perLanguageOption, LanguageNames.CSharp)); Assert.Equal(newValueCodeStyleOption2, newOptionSet.GetOption(perLanguageOption2, LanguageNames.CSharp)); // 3. IOptionService validation optionService.SetOptions(newOptionSet); Assert.Equal(newValueCodeStyleOption, optionService.GetOption(perLanguageOption, LanguageNames.CSharp)); Assert.Equal(newValueCodeStyleOption2, optionService.GetOption(perLanguageOption2, LanguageNames.CSharp)); } [Fact] public void TestLanguageSpecificCodeStyleOptions() { using var workspace = new AdhocWorkspace(); var option2 = new Option2<CodeStyleOption2<bool>>("test", "test", new CodeStyleOption2<bool>(false, NotificationOption2.Warning)); var option = option2.ToPublicOption(); var newValueCodeStyleOption2 = new CodeStyleOption2<bool>(!option2.DefaultValue.Value, option2.DefaultValue.Notification); var newValueCodeStyleOption = (CodeStyleOption<bool>)newValueCodeStyleOption2!; // Test "OptionKey" based overloads for get/set options on OptionSet and OptionService using different public and internal type combinations. // 1. { Option, CodeStyleOption } TestCodeStyleOptionsCommon(workspace, option, language: null, newValueCodeStyleOption); // 2. { Option2, CodeStyleOption } TestCodeStyleOptionsCommon(workspace, option2, language: null, newValueCodeStyleOption); // 3. { Option, CodeStyleOption2 } TestCodeStyleOptionsCommon(workspace, option, language: null, newValueCodeStyleOption2); // 4. { Option2, CodeStyleOption2 } TestCodeStyleOptionsCommon(workspace, option2, language: null, newValueCodeStyleOption2); var optionService = TestOptionService.GetService(workspace); var originalOptionSet = optionService.GetOptions(); // Test "Option" and "Option2" overloads for OptionSet and OptionService. // 1. Verify default value. Assert.Equal(option.DefaultValue, originalOptionSet.GetOption(option)); Assert.Equal(option2.DefaultValue, originalOptionSet.GetOption(option2)); // 2. OptionSet validations. var newOptionSet = originalOptionSet.WithChangedOption(option, newValueCodeStyleOption); Assert.Equal(newValueCodeStyleOption, newOptionSet.GetOption(option)); Assert.Equal(newValueCodeStyleOption2, newOptionSet.GetOption(option2)); newOptionSet = originalOptionSet.WithChangedOption(option2, newValueCodeStyleOption2); Assert.Equal(newValueCodeStyleOption, newOptionSet.GetOption(option)); Assert.Equal(newValueCodeStyleOption2, newOptionSet.GetOption(option2)); // 3. IOptionService validation optionService.SetOptions(newOptionSet); Assert.Equal(newValueCodeStyleOption, optionService.GetOption(option)); Assert.Equal(newValueCodeStyleOption2, optionService.GetOption(option2)); } private static void TestCodeStyleOptionsCommon<TCodeStyleOption>(Workspace workspace, IOption2 option, string? language, TCodeStyleOption newValue) where TCodeStyleOption : ICodeStyleOption { var optionService = TestOptionService.GetService(workspace); var originalOptionSet = optionService.GetOptions(); // Test matrix using different OptionKey and OptionKey2 get/set operations. var optionKey = new OptionKey(option, language); var optionKey2 = new OptionKey2(option, language); // Value return from "object GetOption(OptionKey)" should always be public CodeStyleOption type. var newPublicValue = newValue.AsPublicCodeStyleOption(); // 1. WithChangedOption(OptionKey), GetOption(OptionKey)/GetOption<T>(OptionKey) var newOptionSet = originalOptionSet.WithChangedOption(optionKey, newValue); Assert.Equal(newPublicValue, newOptionSet.GetOption(optionKey)); // Value returned from public API should always be castable to public CodeStyleOption type. Assert.NotNull((CodeStyleOption<bool>)newOptionSet.GetOption(optionKey)!); // Verify "T GetOption<T>(OptionKey)" works for both cases of T being a public and internal code style option type. Assert.Equal(newPublicValue, newOptionSet.GetOption<CodeStyleOption<bool>>(optionKey)); Assert.Equal(newValue, newOptionSet.GetOption<TCodeStyleOption>(optionKey)); // 2. WithChangedOption(OptionKey), GetOption(OptionKey2)/GetOption<T>(OptionKey2) newOptionSet = originalOptionSet.WithChangedOption(optionKey, newValue); Assert.Equal(newPublicValue, newOptionSet.GetOption(optionKey2)); // Verify "T GetOption<T>(OptionKey2)" works for both cases of T being a public and internal code style option type. Assert.Equal(newPublicValue, newOptionSet.GetOption<CodeStyleOption<bool>>(optionKey2)); Assert.Equal(newValue, newOptionSet.GetOption<TCodeStyleOption>(optionKey2)); // 3. WithChangedOption(OptionKey2), GetOption(OptionKey)/GetOption<T>(OptionKey) newOptionSet = originalOptionSet.WithChangedOption(optionKey2, newValue); Assert.Equal(newPublicValue, newOptionSet.GetOption(optionKey)); // Value returned from public API should always be castable to public CodeStyleOption type. Assert.NotNull((CodeStyleOption<bool>)newOptionSet.GetOption(optionKey)!); // Verify "T GetOption<T>(OptionKey)" works for both cases of T being a public and internal code style option type. Assert.Equal(newPublicValue, newOptionSet.GetOption<CodeStyleOption<bool>>(optionKey)); Assert.Equal(newValue, newOptionSet.GetOption<TCodeStyleOption>(optionKey)); // 4. WithChangedOption(OptionKey2), GetOption(OptionKey2)/GetOption<T>(OptionKey2) newOptionSet = originalOptionSet.WithChangedOption(optionKey2, newValue); Assert.Equal(newPublicValue, newOptionSet.GetOption(optionKey2)); // Verify "T GetOption<T>(OptionKey2)" works for both cases of T being a public and internal code style option type. Assert.Equal(newPublicValue, newOptionSet.GetOption<CodeStyleOption<bool>>(optionKey2)); Assert.Equal(newValue, newOptionSet.GetOption<TCodeStyleOption>(optionKey2)); // 5. IOptionService.GetOption(OptionKey) optionService.SetOptions(newOptionSet); Assert.Equal(newPublicValue, optionService.GetOption(optionKey)); } } }
1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicEndConstruct.cs
// 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. #nullable disable using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Roslyn.VisualStudio.IntegrationTests.VisualBasic { [Collection(nameof(SharedIntegrationHostFixture))] public class BasicEndConstruct : AbstractEditorTest { protected override string LanguageName => LanguageNames.VisualBasic; public BasicEndConstruct(VisualStudioInstanceFactory instanceFactory) : base(instanceFactory, nameof(BasicEndConstruct)) { } [WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)] public void EndConstruct() { SetUpEditor(@" Class Program Sub Main() If True Then $$ End Sub End Class"); // Send a space to convert virtual whitespace into real whitespace VisualStudio.Editor.SendKeys(VirtualKey.Enter, " "); VisualStudio.Editor.Verify.TextContains(@" Class Program Sub Main() If True Then $$ End If End Sub End Class", assertCaretPosition: true); } [WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)] public void IntelliSenseCompletedWhile() { SetUpEditor(@" Class Program Sub Main() $$ End Sub End Class"); // Send a space to convert virtual whitespace into real whitespace VisualStudio.Editor.SendKeys("While True", VirtualKey.Enter, " "); VisualStudio.Editor.Verify.TextContains(@" Class Program Sub Main() While True $$ End While End Sub End Class", assertCaretPosition: true); } [WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)] public void InterfaceToClassFixup() { SetUpEditor(@" Interface$$ C End Interface"); VisualStudio.Editor.SendKeys(new KeyPress(VirtualKey.Backspace, ShiftState.Ctrl)); VisualStudio.Editor.SendKeys("Class", VirtualKey.Tab); VisualStudio.Editor.Verify.TextContains(@" Class C End Class"); } [WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)] public void CaseInsensitiveSubToFunction() { SetUpEditor(@" Class C Public Sub$$ Goo() End Sub End Class"); VisualStudio.Editor.SendKeys(new KeyPress(VirtualKey.Backspace, ShiftState.Ctrl)); VisualStudio.Editor.SendKeys("fu", VirtualKey.Tab); VisualStudio.Editor.Verify.TextContains(@" Class C Public Function Goo() End Function End Class"); } } }
// 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. #nullable disable using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Roslyn.VisualStudio.IntegrationTests.VisualBasic { [Collection(nameof(SharedIntegrationHostFixture))] public class BasicEndConstruct : AbstractEditorTest { protected override string LanguageName => LanguageNames.VisualBasic; public BasicEndConstruct(VisualStudioInstanceFactory instanceFactory) : base(instanceFactory, nameof(BasicEndConstruct)) { } [WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)] public void EndConstruct() { SetUpEditor(@" Class Program Sub Main() If True Then $$ End Sub End Class"); // Send a space to convert virtual whitespace into real whitespace VisualStudio.Editor.SendKeys(VirtualKey.Enter, " "); VisualStudio.Editor.Verify.TextContains(@" Class Program Sub Main() If True Then $$ End If End Sub End Class", assertCaretPosition: true); } [WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)] public void IntelliSenseCompletedWhile() { SetUpEditor(@" Class Program Sub Main() $$ End Sub End Class"); // Send a space to convert virtual whitespace into real whitespace VisualStudio.Editor.SendKeys("While True", VirtualKey.Enter, " "); VisualStudio.Editor.Verify.TextContains(@" Class Program Sub Main() While True $$ End While End Sub End Class", assertCaretPosition: true); } [WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)] public void InterfaceToClassFixup() { SetUpEditor(@" Interface$$ C End Interface"); VisualStudio.Editor.SendKeys(new KeyPress(VirtualKey.Backspace, ShiftState.Ctrl)); VisualStudio.Editor.SendKeys("Class", VirtualKey.Tab); VisualStudio.Editor.Verify.TextContains(@" Class C End Class"); } [WpfFact, Trait(Traits.Feature, Traits.Features.EndConstructGeneration)] public void CaseInsensitiveSubToFunction() { SetUpEditor(@" Class C Public Sub$$ Goo() End Sub End Class"); VisualStudio.Editor.SendKeys(new KeyPress(VirtualKey.Backspace, ShiftState.Ctrl)); VisualStudio.Editor.SendKeys("fu", VirtualKey.Tab); VisualStudio.Editor.Verify.TextContains(@" Class C Public Function Goo() End Function End Class"); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpParenthesizedPatternReducer.Rewriter.cs
// 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. #nullable disable using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.PooledObjects; namespace Microsoft.CodeAnalysis.CSharp.Simplification { internal partial class CSharpParenthesizedPatternReducer { private class Rewriter : AbstractReductionRewriter { public Rewriter(ObjectPool<IReductionRewriter> pool) : base(pool) { } public override SyntaxNode VisitParenthesizedPattern(ParenthesizedPatternSyntax node) { return SimplifyExpression( node, newNode: base.VisitParenthesizedPattern(node), simplifier: s_simplifyParentheses); } } } }
// 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. #nullable disable using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.PooledObjects; namespace Microsoft.CodeAnalysis.CSharp.Simplification { internal partial class CSharpParenthesizedPatternReducer { private class Rewriter : AbstractReductionRewriter { public Rewriter(ObjectPool<IReductionRewriter> pool) : base(pool) { } public override SyntaxNode VisitParenthesizedPattern(ParenthesizedPatternSyntax node) { return SimplifyExpression( node, newNode: base.VisitParenthesizedPattern(node), simplifier: s_simplifyParentheses); } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventInfo.cs
// 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. #nullable disable using System.Runtime.CompilerServices; namespace Microsoft.CodeAnalysis.CodeGeneration { internal class CodeGenerationEventInfo { private static readonly ConditionalWeakTable<IEventSymbol, CodeGenerationEventInfo> s_eventToInfoMap = new(); private readonly bool _isUnsafe; private CodeGenerationEventInfo(bool isUnsafe) => _isUnsafe = isUnsafe; public static void Attach(IEventSymbol @event, bool isUnsafe) { var info = new CodeGenerationEventInfo(isUnsafe); s_eventToInfoMap.Add(@event, info); } private static CodeGenerationEventInfo GetInfo(IEventSymbol @event) { s_eventToInfoMap.TryGetValue(@event, out var info); return info; } public static bool GetIsUnsafe(IEventSymbol @event) => GetIsUnsafe(GetInfo(@event)); private static bool GetIsUnsafe(CodeGenerationEventInfo info) => info != null && info._isUnsafe; } }
// 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. #nullable disable using System.Runtime.CompilerServices; namespace Microsoft.CodeAnalysis.CodeGeneration { internal class CodeGenerationEventInfo { private static readonly ConditionalWeakTable<IEventSymbol, CodeGenerationEventInfo> s_eventToInfoMap = new(); private readonly bool _isUnsafe; private CodeGenerationEventInfo(bool isUnsafe) => _isUnsafe = isUnsafe; public static void Attach(IEventSymbol @event, bool isUnsafe) { var info = new CodeGenerationEventInfo(isUnsafe); s_eventToInfoMap.Add(@event, info); } private static CodeGenerationEventInfo GetInfo(IEventSymbol @event) { s_eventToInfoMap.TryGetValue(@event, out var info); return info; } public static bool GetIsUnsafe(IEventSymbol @event) => GetIsUnsafe(GetInfo(@event)); private static bool GetIsUnsafe(CodeGenerationEventInfo info) => info != null && info._isUnsafe; } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/Core/Portable/MoveToNamespace/IMoveToNamespaceOptionsService.cs
// 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. #nullable disable using System.Collections.Immutable; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServices; namespace Microsoft.CodeAnalysis.MoveToNamespace { internal interface IMoveToNamespaceOptionsService : IWorkspaceService { MoveToNamespaceOptionsResult GetChangeNamespaceOptions( string defaultNamespace, ImmutableArray<string> availableNamespaces, ISyntaxFacts syntaxFactsService); } }
// 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. #nullable disable using System.Collections.Immutable; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServices; namespace Microsoft.CodeAnalysis.MoveToNamespace { internal interface IMoveToNamespaceOptionsService : IWorkspaceService { MoveToNamespaceOptionsResult GetChangeNamespaceOptions( string defaultNamespace, ImmutableArray<string> availableNamespaces, ISyntaxFacts syntaxFactsService); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/Core/Implementation/Classification/CompilationAvailableTaggerEventSource.cs
// 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 System; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Tagging; using Microsoft.CodeAnalysis.Editor.Tagging; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.Classification { /// <summary> /// Tagger event that fires once the compilation is ready for a particular project. Used to trigger a /// reclassification pass as classification may show either cached classifications (from a previous session), or /// incomplete classifications due to frozen-partial compilations being used. /// </summary> internal class CompilationAvailableTaggerEventSource : ITaggerEventSource { private readonly ITextBuffer _subjectBuffer; private readonly IAsynchronousOperationListener _asyncListener; /// <summary> /// Other event sources we're composing over. If they fire, we should reclassify. However, after they fire, we /// should also refire an event once we get the next full compilation ready. /// </summary> private readonly ITaggerEventSource _underlyingSource; /// <summary> /// Cancellation tokens controlling background computation of the compilation. /// </summary> private readonly ReferenceCountedDisposable<CancellationSeries> _cancellationSeries = new(new CancellationSeries()); public CompilationAvailableTaggerEventSource( ITextBuffer subjectBuffer, IAsynchronousOperationListener asyncListener, params ITaggerEventSource[] eventSources) { _subjectBuffer = subjectBuffer; _asyncListener = asyncListener; _underlyingSource = TaggerEventSources.Compose(eventSources); } public event EventHandler<TaggerEventArgs>? Changed; public void Connect() { // When we are connected to, connect to all our underlying sources and have them notify us when they've changed. _underlyingSource.Connect(); _underlyingSource.Changed += OnEventSourceChanged; } public void Disconnect() { _underlyingSource.Changed -= OnEventSourceChanged; _underlyingSource.Disconnect(); _cancellationSeries.Dispose(); } private void OnEventSourceChanged(object? sender, TaggerEventArgs args) { // First, notify anyone listening to us that something definitely changed. this.Changed?.Invoke(this, args); var document = _subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document == null) return; if (!document.SupportsSemanticModel) return; using var cancellationSeries = _cancellationSeries.TryAddReference(); if (cancellationSeries is null) { // Already in the process of disposing this instance return; } // Cancel any existing tasks that are computing the compilation and spawn a new one to compute // it and notify any listening clients. var cancellationToken = cancellationSeries.Target.CreateNext(); var token = _asyncListener.BeginAsyncOperation(nameof(OnEventSourceChanged)); var task = Task.Run(async () => { // Support cancellation without throwing await _asyncListener.Delay(TimeSpan.FromMilliseconds(500), cancellationToken).NoThrowAwaitable(captureContext: false); if (cancellationToken.IsCancellationRequested) return; await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); this.Changed?.Invoke(this, new TaggerEventArgs()); }, cancellationToken); task.CompletesAsyncOperation(token); } } }
// 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 System; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Tagging; using Microsoft.CodeAnalysis.Editor.Tagging; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.Classification { /// <summary> /// Tagger event that fires once the compilation is ready for a particular project. Used to trigger a /// reclassification pass as classification may show either cached classifications (from a previous session), or /// incomplete classifications due to frozen-partial compilations being used. /// </summary> internal class CompilationAvailableTaggerEventSource : ITaggerEventSource { private readonly ITextBuffer _subjectBuffer; private readonly IAsynchronousOperationListener _asyncListener; /// <summary> /// Other event sources we're composing over. If they fire, we should reclassify. However, after they fire, we /// should also refire an event once we get the next full compilation ready. /// </summary> private readonly ITaggerEventSource _underlyingSource; /// <summary> /// Cancellation tokens controlling background computation of the compilation. /// </summary> private readonly ReferenceCountedDisposable<CancellationSeries> _cancellationSeries = new(new CancellationSeries()); public CompilationAvailableTaggerEventSource( ITextBuffer subjectBuffer, IAsynchronousOperationListener asyncListener, params ITaggerEventSource[] eventSources) { _subjectBuffer = subjectBuffer; _asyncListener = asyncListener; _underlyingSource = TaggerEventSources.Compose(eventSources); } public event EventHandler<TaggerEventArgs>? Changed; public void Connect() { // When we are connected to, connect to all our underlying sources and have them notify us when they've changed. _underlyingSource.Connect(); _underlyingSource.Changed += OnEventSourceChanged; } public void Disconnect() { _underlyingSource.Changed -= OnEventSourceChanged; _underlyingSource.Disconnect(); _cancellationSeries.Dispose(); } private void OnEventSourceChanged(object? sender, TaggerEventArgs args) { // First, notify anyone listening to us that something definitely changed. this.Changed?.Invoke(this, args); var document = _subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document == null) return; if (!document.SupportsSemanticModel) return; using var cancellationSeries = _cancellationSeries.TryAddReference(); if (cancellationSeries is null) { // Already in the process of disposing this instance return; } // Cancel any existing tasks that are computing the compilation and spawn a new one to compute // it and notify any listening clients. var cancellationToken = cancellationSeries.Target.CreateNext(); var token = _asyncListener.BeginAsyncOperation(nameof(OnEventSourceChanged)); var task = Task.Run(async () => { // Support cancellation without throwing await _asyncListener.Delay(TimeSpan.FromMilliseconds(500), cancellationToken).NoThrowAwaitable(captureContext: false); if (cancellationToken.IsCancellationRequested) return; await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); this.Changed?.Invoke(this, new TaggerEventArgs()); }, cancellationToken); task.CompletesAsyncOperation(token); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/Core/Portable/AddImport/AbstractAddImportFeatureService.cs
// 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 System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Packaging; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.SymbolSearch; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.AddImport { internal abstract partial class AbstractAddImportFeatureService<TSimpleNameSyntax> : IAddImportFeatureService, IEqualityComparer<PortableExecutableReference> where TSimpleNameSyntax : SyntaxNode { protected abstract bool CanAddImport(SyntaxNode node, bool allowInHiddenRegions, CancellationToken cancellationToken); protected abstract bool CanAddImportForMethod(string diagnosticId, ISyntaxFacts syntaxFacts, SyntaxNode node, out TSimpleNameSyntax nameNode); protected abstract bool CanAddImportForNamespace(string diagnosticId, SyntaxNode node, out TSimpleNameSyntax nameNode); protected abstract bool CanAddImportForDeconstruct(string diagnosticId, SyntaxNode node); protected abstract bool CanAddImportForGetAwaiter(string diagnosticId, ISyntaxFacts syntaxFactsService, SyntaxNode node); protected abstract bool CanAddImportForGetEnumerator(string diagnosticId, ISyntaxFacts syntaxFactsService, SyntaxNode node); protected abstract bool CanAddImportForGetAsyncEnumerator(string diagnosticId, ISyntaxFacts syntaxFactsService, SyntaxNode node); protected abstract bool CanAddImportForQuery(string diagnosticId, SyntaxNode node); protected abstract bool CanAddImportForType(string diagnosticId, SyntaxNode node, out TSimpleNameSyntax nameNode); protected abstract ISet<INamespaceSymbol> GetImportNamespacesInScope(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); protected abstract ITypeSymbol GetDeconstructInfo(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); protected abstract ITypeSymbol GetQueryClauseInfo(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); protected abstract bool IsViableExtensionMethod(IMethodSymbol method, SyntaxNode expression, SemanticModel semanticModel, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken); protected abstract Task<Document> AddImportAsync(SyntaxNode contextNode, INamespaceOrTypeSymbol symbol, Document document, bool allowInHiddenRegions, CancellationToken cancellationToken); protected abstract Task<Document> AddImportAsync(SyntaxNode contextNode, IReadOnlyList<string> nameSpaceParts, Document document, bool allowInHiddenRegions, CancellationToken cancellationToken); protected abstract bool IsAddMethodContext(SyntaxNode node, SemanticModel semanticModel); protected abstract string GetDescription(IReadOnlyList<string> nameParts); protected abstract (string description, bool hasExistingImport) GetDescription(Document document, OptionSet options, INamespaceOrTypeSymbol symbol, SemanticModel semanticModel, SyntaxNode root, CancellationToken cancellationToken); public async Task<ImmutableArray<AddImportFixData>> GetFixesAsync( Document document, TextSpan span, string diagnosticId, int maxResults, bool allowInHiddenRegions, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); if (client != null) { var result = await client.TryInvokeAsync<IRemoteMissingImportDiscoveryService, ImmutableArray<AddImportFixData>>( document.Project.Solution, (service, solutionInfo, callbackId, cancellationToken) => service.GetFixesAsync(solutionInfo, callbackId, document.Id, span, diagnosticId, maxResults, allowInHiddenRegions, searchReferenceAssemblies, packageSources, cancellationToken), callbackTarget: symbolSearchService, cancellationToken).ConfigureAwait(false); return result.HasValue ? result.Value : ImmutableArray<AddImportFixData>.Empty; } return await GetFixesInCurrentProcessAsync( document, span, diagnosticId, maxResults, allowInHiddenRegions, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false); } private async Task<ImmutableArray<AddImportFixData>> GetFixesInCurrentProcessAsync( Document document, TextSpan span, string diagnosticId, int maxResults, bool allowInHiddenRegions, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var node = root.FindToken(span.Start, findInsideTrivia: true) .GetAncestor(n => n.Span.Contains(span) && n != root); using var _ = ArrayBuilder<AddImportFixData>.GetInstance(out var result); if (node != null) { using (Logger.LogBlock(FunctionId.Refactoring_AddImport, cancellationToken)) { if (!cancellationToken.IsCancellationRequested) { if (CanAddImport(node, allowInHiddenRegions, cancellationToken)) { var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var allSymbolReferences = await FindResultsAsync( document, semanticModel, diagnosticId, node, maxResults, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false); // Nothing found at all. No need to proceed. foreach (var reference in allSymbolReferences) { cancellationToken.ThrowIfCancellationRequested(); var fixData = await reference.TryGetFixDataAsync(document, node, allowInHiddenRegions, cancellationToken).ConfigureAwait(false); result.AddIfNotNull(fixData); } } } } } return result.ToImmutable(); } private async Task<ImmutableArray<Reference>> FindResultsAsync( Document document, SemanticModel semanticModel, string diagnosticId, SyntaxNode node, int maxResults, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { // Caches so we don't produce the same data multiple times while searching // all over the solution. var project = document.Project; var projectToAssembly = new ConcurrentDictionary<Project, AsyncLazy<IAssemblySymbol>>(concurrencyLevel: 2, capacity: project.Solution.ProjectIds.Count); var referenceToCompilation = new ConcurrentDictionary<PortableExecutableReference, Compilation>(concurrencyLevel: 2, capacity: project.Solution.Projects.Sum(p => p.MetadataReferences.Count)); var finder = new SymbolReferenceFinder( this, document, semanticModel, diagnosticId, node, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken); // Look for exact matches first: var exactReferences = await FindResultsAsync(projectToAssembly, referenceToCompilation, project, maxResults, finder, exact: true, cancellationToken: cancellationToken).ConfigureAwait(false); if (exactReferences.Length > 0) { return exactReferences; } // No exact matches found. Fall back to fuzzy searching. // Only bother doing this for host workspaces. We don't want this for // things like the Interactive workspace as this will cause us to // create expensive bk-trees which we won't even be able to save for // future use. if (!IsHostOrRemoteWorkspace(project)) { return ImmutableArray<Reference>.Empty; } var fuzzyReferences = await FindResultsAsync(projectToAssembly, referenceToCompilation, project, maxResults, finder, exact: false, cancellationToken: cancellationToken).ConfigureAwait(false); return fuzzyReferences; } private static bool IsHostOrRemoteWorkspace(Project project) { return project.Solution.Workspace.Kind is WorkspaceKind.Host or WorkspaceKind.RemoteWorkspace or WorkspaceKind.RemoteTemporaryWorkspace; } private async Task<ImmutableArray<Reference>> FindResultsAsync( ConcurrentDictionary<Project, AsyncLazy<IAssemblySymbol>> projectToAssembly, ConcurrentDictionary<PortableExecutableReference, Compilation> referenceToCompilation, Project project, int maxResults, SymbolReferenceFinder finder, bool exact, CancellationToken cancellationToken) { using var _ = ArrayBuilder<Reference>.GetInstance(out var allReferences); // First search the current project to see if any symbols (source or metadata) match the // search string. await FindResultsInAllSymbolsInStartingProjectAsync( allReferences, maxResults, finder, exact, cancellationToken).ConfigureAwait(false); // Only bother doing this for host workspaces. We don't want this for // things like the Interactive workspace as we can't even add project // references to the interactive window. We could consider adding metadata // references with #r in the future. if (IsHostOrRemoteWorkspace(project)) { // Now search unreferenced projects, and see if they have any source symbols that match // the search string. await FindResultsInUnreferencedProjectSourceSymbolsAsync(projectToAssembly, project, allReferences, maxResults, finder, exact, cancellationToken).ConfigureAwait(false); // Finally, check and see if we have any metadata symbols that match the search string. await FindResultsInUnreferencedMetadataSymbolsAsync(referenceToCompilation, project, allReferences, maxResults, finder, exact, cancellationToken).ConfigureAwait(false); // We only support searching NuGet in an exact manner currently. if (exact) { await finder.FindNugetOrReferenceAssemblyReferencesAsync(allReferences, cancellationToken).ConfigureAwait(false); } } return allReferences.ToImmutable(); } private static async Task FindResultsInAllSymbolsInStartingProjectAsync( ArrayBuilder<Reference> allSymbolReferences, int maxResults, SymbolReferenceFinder finder, bool exact, CancellationToken cancellationToken) { var references = await finder.FindInAllSymbolsInStartingProjectAsync(exact, cancellationToken).ConfigureAwait(false); AddRange(allSymbolReferences, references, maxResults); } private static async Task FindResultsInUnreferencedProjectSourceSymbolsAsync( ConcurrentDictionary<Project, AsyncLazy<IAssemblySymbol>> projectToAssembly, Project project, ArrayBuilder<Reference> allSymbolReferences, int maxResults, SymbolReferenceFinder finder, bool exact, CancellationToken cancellationToken) { // If we didn't find enough hits searching just in the project, then check // in any unreferenced projects. if (allSymbolReferences.Count >= maxResults) { return; } var viableUnreferencedProjects = GetViableUnreferencedProjects(project); // Search all unreferenced projects in parallel. var findTasks = new HashSet<Task<ImmutableArray<SymbolReference>>>(); // Create another cancellation token so we can both search all projects in parallel, // but also stop any searches once we get enough results. using var nestedTokenSource = new CancellationTokenSource(); using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(nestedTokenSource.Token, cancellationToken); foreach (var unreferencedProject in viableUnreferencedProjects) { // Search in this unreferenced project. But don't search in any of its' // direct references. i.e. we don't want to search in its metadata references // or in the projects it references itself. We'll be searching those entities // individually. findTasks.Add(finder.FindInSourceSymbolsInProjectAsync( projectToAssembly, unreferencedProject, exact, linkedTokenSource.Token)); } await WaitForTasksAsync(allSymbolReferences, maxResults, findTasks, nestedTokenSource, cancellationToken).ConfigureAwait(false); } private async Task FindResultsInUnreferencedMetadataSymbolsAsync( ConcurrentDictionary<PortableExecutableReference, Compilation> referenceToCompilation, Project project, ArrayBuilder<Reference> allSymbolReferences, int maxResults, SymbolReferenceFinder finder, bool exact, CancellationToken cancellationToken) { if (allSymbolReferences.Count > 0) { // Only do this if none of the project searches produced any results. We may have a // lot of metadata to search through, and it would be good to avoid that if we can. return; } // Keep track of the references we've seen (so that we don't process them multiple times // across many sibling projects). Prepopulate it with our own metadata references since // we know we don't need to search in that. var seenReferences = new HashSet<PortableExecutableReference>(comparer: this); seenReferences.AddAll(project.MetadataReferences.OfType<PortableExecutableReference>()); var newReferences = GetUnreferencedMetadataReferences(project, seenReferences); // Search all metadata references in parallel. var findTasks = new HashSet<Task<ImmutableArray<SymbolReference>>>(); // Create another cancellation token so we can both search all projects in parallel, // but also stop any searches once we get enough results. using var nestedTokenSource = new CancellationTokenSource(); using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(nestedTokenSource.Token, cancellationToken); foreach (var (referenceProjectId, reference) in newReferences) { var compilation = referenceToCompilation.GetOrAdd( reference, r => CreateCompilation(project, r)); // Ignore netmodules. First, they're incredibly esoteric and barely used. // Second, the SymbolFinder API doesn't even support searching them. if (compilation.GetAssemblyOrModuleSymbol(reference) is IAssemblySymbol assembly) { findTasks.Add(finder.FindInMetadataSymbolsAsync( assembly, referenceProjectId, reference, exact, linkedTokenSource.Token)); } } await WaitForTasksAsync(allSymbolReferences, maxResults, findTasks, nestedTokenSource, cancellationToken).ConfigureAwait(false); } /// <summary> /// Returns the set of PEReferences in the solution that are not currently being referenced /// by this project. The set returned will be tuples containing the PEReference, and the project-id /// for the project we found the pe-reference in. /// </summary> private static ImmutableArray<(ProjectId, PortableExecutableReference)> GetUnreferencedMetadataReferences( Project project, HashSet<PortableExecutableReference> seenReferences) { var result = ArrayBuilder<(ProjectId, PortableExecutableReference)>.GetInstance(); var solution = project.Solution; foreach (var p in solution.Projects) { if (p == project) { continue; } foreach (var reference in p.MetadataReferences) { if (reference is PortableExecutableReference peReference && !IsInPackagesDirectory(peReference) && seenReferences.Add(peReference)) { result.Add((p.Id, peReference)); } } } return result.ToImmutableAndFree(); } private static async Task WaitForTasksAsync( ArrayBuilder<Reference> allSymbolReferences, int maxResults, HashSet<Task<ImmutableArray<SymbolReference>>> findTasks, CancellationTokenSource nestedTokenSource, CancellationToken cancellationToken) { try { while (findTasks.Count > 0) { // Keep on looping through the 'find' tasks, processing each when they finish. cancellationToken.ThrowIfCancellationRequested(); var doneTask = await Task.WhenAny(findTasks).ConfigureAwait(false); // One of the tasks finished. Remove it from the list we're waiting on. findTasks.Remove(doneTask); // Add its results to the final result set we're keeping. AddRange(allSymbolReferences, await doneTask.ConfigureAwait(false), maxResults); // Once we get enough, just stop. if (allSymbolReferences.Count >= maxResults) { return; } } } finally { // Cancel any nested work that's still happening. nestedTokenSource.Cancel(); } } /// <summary> /// We ignore references that are in a directory that contains the names /// "Packages", "packs", "NuGetFallbackFolder", or "NuGetPackages" /// These directories are most likely the ones produced by NuGet, and we don't want /// to offer to add .dll reference manually for dlls that are part of NuGet packages. /// /// Note that this is only a heuristic (though a good one), and we should remove this /// when we can get an API from NuGet that tells us if a reference is actually provided /// by a nuget packages. /// Tracking issue: https://github.com/dotnet/project-system/issues/5275 /// /// This heuristic will do the right thing in practically all cases for all. It /// prevents the very unpleasant experience of us offering to add a direct metadata /// reference to something that should only be referenced as a nuget package. /// /// It does mean that if the following is true: /// You have a project that has a non-nuget metadata reference to something in a "packages" /// directory, and you are in another project that uses a type name that would have matched /// an accessible type from that dll. then we will not offer to add that .dll reference to /// that other project. /// /// However, that would be an exceedingly uncommon case that is degraded. Whereas we're /// vastly improved in the common case. This is a totally acceptable and desirable outcome /// for such a heuristic. /// </summary> private static bool IsInPackagesDirectory(PortableExecutableReference reference) { return ContainsPathComponent(reference, "packages") || ContainsPathComponent(reference, "packs") || ContainsPathComponent(reference, "NuGetFallbackFolder") || ContainsPathComponent(reference, "NuGetPackages"); static bool ContainsPathComponent(PortableExecutableReference reference, string pathComponent) { return PathUtilities.ContainsPathComponent(reference.FilePath, pathComponent, ignoreCase: true); } } /// <summary> /// Called when we want to search a metadata reference. We create a dummy compilation /// containing just that reference and we search that. That way we can get actual symbols /// returned. /// /// We don't want to use the project that the reference is actually associated with as /// getting the compilation for that project may be extremely expensive. For example, /// in a large solution it may cause us to build an enormous amount of skeleton assemblies. /// </summary> private static Compilation CreateCompilation(Project project, PortableExecutableReference reference) { var compilationService = project.LanguageServices.GetRequiredService<ICompilationFactoryService>(); var compilation = compilationService.CreateCompilation("TempAssembly", compilationService.GetDefaultCompilationOptions()); return compilation.WithReferences(reference); } bool IEqualityComparer<PortableExecutableReference>.Equals(PortableExecutableReference? x, PortableExecutableReference? y) { if (x == y) return true; var path1 = x?.FilePath ?? x?.Display; var path2 = y?.FilePath ?? y?.Display; if (path1 == null || path2 == null) return false; return StringComparer.OrdinalIgnoreCase.Equals(path1, path2); } int IEqualityComparer<PortableExecutableReference>.GetHashCode(PortableExecutableReference obj) { var path = obj.FilePath ?? obj.Display; return path == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(path); } private static HashSet<Project> GetViableUnreferencedProjects(Project project) { var solution = project.Solution; var viableProjects = new HashSet<Project>(solution.Projects); // Clearly we can't reference ourselves. viableProjects.Remove(project); // We can't reference any project that transitively depends on us. Doing so would // cause a circular reference between projects. var dependencyGraph = solution.GetProjectDependencyGraph(); var projectsThatTransitivelyDependOnThisProject = dependencyGraph.GetProjectsThatTransitivelyDependOnThisProject(project.Id); viableProjects.RemoveAll(projectsThatTransitivelyDependOnThisProject.Select(id => solution.GetRequiredProject(id))); // We also aren't interested in any projects we're already directly referencing. viableProjects.RemoveAll(project.ProjectReferences.Select(r => solution.GetRequiredProject(r.ProjectId))); return viableProjects; } private static void AddRange<TReference>(ArrayBuilder<Reference> allSymbolReferences, ImmutableArray<TReference> proposedReferences, int maxResults) where TReference : Reference { allSymbolReferences.AddRange(proposedReferences.Take(maxResults - allSymbolReferences.Count)); } protected static bool IsViableExtensionMethod(IMethodSymbol method, ITypeSymbol receiver) { if (receiver == null || method == null) { return false; } // It's possible that the 'method' we're looking at is from a different language than // the language we're currently in. For example, we might find the extension method // in an unreferenced VB project while we're in C#. However, in order to 'reduce' // the extension method, the compiler requires both the method and receiver to be // from the same language. // // So, if they're not from the same language, we simply can't proceed. Now in this // case we decide that the method is not viable. But we could, in the future, decide // to just always consider such methods viable. if (receiver.Language != method.Language) { return false; } return method.ReduceExtensionMethod(receiver) != null; } private static bool NotGlobalNamespace(SymbolReference reference) { var symbol = reference.SymbolResult.Symbol; return symbol.IsNamespace ? !((INamespaceSymbol)symbol).IsGlobalNamespace : true; } private static bool NotNull(SymbolReference reference) => reference.SymbolResult.Symbol != null; public async Task<ImmutableArray<(Diagnostic Diagnostic, ImmutableArray<AddImportFixData> Fixes)>> GetFixesForDiagnosticsAsync( Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { // We might have multiple different diagnostics covering the same span. Have to // process them all as we might produce different fixes for each diagnostic. // Normally we don't allow generation into a hidden region in the file. However, if we have a // modern span mapper at our disposal, we do allow it as that host span mapper can handle mapping // our edit to their domain appropriate. var allowInHiddenRegions = document.CanAddImportsInHiddenRegions(); var fixesForDiagnosticBuilder = ArrayBuilder<(Diagnostic, ImmutableArray<AddImportFixData>)>.GetInstance(); foreach (var diagnostic in diagnostics) { var fixes = await GetFixesAsync( document, span, diagnostic.Id, maxResultsPerDiagnostic, allowInHiddenRegions, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false); fixesForDiagnosticBuilder.Add((diagnostic, fixes)); } return fixesForDiagnosticBuilder.ToImmutableAndFree(); } public async Task<ImmutableArray<AddImportFixData>> GetUniqueFixesAsync( Document document, TextSpan span, ImmutableArray<string> diagnosticIds, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); if (client != null) { var result = await client.TryInvokeAsync<IRemoteMissingImportDiscoveryService, ImmutableArray<AddImportFixData>>( document.Project.Solution, (service, solutionInfo, callbackId, cancellationToken) => service.GetUniqueFixesAsync(solutionInfo, callbackId, document.Id, span, diagnosticIds, searchReferenceAssemblies, packageSources, cancellationToken), callbackTarget: symbolSearchService, cancellationToken).ConfigureAwait(false); return result.HasValue ? result.Value : ImmutableArray<AddImportFixData>.Empty; } return await GetUniqueFixesAsyncInCurrentProcessAsync( document, span, diagnosticIds, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false); } private async Task<ImmutableArray<AddImportFixData>> GetUniqueFixesAsyncInCurrentProcessAsync( Document document, TextSpan span, ImmutableArray<string> diagnosticIds, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { var allowInHiddenRegions = document.CanAddImportsInHiddenRegions(); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); // Get the diagnostics that indicate a missing import. var diagnostics = semanticModel.GetDiagnostics(span, cancellationToken) .Where(diagnostic => diagnosticIds.Contains(diagnostic.Id)) .ToImmutableArray(); var getFixesForDiagnosticsTasks = diagnostics .GroupBy(diagnostic => diagnostic.Location.SourceSpan) .Select(diagnosticsForSourceSpan => GetFixesForDiagnosticsAsync( document, diagnosticsForSourceSpan.Key, diagnosticsForSourceSpan.AsImmutable(), maxResultsPerDiagnostic: 2, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken)); using var _ = ArrayBuilder<AddImportFixData>.GetInstance(out var fixes); foreach (var getFixesForDiagnosticsTask in getFixesForDiagnosticsTasks) { var fixesForDiagnostics = await getFixesForDiagnosticsTask.ConfigureAwait(false); foreach (var fixesForDiagnostic in fixesForDiagnostics) { // When there is more than one potential fix for a missing import diagnostic, // which is possible when the same class name is present in multiple namespaces, // we do not want to choose for the user and be wrong. We will not attempt to // fix this diagnostic and instead leave it for the user to resolve since they // will have more context for determining the proper fix. if (fixesForDiagnostic.Fixes.Length == 1) fixes.Add(fixesForDiagnostic.Fixes[0]); } } return fixes.ToImmutable(); } public ImmutableArray<CodeAction> GetCodeActionsForFixes( Document document, ImmutableArray<AddImportFixData> fixes, IPackageInstallerService? installerService, int maxResults) { var codeActionsBuilder = ArrayBuilder<CodeAction>.GetInstance(); foreach (var fix in fixes) { var codeAction = TryCreateCodeAction(document, fix, installerService); codeActionsBuilder.AddIfNotNull(codeAction); if (codeActionsBuilder.Count >= maxResults) { break; } } return codeActionsBuilder.ToImmutableAndFree(); } private static CodeAction? TryCreateCodeAction(Document document, AddImportFixData fixData, IPackageInstallerService? installerService) => fixData.Kind switch { AddImportFixKind.ProjectSymbol => new ProjectSymbolReferenceCodeAction(document, fixData), AddImportFixKind.MetadataSymbol => new MetadataSymbolReferenceCodeAction(document, fixData), AddImportFixKind.ReferenceAssemblySymbol => new AssemblyReferenceCodeAction(document, fixData), AddImportFixKind.PackageSymbol => installerService?.IsInstalled(document.Project.Solution.Workspace, document.Project.Id, fixData.PackageName) == false ? new ParentInstallPackageCodeAction(document, fixData, installerService) : null, _ => throw ExceptionUtilities.Unreachable, }; private static ITypeSymbol? GetAwaitInfo(SemanticModel semanticModel, ISyntaxFacts syntaxFactsService, SyntaxNode node) { var awaitExpression = FirstAwaitExpressionAncestor(syntaxFactsService, node); if (awaitExpression is null) return null; Debug.Assert(syntaxFactsService.IsAwaitExpression(awaitExpression)); var innerExpression = syntaxFactsService.GetExpressionOfAwaitExpression(awaitExpression); return semanticModel.GetTypeInfo(innerExpression).Type; } private static ITypeSymbol? GetCollectionExpressionType(SemanticModel semanticModel, ISyntaxFacts syntaxFactsService, SyntaxNode node) { var collectionExpression = FirstForeachCollectionExpressionAncestor(syntaxFactsService, node); if (collectionExpression is null) { return null; } return semanticModel.GetTypeInfo(collectionExpression).Type; } protected static bool AncestorOrSelfIsAwaitExpression(ISyntaxFacts syntaxFactsService, SyntaxNode node) => FirstAwaitExpressionAncestor(syntaxFactsService, node) != null; private static SyntaxNode? FirstAwaitExpressionAncestor(ISyntaxFacts syntaxFactsService, SyntaxNode node) => node.FirstAncestorOrSelf<SyntaxNode, ISyntaxFacts>((n, syntaxFactsService) => syntaxFactsService.IsAwaitExpression(n), syntaxFactsService); private static SyntaxNode? FirstForeachCollectionExpressionAncestor(ISyntaxFacts syntaxFactsService, SyntaxNode node) => node.FirstAncestorOrSelf<SyntaxNode, ISyntaxFacts>((n, syntaxFactsService) => syntaxFactsService.IsExpressionOfForeach(n), syntaxFactsService); } }
// 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 System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Packaging; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.SymbolSearch; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.AddImport { internal abstract partial class AbstractAddImportFeatureService<TSimpleNameSyntax> : IAddImportFeatureService, IEqualityComparer<PortableExecutableReference> where TSimpleNameSyntax : SyntaxNode { protected abstract bool CanAddImport(SyntaxNode node, bool allowInHiddenRegions, CancellationToken cancellationToken); protected abstract bool CanAddImportForMethod(string diagnosticId, ISyntaxFacts syntaxFacts, SyntaxNode node, out TSimpleNameSyntax nameNode); protected abstract bool CanAddImportForNamespace(string diagnosticId, SyntaxNode node, out TSimpleNameSyntax nameNode); protected abstract bool CanAddImportForDeconstruct(string diagnosticId, SyntaxNode node); protected abstract bool CanAddImportForGetAwaiter(string diagnosticId, ISyntaxFacts syntaxFactsService, SyntaxNode node); protected abstract bool CanAddImportForGetEnumerator(string diagnosticId, ISyntaxFacts syntaxFactsService, SyntaxNode node); protected abstract bool CanAddImportForGetAsyncEnumerator(string diagnosticId, ISyntaxFacts syntaxFactsService, SyntaxNode node); protected abstract bool CanAddImportForQuery(string diagnosticId, SyntaxNode node); protected abstract bool CanAddImportForType(string diagnosticId, SyntaxNode node, out TSimpleNameSyntax nameNode); protected abstract ISet<INamespaceSymbol> GetImportNamespacesInScope(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); protected abstract ITypeSymbol GetDeconstructInfo(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); protected abstract ITypeSymbol GetQueryClauseInfo(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); protected abstract bool IsViableExtensionMethod(IMethodSymbol method, SyntaxNode expression, SemanticModel semanticModel, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken); protected abstract Task<Document> AddImportAsync(SyntaxNode contextNode, INamespaceOrTypeSymbol symbol, Document document, bool allowInHiddenRegions, CancellationToken cancellationToken); protected abstract Task<Document> AddImportAsync(SyntaxNode contextNode, IReadOnlyList<string> nameSpaceParts, Document document, bool allowInHiddenRegions, CancellationToken cancellationToken); protected abstract bool IsAddMethodContext(SyntaxNode node, SemanticModel semanticModel); protected abstract string GetDescription(IReadOnlyList<string> nameParts); protected abstract (string description, bool hasExistingImport) GetDescription(Document document, OptionSet options, INamespaceOrTypeSymbol symbol, SemanticModel semanticModel, SyntaxNode root, CancellationToken cancellationToken); public async Task<ImmutableArray<AddImportFixData>> GetFixesAsync( Document document, TextSpan span, string diagnosticId, int maxResults, bool allowInHiddenRegions, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); if (client != null) { var result = await client.TryInvokeAsync<IRemoteMissingImportDiscoveryService, ImmutableArray<AddImportFixData>>( document.Project.Solution, (service, solutionInfo, callbackId, cancellationToken) => service.GetFixesAsync(solutionInfo, callbackId, document.Id, span, diagnosticId, maxResults, allowInHiddenRegions, searchReferenceAssemblies, packageSources, cancellationToken), callbackTarget: symbolSearchService, cancellationToken).ConfigureAwait(false); return result.HasValue ? result.Value : ImmutableArray<AddImportFixData>.Empty; } return await GetFixesInCurrentProcessAsync( document, span, diagnosticId, maxResults, allowInHiddenRegions, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false); } private async Task<ImmutableArray<AddImportFixData>> GetFixesInCurrentProcessAsync( Document document, TextSpan span, string diagnosticId, int maxResults, bool allowInHiddenRegions, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var node = root.FindToken(span.Start, findInsideTrivia: true) .GetAncestor(n => n.Span.Contains(span) && n != root); using var _ = ArrayBuilder<AddImportFixData>.GetInstance(out var result); if (node != null) { using (Logger.LogBlock(FunctionId.Refactoring_AddImport, cancellationToken)) { if (!cancellationToken.IsCancellationRequested) { if (CanAddImport(node, allowInHiddenRegions, cancellationToken)) { var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var allSymbolReferences = await FindResultsAsync( document, semanticModel, diagnosticId, node, maxResults, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false); // Nothing found at all. No need to proceed. foreach (var reference in allSymbolReferences) { cancellationToken.ThrowIfCancellationRequested(); var fixData = await reference.TryGetFixDataAsync(document, node, allowInHiddenRegions, cancellationToken).ConfigureAwait(false); result.AddIfNotNull(fixData); } } } } } return result.ToImmutable(); } private async Task<ImmutableArray<Reference>> FindResultsAsync( Document document, SemanticModel semanticModel, string diagnosticId, SyntaxNode node, int maxResults, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { // Caches so we don't produce the same data multiple times while searching // all over the solution. var project = document.Project; var projectToAssembly = new ConcurrentDictionary<Project, AsyncLazy<IAssemblySymbol>>(concurrencyLevel: 2, capacity: project.Solution.ProjectIds.Count); var referenceToCompilation = new ConcurrentDictionary<PortableExecutableReference, Compilation>(concurrencyLevel: 2, capacity: project.Solution.Projects.Sum(p => p.MetadataReferences.Count)); var finder = new SymbolReferenceFinder( this, document, semanticModel, diagnosticId, node, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken); // Look for exact matches first: var exactReferences = await FindResultsAsync(projectToAssembly, referenceToCompilation, project, maxResults, finder, exact: true, cancellationToken: cancellationToken).ConfigureAwait(false); if (exactReferences.Length > 0) { return exactReferences; } // No exact matches found. Fall back to fuzzy searching. // Only bother doing this for host workspaces. We don't want this for // things like the Interactive workspace as this will cause us to // create expensive bk-trees which we won't even be able to save for // future use. if (!IsHostOrRemoteWorkspace(project)) { return ImmutableArray<Reference>.Empty; } var fuzzyReferences = await FindResultsAsync(projectToAssembly, referenceToCompilation, project, maxResults, finder, exact: false, cancellationToken: cancellationToken).ConfigureAwait(false); return fuzzyReferences; } private static bool IsHostOrRemoteWorkspace(Project project) { return project.Solution.Workspace.Kind is WorkspaceKind.Host or WorkspaceKind.RemoteWorkspace or WorkspaceKind.RemoteTemporaryWorkspace; } private async Task<ImmutableArray<Reference>> FindResultsAsync( ConcurrentDictionary<Project, AsyncLazy<IAssemblySymbol>> projectToAssembly, ConcurrentDictionary<PortableExecutableReference, Compilation> referenceToCompilation, Project project, int maxResults, SymbolReferenceFinder finder, bool exact, CancellationToken cancellationToken) { using var _ = ArrayBuilder<Reference>.GetInstance(out var allReferences); // First search the current project to see if any symbols (source or metadata) match the // search string. await FindResultsInAllSymbolsInStartingProjectAsync( allReferences, maxResults, finder, exact, cancellationToken).ConfigureAwait(false); // Only bother doing this for host workspaces. We don't want this for // things like the Interactive workspace as we can't even add project // references to the interactive window. We could consider adding metadata // references with #r in the future. if (IsHostOrRemoteWorkspace(project)) { // Now search unreferenced projects, and see if they have any source symbols that match // the search string. await FindResultsInUnreferencedProjectSourceSymbolsAsync(projectToAssembly, project, allReferences, maxResults, finder, exact, cancellationToken).ConfigureAwait(false); // Finally, check and see if we have any metadata symbols that match the search string. await FindResultsInUnreferencedMetadataSymbolsAsync(referenceToCompilation, project, allReferences, maxResults, finder, exact, cancellationToken).ConfigureAwait(false); // We only support searching NuGet in an exact manner currently. if (exact) { await finder.FindNugetOrReferenceAssemblyReferencesAsync(allReferences, cancellationToken).ConfigureAwait(false); } } return allReferences.ToImmutable(); } private static async Task FindResultsInAllSymbolsInStartingProjectAsync( ArrayBuilder<Reference> allSymbolReferences, int maxResults, SymbolReferenceFinder finder, bool exact, CancellationToken cancellationToken) { var references = await finder.FindInAllSymbolsInStartingProjectAsync(exact, cancellationToken).ConfigureAwait(false); AddRange(allSymbolReferences, references, maxResults); } private static async Task FindResultsInUnreferencedProjectSourceSymbolsAsync( ConcurrentDictionary<Project, AsyncLazy<IAssemblySymbol>> projectToAssembly, Project project, ArrayBuilder<Reference> allSymbolReferences, int maxResults, SymbolReferenceFinder finder, bool exact, CancellationToken cancellationToken) { // If we didn't find enough hits searching just in the project, then check // in any unreferenced projects. if (allSymbolReferences.Count >= maxResults) { return; } var viableUnreferencedProjects = GetViableUnreferencedProjects(project); // Search all unreferenced projects in parallel. var findTasks = new HashSet<Task<ImmutableArray<SymbolReference>>>(); // Create another cancellation token so we can both search all projects in parallel, // but also stop any searches once we get enough results. using var nestedTokenSource = new CancellationTokenSource(); using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(nestedTokenSource.Token, cancellationToken); foreach (var unreferencedProject in viableUnreferencedProjects) { // Search in this unreferenced project. But don't search in any of its' // direct references. i.e. we don't want to search in its metadata references // or in the projects it references itself. We'll be searching those entities // individually. findTasks.Add(finder.FindInSourceSymbolsInProjectAsync( projectToAssembly, unreferencedProject, exact, linkedTokenSource.Token)); } await WaitForTasksAsync(allSymbolReferences, maxResults, findTasks, nestedTokenSource, cancellationToken).ConfigureAwait(false); } private async Task FindResultsInUnreferencedMetadataSymbolsAsync( ConcurrentDictionary<PortableExecutableReference, Compilation> referenceToCompilation, Project project, ArrayBuilder<Reference> allSymbolReferences, int maxResults, SymbolReferenceFinder finder, bool exact, CancellationToken cancellationToken) { if (allSymbolReferences.Count > 0) { // Only do this if none of the project searches produced any results. We may have a // lot of metadata to search through, and it would be good to avoid that if we can. return; } // Keep track of the references we've seen (so that we don't process them multiple times // across many sibling projects). Prepopulate it with our own metadata references since // we know we don't need to search in that. var seenReferences = new HashSet<PortableExecutableReference>(comparer: this); seenReferences.AddAll(project.MetadataReferences.OfType<PortableExecutableReference>()); var newReferences = GetUnreferencedMetadataReferences(project, seenReferences); // Search all metadata references in parallel. var findTasks = new HashSet<Task<ImmutableArray<SymbolReference>>>(); // Create another cancellation token so we can both search all projects in parallel, // but also stop any searches once we get enough results. using var nestedTokenSource = new CancellationTokenSource(); using var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(nestedTokenSource.Token, cancellationToken); foreach (var (referenceProjectId, reference) in newReferences) { var compilation = referenceToCompilation.GetOrAdd( reference, r => CreateCompilation(project, r)); // Ignore netmodules. First, they're incredibly esoteric and barely used. // Second, the SymbolFinder API doesn't even support searching them. if (compilation.GetAssemblyOrModuleSymbol(reference) is IAssemblySymbol assembly) { findTasks.Add(finder.FindInMetadataSymbolsAsync( assembly, referenceProjectId, reference, exact, linkedTokenSource.Token)); } } await WaitForTasksAsync(allSymbolReferences, maxResults, findTasks, nestedTokenSource, cancellationToken).ConfigureAwait(false); } /// <summary> /// Returns the set of PEReferences in the solution that are not currently being referenced /// by this project. The set returned will be tuples containing the PEReference, and the project-id /// for the project we found the pe-reference in. /// </summary> private static ImmutableArray<(ProjectId, PortableExecutableReference)> GetUnreferencedMetadataReferences( Project project, HashSet<PortableExecutableReference> seenReferences) { var result = ArrayBuilder<(ProjectId, PortableExecutableReference)>.GetInstance(); var solution = project.Solution; foreach (var p in solution.Projects) { if (p == project) { continue; } foreach (var reference in p.MetadataReferences) { if (reference is PortableExecutableReference peReference && !IsInPackagesDirectory(peReference) && seenReferences.Add(peReference)) { result.Add((p.Id, peReference)); } } } return result.ToImmutableAndFree(); } private static async Task WaitForTasksAsync( ArrayBuilder<Reference> allSymbolReferences, int maxResults, HashSet<Task<ImmutableArray<SymbolReference>>> findTasks, CancellationTokenSource nestedTokenSource, CancellationToken cancellationToken) { try { while (findTasks.Count > 0) { // Keep on looping through the 'find' tasks, processing each when they finish. cancellationToken.ThrowIfCancellationRequested(); var doneTask = await Task.WhenAny(findTasks).ConfigureAwait(false); // One of the tasks finished. Remove it from the list we're waiting on. findTasks.Remove(doneTask); // Add its results to the final result set we're keeping. AddRange(allSymbolReferences, await doneTask.ConfigureAwait(false), maxResults); // Once we get enough, just stop. if (allSymbolReferences.Count >= maxResults) { return; } } } finally { // Cancel any nested work that's still happening. nestedTokenSource.Cancel(); } } /// <summary> /// We ignore references that are in a directory that contains the names /// "Packages", "packs", "NuGetFallbackFolder", or "NuGetPackages" /// These directories are most likely the ones produced by NuGet, and we don't want /// to offer to add .dll reference manually for dlls that are part of NuGet packages. /// /// Note that this is only a heuristic (though a good one), and we should remove this /// when we can get an API from NuGet that tells us if a reference is actually provided /// by a nuget packages. /// Tracking issue: https://github.com/dotnet/project-system/issues/5275 /// /// This heuristic will do the right thing in practically all cases for all. It /// prevents the very unpleasant experience of us offering to add a direct metadata /// reference to something that should only be referenced as a nuget package. /// /// It does mean that if the following is true: /// You have a project that has a non-nuget metadata reference to something in a "packages" /// directory, and you are in another project that uses a type name that would have matched /// an accessible type from that dll. then we will not offer to add that .dll reference to /// that other project. /// /// However, that would be an exceedingly uncommon case that is degraded. Whereas we're /// vastly improved in the common case. This is a totally acceptable and desirable outcome /// for such a heuristic. /// </summary> private static bool IsInPackagesDirectory(PortableExecutableReference reference) { return ContainsPathComponent(reference, "packages") || ContainsPathComponent(reference, "packs") || ContainsPathComponent(reference, "NuGetFallbackFolder") || ContainsPathComponent(reference, "NuGetPackages"); static bool ContainsPathComponent(PortableExecutableReference reference, string pathComponent) { return PathUtilities.ContainsPathComponent(reference.FilePath, pathComponent, ignoreCase: true); } } /// <summary> /// Called when we want to search a metadata reference. We create a dummy compilation /// containing just that reference and we search that. That way we can get actual symbols /// returned. /// /// We don't want to use the project that the reference is actually associated with as /// getting the compilation for that project may be extremely expensive. For example, /// in a large solution it may cause us to build an enormous amount of skeleton assemblies. /// </summary> private static Compilation CreateCompilation(Project project, PortableExecutableReference reference) { var compilationService = project.LanguageServices.GetRequiredService<ICompilationFactoryService>(); var compilation = compilationService.CreateCompilation("TempAssembly", compilationService.GetDefaultCompilationOptions()); return compilation.WithReferences(reference); } bool IEqualityComparer<PortableExecutableReference>.Equals(PortableExecutableReference? x, PortableExecutableReference? y) { if (x == y) return true; var path1 = x?.FilePath ?? x?.Display; var path2 = y?.FilePath ?? y?.Display; if (path1 == null || path2 == null) return false; return StringComparer.OrdinalIgnoreCase.Equals(path1, path2); } int IEqualityComparer<PortableExecutableReference>.GetHashCode(PortableExecutableReference obj) { var path = obj.FilePath ?? obj.Display; return path == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(path); } private static HashSet<Project> GetViableUnreferencedProjects(Project project) { var solution = project.Solution; var viableProjects = new HashSet<Project>(solution.Projects); // Clearly we can't reference ourselves. viableProjects.Remove(project); // We can't reference any project that transitively depends on us. Doing so would // cause a circular reference between projects. var dependencyGraph = solution.GetProjectDependencyGraph(); var projectsThatTransitivelyDependOnThisProject = dependencyGraph.GetProjectsThatTransitivelyDependOnThisProject(project.Id); viableProjects.RemoveAll(projectsThatTransitivelyDependOnThisProject.Select(id => solution.GetRequiredProject(id))); // We also aren't interested in any projects we're already directly referencing. viableProjects.RemoveAll(project.ProjectReferences.Select(r => solution.GetRequiredProject(r.ProjectId))); return viableProjects; } private static void AddRange<TReference>(ArrayBuilder<Reference> allSymbolReferences, ImmutableArray<TReference> proposedReferences, int maxResults) where TReference : Reference { allSymbolReferences.AddRange(proposedReferences.Take(maxResults - allSymbolReferences.Count)); } protected static bool IsViableExtensionMethod(IMethodSymbol method, ITypeSymbol receiver) { if (receiver == null || method == null) { return false; } // It's possible that the 'method' we're looking at is from a different language than // the language we're currently in. For example, we might find the extension method // in an unreferenced VB project while we're in C#. However, in order to 'reduce' // the extension method, the compiler requires both the method and receiver to be // from the same language. // // So, if they're not from the same language, we simply can't proceed. Now in this // case we decide that the method is not viable. But we could, in the future, decide // to just always consider such methods viable. if (receiver.Language != method.Language) { return false; } return method.ReduceExtensionMethod(receiver) != null; } private static bool NotGlobalNamespace(SymbolReference reference) { var symbol = reference.SymbolResult.Symbol; return symbol.IsNamespace ? !((INamespaceSymbol)symbol).IsGlobalNamespace : true; } private static bool NotNull(SymbolReference reference) => reference.SymbolResult.Symbol != null; public async Task<ImmutableArray<(Diagnostic Diagnostic, ImmutableArray<AddImportFixData> Fixes)>> GetFixesForDiagnosticsAsync( Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { // We might have multiple different diagnostics covering the same span. Have to // process them all as we might produce different fixes for each diagnostic. // Normally we don't allow generation into a hidden region in the file. However, if we have a // modern span mapper at our disposal, we do allow it as that host span mapper can handle mapping // our edit to their domain appropriate. var allowInHiddenRegions = document.CanAddImportsInHiddenRegions(); var fixesForDiagnosticBuilder = ArrayBuilder<(Diagnostic, ImmutableArray<AddImportFixData>)>.GetInstance(); foreach (var diagnostic in diagnostics) { var fixes = await GetFixesAsync( document, span, diagnostic.Id, maxResultsPerDiagnostic, allowInHiddenRegions, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false); fixesForDiagnosticBuilder.Add((diagnostic, fixes)); } return fixesForDiagnosticBuilder.ToImmutableAndFree(); } public async Task<ImmutableArray<AddImportFixData>> GetUniqueFixesAsync( Document document, TextSpan span, ImmutableArray<string> diagnosticIds, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); if (client != null) { var result = await client.TryInvokeAsync<IRemoteMissingImportDiscoveryService, ImmutableArray<AddImportFixData>>( document.Project.Solution, (service, solutionInfo, callbackId, cancellationToken) => service.GetUniqueFixesAsync(solutionInfo, callbackId, document.Id, span, diagnosticIds, searchReferenceAssemblies, packageSources, cancellationToken), callbackTarget: symbolSearchService, cancellationToken).ConfigureAwait(false); return result.HasValue ? result.Value : ImmutableArray<AddImportFixData>.Empty; } return await GetUniqueFixesAsyncInCurrentProcessAsync( document, span, diagnosticIds, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false); } private async Task<ImmutableArray<AddImportFixData>> GetUniqueFixesAsyncInCurrentProcessAsync( Document document, TextSpan span, ImmutableArray<string> diagnosticIds, ISymbolSearchService symbolSearchService, bool searchReferenceAssemblies, ImmutableArray<PackageSource> packageSources, CancellationToken cancellationToken) { var allowInHiddenRegions = document.CanAddImportsInHiddenRegions(); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); // Get the diagnostics that indicate a missing import. var diagnostics = semanticModel.GetDiagnostics(span, cancellationToken) .Where(diagnostic => diagnosticIds.Contains(diagnostic.Id)) .ToImmutableArray(); var getFixesForDiagnosticsTasks = diagnostics .GroupBy(diagnostic => diagnostic.Location.SourceSpan) .Select(diagnosticsForSourceSpan => GetFixesForDiagnosticsAsync( document, diagnosticsForSourceSpan.Key, diagnosticsForSourceSpan.AsImmutable(), maxResultsPerDiagnostic: 2, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken)); using var _ = ArrayBuilder<AddImportFixData>.GetInstance(out var fixes); foreach (var getFixesForDiagnosticsTask in getFixesForDiagnosticsTasks) { var fixesForDiagnostics = await getFixesForDiagnosticsTask.ConfigureAwait(false); foreach (var fixesForDiagnostic in fixesForDiagnostics) { // When there is more than one potential fix for a missing import diagnostic, // which is possible when the same class name is present in multiple namespaces, // we do not want to choose for the user and be wrong. We will not attempt to // fix this diagnostic and instead leave it for the user to resolve since they // will have more context for determining the proper fix. if (fixesForDiagnostic.Fixes.Length == 1) fixes.Add(fixesForDiagnostic.Fixes[0]); } } return fixes.ToImmutable(); } public ImmutableArray<CodeAction> GetCodeActionsForFixes( Document document, ImmutableArray<AddImportFixData> fixes, IPackageInstallerService? installerService, int maxResults) { var codeActionsBuilder = ArrayBuilder<CodeAction>.GetInstance(); foreach (var fix in fixes) { var codeAction = TryCreateCodeAction(document, fix, installerService); codeActionsBuilder.AddIfNotNull(codeAction); if (codeActionsBuilder.Count >= maxResults) { break; } } return codeActionsBuilder.ToImmutableAndFree(); } private static CodeAction? TryCreateCodeAction(Document document, AddImportFixData fixData, IPackageInstallerService? installerService) => fixData.Kind switch { AddImportFixKind.ProjectSymbol => new ProjectSymbolReferenceCodeAction(document, fixData), AddImportFixKind.MetadataSymbol => new MetadataSymbolReferenceCodeAction(document, fixData), AddImportFixKind.ReferenceAssemblySymbol => new AssemblyReferenceCodeAction(document, fixData), AddImportFixKind.PackageSymbol => installerService?.IsInstalled(document.Project.Solution.Workspace, document.Project.Id, fixData.PackageName) == false ? new ParentInstallPackageCodeAction(document, fixData, installerService) : null, _ => throw ExceptionUtilities.Unreachable, }; private static ITypeSymbol? GetAwaitInfo(SemanticModel semanticModel, ISyntaxFacts syntaxFactsService, SyntaxNode node) { var awaitExpression = FirstAwaitExpressionAncestor(syntaxFactsService, node); if (awaitExpression is null) return null; Debug.Assert(syntaxFactsService.IsAwaitExpression(awaitExpression)); var innerExpression = syntaxFactsService.GetExpressionOfAwaitExpression(awaitExpression); return semanticModel.GetTypeInfo(innerExpression).Type; } private static ITypeSymbol? GetCollectionExpressionType(SemanticModel semanticModel, ISyntaxFacts syntaxFactsService, SyntaxNode node) { var collectionExpression = FirstForeachCollectionExpressionAncestor(syntaxFactsService, node); if (collectionExpression is null) { return null; } return semanticModel.GetTypeInfo(collectionExpression).Type; } protected static bool AncestorOrSelfIsAwaitExpression(ISyntaxFacts syntaxFactsService, SyntaxNode node) => FirstAwaitExpressionAncestor(syntaxFactsService, node) != null; private static SyntaxNode? FirstAwaitExpressionAncestor(ISyntaxFacts syntaxFactsService, SyntaxNode node) => node.FirstAncestorOrSelf<SyntaxNode, ISyntaxFacts>((n, syntaxFactsService) => syntaxFactsService.IsAwaitExpression(n), syntaxFactsService); private static SyntaxNode? FirstForeachCollectionExpressionAncestor(ISyntaxFacts syntaxFactsService, SyntaxNode node) => node.FirstAncestorOrSelf<SyntaxNode, ISyntaxFacts>((n, syntaxFactsService) => syntaxFactsService.IsExpressionOfForeach(n), syntaxFactsService); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Analyzers/CSharp/Analyzers/InlineDeclaration/CSharpInlineDeclarationDiagnosticAnalyzer.cs
// 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. #nullable disable using System.Collections.Immutable; using System.Linq; using System.Linq.Expressions; using System.Threading; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.InlineDeclaration { /// <summary> /// Looks for code of the form: /// /// int i; /// if (int.TryParse(s, out i)) { } /// /// And offers to convert it to: /// /// if (int.TryParse(s, out var i)) { } or /// if (int.TryParse(s, out int i)) { } or /// /// </summary> [DiagnosticAnalyzer(LanguageNames.CSharp)] internal class CSharpInlineDeclarationDiagnosticAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer { private const string CS0165 = nameof(CS0165); // Use of unassigned local variable 's' public CSharpInlineDeclarationDiagnosticAnalyzer() : base(IDEDiagnosticIds.InlineDeclarationDiagnosticId, EnforceOnBuildValues.InlineDeclaration, CSharpCodeStyleOptions.PreferInlinedVariableDeclaration, LanguageNames.CSharp, new LocalizableResourceString(nameof(CSharpAnalyzersResources.Inline_variable_declaration), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)), new LocalizableResourceString(nameof(CSharpAnalyzersResources.Variable_declaration_can_be_inlined), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources))) { } public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SemanticSpanAnalysis; protected override void InitializeWorker(AnalysisContext context) { context.RegisterCompilationStartAction(compilationContext => { var compilation = compilationContext.Compilation; var expressionTypeOpt = compilation.GetTypeByMetadataName(typeof(Expression<>).FullName); compilationContext.RegisterSyntaxNodeAction( syntaxContext => AnalyzeSyntaxNode(syntaxContext, expressionTypeOpt), SyntaxKind.Argument); }); } private void AnalyzeSyntaxNode(SyntaxNodeAnalysisContext context, INamedTypeSymbol expressionTypeOpt) { var argumentNode = (ArgumentSyntax)context.Node; var csOptions = (CSharpParseOptions)context.Node.SyntaxTree.Options; if (csOptions.LanguageVersion < LanguageVersion.CSharp7) { // out-vars are not supported prior to C# 7.0. return; } var options = context.Options; var syntaxTree = context.Node.SyntaxTree; var cancellationToken = context.CancellationToken; var option = options.GetOption(CSharpCodeStyleOptions.PreferInlinedVariableDeclaration, syntaxTree, cancellationToken); if (!option.Value) { // Don't bother doing any work if the user doesn't even have this preference set. return; } if (argumentNode.RefOrOutKeyword.Kind() != SyntaxKind.OutKeyword) { // Immediately bail if this is not an out-argument. If it's not an out-argument // we clearly can't convert it to be an out-variable-declaration. return; } var argumentExpression = argumentNode.Expression; if (!argumentExpression.IsKind(SyntaxKind.IdentifierName, out IdentifierNameSyntax identifierName)) { // has to be exactly the form "out i". i.e. "out this.i" or "out v[i]" are legal // cases for out-arguments, but could not be converted to an out-variable-declaration. return; } if (!(argumentNode.Parent is ArgumentListSyntax argumentList)) { return; } var invocationOrCreation = argumentList.Parent; if (!invocationOrCreation.IsKind(SyntaxKind.InvocationExpression) && !invocationOrCreation.IsKind(SyntaxKind.ObjectCreationExpression)) { // Out-variables are only legal with invocations and object creations. // If we don't have one of those bail. Note: we need hte parent to be // one of these forms so we can accurately verify that inlining the // variable doesn't change semantics. return; } // Don't offer to inline variables named "_". It can cause is to create a discard symbol // which would cause a break. if (identifierName.Identifier.ValueText == "_") { return; } var containingStatement = argumentExpression.FirstAncestorOrSelf<StatementSyntax>(); if (containingStatement == null) { return; } var semanticModel = context.SemanticModel; if (!(semanticModel.GetSymbolInfo(argumentExpression, cancellationToken).Symbol is ILocalSymbol outLocalSymbol)) { // The out-argument wasn't referencing a local. So we don't have an local // declaration that we can attempt to inline here. return; } // Ensure that the local-symbol actually belongs to LocalDeclarationStatement. // Trying to do things like inline a var-decl in a for-statement is just too // esoteric and would make us have to write a lot more complex code to support // that scenario. var localReference = outLocalSymbol.DeclaringSyntaxReferences.FirstOrDefault(); if (!(localReference?.GetSyntax(cancellationToken) is VariableDeclaratorSyntax localDeclarator)) { return; } var localDeclaration = localDeclarator.Parent as VariableDeclarationSyntax; if (!(localDeclaration?.Parent is LocalDeclarationStatementSyntax localStatement)) { return; } if (localDeclarator.SpanStart >= argumentNode.SpanStart) { // We have an error situation where the local was declared after the out-var. // Don't even bother offering anything here. return; } // If the local has an initializer, only allow the refactoring if it is initialized // with a simple literal or 'default' expression. i.e. it's ok to inline "var v = 0" // since there are no side-effects of the initialization. However something like // "var v = M()" should not be inlined as that could break program semantics. if (localDeclarator.Initializer != null) { if (!(localDeclarator.Initializer.Value is LiteralExpressionSyntax) && !(localDeclarator.Initializer.Value is DefaultExpressionSyntax)) { return; } } // Get the block that the local is scoped inside of. We'll search that block // for references to the local to make sure that no reads/writes happen before // the out-argument. If there are any reads/writes we can't inline as those // accesses will become invalid. if (!(localStatement.Parent is BlockSyntax enclosingBlockOfLocalStatement)) { return; } if (argumentExpression.IsInExpressionTree(semanticModel, expressionTypeOpt, cancellationToken)) { // out-vars are not allowed inside expression-trees. So don't offer to // fix if we're inside one. return; } // Find the scope that the out-declaration variable will live in after we // rewrite things. var outArgumentScope = GetOutArgumentScope(argumentExpression); if (!outLocalSymbol.CanSafelyMoveLocalToBlock(enclosingBlockOfLocalStatement, outArgumentScope)) { return; } // Make sure that variable is not accessed outside of that scope. var dataFlow = semanticModel.AnalyzeDataFlow(outArgumentScope); if (dataFlow.ReadOutside.Contains(outLocalSymbol) || dataFlow.WrittenOutside.Contains(outLocalSymbol)) { // The variable is read or written from outside the block that the new variable // would be scoped in. This would cause a break. // // Note(cyrusn): We could still offer the refactoring, but just show an error in the // preview in this case. return; } // Make sure the variable isn't ever accessed before the usage in this out-var. if (IsAccessed(semanticModel, outLocalSymbol, enclosingBlockOfLocalStatement, localStatement, argumentNode, cancellationToken)) { return; } // See if inlining this variable would make it so that some variables were no // longer definitely assigned. if (WouldCauseDefiniteAssignmentErrors(semanticModel, localStatement, enclosingBlockOfLocalStatement, outLocalSymbol)) { return; } // Collect some useful nodes for the fix provider to use so it doesn't have to // find them again. var allLocations = ImmutableArray.Create( localDeclarator.GetLocation(), identifierName.GetLocation(), invocationOrCreation.GetLocation()); // If the local variable only has one declarator, then report the suggestion on the whole // declaration. Otherwise, return the suggestion only on the single declarator. var reportNode = localDeclaration.Variables.Count == 1 ? (SyntaxNode)localDeclaration : localDeclarator; context.ReportDiagnostic(DiagnosticHelper.Create( Descriptor, reportNode.GetLocation(), option.Notification.Severity, additionalLocations: allLocations, properties: null)); } private static bool WouldCauseDefiniteAssignmentErrors( SemanticModel semanticModel, LocalDeclarationStatementSyntax localStatement, BlockSyntax enclosingBlock, ILocalSymbol outLocalSymbol) { // See if we have something like: // // int i = 0; // if (Goo() || Bar(out i)) // { // Console.WriteLine(i); // } // // In this case, inlining the 'i' would cause it to longer be definitely // assigned in the WriteLine invocation. var dataFlow = semanticModel.AnalyzeDataFlow( localStatement.GetNextStatement(), enclosingBlock.Statements.Last()); return dataFlow.DataFlowsIn.Contains(outLocalSymbol); } private static SyntaxNode GetOutArgumentScope(SyntaxNode argumentExpression) { for (var current = argumentExpression; current != null; current = current.Parent) { if (current.Parent is LambdaExpressionSyntax lambda && current == lambda.Body) { // We were in a lambda. The lambda body will be the new scope of the // out var. return current; } // Any loop construct defines a scope for out-variables, as well as each of the following: // * Using statements // * Fixed statements // * Try statements (specifically for exception filters) switch (current.Kind()) { case SyntaxKind.WhileStatement: case SyntaxKind.DoStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForEachStatement: case SyntaxKind.UsingStatement: case SyntaxKind.FixedStatement: case SyntaxKind.TryStatement: return current; } if (current is StatementSyntax) { // We hit a statement containing the out-argument. Statements can have one of // two forms. They're either parented by a block, or by another statement // (i.e. they're an embedded statement). If we're parented by a block, then // that block will be the scope of the new out-var. // // However, if our containing statement is not parented by a block, then that // means we have something like: // // if (x) // if (Try(out y)) // // In this case, there is a 'virtual' block scope surrounding the embedded 'if' // statement, and that will be the scope the out-var goes into. return current.IsParentKind(SyntaxKind.Block) ? current.Parent : current; } } return null; } private static bool IsAccessed( SemanticModel semanticModel, ISymbol outSymbol, BlockSyntax enclosingBlockOfLocalStatement, LocalDeclarationStatementSyntax localStatement, ArgumentSyntax argumentNode, CancellationToken cancellationToken) { var localStatementStart = localStatement.Span.Start; var argumentNodeStart = argumentNode.Span.Start; var variableName = outSymbol.Name; // Walk the block that the local is declared in looking for accesses. // We can ignore anything prior to the actual local declaration point, // and we only need to check up until we reach the out-argument. foreach (var descendentNode in enclosingBlockOfLocalStatement.DescendantNodes()) { var descendentStart = descendentNode.Span.Start; if (descendentStart <= localStatementStart) { // This node is before the local declaration. Can ignore it entirely as it could // not be an access to the local. continue; } if (descendentStart >= argumentNodeStart) { // We reached the out-var. We can stop searching entirely. break; } if (descendentNode.IsKind(SyntaxKind.IdentifierName, out IdentifierNameSyntax identifierName)) { // See if this looks like an accessor to the local variable syntactically. if (identifierName.Identifier.ValueText == variableName) { // Confirm that it is a access of the local. var symbol = semanticModel.GetSymbolInfo(identifierName, cancellationToken).Symbol; if (outSymbol.Equals(symbol)) { // We definitely accessed the local before the out-argument. We // can't inline this local. return true; } } } } // No accesses detected return false; } } }
// 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. #nullable disable using System.Collections.Immutable; using System.Linq; using System.Linq.Expressions; using System.Threading; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.InlineDeclaration { /// <summary> /// Looks for code of the form: /// /// int i; /// if (int.TryParse(s, out i)) { } /// /// And offers to convert it to: /// /// if (int.TryParse(s, out var i)) { } or /// if (int.TryParse(s, out int i)) { } or /// /// </summary> [DiagnosticAnalyzer(LanguageNames.CSharp)] internal class CSharpInlineDeclarationDiagnosticAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer { private const string CS0165 = nameof(CS0165); // Use of unassigned local variable 's' public CSharpInlineDeclarationDiagnosticAnalyzer() : base(IDEDiagnosticIds.InlineDeclarationDiagnosticId, EnforceOnBuildValues.InlineDeclaration, CSharpCodeStyleOptions.PreferInlinedVariableDeclaration, LanguageNames.CSharp, new LocalizableResourceString(nameof(CSharpAnalyzersResources.Inline_variable_declaration), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)), new LocalizableResourceString(nameof(CSharpAnalyzersResources.Variable_declaration_can_be_inlined), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources))) { } public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SemanticSpanAnalysis; protected override void InitializeWorker(AnalysisContext context) { context.RegisterCompilationStartAction(compilationContext => { var compilation = compilationContext.Compilation; var expressionTypeOpt = compilation.GetTypeByMetadataName(typeof(Expression<>).FullName); compilationContext.RegisterSyntaxNodeAction( syntaxContext => AnalyzeSyntaxNode(syntaxContext, expressionTypeOpt), SyntaxKind.Argument); }); } private void AnalyzeSyntaxNode(SyntaxNodeAnalysisContext context, INamedTypeSymbol expressionTypeOpt) { var argumentNode = (ArgumentSyntax)context.Node; var csOptions = (CSharpParseOptions)context.Node.SyntaxTree.Options; if (csOptions.LanguageVersion < LanguageVersion.CSharp7) { // out-vars are not supported prior to C# 7.0. return; } var options = context.Options; var syntaxTree = context.Node.SyntaxTree; var cancellationToken = context.CancellationToken; var option = options.GetOption(CSharpCodeStyleOptions.PreferInlinedVariableDeclaration, syntaxTree, cancellationToken); if (!option.Value) { // Don't bother doing any work if the user doesn't even have this preference set. return; } if (argumentNode.RefOrOutKeyword.Kind() != SyntaxKind.OutKeyword) { // Immediately bail if this is not an out-argument. If it's not an out-argument // we clearly can't convert it to be an out-variable-declaration. return; } var argumentExpression = argumentNode.Expression; if (!argumentExpression.IsKind(SyntaxKind.IdentifierName, out IdentifierNameSyntax identifierName)) { // has to be exactly the form "out i". i.e. "out this.i" or "out v[i]" are legal // cases for out-arguments, but could not be converted to an out-variable-declaration. return; } if (!(argumentNode.Parent is ArgumentListSyntax argumentList)) { return; } var invocationOrCreation = argumentList.Parent; if (!invocationOrCreation.IsKind(SyntaxKind.InvocationExpression) && !invocationOrCreation.IsKind(SyntaxKind.ObjectCreationExpression)) { // Out-variables are only legal with invocations and object creations. // If we don't have one of those bail. Note: we need hte parent to be // one of these forms so we can accurately verify that inlining the // variable doesn't change semantics. return; } // Don't offer to inline variables named "_". It can cause is to create a discard symbol // which would cause a break. if (identifierName.Identifier.ValueText == "_") { return; } var containingStatement = argumentExpression.FirstAncestorOrSelf<StatementSyntax>(); if (containingStatement == null) { return; } var semanticModel = context.SemanticModel; if (!(semanticModel.GetSymbolInfo(argumentExpression, cancellationToken).Symbol is ILocalSymbol outLocalSymbol)) { // The out-argument wasn't referencing a local. So we don't have an local // declaration that we can attempt to inline here. return; } // Ensure that the local-symbol actually belongs to LocalDeclarationStatement. // Trying to do things like inline a var-decl in a for-statement is just too // esoteric and would make us have to write a lot more complex code to support // that scenario. var localReference = outLocalSymbol.DeclaringSyntaxReferences.FirstOrDefault(); if (!(localReference?.GetSyntax(cancellationToken) is VariableDeclaratorSyntax localDeclarator)) { return; } var localDeclaration = localDeclarator.Parent as VariableDeclarationSyntax; if (!(localDeclaration?.Parent is LocalDeclarationStatementSyntax localStatement)) { return; } if (localDeclarator.SpanStart >= argumentNode.SpanStart) { // We have an error situation where the local was declared after the out-var. // Don't even bother offering anything here. return; } // If the local has an initializer, only allow the refactoring if it is initialized // with a simple literal or 'default' expression. i.e. it's ok to inline "var v = 0" // since there are no side-effects of the initialization. However something like // "var v = M()" should not be inlined as that could break program semantics. if (localDeclarator.Initializer != null) { if (!(localDeclarator.Initializer.Value is LiteralExpressionSyntax) && !(localDeclarator.Initializer.Value is DefaultExpressionSyntax)) { return; } } // Get the block that the local is scoped inside of. We'll search that block // for references to the local to make sure that no reads/writes happen before // the out-argument. If there are any reads/writes we can't inline as those // accesses will become invalid. if (!(localStatement.Parent is BlockSyntax enclosingBlockOfLocalStatement)) { return; } if (argumentExpression.IsInExpressionTree(semanticModel, expressionTypeOpt, cancellationToken)) { // out-vars are not allowed inside expression-trees. So don't offer to // fix if we're inside one. return; } // Find the scope that the out-declaration variable will live in after we // rewrite things. var outArgumentScope = GetOutArgumentScope(argumentExpression); if (!outLocalSymbol.CanSafelyMoveLocalToBlock(enclosingBlockOfLocalStatement, outArgumentScope)) { return; } // Make sure that variable is not accessed outside of that scope. var dataFlow = semanticModel.AnalyzeDataFlow(outArgumentScope); if (dataFlow.ReadOutside.Contains(outLocalSymbol) || dataFlow.WrittenOutside.Contains(outLocalSymbol)) { // The variable is read or written from outside the block that the new variable // would be scoped in. This would cause a break. // // Note(cyrusn): We could still offer the refactoring, but just show an error in the // preview in this case. return; } // Make sure the variable isn't ever accessed before the usage in this out-var. if (IsAccessed(semanticModel, outLocalSymbol, enclosingBlockOfLocalStatement, localStatement, argumentNode, cancellationToken)) { return; } // See if inlining this variable would make it so that some variables were no // longer definitely assigned. if (WouldCauseDefiniteAssignmentErrors(semanticModel, localStatement, enclosingBlockOfLocalStatement, outLocalSymbol)) { return; } // Collect some useful nodes for the fix provider to use so it doesn't have to // find them again. var allLocations = ImmutableArray.Create( localDeclarator.GetLocation(), identifierName.GetLocation(), invocationOrCreation.GetLocation()); // If the local variable only has one declarator, then report the suggestion on the whole // declaration. Otherwise, return the suggestion only on the single declarator. var reportNode = localDeclaration.Variables.Count == 1 ? (SyntaxNode)localDeclaration : localDeclarator; context.ReportDiagnostic(DiagnosticHelper.Create( Descriptor, reportNode.GetLocation(), option.Notification.Severity, additionalLocations: allLocations, properties: null)); } private static bool WouldCauseDefiniteAssignmentErrors( SemanticModel semanticModel, LocalDeclarationStatementSyntax localStatement, BlockSyntax enclosingBlock, ILocalSymbol outLocalSymbol) { // See if we have something like: // // int i = 0; // if (Goo() || Bar(out i)) // { // Console.WriteLine(i); // } // // In this case, inlining the 'i' would cause it to longer be definitely // assigned in the WriteLine invocation. var dataFlow = semanticModel.AnalyzeDataFlow( localStatement.GetNextStatement(), enclosingBlock.Statements.Last()); return dataFlow.DataFlowsIn.Contains(outLocalSymbol); } private static SyntaxNode GetOutArgumentScope(SyntaxNode argumentExpression) { for (var current = argumentExpression; current != null; current = current.Parent) { if (current.Parent is LambdaExpressionSyntax lambda && current == lambda.Body) { // We were in a lambda. The lambda body will be the new scope of the // out var. return current; } // Any loop construct defines a scope for out-variables, as well as each of the following: // * Using statements // * Fixed statements // * Try statements (specifically for exception filters) switch (current.Kind()) { case SyntaxKind.WhileStatement: case SyntaxKind.DoStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForEachStatement: case SyntaxKind.UsingStatement: case SyntaxKind.FixedStatement: case SyntaxKind.TryStatement: return current; } if (current is StatementSyntax) { // We hit a statement containing the out-argument. Statements can have one of // two forms. They're either parented by a block, or by another statement // (i.e. they're an embedded statement). If we're parented by a block, then // that block will be the scope of the new out-var. // // However, if our containing statement is not parented by a block, then that // means we have something like: // // if (x) // if (Try(out y)) // // In this case, there is a 'virtual' block scope surrounding the embedded 'if' // statement, and that will be the scope the out-var goes into. return current.IsParentKind(SyntaxKind.Block) ? current.Parent : current; } } return null; } private static bool IsAccessed( SemanticModel semanticModel, ISymbol outSymbol, BlockSyntax enclosingBlockOfLocalStatement, LocalDeclarationStatementSyntax localStatement, ArgumentSyntax argumentNode, CancellationToken cancellationToken) { var localStatementStart = localStatement.Span.Start; var argumentNodeStart = argumentNode.Span.Start; var variableName = outSymbol.Name; // Walk the block that the local is declared in looking for accesses. // We can ignore anything prior to the actual local declaration point, // and we only need to check up until we reach the out-argument. foreach (var descendentNode in enclosingBlockOfLocalStatement.DescendantNodes()) { var descendentStart = descendentNode.Span.Start; if (descendentStart <= localStatementStart) { // This node is before the local declaration. Can ignore it entirely as it could // not be an access to the local. continue; } if (descendentStart >= argumentNodeStart) { // We reached the out-var. We can stop searching entirely. break; } if (descendentNode.IsKind(SyntaxKind.IdentifierName, out IdentifierNameSyntax identifierName)) { // See if this looks like an accessor to the local variable syntactically. if (identifierName.Identifier.ValueText == variableName) { // Confirm that it is a access of the local. var symbol = semanticModel.GetSymbolInfo(identifierName, cancellationToken).Symbol; if (outSymbol.Equals(symbol)) { // We definitely accessed the local before the out-argument. We // can't inline this local. return true; } } } } // No accesses detected return false; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/Core/Portable/IntroduceVariable/IntroduceLocalForExpressionCodeRefactoringProvider.cs
// 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. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.IntroduceVariable { internal abstract class AbstractIntroduceLocalForExpressionCodeRefactoringProvider< TExpressionSyntax, TStatementSyntax, TExpressionStatementSyntax, TLocalDeclarationStatementSyntax> : CodeRefactoringProvider where TExpressionSyntax : SyntaxNode where TStatementSyntax : SyntaxNode where TExpressionStatementSyntax : TStatementSyntax where TLocalDeclarationStatementSyntax : TStatementSyntax { protected abstract bool IsValid(TExpressionStatementSyntax expressionStatement, TextSpan span); protected abstract TLocalDeclarationStatementSyntax FixupLocalDeclaration(TExpressionStatementSyntax expressionStatement, TLocalDeclarationStatementSyntax localDeclaration); public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContext context) { var expressionStatement = await GetExpressionStatementAsync(context).ConfigureAwait(false); if (expressionStatement == null) { return; } var (document, _, cancellationToken) = context; var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>(); var expression = syntaxFacts.GetExpressionOfExpressionStatement(expressionStatement); var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var type = semanticModel.GetTypeInfo(expression).Type; if (type == null || type.SpecialType == SpecialType.System_Void) { return; } var singleLineExpression = syntaxFacts.ConvertToSingleLine(expression); var nodeString = singleLineExpression.ToString(); context.RegisterRefactoring( new MyCodeAction( string.Format(FeaturesResources.Introduce_local_for_0, nodeString), c => IntroduceLocalAsync(document, expressionStatement, c)), expressionStatement.Span); } protected async Task<TExpressionStatementSyntax> GetExpressionStatementAsync(CodeRefactoringContext context) { var expressionStatement = await context.TryGetRelevantNodeAsync<TExpressionStatementSyntax>().ConfigureAwait(false); return expressionStatement != null && IsValid(expressionStatement, context.Span) ? expressionStatement : null; } private async Task<Document> IntroduceLocalAsync( Document document, TExpressionStatementSyntax expressionStatement, CancellationToken cancellationToken) { var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var generator = SyntaxGenerator.GetGenerator(document); var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>(); var expression = (TExpressionSyntax)syntaxFacts.GetExpressionOfExpressionStatement(expressionStatement); var nameToken = await GenerateUniqueNameAsync(document, expression, cancellationToken).ConfigureAwait(false); var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; var localDeclaration = (TLocalDeclarationStatementSyntax)generator.LocalDeclarationStatement( generator.TypeExpression(type), nameToken.WithAdditionalAnnotations(RenameAnnotation.Create()), expression.WithoutLeadingTrivia()); localDeclaration = localDeclaration.WithLeadingTrivia(expression.GetLeadingTrivia()); // Because expr-statements and local decl statements are so close, we can allow // each language to do a little extra work to ensure the resultant local decl // feels right. For example, C# will want to transport the semicolon from the // expr statement to the local decl if it has one. localDeclaration = FixupLocalDeclaration(expressionStatement, localDeclaration); var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var newRoot = root.ReplaceNode(expressionStatement, localDeclaration); return document.WithSyntaxRoot(newRoot); } protected static async Task<SyntaxToken> GenerateUniqueNameAsync( Document document, TExpressionSyntax expression, CancellationToken cancellationToken) { var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var semanticFacts = document.GetLanguageService<ISemanticFactsService>(); var baseName = semanticFacts.GenerateNameForExpression(semanticModel, expression, capitalize: false, cancellationToken); var uniqueName = semanticFacts.GenerateUniqueLocalName(semanticModel, expression, containerOpt: null, baseName, cancellationToken) .WithAdditionalAnnotations(RenameAnnotation.Create()); return uniqueName; } private class MyCodeAction : CodeAction.DocumentChangeAction { public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument) : base(title, createChangedDocument, title) { } } } }
// 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. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.IntroduceVariable { internal abstract class AbstractIntroduceLocalForExpressionCodeRefactoringProvider< TExpressionSyntax, TStatementSyntax, TExpressionStatementSyntax, TLocalDeclarationStatementSyntax> : CodeRefactoringProvider where TExpressionSyntax : SyntaxNode where TStatementSyntax : SyntaxNode where TExpressionStatementSyntax : TStatementSyntax where TLocalDeclarationStatementSyntax : TStatementSyntax { protected abstract bool IsValid(TExpressionStatementSyntax expressionStatement, TextSpan span); protected abstract TLocalDeclarationStatementSyntax FixupLocalDeclaration(TExpressionStatementSyntax expressionStatement, TLocalDeclarationStatementSyntax localDeclaration); public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContext context) { var expressionStatement = await GetExpressionStatementAsync(context).ConfigureAwait(false); if (expressionStatement == null) { return; } var (document, _, cancellationToken) = context; var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>(); var expression = syntaxFacts.GetExpressionOfExpressionStatement(expressionStatement); var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var type = semanticModel.GetTypeInfo(expression).Type; if (type == null || type.SpecialType == SpecialType.System_Void) { return; } var singleLineExpression = syntaxFacts.ConvertToSingleLine(expression); var nodeString = singleLineExpression.ToString(); context.RegisterRefactoring( new MyCodeAction( string.Format(FeaturesResources.Introduce_local_for_0, nodeString), c => IntroduceLocalAsync(document, expressionStatement, c)), expressionStatement.Span); } protected async Task<TExpressionStatementSyntax> GetExpressionStatementAsync(CodeRefactoringContext context) { var expressionStatement = await context.TryGetRelevantNodeAsync<TExpressionStatementSyntax>().ConfigureAwait(false); return expressionStatement != null && IsValid(expressionStatement, context.Span) ? expressionStatement : null; } private async Task<Document> IntroduceLocalAsync( Document document, TExpressionStatementSyntax expressionStatement, CancellationToken cancellationToken) { var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var generator = SyntaxGenerator.GetGenerator(document); var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>(); var expression = (TExpressionSyntax)syntaxFacts.GetExpressionOfExpressionStatement(expressionStatement); var nameToken = await GenerateUniqueNameAsync(document, expression, cancellationToken).ConfigureAwait(false); var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; var localDeclaration = (TLocalDeclarationStatementSyntax)generator.LocalDeclarationStatement( generator.TypeExpression(type), nameToken.WithAdditionalAnnotations(RenameAnnotation.Create()), expression.WithoutLeadingTrivia()); localDeclaration = localDeclaration.WithLeadingTrivia(expression.GetLeadingTrivia()); // Because expr-statements and local decl statements are so close, we can allow // each language to do a little extra work to ensure the resultant local decl // feels right. For example, C# will want to transport the semicolon from the // expr statement to the local decl if it has one. localDeclaration = FixupLocalDeclaration(expressionStatement, localDeclaration); var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var newRoot = root.ReplaceNode(expressionStatement, localDeclaration); return document.WithSyntaxRoot(newRoot); } protected static async Task<SyntaxToken> GenerateUniqueNameAsync( Document document, TExpressionSyntax expression, CancellationToken cancellationToken) { var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var semanticFacts = document.GetLanguageService<ISemanticFactsService>(); var baseName = semanticFacts.GenerateNameForExpression(semanticModel, expression, capitalize: false, cancellationToken); var uniqueName = semanticFacts.GenerateUniqueLocalName(semanticModel, expression, containerOpt: null, baseName, cancellationToken) .WithAdditionalAnnotations(RenameAnnotation.Create()); return uniqueName; } private class MyCodeAction : CodeAction.DocumentChangeAction { public MyCodeAction(string title, Func<CancellationToken, Task<Document>> createChangedDocument) : base(title, createChangedDocument, title) { } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Def/Implementation/PullMemberUp/MainDialog/BaseTypeTreeNodeViewModel.cs
// 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. #nullable disable using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.PullMemberUp; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.PullMemberUp.MainDialog { /// <summary> /// View model used to represent and display the inheritance graph as a tree. This tree is constructed by breadth first searching. /// If one type is the common base type of several other types, it will be showed multiple time. /// </summary> internal class BaseTypeTreeNodeViewModel : SymbolViewModel<INamedTypeSymbol> { /// <summary> /// Base types of this tree node /// </summary> public ImmutableArray<BaseTypeTreeNodeViewModel> BaseTypeNodes { get; private set; } public bool IsExpanded { get; set; } /// <summary> /// Content of the tooltip. /// </summary> public string Namespace => string.Format(ServicesVSResources.Namespace_0, Symbol.ContainingNamespace?.ToDisplayString() ?? "global"); private BaseTypeTreeNodeViewModel(INamedTypeSymbol node, IGlyphService glyphService) : base(node, glyphService) { } /// <summary> /// Use breadth first search to create the inheritance tree. Only non-generated types in the solution will be included in the tree. /// </summary> public static BaseTypeTreeNodeViewModel CreateBaseTypeTree( IGlyphService glyphService, Solution solution, INamedTypeSymbol root, CancellationToken cancellationToken) { var rootTreeNode = new BaseTypeTreeNodeViewModel(root, glyphService) { IsChecked = false, IsExpanded = true }; var queue = new Queue<BaseTypeTreeNodeViewModel>(); queue.Enqueue(rootTreeNode); while (queue.Any()) { var currentTreeNode = queue.Dequeue(); var currentTypeSymbol = currentTreeNode.Symbol; currentTreeNode.BaseTypeNodes = currentTypeSymbol.Interfaces .Concat(currentTypeSymbol.BaseType) .Where(baseType => baseType != null && MemberAndDestinationValidator.IsDestinationValid(solution, baseType, cancellationToken)) .OrderBy(baseType => baseType.ToDisplayString()) .Select(baseType => new BaseTypeTreeNodeViewModel(baseType, glyphService) { IsChecked = false, IsExpanded = true }) .ToImmutableArray(); foreach (var node in currentTreeNode.BaseTypeNodes) { queue.Enqueue(node); } } return rootTreeNode; } } }
// 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. #nullable disable using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.PullMemberUp; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.PullMemberUp.MainDialog { /// <summary> /// View model used to represent and display the inheritance graph as a tree. This tree is constructed by breadth first searching. /// If one type is the common base type of several other types, it will be showed multiple time. /// </summary> internal class BaseTypeTreeNodeViewModel : SymbolViewModel<INamedTypeSymbol> { /// <summary> /// Base types of this tree node /// </summary> public ImmutableArray<BaseTypeTreeNodeViewModel> BaseTypeNodes { get; private set; } public bool IsExpanded { get; set; } /// <summary> /// Content of the tooltip. /// </summary> public string Namespace => string.Format(ServicesVSResources.Namespace_0, Symbol.ContainingNamespace?.ToDisplayString() ?? "global"); private BaseTypeTreeNodeViewModel(INamedTypeSymbol node, IGlyphService glyphService) : base(node, glyphService) { } /// <summary> /// Use breadth first search to create the inheritance tree. Only non-generated types in the solution will be included in the tree. /// </summary> public static BaseTypeTreeNodeViewModel CreateBaseTypeTree( IGlyphService glyphService, Solution solution, INamedTypeSymbol root, CancellationToken cancellationToken) { var rootTreeNode = new BaseTypeTreeNodeViewModel(root, glyphService) { IsChecked = false, IsExpanded = true }; var queue = new Queue<BaseTypeTreeNodeViewModel>(); queue.Enqueue(rootTreeNode); while (queue.Any()) { var currentTreeNode = queue.Dequeue(); var currentTypeSymbol = currentTreeNode.Symbol; currentTreeNode.BaseTypeNodes = currentTypeSymbol.Interfaces .Concat(currentTypeSymbol.BaseType) .Where(baseType => baseType != null && MemberAndDestinationValidator.IsDestinationValid(solution, baseType, cancellationToken)) .OrderBy(baseType => baseType.ToDisplayString()) .Select(baseType => new BaseTypeTreeNodeViewModel(baseType, glyphService) { IsChecked = false, IsExpanded = true }) .ToImmutableArray(); foreach (var node in currentTreeNode.BaseTypeNodes) { queue.Enqueue(node); } } return rootTreeNode; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/ExpressionEvaluator/CSharp/Test/ResultProvider/FunctionPointerTests.cs
// 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. #nullable disable using Microsoft.CodeAnalysis.ExpressionEvaluator; using Microsoft.VisualStudio.Debugger.Clr; using Microsoft.VisualStudio.Debugger.Evaluation; using Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation; using Microsoft.VisualStudio.Debugger.Metadata; using System; using System.Diagnostics; using Xunit; using Type = Microsoft.VisualStudio.Debugger.Metadata.Type; namespace Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.UnitTests { public class FunctionPointerTests : CSharpResultProviderTestBase { [Fact] public void Root() { var source = @"unsafe class C { internal C(long p) { this.pfn = (int*)p; } int* pfn; }"; var assembly = GetUnsafeAssembly(source); unsafe { int i = 0x1234; long ptr = (long)&i; var type = assembly.GetType("C"); var value = GetFunctionPointerField(CreateDkmClrValue(type.Instantiate(ptr)), "pfn"); var evalResult = FormatResult("pfn", value); Verify(evalResult, EvalResult("pfn", PointerToString(new IntPtr(ptr)), "System.Object*", "pfn", DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Other)); } } [Fact] public void Member() { var source = @"unsafe class C { internal C(long p) { this.pfn = (int*)p; } int* pfn; }"; var assembly = GetUnsafeAssembly(source); const long ptr = 0x0; DkmClrValue getMemberValue(DkmClrValue v, string m) => (m == "pfn") ? GetFunctionPointerField(v, m) : null; var runtime = new DkmClrRuntimeInstance(ReflectionUtilities.GetMscorlibAndSystemCore(assembly), getMemberValue: getMemberValue); using (runtime.Load()) { var type = runtime.GetType("C"); var value = type.Instantiate(ptr); var evalResult = FormatResult("o", value); Verify(evalResult, EvalResult("o", "{C}", "C", "o", DkmEvaluationResultFlags.Expandable, DkmEvaluationResultCategory.Other)); var children = GetChildren(evalResult); Verify(children, EvalResult("pfn", PointerToString(new IntPtr(ptr)), "int*", "o.pfn", DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Other)); } } private DkmClrValue GetFunctionPointerField(DkmClrValue value, string fieldName) { var valueType = value.Type.GetLmrType(); var fieldInfo = valueType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); var fieldValue = fieldInfo.GetValue(value.RawValue); return CreateDkmClrValue(DkmClrValue.UnboxPointer(fieldValue), new DkmClrType(FunctionPointerType.Instance)); } // Function pointer type has IsPointer == true and GetElementType() == null. private sealed class FunctionPointerType : TypeImpl { internal static readonly FunctionPointerType Instance = new FunctionPointerType(); private FunctionPointerType() : base(typeof(object).MakePointerType()) { Debug.Assert(this.IsPointer); } public override Type GetElementType() { return null; } public override bool IsFunctionPointer() { return true; } } } }
// 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. #nullable disable using Microsoft.CodeAnalysis.ExpressionEvaluator; using Microsoft.VisualStudio.Debugger.Clr; using Microsoft.VisualStudio.Debugger.Evaluation; using Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation; using Microsoft.VisualStudio.Debugger.Metadata; using System; using System.Diagnostics; using Xunit; using Type = Microsoft.VisualStudio.Debugger.Metadata.Type; namespace Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.UnitTests { public class FunctionPointerTests : CSharpResultProviderTestBase { [Fact] public void Root() { var source = @"unsafe class C { internal C(long p) { this.pfn = (int*)p; } int* pfn; }"; var assembly = GetUnsafeAssembly(source); unsafe { int i = 0x1234; long ptr = (long)&i; var type = assembly.GetType("C"); var value = GetFunctionPointerField(CreateDkmClrValue(type.Instantiate(ptr)), "pfn"); var evalResult = FormatResult("pfn", value); Verify(evalResult, EvalResult("pfn", PointerToString(new IntPtr(ptr)), "System.Object*", "pfn", DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Other)); } } [Fact] public void Member() { var source = @"unsafe class C { internal C(long p) { this.pfn = (int*)p; } int* pfn; }"; var assembly = GetUnsafeAssembly(source); const long ptr = 0x0; DkmClrValue getMemberValue(DkmClrValue v, string m) => (m == "pfn") ? GetFunctionPointerField(v, m) : null; var runtime = new DkmClrRuntimeInstance(ReflectionUtilities.GetMscorlibAndSystemCore(assembly), getMemberValue: getMemberValue); using (runtime.Load()) { var type = runtime.GetType("C"); var value = type.Instantiate(ptr); var evalResult = FormatResult("o", value); Verify(evalResult, EvalResult("o", "{C}", "C", "o", DkmEvaluationResultFlags.Expandable, DkmEvaluationResultCategory.Other)); var children = GetChildren(evalResult); Verify(children, EvalResult("pfn", PointerToString(new IntPtr(ptr)), "int*", "o.pfn", DkmEvaluationResultFlags.None, DkmEvaluationResultCategory.Other)); } } private DkmClrValue GetFunctionPointerField(DkmClrValue value, string fieldName) { var valueType = value.Type.GetLmrType(); var fieldInfo = valueType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); var fieldValue = fieldInfo.GetValue(value.RawValue); return CreateDkmClrValue(DkmClrValue.UnboxPointer(fieldValue), new DkmClrType(FunctionPointerType.Instance)); } // Function pointer type has IsPointer == true and GetElementType() == null. private sealed class FunctionPointerType : TypeImpl { internal static readonly FunctionPointerType Instance = new FunctionPointerType(); private FunctionPointerType() : base(typeof(object).MakePointerType()) { Debug.Assert(this.IsPointer); } public override Type GetElementType() { return null; } public override bool IsFunctionPointer() { return true; } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/Test/EditorConfigSettings/Data/CodeStyleSettingsTest.cs
// 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. extern alias WORKSPACES; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Data; using WORKSPACES::Microsoft.CodeAnalysis.Options; using Xunit; namespace Microsoft.CodeAnalysis.Editor.UnitTests.EditorConfigSettings.Data { public class CodeStyleSettingsTest { [Theory] [InlineData(true)] [InlineData(false)] public static void CodeStyleSettingBoolFactory(bool defaultValue) { var option = CreateBoolOption(defaultValue); var editorConfigOptions = new TestAnalyzerConfigOptions(); var visualStudioOptions = new TestOptionSet<bool>(option.DefaultValue); var setting = CodeStyleSetting.Create(option, description: "TestDesciption", editorConfigOptions, visualStudioOptions, updater: null!, fileName: null!); Assert.Equal(string.Empty, setting.Category); Assert.Equal("TestDesciption", setting.Description); Assert.False(setting.IsDefinedInEditorConfig); Assert.Equal(typeof(bool), setting.Type); Assert.Equal(defaultValue, setting.Value); } [Theory] [InlineData(DayOfWeek.Monday)] [InlineData(DayOfWeek.Friday)] public static void CodeStyleSettingEnumFactory(DayOfWeek defaultValue) { var option = CreateEnumOption(defaultValue); var editorConfigOptions = new TestAnalyzerConfigOptions(); var visualStudioOptions = new TestOptionSet<DayOfWeek>(option.DefaultValue); var setting = CodeStyleSetting.Create(option, description: "TestDesciption", enumValues: (DayOfWeek[])Enum.GetValues(typeof(DayOfWeek)), valueDescriptions: Enum.GetNames(typeof(DayOfWeek)), editorConfigOptions, visualStudioOptions, updater: null!, fileName: null!); Assert.Equal(string.Empty, setting.Category); Assert.Equal("TestDesciption", setting.Description); Assert.False(setting.IsDefinedInEditorConfig); Assert.Equal(typeof(DayOfWeek), setting.Type); Assert.Equal(defaultValue, setting.Value); } private static Option2<CodeStyleOption2<bool>> CreateBoolOption(bool @default = false) { var option = CodeStyleOption2<bool>.Default; option = (CodeStyleOption2<bool>)((ICodeStyleOption)option).WithValue(@default); return new Option2<CodeStyleOption2<bool>>(feature: "TestFeature", name: "TestOption", defaultValue: option); } private static Option2<CodeStyleOption2<T>> CreateEnumOption<T>(T @default) where T : notnull, Enum { var option = CodeStyleOption2<T>.Default; option = (CodeStyleOption2<T>)((ICodeStyleOption)option).WithValue(@default); return new Option2<CodeStyleOption2<T>>(feature: "TestFeature", name: "TestOption", defaultValue: option); } private class TestAnalyzerConfigOptions : AnalyzerConfigOptions { private readonly IDictionary<string, string> _dictionary; public TestAnalyzerConfigOptions((string, string)[]? options = null) => _dictionary = options?.ToDictionary(x => x.Item1, x => x.Item2) ?? new Dictionary<string, string>(); public override bool TryGetValue(string key, [NotNullWhen(true)] out string? value) => _dictionary.TryGetValue(key, out value); } private class TestOptionSet<T> : OptionSet { private readonly object? _value; public TestOptionSet(CodeStyleOption2<T> value) => _value = value; public override OptionSet WithChangedOption(OptionKey optionAndLanguage, object? value) => this; internal override IEnumerable<OptionKey> GetChangedOptions(OptionSet optionSet) => Array.Empty<OptionKey>(); private protected override object? GetOptionCore(OptionKey optionKey) => _value; } } }
// 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. extern alias WORKSPACES; using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.EditorConfigSettings.Data; using WORKSPACES::Microsoft.CodeAnalysis.Options; using Xunit; namespace Microsoft.CodeAnalysis.Editor.UnitTests.EditorConfigSettings.Data { public class CodeStyleSettingsTest { [Theory] [InlineData(true)] [InlineData(false)] public static void CodeStyleSettingBoolFactory(bool defaultValue) { var option = CreateBoolOption(defaultValue); var editorConfigOptions = new TestAnalyzerConfigOptions(); var visualStudioOptions = new TestOptionSet<bool>(option.DefaultValue); var setting = CodeStyleSetting.Create(option, description: "TestDesciption", editorConfigOptions, visualStudioOptions, updater: null!, fileName: null!); Assert.Equal(string.Empty, setting.Category); Assert.Equal("TestDesciption", setting.Description); Assert.False(setting.IsDefinedInEditorConfig); Assert.Equal(typeof(bool), setting.Type); Assert.Equal(defaultValue, setting.Value); } [Theory] [InlineData(DayOfWeek.Monday)] [InlineData(DayOfWeek.Friday)] public static void CodeStyleSettingEnumFactory(DayOfWeek defaultValue) { var option = CreateEnumOption(defaultValue); var editorConfigOptions = new TestAnalyzerConfigOptions(); var visualStudioOptions = new TestOptionSet<DayOfWeek>(option.DefaultValue); var setting = CodeStyleSetting.Create(option, description: "TestDesciption", enumValues: (DayOfWeek[])Enum.GetValues(typeof(DayOfWeek)), valueDescriptions: Enum.GetNames(typeof(DayOfWeek)), editorConfigOptions, visualStudioOptions, updater: null!, fileName: null!); Assert.Equal(string.Empty, setting.Category); Assert.Equal("TestDesciption", setting.Description); Assert.False(setting.IsDefinedInEditorConfig); Assert.Equal(typeof(DayOfWeek), setting.Type); Assert.Equal(defaultValue, setting.Value); } private static Option2<CodeStyleOption2<bool>> CreateBoolOption(bool @default = false) { var option = CodeStyleOption2<bool>.Default; option = (CodeStyleOption2<bool>)((ICodeStyleOption)option).WithValue(@default); return new Option2<CodeStyleOption2<bool>>(feature: "TestFeature", name: "TestOption", defaultValue: option); } private static Option2<CodeStyleOption2<T>> CreateEnumOption<T>(T @default) where T : notnull, Enum { var option = CodeStyleOption2<T>.Default; option = (CodeStyleOption2<T>)((ICodeStyleOption)option).WithValue(@default); return new Option2<CodeStyleOption2<T>>(feature: "TestFeature", name: "TestOption", defaultValue: option); } private class TestAnalyzerConfigOptions : AnalyzerConfigOptions { private readonly IDictionary<string, string> _dictionary; public TestAnalyzerConfigOptions((string, string)[]? options = null) => _dictionary = options?.ToDictionary(x => x.Item1, x => x.Item2) ?? new Dictionary<string, string>(); public override bool TryGetValue(string key, [NotNullWhen(true)] out string? value) => _dictionary.TryGetValue(key, out value); } private class TestOptionSet<T> : OptionSet { private readonly object? _value; public TestOptionSet(CodeStyleOption2<T> value) => _value = value; public override OptionSet WithChangedOption(OptionKey optionAndLanguage, object? value) => this; internal override IEnumerable<OptionKey> GetChangedOptions(OptionSet optionSet) => Array.Empty<OptionKey>(); private protected override object? GetOptionCore(OptionKey optionKey) => _value; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/VSTypeScriptInlineRenameLocationWrapper.cs
// 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. #nullable disable using Microsoft.CodeAnalysis.Editor; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api { internal readonly struct VSTypeScriptInlineRenameLocationWrapper { private readonly InlineRenameLocation _underlyingObject; public VSTypeScriptInlineRenameLocationWrapper(InlineRenameLocation underlyingObject) => _underlyingObject = underlyingObject; public Document Document => _underlyingObject.Document; public TextSpan TextSpan => _underlyingObject.TextSpan; } }
// 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. #nullable disable using Microsoft.CodeAnalysis.Editor; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api { internal readonly struct VSTypeScriptInlineRenameLocationWrapper { private readonly InlineRenameLocation _underlyingObject; public VSTypeScriptInlineRenameLocationWrapper(InlineRenameLocation underlyingObject) => _underlyingObject = underlyingObject; public Document Document => _underlyingObject.Document; public TextSpan TextSpan => _underlyingObject.TextSpan; } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/CSharp/Portable/Declarations/SingleNamespaceOrTypeDeclaration.cs
// 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. #nullable disable using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.CSharp { internal abstract class SingleNamespaceOrTypeDeclaration : Declaration { private readonly SyntaxReference _syntaxReference; private readonly SourceLocation _nameLocation; /// <summary> /// Any diagnostics reported while converting the Namespace/Type syntax into the Declaration /// instance. Generally, we determine and store some diagnostics here because we don't want /// to have to go back to Syntax when we have our NamespaceSymbol or NamedTypeSymbol. /// </summary> public readonly ImmutableArray<Diagnostic> Diagnostics; protected SingleNamespaceOrTypeDeclaration( string name, SyntaxReference syntaxReference, SourceLocation nameLocation, ImmutableArray<Diagnostic> diagnostics) : base(name) { _syntaxReference = syntaxReference; _nameLocation = nameLocation; Diagnostics = diagnostics; } public SourceLocation Location { get { return new SourceLocation(this.SyntaxReference); } } public SyntaxReference SyntaxReference { get { return _syntaxReference; } } public SourceLocation NameLocation { get { return _nameLocation; } } protected override ImmutableArray<Declaration> GetDeclarationChildren() { return StaticCast<Declaration>.From(this.GetNamespaceOrTypeDeclarationChildren()); } public new ImmutableArray<SingleNamespaceOrTypeDeclaration> Children { get { return this.GetNamespaceOrTypeDeclarationChildren(); } } protected abstract ImmutableArray<SingleNamespaceOrTypeDeclaration> GetNamespaceOrTypeDeclarationChildren(); } }
// 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. #nullable disable using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.CSharp { internal abstract class SingleNamespaceOrTypeDeclaration : Declaration { private readonly SyntaxReference _syntaxReference; private readonly SourceLocation _nameLocation; /// <summary> /// Any diagnostics reported while converting the Namespace/Type syntax into the Declaration /// instance. Generally, we determine and store some diagnostics here because we don't want /// to have to go back to Syntax when we have our NamespaceSymbol or NamedTypeSymbol. /// </summary> public readonly ImmutableArray<Diagnostic> Diagnostics; protected SingleNamespaceOrTypeDeclaration( string name, SyntaxReference syntaxReference, SourceLocation nameLocation, ImmutableArray<Diagnostic> diagnostics) : base(name) { _syntaxReference = syntaxReference; _nameLocation = nameLocation; Diagnostics = diagnostics; } public SourceLocation Location { get { return new SourceLocation(this.SyntaxReference); } } public SyntaxReference SyntaxReference { get { return _syntaxReference; } } public SourceLocation NameLocation { get { return _nameLocation; } } protected override ImmutableArray<Declaration> GetDeclarationChildren() { return StaticCast<Declaration>.From(this.GetNamespaceOrTypeDeclarationChildren()); } public new ImmutableArray<SingleNamespaceOrTypeDeclaration> Children { get { return this.GetNamespaceOrTypeDeclarationChildren(); } } protected abstract ImmutableArray<SingleNamespaceOrTypeDeclaration> GetNamespaceOrTypeDeclarationChildren(); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Def/Implementation/PullMemberUp/MainDialog/PullMemberUpDialogViewModel.cs
// 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 System.Collections.Immutable; using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeRefactorings.PullMemberUp; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.PullMemberUp; using Microsoft.VisualStudio.LanguageServices.Implementation.CommonControls; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; using Microsoft.VisualStudio.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.PullMemberUp.MainDialog { internal class PullMemberUpDialogViewModel : AbstractNotifyPropertyChanged { public bool OkButtonEnabled { get => _okButtonEnabled; set => SetProperty(ref _okButtonEnabled, value, nameof(OkButtonEnabled)); } public bool? SelectAllCheckBoxState { get => _selectAllCheckBoxState; set => SetProperty(ref _selectAllCheckBoxState, value, nameof(SelectAllCheckBoxState)); } public bool SelectAllCheckBoxThreeStateEnable { get => _selectAllCheckBoxThreeStateEnable; set => SetProperty(ref _selectAllCheckBoxThreeStateEnable, value, nameof(SelectAllCheckBoxThreeStateEnable)); } public string SelectAllCheckBoxAutomationText => ServicesVSResources.Select_All; public string DestinationTreeViewAutomationText => ServicesVSResources.Select_destination; public string SelectMemberListViewAutomationText => ServicesVSResources.Select_member; private bool _selectAllCheckBoxThreeStateEnable; private bool? _selectAllCheckBoxState; private readonly IUIThreadOperationExecutor _uiThreadOperationExecutor; private readonly ImmutableDictionary<ISymbol, Task<ImmutableArray<ISymbol>>> _symbolToDependentsMap; private bool _okButtonEnabled; public PullMemberUpDialogViewModel( IUIThreadOperationExecutor uiThreadOperationExecutor, ImmutableArray<PullMemberUpSymbolViewModel> members, BaseTypeTreeNodeViewModel destinationTreeViewModel, ImmutableDictionary<ISymbol, Task<ImmutableArray<ISymbol>>> dependentsMap) { _uiThreadOperationExecutor = uiThreadOperationExecutor; _symbolToDependentsMap = dependentsMap; MemberSelectionViewModel = new MemberSelectionViewModel( _uiThreadOperationExecutor, members, _symbolToDependentsMap); MemberSelectionViewModel.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(MemberSelectionViewModel.CheckedMembers)) { EnableOrDisableOkButton(); } }; DestinationTreeNodeViewModel = destinationTreeViewModel; _selectedDestination = destinationTreeViewModel; EnableOrDisableOkButton(); } public BaseTypeTreeNodeViewModel DestinationTreeNodeViewModel { get; } public MemberSelectionViewModel MemberSelectionViewModel { get; } private BaseTypeTreeNodeViewModel _selectedDestination; public BaseTypeTreeNodeViewModel SelectedDestination { get => _selectedDestination; set { if (SetProperty(ref _selectedDestination, value)) { MemberSelectionViewModel.UpdateMembersBasedOnDestinationKind(_selectedDestination.Symbol.TypeKind); EnableOrDisableOkButton(); } } } public PullMembersUpOptions CreatePullMemberUpOptions() { var selectedOptionFromDialog = MemberSelectionViewModel.GetSelectedMembers(); var options = PullMembersUpOptionsBuilder.BuildPullMembersUpOptions( SelectedDestination.Symbol, selectedOptionFromDialog); return options; } private void EnableOrDisableOkButton() { var selectedMembers = MemberSelectionViewModel.CheckedMembers; OkButtonEnabled = SelectedDestination != DestinationTreeNodeViewModel && selectedMembers.Any(); } } }
// 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 System.Collections.Immutable; using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeRefactorings.PullMemberUp; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.PullMemberUp; using Microsoft.VisualStudio.LanguageServices.Implementation.CommonControls; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; using Microsoft.VisualStudio.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.PullMemberUp.MainDialog { internal class PullMemberUpDialogViewModel : AbstractNotifyPropertyChanged { public bool OkButtonEnabled { get => _okButtonEnabled; set => SetProperty(ref _okButtonEnabled, value, nameof(OkButtonEnabled)); } public bool? SelectAllCheckBoxState { get => _selectAllCheckBoxState; set => SetProperty(ref _selectAllCheckBoxState, value, nameof(SelectAllCheckBoxState)); } public bool SelectAllCheckBoxThreeStateEnable { get => _selectAllCheckBoxThreeStateEnable; set => SetProperty(ref _selectAllCheckBoxThreeStateEnable, value, nameof(SelectAllCheckBoxThreeStateEnable)); } public string SelectAllCheckBoxAutomationText => ServicesVSResources.Select_All; public string DestinationTreeViewAutomationText => ServicesVSResources.Select_destination; public string SelectMemberListViewAutomationText => ServicesVSResources.Select_member; private bool _selectAllCheckBoxThreeStateEnable; private bool? _selectAllCheckBoxState; private readonly IUIThreadOperationExecutor _uiThreadOperationExecutor; private readonly ImmutableDictionary<ISymbol, Task<ImmutableArray<ISymbol>>> _symbolToDependentsMap; private bool _okButtonEnabled; public PullMemberUpDialogViewModel( IUIThreadOperationExecutor uiThreadOperationExecutor, ImmutableArray<PullMemberUpSymbolViewModel> members, BaseTypeTreeNodeViewModel destinationTreeViewModel, ImmutableDictionary<ISymbol, Task<ImmutableArray<ISymbol>>> dependentsMap) { _uiThreadOperationExecutor = uiThreadOperationExecutor; _symbolToDependentsMap = dependentsMap; MemberSelectionViewModel = new MemberSelectionViewModel( _uiThreadOperationExecutor, members, _symbolToDependentsMap); MemberSelectionViewModel.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(MemberSelectionViewModel.CheckedMembers)) { EnableOrDisableOkButton(); } }; DestinationTreeNodeViewModel = destinationTreeViewModel; _selectedDestination = destinationTreeViewModel; EnableOrDisableOkButton(); } public BaseTypeTreeNodeViewModel DestinationTreeNodeViewModel { get; } public MemberSelectionViewModel MemberSelectionViewModel { get; } private BaseTypeTreeNodeViewModel _selectedDestination; public BaseTypeTreeNodeViewModel SelectedDestination { get => _selectedDestination; set { if (SetProperty(ref _selectedDestination, value)) { MemberSelectionViewModel.UpdateMembersBasedOnDestinationKind(_selectedDestination.Symbol.TypeKind); EnableOrDisableOkButton(); } } } public PullMembersUpOptions CreatePullMemberUpOptions() { var selectedOptionFromDialog = MemberSelectionViewModel.GetSelectedMembers(); var options = PullMembersUpOptionsBuilder.BuildPullMembersUpOptions( SelectedDestination.Symbol, selectedOptionFromDialog); return options; } private void EnableOrDisableOkButton() { var selectedMembers = MemberSelectionViewModel.CheckedMembers; OkButtonEnabled = SelectedDestination != DestinationTreeNodeViewModel && selectedMembers.Any(); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/CSharp/Portable/Completion/KeywordRecommenders/ChecksumKeywordRecommender.cs
// 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. #nullable disable using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class ChecksumKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public ChecksumKeywordRecommender() : base(SyntaxKind.ChecksumKeyword, isValidInPreprocessorContext: true) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { // # pragma | // # pragma w| var previousToken1 = context.TargetToken; var previousToken2 = previousToken1.GetPreviousToken(includeSkipped: true); return previousToken1.Kind() == SyntaxKind.PragmaKeyword && previousToken2.Kind() == SyntaxKind.HashToken; } } }
// 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. #nullable disable using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class ChecksumKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public ChecksumKeywordRecommender() : base(SyntaxKind.ChecksumKeyword, isValidInPreprocessorContext: true) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { // # pragma | // # pragma w| var previousToken1 = context.TargetToken; var previousToken2 = previousToken1.GetPreviousToken(includeSkipped: true); return previousToken1.Kind() == SyntaxKind.PragmaKeyword && previousToken2.Kind() == SyntaxKind.HashToken; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItem/AnalyzerItemSourceProvider.cs
// 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. #nullable disable using System; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.Internal.VisualStudio.PlatformUI; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer { [Export(typeof(IAttachedCollectionSourceProvider))] [Name(nameof(AnalyzerItemSourceProvider))] [Order] [AppliesToProject("(CSharp | VB) & !CPS")] // in the CPS case, the Analyzers items are created by the project system internal sealed class AnalyzerItemSourceProvider : AttachedCollectionSourceProvider<AnalyzersFolderItem> { [Import(typeof(AnalyzersCommandHandler))] private readonly IAnalyzersCommandHandler _commandHandler = null; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public AnalyzerItemSourceProvider() { } protected override IAttachedCollectionSource CreateCollectionSource(AnalyzersFolderItem analyzersFolder, string relationshipName) { if (relationshipName == KnownRelationships.Contains) { return new AnalyzerItemSource(analyzersFolder, _commandHandler); } return null; } } }
// 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. #nullable disable using System; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.Internal.VisualStudio.PlatformUI; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer { [Export(typeof(IAttachedCollectionSourceProvider))] [Name(nameof(AnalyzerItemSourceProvider))] [Order] [AppliesToProject("(CSharp | VB) & !CPS")] // in the CPS case, the Analyzers items are created by the project system internal sealed class AnalyzerItemSourceProvider : AttachedCollectionSourceProvider<AnalyzersFolderItem> { [Import(typeof(AnalyzersCommandHandler))] private readonly IAnalyzersCommandHandler _commandHandler = null; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public AnalyzerItemSourceProvider() { } protected override IAttachedCollectionSource CreateCollectionSource(AnalyzersFolderItem analyzersFolder, string relationshipName) { if (relationshipName == KnownRelationships.Contains) { return new AnalyzerItemSource(analyzersFolder, _commandHandler); } return null; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Analyzers/CSharp/Analyzers/ConvertTypeofToNameof/CSharpConvertTypeOfToNameOfDiagnosticAnalyzer.cs
// 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.CodeAnalysis.ConvertTypeOfToNameOf; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; namespace Microsoft.CodeAnalysis.CSharp.ConvertTypeOfToNameOf { /// <summary> /// Finds code like typeof(someType).Name and determines whether it can be changed to nameof(someType), if yes then it offers a diagnostic /// </summary> [DiagnosticAnalyzer(LanguageNames.CSharp)] internal sealed class CSharpConvertTypeOfToNameOfDiagnosticAnalyzer : AbstractConvertTypeOfToNameOfDiagnosticAnalyzer { private static readonly string s_title = CSharpAnalyzersResources.typeof_can_be_converted__to_nameof; public CSharpConvertTypeOfToNameOfDiagnosticAnalyzer() : base(s_title, LanguageNames.CSharp) { } protected override bool IsValidTypeofAction(OperationAnalysisContext context) { var node = context.Operation.Syntax; var syntaxTree = node.SyntaxTree; // nameof was added in CSharp 6.0, so don't offer it for any languages before that time if (((CSharpParseOptions)syntaxTree.Options).LanguageVersion < LanguageVersion.CSharp6) { return false; } // Make sure that the syntax that we're looking at is actually a typeof expression and that // the parent syntax is a member access expression otherwise the syntax is not the kind of // expression that we want to analyze return node is TypeOfExpressionSyntax { Parent: MemberAccessExpressionSyntax } typeofExpression && // nameof(System.Void) isn't allowed in C#. typeofExpression is not { Type: PredefinedTypeSyntax { Keyword: { RawKind: (int)SyntaxKind.VoidKeyword } } }; } } }
// 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.CodeAnalysis.ConvertTypeOfToNameOf; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; namespace Microsoft.CodeAnalysis.CSharp.ConvertTypeOfToNameOf { /// <summary> /// Finds code like typeof(someType).Name and determines whether it can be changed to nameof(someType), if yes then it offers a diagnostic /// </summary> [DiagnosticAnalyzer(LanguageNames.CSharp)] internal sealed class CSharpConvertTypeOfToNameOfDiagnosticAnalyzer : AbstractConvertTypeOfToNameOfDiagnosticAnalyzer { private static readonly string s_title = CSharpAnalyzersResources.typeof_can_be_converted__to_nameof; public CSharpConvertTypeOfToNameOfDiagnosticAnalyzer() : base(s_title, LanguageNames.CSharp) { } protected override bool IsValidTypeofAction(OperationAnalysisContext context) { var node = context.Operation.Syntax; var syntaxTree = node.SyntaxTree; // nameof was added in CSharp 6.0, so don't offer it for any languages before that time if (((CSharpParseOptions)syntaxTree.Options).LanguageVersion < LanguageVersion.CSharp6) { return false; } // Make sure that the syntax that we're looking at is actually a typeof expression and that // the parent syntax is a member access expression otherwise the syntax is not the kind of // expression that we want to analyze return node is TypeOfExpressionSyntax { Parent: MemberAccessExpressionSyntax } typeofExpression && // nameof(System.Void) isn't allowed in C#. typeofExpression is not { Type: PredefinedTypeSyntax { Keyword: { RawKind: (int)SyntaxKind.VoidKeyword } } }; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs
// 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 System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.RemoveUnnecessarySuppressions; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.CSharp.UseAutoProperty; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Diagnostics.CSharp; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Operations; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.UseAutoProperty; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessarySuppressions { [Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessarySuppressions)] [WorkItem(44177, "https://github.com/dotnet/roslyn/issues/44177")] public abstract class RemoveUnnecessaryInlineSuppressionsTests : AbstractUnncessarySuppressionDiagnosticTest { protected RemoveUnnecessaryInlineSuppressionsTests(ITestOutputHelper logger) : base(logger) { } #region Helpers internal sealed override CodeFixProvider CodeFixProvider => new RemoveUnnecessaryInlineSuppressionsCodeFixProvider(); internal sealed override AbstractRemoveUnnecessaryInlineSuppressionsDiagnosticAnalyzer SuppressionAnalyzer => new CSharpRemoveUnnecessaryInlineSuppressionsDiagnosticAnalyzer(); protected sealed override ParseOptions GetScriptOptions() => Options.Script; protected internal sealed override string GetLanguage() => LanguageNames.CSharp; protected override TestParameters SetParameterDefaults(TestParameters parameters) => parameters.WithCompilationOptions((parameters.compilationOptions ?? TestOptions.DebugDll).WithReportSuppressedDiagnostics(true)); protected sealed class UserDiagnosticAnalyzer : DiagnosticAnalyzer { public static readonly DiagnosticDescriptor Descriptor0168 = new DiagnosticDescriptor("Analyzer0168", "Variable is declared but never used", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true); public static readonly DiagnosticDescriptor Descriptor0219 = new DiagnosticDescriptor("Analyzer0219", "Variable is assigned but its value is never used", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor0168, Descriptor0219); public override void Initialize(AnalysisContext context) { context.RegisterOperationBlockStartAction( context => { var localsToIsAssignedMap = new ConcurrentDictionary<ILocalSymbol, bool>(); var usedLocals = new HashSet<ILocalSymbol>(); context.RegisterOperationAction( context => { var declarator = (IVariableDeclaratorOperation)context.Operation; var hasInitializer = declarator.GetVariableInitializer() != null; localsToIsAssignedMap.GetOrAdd(declarator.Symbol, hasInitializer); }, OperationKind.VariableDeclarator); context.RegisterOperationAction( context => { var localReference = (ILocalReferenceOperation)context.Operation; if (localReference.Parent is ISimpleAssignmentOperation simpleAssignment && simpleAssignment.Target == localReference) { localsToIsAssignedMap.AddOrUpdate(localReference.Local, true, (_1, _2) => true); } else { usedLocals.Add(localReference.Local); } }, OperationKind.LocalReference); context.RegisterOperationBlockEndAction( context => { foreach (var (local, isAssigned) in localsToIsAssignedMap) { if (usedLocals.Contains(local)) { continue; } var rule = !isAssigned ? Descriptor0168 : Descriptor0219; context.ReportDiagnostic(Diagnostic.Create(rule, local.Locations[0])); } }); }); } } protected sealed class CompilationEndDiagnosticAnalyzer : DiagnosticAnalyzer { public static readonly DiagnosticDescriptor Descriptor = new DiagnosticDescriptor("CompilationEndId", "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true, customTags: new[] { WellKnownDiagnosticTags.CompilationEnd }); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor); public override void Initialize(AnalysisContext context) => context.RegisterCompilationStartAction(context => context.RegisterCompilationEndAction(_ => { })); } #endregion #region Single analyzer tests (Compiler OR Analyzer) public abstract class CompilerOrAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { protected CompilerOrAnalyzerTests(ITestOutputHelper logger) : base(logger) { } protected abstract bool IsCompilerDiagnosticsTest { get; } protected abstract string VariableDeclaredButNotUsedDiagnosticId { get; } protected abstract string VariableAssignedButNotUsedDiagnosticId { get; } protected abstract ImmutableArray<string> UnsupportedDiagnosticIds { get; } public sealed class CompilerTests : CompilerOrAnalyzerTests { public CompilerTests(ITestOutputHelper logger) : base(logger) { } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new CSharpCompilerDiagnosticAnalyzer()); protected override bool IsCompilerDiagnosticsTest => true; protected override string VariableDeclaredButNotUsedDiagnosticId => "CS0168"; protected override string VariableAssignedButNotUsedDiagnosticId => "CS0219"; protected override ImmutableArray<string> UnsupportedDiagnosticIds { get { var errorCodes = Enum.GetValues(typeof(ErrorCode)); var supported = ((CSharpCompilerDiagnosticAnalyzer)OtherAnalyzers[0]).GetSupportedErrorCodes(); using var _ = ArrayBuilder<string>.GetInstance(out var builder); foreach (int errorCode in errorCodes) { if (!supported.Contains(errorCode) && errorCode > 0) { // Add all 3 supported formats for suppressions: integer, integer with leading zeros, "CS" prefix var errorCodeString = errorCode.ToString(); var errorCodeD4String = errorCode.ToString("D4"); builder.Add(errorCodeString); if (errorCodeD4String != errorCodeString) builder.Add(errorCodeD4String); builder.Add("CS" + errorCodeD4String); } } return builder.ToImmutable(); } } } public sealed class AnalyzerTests : CompilerOrAnalyzerTests { public AnalyzerTests(ITestOutputHelper logger) : base(logger) { } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new UserDiagnosticAnalyzer(), new CompilationEndDiagnosticAnalyzer()); protected override bool IsCompilerDiagnosticsTest => false; protected override string VariableDeclaredButNotUsedDiagnosticId => UserDiagnosticAnalyzer.Descriptor0168.Id; protected override string VariableAssignedButNotUsedDiagnosticId => UserDiagnosticAnalyzer.Descriptor0219.Id; protected override ImmutableArray<string> UnsupportedDiagnosticIds => ImmutableArray.Create( CompilationEndDiagnosticAnalyzer.Descriptor.Id, IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId, IDEDiagnosticIds.FormattingDiagnosticId, "format"); } [Fact] public async Task TestDoNotRemoveRequiredDiagnosticSuppression_Pragma() { await TestMissingInRegularAndScriptAsync( $@" class Class {{ void M() {{ [|#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary|] }} }}"); } [Fact] public async Task TestDoNotRemoveRequiredDiagnosticSuppression_Pragma_02() { await TestMissingInRegularAndScriptAsync( $@" [|#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary|] class Class {{ void M() {{ int y; }} }}"); } [Fact] public async Task TestDoNotRemoveRequiredDiagnosticSuppression_Attribute_Method() { var code = $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] void M() {{ int y; }} }}"; // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. if (!IsCompilerDiagnosticsTest) { await TestMissingInRegularAndScriptAsync(code); } else { await TestInRegularAndScript1Async(code, @" class Class { void M() { int y; } }"); } } [Fact] public async Task TestDoNotRemoveRequiredDiagnosticSuppression_Attribute_02() { var code = $@" [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] class Class {{ void M() {{ int y; }} }}"; // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. if (!IsCompilerDiagnosticsTest) { await TestMissingInRegularAndScriptAsync(code); } else { await TestInRegularAndScript1Async(code, @" class Class { void M() { int y; } }"); } } public enum TestKind { Pragmas, SuppressMessageAttributes, PragmasAndSuppressMessageAttributes } [Theory, CombinatorialData] [WorkItem(46047, "https://github.com/dotnet/roslyn/issues/46047")] public async Task TestDoNotRemoveUnsupportedDiagnosticSuppression(bool disable, TestKind testKind) { var disableOrRestore = disable ? "disable" : "restore"; var pragmas = new StringBuilder(); var suppressMessageAttribtes = new StringBuilder(); foreach (var id in UnsupportedDiagnosticIds) { if (testKind == TestKind.Pragmas || testKind == TestKind.PragmasAndSuppressMessageAttributes) pragmas.AppendLine($@"#pragma warning {disableOrRestore} {id}"); if (testKind == TestKind.SuppressMessageAttributes || testKind == TestKind.PragmasAndSuppressMessageAttributes) suppressMessageAttribtes.AppendLine($@"[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{id}"")]"); } var source = $@"{{|FixAllInDocument:{pragmas}{suppressMessageAttribtes}|}}class Class {{ }}"; // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. if (!IsCompilerDiagnosticsTest || testKind == TestKind.Pragmas) { await TestMissingInRegularAndScriptAsync(source); } else { var fixedSource = $@"{pragmas}class Class {{ }}"; await TestInRegularAndScriptAsync(source, fixedSource); } } [Fact] public async Task TestDoNotRemoveInactiveDiagnosticSuppression() { await TestMissingInRegularAndScriptAsync( $@" #if false [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Inactive int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Inactive y = 1; }} }} |] #endif"); } [Fact] public async Task TestDoNotRemoveDiagnosticSuppressionsInCodeWithSyntaxErrors() { await TestMissingInRegularAndScriptAsync( $@" [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used int y // CS1002: ; expected #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used y = 1; }} }} |]"); } [Fact] public async Task TestDoNotRemoveDiagnosticSuppressionWhenAnalyzerSuppressed() { await TestMissingInRegularAndScriptAsync( $@" #pragma warning disable {IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId} [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }} |]"); } [Fact, WorkItem(46075, "https://github.com/dotnet/roslyn/issues/46075")] public async Task TestDoNotRemoveDiagnosticSuppressionInGeneratedCode() { await TestMissingInRegularAndScriptAsync( $@" // <autogenerated> [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Unnecessary, but not reported in generated code void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but not reported in generated code int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but not reported in generated code y = 1; }} }} |]"); } [Theory, CombinatorialData] public async Task TestDoNotRemoveExcludedDiagnosticSuppression(bool excludeAll) { var options = new OptionsCollection(LanguageNames.CSharp) { { CodeStyleOptions2.RemoveUnnecessarySuppressionExclusions, excludeAll ? "all" : VariableDeclaredButNotUsedDiagnosticId } }; await TestMissingInRegularAndScriptAsync( $@" [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }} |]", new TestParameters(options: options)); } [Fact, WorkItem(47288, "https://github.com/dotnet/roslyn/issues/47288")] public async Task TestDoNotRemoveExcludedDiagnosticCategorySuppression() { var options = new OptionsCollection(LanguageNames.CSharp) { { CodeStyleOptions2.RemoveUnnecessarySuppressionExclusions, "category: ExcludedCategory" } }; await TestMissingInRegularAndScriptAsync( $@" [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""ExcludedCategory"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] [System.Diagnostics.CodeAnalysis.SuppressMessage(""ExcludedCategory"", ""{VariableAssignedButNotUsedDiagnosticId}"")] void M() {{ int y; y = 1; int z = 1; z++; }} }} |]", new TestParameters(options: options)); } [Fact] public async Task TestDoNotRemoveDiagnosticSuppression_Attribute_OnPartialDeclarations() { await TestMissingInRegularAndScriptAsync( $@" [| // Unnecessary, but we do not perform analysis for SuppressMessageAttributes on partial declarations. [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] partial class Class {{ }} partial class Class {{ void M() {{ int y; y = 1; }} }} |]"); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_Pragma(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} int y; {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] // Variable is declared but never used - Unnecessary void M() {{ int y; y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_Trivia() { await TestInRegularAndScript1Async( $@" class Class {{ // Comment1 /// <summary> /// DocComment /// </summary> // Comment2 [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] // Comment3 // Comment4 void M() {{ int y; y = 1; }} }}", @" class Class { // Comment1 /// <summary> /// DocComment /// </summary> // Comment2 // Comment4 void M() { int y; y = 1; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_OnlyDisableDirective() { await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ [|#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary|] int y; y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_OnlyRestoreDirective() { await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ int y; [|#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary|] y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_DuplicatePragmaSuppression(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary }} {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicateAttributeSuppression() { // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. var retainedAttributesInFixCode = IsCompilerDiagnosticsTest ? string.Empty : $@"[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Necessary "; await TestInRegularAndScript1Async( $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Necessary {{|FixAllInDocument:[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Unnecessary|}} void M() {{ int y; }} }}", $@" class Class {{ {retainedAttributesInFixCode}void M() {{ int y; }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicateAttributeSuppression_OnContainingSymbol() { // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. var retainedAttributesInFixCode = IsCompilerDiagnosticsTest ? string.Empty : $@"[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Necessary "; await TestInRegularAndScript1Async( $@" {{|FixAllInDocument:[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Unnecessary|}} class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Necessary void M() {{ int y; }} }}", $@" class Class {{ {retainedAttributesInFixCode}void M() {{ int y; }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicatePragmaAndAttributeSuppression() { var source = $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId}|] int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} }} }}"; string fixedSource; if (IsCompilerDiagnosticsTest) { // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. fixedSource = $@" class Class {{ void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} }} }}"; } else { // Analyzer diagnostics can be suppressed with both SuppressMessageAttribute and pragmas. // SuppressMessageAttribute takes precedence over pragmas for duplicate suppressions, // hence duplicate pragmas are considered unnecessary. fixedSource = $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ int y; }} }}"; } await TestInRegularAndScript1Async(source, fixedSource); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_Pragma_InnerValidSuppression(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_InnerValidSuppression() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] // Variable is declared but never used - Unnecessary [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableAssignedButNotUsedDiagnosticId}"")] // Variable is assigned but its value is never used - Necessary void M() {{ int y = 0; }} }}", $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableAssignedButNotUsedDiagnosticId}"")] // Variable is assigned but its value is never used - Necessary void M() {{ int y = 0; }} }}"); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_Pragma_OuterValidSuppression(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} int y = 0; {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_OuterValidSuppression() { await TestInRegularAndScript1Async( $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableAssignedButNotUsedDiagnosticId}"")] // Variable is assigned but its value is never used - Necessary [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] // Variable is declared but never used - Unnecessary void M() {{ int y = 0; }} }}", $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableAssignedButNotUsedDiagnosticId}"")] // Variable is assigned but its value is never used - Necessary void M() {{ int y = 0; }} }}"); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_OverlappingDirectives(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicateDisableWithoutMatchingRestoreDirective() { await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ [|#pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Unnecessary|] #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicateRestoreWithoutMatchingDisableDirective() { await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary [|#pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Unnecessary|] }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Theory, CombinatorialData] public async Task TestRemoveUnknownDiagnosticSuppression_Pragma(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" {disablePrefix}#pragma warning disable UnknownId{disableSuffix} class Class {restorePrefix}#pragma warning restore UnknownId{restoreSuffix} {{ }}", @" class Class { }"); } [Fact] public async Task TestRemoveUnknownDiagnosticSuppression_Attribute() { await TestInRegularAndScript1Async( @" [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""UnknownId"")]|] class Class { }", @" class Class { }"); } } #endregion #region Multiple analyzer tests (Compiler AND Analyzer) public sealed class CompilerAndAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { public CompilerAndAnalyzerTests(ITestOutputHelper logger) : base(logger) { } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new CSharpCompilerDiagnosticAnalyzer(), new UserDiagnosticAnalyzer()); [Fact] public async Task TestDoNotRemoveInvalidDiagnosticSuppression() { await TestMissingInRegularAndScriptAsync( $@" class Class {{ void M() {{ [|#pragma warning disable int y; #pragma warning restore |] y = 1; }} }} "); } [Fact] public async Task TestDoNotRemoveDiagnosticSuppressionsForSuppressedAnalyzer() { var source = $@" [|class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""CS0168"")] // Variable is declared but never used - Unnecessary, but suppressed [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{UserDiagnosticAnalyzer.Descriptor0168.Id}"")] // Variable is declared but never used - Unnecessary, but suppressed void M() {{ #pragma warning disable CS0168 // Variable is declared but never used - Unnecessary, but suppressed #pragma warning disable {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary, but suppressed #pragma warning restore CS0168 // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }}|]"; var parameters = new TestParameters(); using var workspace = CreateWorkspaceFromOptions(source, parameters); // Suppress the diagnostic in options. var projectId = workspace.Projects[0].Id; var compilationOptions = TestOptions.DebugDll.WithSpecificDiagnosticOptions( ImmutableDictionary<string, ReportDiagnostic>.Empty .Add(IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId, ReportDiagnostic.Suppress)); workspace.SetCurrentSolution(s => s.WithProjectCompilationOptions(projectId, compilationOptions), WorkspaceChangeKind.ProjectChanged, projectId); var (actions, _) = await GetCodeActionsAsync(workspace, parameters); Assert.True(actions.Length == 0, "An action was offered when none was expected"); } [Theory, CombinatorialData] public async Task TestDoNotRemoveCompilerDiagnosticSuppression_IntegerId(bool leadingZero) { var id = leadingZero ? "0168" : "168"; await TestMissingInRegularAndScriptAsync( $@" class Class {{ void M() {{ [|#pragma warning disable {id} // Variable is declared but never used - Necessary int y; #pragma warning restore {id} // Variable is declared but never used - Necessary|] }} }}"); } [Theory, CombinatorialData] public async Task TestRemoveCompilerDiagnosticSuppression_IntegerId(bool leadingZero) { var id = leadingZero ? "0168" : "168"; await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ [|#pragma warning disable {id} // Variable is declared but never used - Unnecessary|] int y; #pragma warning restore {id} // Variable is declared but never used - Unnecessary y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Theory, CombinatorialData] public async Task TestDoNotRemoveExcludedDiagnosticSuppression_Multiple(bool excludeAll) { var options = new OptionsCollection(LanguageNames.CSharp) { { CodeStyleOptions2.RemoveUnnecessarySuppressionExclusions, excludeAll ? "all" : $"CS0168, {UserDiagnosticAnalyzer.Descriptor0168.Id}" } }; await TestMissingInRegularAndScriptAsync( $@" [|class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""CS0168"")] // Variable is declared but never used - Unnecessary, but suppressed [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{UserDiagnosticAnalyzer.Descriptor0168.Id}"")] // Variable is declared but never used - Unnecessary, but suppressed void M() {{ #pragma warning disable CS0168 // Variable is declared but never used - Unnecessary, but suppressed #pragma warning disable {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary, but suppressed #pragma warning restore CS0168 // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }}|]", new TestParameters(options: options)); } [Theory, CombinatorialData] public async Task TestDoNotRemoveExcludedDiagnosticSuppression_Subset(bool suppressCompilerDiagnostic, bool testDisableDirective) { var (disabledId, enabledId) = suppressCompilerDiagnostic ? ("CS0168", UserDiagnosticAnalyzer.Descriptor0168.Id) : (UserDiagnosticAnalyzer.Descriptor0168.Id, "CS0168"); var options = new OptionsCollection(LanguageNames.CSharp) { { CodeStyleOptions2.RemoveUnnecessarySuppressionExclusions, disabledId } }; var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testDisableDirective ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); // Verify disabled ID is not marked unnecessary. await TestMissingInRegularAndScriptAsync( $@" class Class {{ void M() {{ {disablePrefix}#pragma warning disable {disabledId} // Variable is declared but never used - Unnecessary, but suppressed{disableSuffix} #pragma warning disable {enabledId} // Variable is declared but never used - Unnecessary, not suppressed int y; #pragma warning restore {enabledId} // Variable is declared but never used - Unnecessary, not suppressed {restorePrefix}#pragma warning restore {disabledId} // Variable is declared but never used - Unnecessary, but suppressed{restoreSuffix} y = 1; }} }}", new TestParameters(options: options)); // Verify enabled ID is marked unnecessary and removed with code fix. await TestInRegularAndScriptAsync( $@" class Class {{ void M() {{ #pragma warning disable {disabledId} // Variable is declared but never used - Unnecessary, but suppressed {disablePrefix}#pragma warning disable {enabledId} // Variable is declared but never used - Unnecessary, not suppressed{disableSuffix} int y; {restorePrefix}#pragma warning restore {enabledId} // Variable is declared but never used - Unnecessary, not suppressed{restoreSuffix} #pragma warning restore {disabledId} // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }}", $@" class Class {{ void M() {{ #pragma warning disable {disabledId} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {disabledId} // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }}", options: options); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_FixAll(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("{|FixAllInDocument:", "|}", "", "") : ("", "", "{|FixAllInDocument:", "|}"); await TestInRegularAndScript1Async( $@" #pragma warning disable CS0168 // Variable is declared but never used - Unnecessary #pragma warning disable {UserDiagnosticAnalyzer.Descriptor0168.Id} [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""CS0168"")] [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{UserDiagnosticAnalyzer.Descriptor0168.Id}"")] class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""CS0168"")] [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{UserDiagnosticAnalyzer.Descriptor0168.Id}"")] void M() {{ {disablePrefix}#pragma warning disable {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary{disableSuffix} #pragma warning disable CS0168 // Variable is declared but never used - Unnecessary int y; {restorePrefix}#pragma warning restore {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary{restoreSuffix} #pragma warning restore CS0168 // Variable is declared but never used y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_Field() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""UnknownId"")]|] private int f; }}", @" class Class { private int f; }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_Property() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""UnknownId"")]|] public int P {{ get; }} }}", @" class Class { public int P { get; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_Event() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""UnknownId"")]|] private event System.EventHandler SampleEvent; }}", @" class Class { private event System.EventHandler SampleEvent; }"); } public sealed class NonLocalDiagnosticsAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { public NonLocalDiagnosticsAnalyzerTests(ITestOutputHelper logger) : base(logger) { } private sealed class NonLocalDiagnosticsAnalyzer : DiagnosticAnalyzer { public const string DiagnosticId = "NonLocalDiagnosticId"; public static readonly DiagnosticDescriptor Descriptor = new(DiagnosticId, "NonLocalDiagnosticTitle", "NonLocalDiagnosticMessage", "NonLocalDiagnosticCategory", DiagnosticSeverity.Warning, isEnabledByDefault: true); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor); public override void Initialize(AnalysisContext context) { context.RegisterSymbolAction(context => { if (!context.Symbol.ContainingNamespace.IsGlobalNamespace) { var diagnostic = Diagnostic.Create(Descriptor, context.Symbol.ContainingNamespace.Locations[0]); context.ReportDiagnostic(diagnostic); } }, SymbolKind.NamedType); } } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new NonLocalDiagnosticsAnalyzer()); [Fact, WorkItem(50203, "https://github.com/dotnet/roslyn/issues/50203")] public async Task TestDoNotRemoveInvalidDiagnosticSuppression() { await TestMissingInRegularAndScriptAsync( $@" [|#pragma warning disable {NonLocalDiagnosticsAnalyzer.DiagnosticId} namespace N #pragma warning restore {NonLocalDiagnosticsAnalyzer.DiagnosticId}|] {{ class Class {{ }} }}"); } } public sealed class UseAutoPropertyAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { public UseAutoPropertyAnalyzerTests(ITestOutputHelper logger) : base(logger) { } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new CSharpUseAutoPropertyAnalyzer()); [Fact, WorkItem(55529, "https://github.com/dotnet/roslyn/issues/55529")] public async Task TestDoNotRemoveAutoPropertySuppression() { await TestMissingInRegularAndScriptAsync( $@" public class Test2 {{ // Message IDE0079 Remove unnecessary suppression [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Style"", ""IDE0032: Use auto property"", Justification = ""<Pending >"")]|] private readonly int i; public int I => i; }} ", new TestParameters(options: Option(CodeStyleOptions2.PreferAutoProperties, true, NotificationOption2.Warning))); } } #endregion } }
// 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 System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Text; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.RemoveUnnecessarySuppressions; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.CSharp.UseAutoProperty; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Diagnostics.CSharp; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Operations; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.UseAutoProperty; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveUnnecessarySuppressions { [Trait(Traits.Feature, Traits.Features.CodeActionsRemoveUnnecessarySuppressions)] [WorkItem(44177, "https://github.com/dotnet/roslyn/issues/44177")] public abstract class RemoveUnnecessaryInlineSuppressionsTests : AbstractUnncessarySuppressionDiagnosticTest { protected RemoveUnnecessaryInlineSuppressionsTests(ITestOutputHelper logger) : base(logger) { } #region Helpers internal sealed override CodeFixProvider CodeFixProvider => new RemoveUnnecessaryInlineSuppressionsCodeFixProvider(); internal sealed override AbstractRemoveUnnecessaryInlineSuppressionsDiagnosticAnalyzer SuppressionAnalyzer => new CSharpRemoveUnnecessaryInlineSuppressionsDiagnosticAnalyzer(); protected sealed override ParseOptions GetScriptOptions() => Options.Script; protected internal sealed override string GetLanguage() => LanguageNames.CSharp; protected override TestParameters SetParameterDefaults(TestParameters parameters) => parameters.WithCompilationOptions((parameters.compilationOptions ?? TestOptions.DebugDll).WithReportSuppressedDiagnostics(true)); protected sealed class UserDiagnosticAnalyzer : DiagnosticAnalyzer { public static readonly DiagnosticDescriptor Descriptor0168 = new DiagnosticDescriptor("Analyzer0168", "Variable is declared but never used", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true); public static readonly DiagnosticDescriptor Descriptor0219 = new DiagnosticDescriptor("Analyzer0219", "Variable is assigned but its value is never used", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor0168, Descriptor0219); public override void Initialize(AnalysisContext context) { context.RegisterOperationBlockStartAction( context => { var localsToIsAssignedMap = new ConcurrentDictionary<ILocalSymbol, bool>(); var usedLocals = new HashSet<ILocalSymbol>(); context.RegisterOperationAction( context => { var declarator = (IVariableDeclaratorOperation)context.Operation; var hasInitializer = declarator.GetVariableInitializer() != null; localsToIsAssignedMap.GetOrAdd(declarator.Symbol, hasInitializer); }, OperationKind.VariableDeclarator); context.RegisterOperationAction( context => { var localReference = (ILocalReferenceOperation)context.Operation; if (localReference.Parent is ISimpleAssignmentOperation simpleAssignment && simpleAssignment.Target == localReference) { localsToIsAssignedMap.AddOrUpdate(localReference.Local, true, (_1, _2) => true); } else { usedLocals.Add(localReference.Local); } }, OperationKind.LocalReference); context.RegisterOperationBlockEndAction( context => { foreach (var (local, isAssigned) in localsToIsAssignedMap) { if (usedLocals.Contains(local)) { continue; } var rule = !isAssigned ? Descriptor0168 : Descriptor0219; context.ReportDiagnostic(Diagnostic.Create(rule, local.Locations[0])); } }); }); } } protected sealed class CompilationEndDiagnosticAnalyzer : DiagnosticAnalyzer { public static readonly DiagnosticDescriptor Descriptor = new DiagnosticDescriptor("CompilationEndId", "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true, customTags: new[] { WellKnownDiagnosticTags.CompilationEnd }); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor); public override void Initialize(AnalysisContext context) => context.RegisterCompilationStartAction(context => context.RegisterCompilationEndAction(_ => { })); } #endregion #region Single analyzer tests (Compiler OR Analyzer) public abstract class CompilerOrAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { protected CompilerOrAnalyzerTests(ITestOutputHelper logger) : base(logger) { } protected abstract bool IsCompilerDiagnosticsTest { get; } protected abstract string VariableDeclaredButNotUsedDiagnosticId { get; } protected abstract string VariableAssignedButNotUsedDiagnosticId { get; } protected abstract ImmutableArray<string> UnsupportedDiagnosticIds { get; } public sealed class CompilerTests : CompilerOrAnalyzerTests { public CompilerTests(ITestOutputHelper logger) : base(logger) { } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new CSharpCompilerDiagnosticAnalyzer()); protected override bool IsCompilerDiagnosticsTest => true; protected override string VariableDeclaredButNotUsedDiagnosticId => "CS0168"; protected override string VariableAssignedButNotUsedDiagnosticId => "CS0219"; protected override ImmutableArray<string> UnsupportedDiagnosticIds { get { var errorCodes = Enum.GetValues(typeof(ErrorCode)); var supported = ((CSharpCompilerDiagnosticAnalyzer)OtherAnalyzers[0]).GetSupportedErrorCodes(); using var _ = ArrayBuilder<string>.GetInstance(out var builder); foreach (int errorCode in errorCodes) { if (!supported.Contains(errorCode) && errorCode > 0) { // Add all 3 supported formats for suppressions: integer, integer with leading zeros, "CS" prefix var errorCodeString = errorCode.ToString(); var errorCodeD4String = errorCode.ToString("D4"); builder.Add(errorCodeString); if (errorCodeD4String != errorCodeString) builder.Add(errorCodeD4String); builder.Add("CS" + errorCodeD4String); } } return builder.ToImmutable(); } } } public sealed class AnalyzerTests : CompilerOrAnalyzerTests { public AnalyzerTests(ITestOutputHelper logger) : base(logger) { } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new UserDiagnosticAnalyzer(), new CompilationEndDiagnosticAnalyzer()); protected override bool IsCompilerDiagnosticsTest => false; protected override string VariableDeclaredButNotUsedDiagnosticId => UserDiagnosticAnalyzer.Descriptor0168.Id; protected override string VariableAssignedButNotUsedDiagnosticId => UserDiagnosticAnalyzer.Descriptor0219.Id; protected override ImmutableArray<string> UnsupportedDiagnosticIds => ImmutableArray.Create( CompilationEndDiagnosticAnalyzer.Descriptor.Id, IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId, IDEDiagnosticIds.FormattingDiagnosticId, "format"); } [Fact] public async Task TestDoNotRemoveRequiredDiagnosticSuppression_Pragma() { await TestMissingInRegularAndScriptAsync( $@" class Class {{ void M() {{ [|#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary|] }} }}"); } [Fact] public async Task TestDoNotRemoveRequiredDiagnosticSuppression_Pragma_02() { await TestMissingInRegularAndScriptAsync( $@" [|#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary|] class Class {{ void M() {{ int y; }} }}"); } [Fact] public async Task TestDoNotRemoveRequiredDiagnosticSuppression_Attribute_Method() { var code = $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] void M() {{ int y; }} }}"; // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. if (!IsCompilerDiagnosticsTest) { await TestMissingInRegularAndScriptAsync(code); } else { await TestInRegularAndScript1Async(code, @" class Class { void M() { int y; } }"); } } [Fact] public async Task TestDoNotRemoveRequiredDiagnosticSuppression_Attribute_02() { var code = $@" [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] class Class {{ void M() {{ int y; }} }}"; // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. if (!IsCompilerDiagnosticsTest) { await TestMissingInRegularAndScriptAsync(code); } else { await TestInRegularAndScript1Async(code, @" class Class { void M() { int y; } }"); } } public enum TestKind { Pragmas, SuppressMessageAttributes, PragmasAndSuppressMessageAttributes } [Theory, CombinatorialData] [WorkItem(46047, "https://github.com/dotnet/roslyn/issues/46047")] public async Task TestDoNotRemoveUnsupportedDiagnosticSuppression(bool disable, TestKind testKind) { var disableOrRestore = disable ? "disable" : "restore"; var pragmas = new StringBuilder(); var suppressMessageAttribtes = new StringBuilder(); foreach (var id in UnsupportedDiagnosticIds) { if (testKind == TestKind.Pragmas || testKind == TestKind.PragmasAndSuppressMessageAttributes) pragmas.AppendLine($@"#pragma warning {disableOrRestore} {id}"); if (testKind == TestKind.SuppressMessageAttributes || testKind == TestKind.PragmasAndSuppressMessageAttributes) suppressMessageAttribtes.AppendLine($@"[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{id}"")]"); } var source = $@"{{|FixAllInDocument:{pragmas}{suppressMessageAttribtes}|}}class Class {{ }}"; // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. if (!IsCompilerDiagnosticsTest || testKind == TestKind.Pragmas) { await TestMissingInRegularAndScriptAsync(source); } else { var fixedSource = $@"{pragmas}class Class {{ }}"; await TestInRegularAndScriptAsync(source, fixedSource); } } [Fact] public async Task TestDoNotRemoveInactiveDiagnosticSuppression() { await TestMissingInRegularAndScriptAsync( $@" #if false [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Inactive int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Inactive y = 1; }} }} |] #endif"); } [Fact] public async Task TestDoNotRemoveDiagnosticSuppressionsInCodeWithSyntaxErrors() { await TestMissingInRegularAndScriptAsync( $@" [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used int y // CS1002: ; expected #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used y = 1; }} }} |]"); } [Fact] public async Task TestDoNotRemoveDiagnosticSuppressionWhenAnalyzerSuppressed() { await TestMissingInRegularAndScriptAsync( $@" #pragma warning disable {IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId} [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }} |]"); } [Fact, WorkItem(46075, "https://github.com/dotnet/roslyn/issues/46075")] public async Task TestDoNotRemoveDiagnosticSuppressionInGeneratedCode() { await TestMissingInRegularAndScriptAsync( $@" // <autogenerated> [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Unnecessary, but not reported in generated code void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but not reported in generated code int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but not reported in generated code y = 1; }} }} |]"); } [Theory, CombinatorialData] public async Task TestDoNotRemoveExcludedDiagnosticSuppression(bool excludeAll) { var options = new OptionsCollection(LanguageNames.CSharp) { { CodeStyleOptions2.RemoveUnnecessarySuppressionExclusions, excludeAll ? "all" : VariableDeclaredButNotUsedDiagnosticId } }; await TestMissingInRegularAndScriptAsync( $@" [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }} |]", new TestParameters(options: options)); } [Fact, WorkItem(47288, "https://github.com/dotnet/roslyn/issues/47288")] public async Task TestDoNotRemoveExcludedDiagnosticCategorySuppression() { var options = new OptionsCollection(LanguageNames.CSharp) { { CodeStyleOptions2.RemoveUnnecessarySuppressionExclusions, "category: ExcludedCategory" } }; await TestMissingInRegularAndScriptAsync( $@" [| class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""ExcludedCategory"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] [System.Diagnostics.CodeAnalysis.SuppressMessage(""ExcludedCategory"", ""{VariableAssignedButNotUsedDiagnosticId}"")] void M() {{ int y; y = 1; int z = 1; z++; }} }} |]", new TestParameters(options: options)); } [Fact] public async Task TestDoNotRemoveDiagnosticSuppression_Attribute_OnPartialDeclarations() { await TestMissingInRegularAndScriptAsync( $@" [| // Unnecessary, but we do not perform analysis for SuppressMessageAttributes on partial declarations. [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] partial class Class {{ }} partial class Class {{ void M() {{ int y; y = 1; }} }} |]"); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_Pragma(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} int y; {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] // Variable is declared but never used - Unnecessary void M() {{ int y; y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_Trivia() { await TestInRegularAndScript1Async( $@" class Class {{ // Comment1 /// <summary> /// DocComment /// </summary> // Comment2 [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] // Comment3 // Comment4 void M() {{ int y; y = 1; }} }}", @" class Class { // Comment1 /// <summary> /// DocComment /// </summary> // Comment2 // Comment4 void M() { int y; y = 1; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_OnlyDisableDirective() { await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ [|#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary|] int y; y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_OnlyRestoreDirective() { await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ int y; [|#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary|] y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_DuplicatePragmaSuppression(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary }} {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicateAttributeSuppression() { // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. var retainedAttributesInFixCode = IsCompilerDiagnosticsTest ? string.Empty : $@"[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Necessary "; await TestInRegularAndScript1Async( $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Necessary {{|FixAllInDocument:[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Unnecessary|}} void M() {{ int y; }} }}", $@" class Class {{ {retainedAttributesInFixCode}void M() {{ int y; }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicateAttributeSuppression_OnContainingSymbol() { // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. var retainedAttributesInFixCode = IsCompilerDiagnosticsTest ? string.Empty : $@"[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Necessary "; await TestInRegularAndScript1Async( $@" {{|FixAllInDocument:[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Unnecessary|}} class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] // Variable is declared but never used - Necessary void M() {{ int y; }} }}", $@" class Class {{ {retainedAttributesInFixCode}void M() {{ int y; }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicatePragmaAndAttributeSuppression() { var source = $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId}|] int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} }} }}"; string fixedSource; if (IsCompilerDiagnosticsTest) { // Compiler diagnostics cannot be suppressed with SuppressMessageAttribute. // Hence, attribute suppressions for compiler diagnostics are always unnecessary. fixedSource = $@" class Class {{ void M() {{ #pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} int y; #pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} }} }}"; } else { // Analyzer diagnostics can be suppressed with both SuppressMessageAttribute and pragmas. // SuppressMessageAttribute takes precedence over pragmas for duplicate suppressions, // hence duplicate pragmas are considered unnecessary. fixedSource = $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")] void M() {{ int y; }} }}"; } await TestInRegularAndScript1Async(source, fixedSource); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_Pragma_InnerValidSuppression(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_InnerValidSuppression() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] // Variable is declared but never used - Unnecessary [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableAssignedButNotUsedDiagnosticId}"")] // Variable is assigned but its value is never used - Necessary void M() {{ int y = 0; }} }}", $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableAssignedButNotUsedDiagnosticId}"")] // Variable is assigned but its value is never used - Necessary void M() {{ int y = 0; }} }}"); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_Pragma_OuterValidSuppression(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} int y = 0; {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_OuterValidSuppression() { await TestInRegularAndScript1Async( $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableAssignedButNotUsedDiagnosticId}"")] // Variable is assigned but its value is never used - Necessary [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableDeclaredButNotUsedDiagnosticId}"")]|] // Variable is declared but never used - Unnecessary void M() {{ int y = 0; }} }}", $@" class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{VariableAssignedButNotUsedDiagnosticId}"")] // Variable is assigned but its value is never used - Necessary void M() {{ int y = 0; }} }}"); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_OverlappingDirectives(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ {disablePrefix}#pragma warning disable {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{disableSuffix} #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; {restorePrefix}#pragma warning restore {VariableDeclaredButNotUsedDiagnosticId} // Variable is declared but never used - Unnecessary{restoreSuffix} #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicateDisableWithoutMatchingRestoreDirective() { await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ [|#pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Unnecessary|] #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Fact] public async Task TestRemoveDiagnosticSuppression_DuplicateRestoreWithoutMatchingDisableDirective() { await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary [|#pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Unnecessary|] }} }}", $@" class Class {{ void M() {{ #pragma warning disable {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary int y = 0; #pragma warning restore {VariableAssignedButNotUsedDiagnosticId} // Variable is assigned but its value is never used - Necessary }} }}"); } [Theory, CombinatorialData] public async Task TestRemoveUnknownDiagnosticSuppression_Pragma(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); await TestInRegularAndScript1Async( $@" {disablePrefix}#pragma warning disable UnknownId{disableSuffix} class Class {restorePrefix}#pragma warning restore UnknownId{restoreSuffix} {{ }}", @" class Class { }"); } [Fact] public async Task TestRemoveUnknownDiagnosticSuppression_Attribute() { await TestInRegularAndScript1Async( @" [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""UnknownId"")]|] class Class { }", @" class Class { }"); } } #endregion #region Multiple analyzer tests (Compiler AND Analyzer) public sealed class CompilerAndAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { public CompilerAndAnalyzerTests(ITestOutputHelper logger) : base(logger) { } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new CSharpCompilerDiagnosticAnalyzer(), new UserDiagnosticAnalyzer()); [Fact] public async Task TestDoNotRemoveInvalidDiagnosticSuppression() { await TestMissingInRegularAndScriptAsync( $@" class Class {{ void M() {{ [|#pragma warning disable int y; #pragma warning restore |] y = 1; }} }} "); } [Fact] public async Task TestDoNotRemoveDiagnosticSuppressionsForSuppressedAnalyzer() { var source = $@" [|class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""CS0168"")] // Variable is declared but never used - Unnecessary, but suppressed [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{UserDiagnosticAnalyzer.Descriptor0168.Id}"")] // Variable is declared but never used - Unnecessary, but suppressed void M() {{ #pragma warning disable CS0168 // Variable is declared but never used - Unnecessary, but suppressed #pragma warning disable {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary, but suppressed #pragma warning restore CS0168 // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }}|]"; var parameters = new TestParameters(); using var workspace = CreateWorkspaceFromOptions(source, parameters); // Suppress the diagnostic in options. var projectId = workspace.Projects[0].Id; var compilationOptions = TestOptions.DebugDll.WithSpecificDiagnosticOptions( ImmutableDictionary<string, ReportDiagnostic>.Empty .Add(IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId, ReportDiagnostic.Suppress)); workspace.SetCurrentSolution(s => s.WithProjectCompilationOptions(projectId, compilationOptions), WorkspaceChangeKind.ProjectChanged, projectId); var (actions, _) = await GetCodeActionsAsync(workspace, parameters); Assert.True(actions.Length == 0, "An action was offered when none was expected"); } [Theory, CombinatorialData] public async Task TestDoNotRemoveCompilerDiagnosticSuppression_IntegerId(bool leadingZero) { var id = leadingZero ? "0168" : "168"; await TestMissingInRegularAndScriptAsync( $@" class Class {{ void M() {{ [|#pragma warning disable {id} // Variable is declared but never used - Necessary int y; #pragma warning restore {id} // Variable is declared but never used - Necessary|] }} }}"); } [Theory, CombinatorialData] public async Task TestRemoveCompilerDiagnosticSuppression_IntegerId(bool leadingZero) { var id = leadingZero ? "0168" : "168"; await TestInRegularAndScript1Async( $@" class Class {{ void M() {{ [|#pragma warning disable {id} // Variable is declared but never used - Unnecessary|] int y; #pragma warning restore {id} // Variable is declared but never used - Unnecessary y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } [Theory, CombinatorialData] public async Task TestDoNotRemoveExcludedDiagnosticSuppression_Multiple(bool excludeAll) { var options = new OptionsCollection(LanguageNames.CSharp) { { CodeStyleOptions2.RemoveUnnecessarySuppressionExclusions, excludeAll ? "all" : $"CS0168, {UserDiagnosticAnalyzer.Descriptor0168.Id}" } }; await TestMissingInRegularAndScriptAsync( $@" [|class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""CS0168"")] // Variable is declared but never used - Unnecessary, but suppressed [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{UserDiagnosticAnalyzer.Descriptor0168.Id}"")] // Variable is declared but never used - Unnecessary, but suppressed void M() {{ #pragma warning disable CS0168 // Variable is declared but never used - Unnecessary, but suppressed #pragma warning disable {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary, but suppressed #pragma warning restore CS0168 // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }}|]", new TestParameters(options: options)); } [Theory, CombinatorialData] public async Task TestDoNotRemoveExcludedDiagnosticSuppression_Subset(bool suppressCompilerDiagnostic, bool testDisableDirective) { var (disabledId, enabledId) = suppressCompilerDiagnostic ? ("CS0168", UserDiagnosticAnalyzer.Descriptor0168.Id) : (UserDiagnosticAnalyzer.Descriptor0168.Id, "CS0168"); var options = new OptionsCollection(LanguageNames.CSharp) { { CodeStyleOptions2.RemoveUnnecessarySuppressionExclusions, disabledId } }; var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testDisableDirective ? ("[|", "|]", "", "") : ("", "", "[|", "|]"); // Verify disabled ID is not marked unnecessary. await TestMissingInRegularAndScriptAsync( $@" class Class {{ void M() {{ {disablePrefix}#pragma warning disable {disabledId} // Variable is declared but never used - Unnecessary, but suppressed{disableSuffix} #pragma warning disable {enabledId} // Variable is declared but never used - Unnecessary, not suppressed int y; #pragma warning restore {enabledId} // Variable is declared but never used - Unnecessary, not suppressed {restorePrefix}#pragma warning restore {disabledId} // Variable is declared but never used - Unnecessary, but suppressed{restoreSuffix} y = 1; }} }}", new TestParameters(options: options)); // Verify enabled ID is marked unnecessary and removed with code fix. await TestInRegularAndScriptAsync( $@" class Class {{ void M() {{ #pragma warning disable {disabledId} // Variable is declared but never used - Unnecessary, but suppressed {disablePrefix}#pragma warning disable {enabledId} // Variable is declared but never used - Unnecessary, not suppressed{disableSuffix} int y; {restorePrefix}#pragma warning restore {enabledId} // Variable is declared but never used - Unnecessary, not suppressed{restoreSuffix} #pragma warning restore {disabledId} // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }}", $@" class Class {{ void M() {{ #pragma warning disable {disabledId} // Variable is declared but never used - Unnecessary, but suppressed int y; #pragma warning restore {disabledId} // Variable is declared but never used - Unnecessary, but suppressed y = 1; }} }}", options: options); } [Theory, CombinatorialData] public async Task TestRemoveDiagnosticSuppression_FixAll(bool testFixFromDisable) { var (disablePrefix, disableSuffix, restorePrefix, restoreSuffix) = testFixFromDisable ? ("{|FixAllInDocument:", "|}", "", "") : ("", "", "{|FixAllInDocument:", "|}"); await TestInRegularAndScript1Async( $@" #pragma warning disable CS0168 // Variable is declared but never used - Unnecessary #pragma warning disable {UserDiagnosticAnalyzer.Descriptor0168.Id} [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""CS0168"")] [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{UserDiagnosticAnalyzer.Descriptor0168.Id}"")] class Class {{ [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""CS0168"")] [System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""{UserDiagnosticAnalyzer.Descriptor0168.Id}"")] void M() {{ {disablePrefix}#pragma warning disable {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary{disableSuffix} #pragma warning disable CS0168 // Variable is declared but never used - Unnecessary int y; {restorePrefix}#pragma warning restore {UserDiagnosticAnalyzer.Descriptor0168.Id} // Variable is declared but never used - Unnecessary{restoreSuffix} #pragma warning restore CS0168 // Variable is declared but never used y = 1; }} }}", @" class Class { void M() { int y; y = 1; } }"); } } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_Field() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""UnknownId"")]|] private int f; }}", @" class Class { private int f; }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_Property() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""UnknownId"")]|] public int P {{ get; }} }}", @" class Class { public int P { get; } }"); } [Fact] public async Task TestRemoveDiagnosticSuppression_Attribute_Event() { await TestInRegularAndScript1Async( $@" class Class {{ [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Category"", ""UnknownId"")]|] private event System.EventHandler SampleEvent; }}", @" class Class { private event System.EventHandler SampleEvent; }"); } public sealed class NonLocalDiagnosticsAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { public NonLocalDiagnosticsAnalyzerTests(ITestOutputHelper logger) : base(logger) { } private sealed class NonLocalDiagnosticsAnalyzer : DiagnosticAnalyzer { public const string DiagnosticId = "NonLocalDiagnosticId"; public static readonly DiagnosticDescriptor Descriptor = new(DiagnosticId, "NonLocalDiagnosticTitle", "NonLocalDiagnosticMessage", "NonLocalDiagnosticCategory", DiagnosticSeverity.Warning, isEnabledByDefault: true); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(Descriptor); public override void Initialize(AnalysisContext context) { context.RegisterSymbolAction(context => { if (!context.Symbol.ContainingNamespace.IsGlobalNamespace) { var diagnostic = Diagnostic.Create(Descriptor, context.Symbol.ContainingNamespace.Locations[0]); context.ReportDiagnostic(diagnostic); } }, SymbolKind.NamedType); } } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new NonLocalDiagnosticsAnalyzer()); [Fact, WorkItem(50203, "https://github.com/dotnet/roslyn/issues/50203")] public async Task TestDoNotRemoveInvalidDiagnosticSuppression() { await TestMissingInRegularAndScriptAsync( $@" [|#pragma warning disable {NonLocalDiagnosticsAnalyzer.DiagnosticId} namespace N #pragma warning restore {NonLocalDiagnosticsAnalyzer.DiagnosticId}|] {{ class Class {{ }} }}"); } } public sealed class UseAutoPropertyAnalyzerTests : RemoveUnnecessaryInlineSuppressionsTests { public UseAutoPropertyAnalyzerTests(ITestOutputHelper logger) : base(logger) { } internal override ImmutableArray<DiagnosticAnalyzer> OtherAnalyzers => ImmutableArray.Create<DiagnosticAnalyzer>(new CSharpUseAutoPropertyAnalyzer()); [Fact, WorkItem(55529, "https://github.com/dotnet/roslyn/issues/55529")] public async Task TestDoNotRemoveAutoPropertySuppression() { await TestMissingInRegularAndScriptAsync( $@" public class Test2 {{ // Message IDE0079 Remove unnecessary suppression [|[System.Diagnostics.CodeAnalysis.SuppressMessage(""Style"", ""IDE0032: Use auto property"", Justification = ""<Pending >"")]|] private readonly int i; public int I => i; }} ", new TestParameters(options: Option(CodeStyleOptions2.PreferAutoProperties, true, NotificationOption2.Warning))); } } #endregion } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Core/Portable/CodeGen/DebugDocumentProvider.cs
// 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. namespace Microsoft.CodeAnalysis.CodeGen { internal delegate Cci.DebugSourceDocument DebugDocumentProvider(string path, string basePath); }
// 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. namespace Microsoft.CodeAnalysis.CodeGen { internal delegate Cci.DebugSourceDocument DebugDocumentProvider(string path, string basePath); }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/CSharp/Portable/Syntax/ThrowStatementSyntax.cs
// 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.CodeAnalysis.CSharp.Syntax; namespace Microsoft.CodeAnalysis.CSharp.Syntax { public partial class ThrowStatementSyntax { public ThrowStatementSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) => Update(AttributeLists, throwKeyword, expression, semicolonToken); } } namespace Microsoft.CodeAnalysis.CSharp { public partial class SyntaxFactory { public static ThrowStatementSyntax ThrowStatement(SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) => ThrowStatement(attributeLists: default, throwKeyword, expression, semicolonToken); } }
// 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.CodeAnalysis.CSharp.Syntax; namespace Microsoft.CodeAnalysis.CSharp.Syntax { public partial class ThrowStatementSyntax { public ThrowStatementSyntax Update(SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) => Update(AttributeLists, throwKeyword, expression, semicolonToken); } } namespace Microsoft.CodeAnalysis.CSharp { public partial class SyntaxFactory { public static ThrowStatementSyntax ThrowStatement(SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken) => ThrowStatement(attributeLists: default, throwKeyword, expression, semicolonToken); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Analyzers/CSharp/Tests/UseIsNullCheck/UseIsNullCheckForReferenceEqualsTests.cs
// 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. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.UseIsNullCheck; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseIsNullCheck { public partial class UseIsNullCheckForReferenceEqualsTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { public UseIsNullCheckForReferenceEqualsTests(ITestOutputHelper logger) : base(logger) { } private static readonly ParseOptions CSharp7 = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7); private static readonly ParseOptions CSharp8 = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp8); private static readonly ParseOptions CSharp9 = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp9); internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer(), new CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider()); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestIdentifierName() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if ([||]ReferenceEquals(s, null)) return; } }", @"using System; class C { void M(string s) { if (s is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestBuiltInType() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if (object.[||]ReferenceEquals(s, null)) return; } }", @"using System; class C { void M(string s) { if (s is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestNamedType() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if (Object.[||]ReferenceEquals(s, null)) return; } }", @"using System; class C { void M(string s) { if (s is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestReversed() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if ([||]ReferenceEquals(null, s)) return; } }", @"using System; class C { void M(string s) { if (s is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestNegated_CSharp7() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if (![||]ReferenceEquals(null, s)) return; } }", @"using System; class C { void M(string s) { if (s is object) return; } }", new TestParameters(parseOptions: CSharp7)); } [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestNegated_CSharp9() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if (![||]ReferenceEquals(null, s)) return; } }", @"using System; class C { void M(string s) { if (s is not null) return; } }", new TestParameters(parseOptions: CSharp9)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestNotInCSharp6() { await TestMissingAsync( @"using System; class C { void M(string s) { if ([||]ReferenceEquals(null, s)) return; } }", parameters: new TestParameters(parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp6))); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestFixAll1() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s1, string s2) { if ({|FixAllInDocument:ReferenceEquals|}(s1, null) || ReferenceEquals(s2, null)) return; } }", @"using System; class C { void M(string s1, string s2) { if (s1 is null || s2 is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestFixAll2() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s1, string s2) { if (ReferenceEquals(s1, null) || {|FixAllInDocument:ReferenceEquals|}(s2, null)) return; } }", @"using System; class C { void M(string s1, string s2) { if (s1 is null || s2 is null) return; } }"); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/23581")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsUnconstrainedGeneric_CSharp7() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) { if ([||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) { if (value == null) { return; } } } ", new TestParameters(parseOptions: CSharp7)); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/47972")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsUnconstrainedGeneric_CSharp8() { await TestInRegularAndScript1Async( @"using System; class C { public static void NotNull<T>(T value) { if ({|FixAllInDocument:ReferenceEquals|}(value, null)) { return; } } }", @"using System; class C { public static void NotNull<T>(T value) { if (value is null) { return; } } }", new TestParameters(parseOptions: CSharp8)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsUnconstrainedGenericNegated_CSharp7() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) { if (![||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) { if (value is object) { return; } } } ", new TestParameters(parseOptions: CSharp7)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsUnconstrainedGenericNegated_CSharp9() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) { if (![||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) { if (value is not null) { return; } } } ", new TestParameters(parseOptions: CSharp9)); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/23581")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsRefConstraintGeneric() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) where T:class { if ([||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) where T:class { if (value is null) { return; } } } "); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsRefConstraintGenericNegated_CSharp7() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) where T:class { if (![||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) where T:class { if (value is object) { return; } } } ", new TestParameters(parseOptions: CSharp7)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsRefConstraintGenericNegated_CSharp9() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) where T:class { if (![||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) where T:class { if (value is not null) { return; } } } ", new TestParameters(parseOptions: CSharp9)); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/23581")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsValueConstraintGeneric() { await TestMissingAsync( @" class C { public static void NotNull<T>(T value) where T:struct { if ([||]ReferenceEquals(value, null)) { return; } } } "); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsValueConstraintGenericNegated() { await TestMissingAsync( @" class C { public static void NotNull<T>(T value) where T:struct { if (![||]ReferenceEquals(value, null)) { return; } } } "); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestFixAllNested1() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s2) { if ({|FixAllInDocument:ReferenceEquals|}(ReferenceEquals(s2, null), null)) return; } }", @"using System; class C { void M(string s2) { if (ReferenceEquals(s2, null) is null) return; } }"); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/47972")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsBaseTypeConstraintGeneric() { await TestInRegularAndScript1Async( @"using System; class C { public static void NotNull<T>(T value) where T:C { if ({|FixAllInDocument:ReferenceEquals|}(value, null)) { return; } } }", @"using System; class C { public static void NotNull<T>(T value) where T:C { if (value is null) { return; } } }", new TestParameters(parseOptions: CSharp7)); } } }
// 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. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.UseIsNullCheck; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseIsNullCheck { public partial class UseIsNullCheckForReferenceEqualsTests : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { public UseIsNullCheckForReferenceEqualsTests(ITestOutputHelper logger) : base(logger) { } private static readonly ParseOptions CSharp7 = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp7); private static readonly ParseOptions CSharp8 = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp8); private static readonly ParseOptions CSharp9 = CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp9); internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProviderAndFixer(Workspace workspace) => (new CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer(), new CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider()); [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestIdentifierName() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if ([||]ReferenceEquals(s, null)) return; } }", @"using System; class C { void M(string s) { if (s is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestBuiltInType() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if (object.[||]ReferenceEquals(s, null)) return; } }", @"using System; class C { void M(string s) { if (s is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestNamedType() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if (Object.[||]ReferenceEquals(s, null)) return; } }", @"using System; class C { void M(string s) { if (s is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestReversed() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if ([||]ReferenceEquals(null, s)) return; } }", @"using System; class C { void M(string s) { if (s is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestNegated_CSharp7() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if (![||]ReferenceEquals(null, s)) return; } }", @"using System; class C { void M(string s) { if (s is object) return; } }", new TestParameters(parseOptions: CSharp7)); } [WorkItem(42368, "https://github.com/dotnet/roslyn/issues/42368")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestNegated_CSharp9() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s) { if (![||]ReferenceEquals(null, s)) return; } }", @"using System; class C { void M(string s) { if (s is not null) return; } }", new TestParameters(parseOptions: CSharp9)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestNotInCSharp6() { await TestMissingAsync( @"using System; class C { void M(string s) { if ([||]ReferenceEquals(null, s)) return; } }", parameters: new TestParameters(parseOptions: CSharpParseOptions.Default.WithLanguageVersion(LanguageVersion.CSharp6))); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestFixAll1() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s1, string s2) { if ({|FixAllInDocument:ReferenceEquals|}(s1, null) || ReferenceEquals(s2, null)) return; } }", @"using System; class C { void M(string s1, string s2) { if (s1 is null || s2 is null) return; } }"); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestFixAll2() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s1, string s2) { if (ReferenceEquals(s1, null) || {|FixAllInDocument:ReferenceEquals|}(s2, null)) return; } }", @"using System; class C { void M(string s1, string s2) { if (s1 is null || s2 is null) return; } }"); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/23581")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsUnconstrainedGeneric_CSharp7() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) { if ([||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) { if (value == null) { return; } } } ", new TestParameters(parseOptions: CSharp7)); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/47972")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsUnconstrainedGeneric_CSharp8() { await TestInRegularAndScript1Async( @"using System; class C { public static void NotNull<T>(T value) { if ({|FixAllInDocument:ReferenceEquals|}(value, null)) { return; } } }", @"using System; class C { public static void NotNull<T>(T value) { if (value is null) { return; } } }", new TestParameters(parseOptions: CSharp8)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsUnconstrainedGenericNegated_CSharp7() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) { if (![||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) { if (value is object) { return; } } } ", new TestParameters(parseOptions: CSharp7)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsUnconstrainedGenericNegated_CSharp9() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) { if (![||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) { if (value is not null) { return; } } } ", new TestParameters(parseOptions: CSharp9)); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/23581")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsRefConstraintGeneric() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) where T:class { if ([||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) where T:class { if (value is null) { return; } } } "); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsRefConstraintGenericNegated_CSharp7() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) where T:class { if (![||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) where T:class { if (value is object) { return; } } } ", new TestParameters(parseOptions: CSharp7)); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsRefConstraintGenericNegated_CSharp9() { await TestInRegularAndScript1Async( @" class C { public static void NotNull<T>(T value) where T:class { if (![||]ReferenceEquals(value, null)) { return; } } } ", @" class C { public static void NotNull<T>(T value) where T:class { if (value is not null) { return; } } } ", new TestParameters(parseOptions: CSharp9)); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/23581")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsValueConstraintGeneric() { await TestMissingAsync( @" class C { public static void NotNull<T>(T value) where T:struct { if ([||]ReferenceEquals(value, null)) { return; } } } "); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsValueConstraintGenericNegated() { await TestMissingAsync( @" class C { public static void NotNull<T>(T value) where T:struct { if (![||]ReferenceEquals(value, null)) { return; } } } "); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestFixAllNested1() { await TestInRegularAndScript1Async( @"using System; class C { void M(string s2) { if ({|FixAllInDocument:ReferenceEquals|}(ReferenceEquals(s2, null), null)) return; } }", @"using System; class C { void M(string s2) { if (ReferenceEquals(s2, null) is null) return; } }"); } [WorkItem(23581, "https://github.com/dotnet/roslyn/issues/47972")] [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseIsNullCheck)] public async Task TestValueParameterTypeIsBaseTypeConstraintGeneric() { await TestInRegularAndScript1Async( @"using System; class C { public static void NotNull<T>(T value) where T:C { if ({|FixAllInDocument:ReferenceEquals|}(value, null)) { return; } } }", @"using System; class C { public static void NotNull<T>(T value) where T:C { if (value is null) { return; } } }", new TestParameters(parseOptions: CSharp7)); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Scripting/CoreTest/NuGetPackageResolverTests.cs
// 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. #nullable disable using Microsoft.CodeAnalysis.Scripting.Hosting; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Scripting.Test { public class NuGetPackageResolverTests : TestBase { [Fact] public void ParsePackageNameAndVersion() { ParseInvalidPackageReference("A"); ParseInvalidPackageReference("A/1"); ParseInvalidPackageReference("nuget"); ParseInvalidPackageReference("nuget:"); ParseInvalidPackageReference("NUGET:"); ParseInvalidPackageReference("nugetA/1"); ParseValidPackageReference("nuget:A", "A", ""); ParseValidPackageReference("nuget:A.B", "A.B", ""); ParseValidPackageReference("nuget: ", " ", ""); ParseInvalidPackageReference("nuget:A/"); ParseInvalidPackageReference("nuget:A//1.0"); ParseInvalidPackageReference("nuget:/1.0.0"); ParseInvalidPackageReference("nuget:A/B/2.0.0"); ParseValidPackageReference("nuget::nuget/1", ":nuget", "1"); ParseValidPackageReference("nuget:A/1", "A", "1"); ParseValidPackageReference("nuget:A.B/1.0.0", "A.B", "1.0.0"); ParseValidPackageReference("nuget:A/B.C", "A", "B.C"); ParseValidPackageReference("nuget: /1", " ", "1"); ParseValidPackageReference("nuget:A\t/\n1.0\r ", "A\t", "\n1.0\r "); } private static void ParseValidPackageReference(string reference, string expectedName, string expectedVersion) { string name; string version; Assert.True(NuGetPackageResolver.TryParsePackageReference(reference, out name, out version)); Assert.Equal(expectedName, name); Assert.Equal(expectedVersion, version); } private static void ParseInvalidPackageReference(string reference) { string name; string version; Assert.False(NuGetPackageResolver.TryParsePackageReference(reference, out name, out version)); Assert.Null(name); Assert.Null(version); } } }
// 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. #nullable disable using Microsoft.CodeAnalysis.Scripting.Hosting; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Scripting.Test { public class NuGetPackageResolverTests : TestBase { [Fact] public void ParsePackageNameAndVersion() { ParseInvalidPackageReference("A"); ParseInvalidPackageReference("A/1"); ParseInvalidPackageReference("nuget"); ParseInvalidPackageReference("nuget:"); ParseInvalidPackageReference("NUGET:"); ParseInvalidPackageReference("nugetA/1"); ParseValidPackageReference("nuget:A", "A", ""); ParseValidPackageReference("nuget:A.B", "A.B", ""); ParseValidPackageReference("nuget: ", " ", ""); ParseInvalidPackageReference("nuget:A/"); ParseInvalidPackageReference("nuget:A//1.0"); ParseInvalidPackageReference("nuget:/1.0.0"); ParseInvalidPackageReference("nuget:A/B/2.0.0"); ParseValidPackageReference("nuget::nuget/1", ":nuget", "1"); ParseValidPackageReference("nuget:A/1", "A", "1"); ParseValidPackageReference("nuget:A.B/1.0.0", "A.B", "1.0.0"); ParseValidPackageReference("nuget:A/B.C", "A", "B.C"); ParseValidPackageReference("nuget: /1", " ", "1"); ParseValidPackageReference("nuget:A\t/\n1.0\r ", "A\t", "\n1.0\r "); } private static void ParseValidPackageReference(string reference, string expectedName, string expectedVersion) { string name; string version; Assert.True(NuGetPackageResolver.TryParsePackageReference(reference, out name, out version)); Assert.Equal(expectedName, name); Assert.Equal(expectedVersion, version); } private static void ParseInvalidPackageReference(string reference) { string name; string version; Assert.False(NuGetPackageResolver.TryParsePackageReference(reference, out name, out version)); Assert.Null(name); Assert.Null(version); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/CSharp/Portable/Completion/KeywordRecommenders/NewKeywordRecommender.cs
// 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. #nullable disable using System.Collections.Generic; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Utilities; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class NewKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) { SyntaxKind.AbstractKeyword, SyntaxKind.ExternKeyword, SyntaxKind.InternalKeyword, SyntaxKind.PublicKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.ReadOnlyKeyword, SyntaxKind.SealedKeyword, SyntaxKind.StaticKeyword, SyntaxKind.UnsafeKeyword, SyntaxKind.VirtualKeyword, SyntaxKind.VolatileKeyword, }; protected static readonly ISet<SyntaxKind> ValidTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) { SyntaxKind.AbstractKeyword, SyntaxKind.InternalKeyword, SyntaxKind.PublicKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SealedKeyword, SyntaxKind.StaticKeyword, SyntaxKind.UnsafeKeyword }; public NewKeywordRecommender() : base(SyntaxKind.NewKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { return IsNewConstraintContext(context) || context.IsAnyExpressionContext || context.IsStatementContext || context.IsGlobalStatementContext || IsMemberDeclarationContext(context, cancellationToken) || IsTypeDeclarationContext(context, cancellationToken); } private static bool IsTypeDeclarationContext(CSharpSyntaxContext context, CancellationToken cancellationToken) { if (context.IsTypeDeclarationContext(validModifiers: ValidTypeModifiers, validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructRecordTypeDeclarations, canBePartial: false, cancellationToken: cancellationToken)) { // we must be on a nested type. var token = context.LeftToken; return token.GetAncestors<TypeDeclarationSyntax>() .Any(t => token.SpanStart > t.OpenBraceToken.Span.End && token.Span.End < t.CloseBraceToken.SpanStart); } return false; } private static bool IsMemberDeclarationContext(CSharpSyntaxContext context, CancellationToken cancellationToken) { return context.SyntaxTree.IsGlobalMemberDeclarationContext(context.Position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) || context.IsMemberDeclarationContext( validModifiers: s_validMemberModifiers, validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructRecordTypeDeclarations, canBePartial: false, cancellationToken: cancellationToken); } private static bool IsNewConstraintContext(CSharpSyntaxContext context) { // cases: // where T : | // where T : class, | // where T : Goo, | // note: 'new()' can't come after a 'struct' constraint. if (context.SyntaxTree.IsTypeParameterConstraintStartContext(context.Position, context.LeftToken)) { return true; } var token = context.TargetToken; if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause, out TypeParameterConstraintClauseSyntax constraintClause)) { if (!constraintClause.Constraints .OfType<ClassOrStructConstraintSyntax>() .Any(c => c.ClassOrStructKeyword.Kind() == SyntaxKind.StructKeyword)) { return true; } } return false; } } }
// 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. #nullable disable using System.Collections.Generic; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Utilities; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class NewKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) { SyntaxKind.AbstractKeyword, SyntaxKind.ExternKeyword, SyntaxKind.InternalKeyword, SyntaxKind.PublicKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.ReadOnlyKeyword, SyntaxKind.SealedKeyword, SyntaxKind.StaticKeyword, SyntaxKind.UnsafeKeyword, SyntaxKind.VirtualKeyword, SyntaxKind.VolatileKeyword, }; protected static readonly ISet<SyntaxKind> ValidTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) { SyntaxKind.AbstractKeyword, SyntaxKind.InternalKeyword, SyntaxKind.PublicKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SealedKeyword, SyntaxKind.StaticKeyword, SyntaxKind.UnsafeKeyword }; public NewKeywordRecommender() : base(SyntaxKind.NewKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { return IsNewConstraintContext(context) || context.IsAnyExpressionContext || context.IsStatementContext || context.IsGlobalStatementContext || IsMemberDeclarationContext(context, cancellationToken) || IsTypeDeclarationContext(context, cancellationToken); } private static bool IsTypeDeclarationContext(CSharpSyntaxContext context, CancellationToken cancellationToken) { if (context.IsTypeDeclarationContext(validModifiers: ValidTypeModifiers, validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructRecordTypeDeclarations, canBePartial: false, cancellationToken: cancellationToken)) { // we must be on a nested type. var token = context.LeftToken; return token.GetAncestors<TypeDeclarationSyntax>() .Any(t => token.SpanStart > t.OpenBraceToken.Span.End && token.Span.End < t.CloseBraceToken.SpanStart); } return false; } private static bool IsMemberDeclarationContext(CSharpSyntaxContext context, CancellationToken cancellationToken) { return context.SyntaxTree.IsGlobalMemberDeclarationContext(context.Position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) || context.IsMemberDeclarationContext( validModifiers: s_validMemberModifiers, validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructRecordTypeDeclarations, canBePartial: false, cancellationToken: cancellationToken); } private static bool IsNewConstraintContext(CSharpSyntaxContext context) { // cases: // where T : | // where T : class, | // where T : Goo, | // note: 'new()' can't come after a 'struct' constraint. if (context.SyntaxTree.IsTypeParameterConstraintStartContext(context.Position, context.LeftToken)) { return true; } var token = context.TargetToken; if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause, out TypeParameterConstraintClauseSyntax constraintClause)) { if (!constraintClause.Constraints .OfType<ClassOrStructConstraintSyntax>() .Any(c => c.ClassOrStructKeyword.Kind() == SyntaxKind.StructKeyword)) { return true; } } return false; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/CSharp/Portable/Symbols/Wrapped/WrappedParameterSymbol.cs
// 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. #nullable disable using System.Collections.Immutable; using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Threading; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.CSharp.Emit; namespace Microsoft.CodeAnalysis.CSharp.Symbols { /// <summary> /// Represents a parameter that is based on another parameter. /// When inheriting from this class, one shouldn't assume that /// the default behavior it has is appropriate for every case. /// That behavior should be carefully reviewed and derived type /// should override behavior as appropriate. /// </summary> internal abstract class WrappedParameterSymbol : ParameterSymbol { protected readonly ParameterSymbol _underlyingParameter; protected WrappedParameterSymbol(ParameterSymbol underlyingParameter) { Debug.Assert((object)underlyingParameter != null); this._underlyingParameter = underlyingParameter; } public ParameterSymbol UnderlyingParameter => _underlyingParameter; public sealed override bool IsDiscard => _underlyingParameter.IsDiscard; #region Forwarded public override TypeWithAnnotations TypeWithAnnotations { get { return _underlyingParameter.TypeWithAnnotations; } } public sealed override RefKind RefKind { get { return _underlyingParameter.RefKind; } } internal sealed override bool IsMetadataIn { get { return _underlyingParameter.IsMetadataIn; } } internal sealed override bool IsMetadataOut { get { return _underlyingParameter.IsMetadataOut; } } public sealed override ImmutableArray<Location> Locations { get { return _underlyingParameter.Locations; } } public sealed override ImmutableArray<SyntaxReference> DeclaringSyntaxReferences { get { return _underlyingParameter.DeclaringSyntaxReferences; } } public override ImmutableArray<CSharpAttributeData> GetAttributes() { return _underlyingParameter.GetAttributes(); } internal override void AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, ref ArrayBuilder<SynthesizedAttributeData> attributes) { _underlyingParameter.AddSynthesizedAttributes(moduleBuilder, ref attributes); } internal sealed override ConstantValue ExplicitDefaultConstantValue { get { return _underlyingParameter.ExplicitDefaultConstantValue; } } public override int Ordinal { get { return _underlyingParameter.Ordinal; } } public override bool IsParams { get { return _underlyingParameter.IsParams; } } internal override bool IsMetadataOptional { get { return _underlyingParameter.IsMetadataOptional; } } public override bool IsImplicitlyDeclared { get { return _underlyingParameter.IsImplicitlyDeclared; } } public sealed override string Name { get { return _underlyingParameter.Name; } } public sealed override string MetadataName { get { return _underlyingParameter.MetadataName; } } public override ImmutableArray<CustomModifier> RefCustomModifiers { get { return _underlyingParameter.RefCustomModifiers; } } internal override MarshalPseudoCustomAttributeData MarshallingInformation { get { return _underlyingParameter.MarshallingInformation; } } internal override UnmanagedType MarshallingType { get { return _underlyingParameter.MarshallingType; } } internal override bool IsIDispatchConstant { get { return _underlyingParameter.IsIDispatchConstant; } } internal override bool IsIUnknownConstant { get { return _underlyingParameter.IsIUnknownConstant; } } internal override FlowAnalysisAnnotations FlowAnalysisAnnotations { // https://github.com/dotnet/roslyn/issues/30073: Consider moving to leaf types get { return _underlyingParameter.FlowAnalysisAnnotations; } } internal override ImmutableHashSet<string> NotNullIfParameterNotNull { get { return _underlyingParameter.NotNullIfParameterNotNull; } } public override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default) { return _underlyingParameter.GetDocumentationCommentXml(preferredCulture, expandIncludes, cancellationToken); } #endregion } }
// 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. #nullable disable using System.Collections.Immutable; using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Threading; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.CSharp.Emit; namespace Microsoft.CodeAnalysis.CSharp.Symbols { /// <summary> /// Represents a parameter that is based on another parameter. /// When inheriting from this class, one shouldn't assume that /// the default behavior it has is appropriate for every case. /// That behavior should be carefully reviewed and derived type /// should override behavior as appropriate. /// </summary> internal abstract class WrappedParameterSymbol : ParameterSymbol { protected readonly ParameterSymbol _underlyingParameter; protected WrappedParameterSymbol(ParameterSymbol underlyingParameter) { Debug.Assert((object)underlyingParameter != null); this._underlyingParameter = underlyingParameter; } public ParameterSymbol UnderlyingParameter => _underlyingParameter; public sealed override bool IsDiscard => _underlyingParameter.IsDiscard; #region Forwarded public override TypeWithAnnotations TypeWithAnnotations { get { return _underlyingParameter.TypeWithAnnotations; } } public sealed override RefKind RefKind { get { return _underlyingParameter.RefKind; } } internal sealed override bool IsMetadataIn { get { return _underlyingParameter.IsMetadataIn; } } internal sealed override bool IsMetadataOut { get { return _underlyingParameter.IsMetadataOut; } } public sealed override ImmutableArray<Location> Locations { get { return _underlyingParameter.Locations; } } public sealed override ImmutableArray<SyntaxReference> DeclaringSyntaxReferences { get { return _underlyingParameter.DeclaringSyntaxReferences; } } public override ImmutableArray<CSharpAttributeData> GetAttributes() { return _underlyingParameter.GetAttributes(); } internal override void AddSynthesizedAttributes(PEModuleBuilder moduleBuilder, ref ArrayBuilder<SynthesizedAttributeData> attributes) { _underlyingParameter.AddSynthesizedAttributes(moduleBuilder, ref attributes); } internal sealed override ConstantValue ExplicitDefaultConstantValue { get { return _underlyingParameter.ExplicitDefaultConstantValue; } } public override int Ordinal { get { return _underlyingParameter.Ordinal; } } public override bool IsParams { get { return _underlyingParameter.IsParams; } } internal override bool IsMetadataOptional { get { return _underlyingParameter.IsMetadataOptional; } } public override bool IsImplicitlyDeclared { get { return _underlyingParameter.IsImplicitlyDeclared; } } public sealed override string Name { get { return _underlyingParameter.Name; } } public sealed override string MetadataName { get { return _underlyingParameter.MetadataName; } } public override ImmutableArray<CustomModifier> RefCustomModifiers { get { return _underlyingParameter.RefCustomModifiers; } } internal override MarshalPseudoCustomAttributeData MarshallingInformation { get { return _underlyingParameter.MarshallingInformation; } } internal override UnmanagedType MarshallingType { get { return _underlyingParameter.MarshallingType; } } internal override bool IsIDispatchConstant { get { return _underlyingParameter.IsIDispatchConstant; } } internal override bool IsIUnknownConstant { get { return _underlyingParameter.IsIUnknownConstant; } } internal override FlowAnalysisAnnotations FlowAnalysisAnnotations { // https://github.com/dotnet/roslyn/issues/30073: Consider moving to leaf types get { return _underlyingParameter.FlowAnalysisAnnotations; } } internal override ImmutableHashSet<string> NotNullIfParameterNotNull { get { return _underlyingParameter.NotNullIfParameterNotNull; } } public override string GetDocumentationCommentXml(CultureInfo preferredCulture = null, bool expandIncludes = false, CancellationToken cancellationToken = default) { return _underlyingParameter.GetDocumentationCommentXml(preferredCulture, expandIncludes, cancellationToken); } #endregion } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Core/Portable/Interop/IClrMetaHost.cs
// 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. #nullable disable using System; using System.Runtime.InteropServices; using System.Security; using System.Text; #pragma warning disable CS0436 // Type conflicts with imported type: SuppressUnmanagedCodeSecurity namespace Microsoft.CodeAnalysis.Interop { [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("D332DB9E-B9B3-4125-8207-A14884F53216"), SuppressUnmanagedCodeSecurity] internal interface IClrMetaHost { [return: MarshalAs(UnmanagedType.Interface)] object GetRuntime( [In, MarshalAs(UnmanagedType.LPWStr)] string version, [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceId); [PreserveSig] int GetVersionFromFile( [In, MarshalAs(UnmanagedType.LPWStr)] string filePath, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder buffer, [In, Out, MarshalAs(UnmanagedType.U4)] ref int bufferLength); [return: MarshalAs(UnmanagedType.Interface)] object EnumerateInstalledRuntimes(); [return: MarshalAs(UnmanagedType.Interface)] object EnumerateLoadedRuntimes( [In] IntPtr processHandle); // Placeholder for RequestRuntimeLoadedNotification [PreserveSig] int Reserved01( [In] IntPtr reserved1); [return: MarshalAs(UnmanagedType.Interface)] object QueryLegacyV2RuntimeBinding( [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceId); void ExitProcess( [In, MarshalAs(UnmanagedType.U4)] int exitCode); } }
// 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. #nullable disable using System; using System.Runtime.InteropServices; using System.Security; using System.Text; #pragma warning disable CS0436 // Type conflicts with imported type: SuppressUnmanagedCodeSecurity namespace Microsoft.CodeAnalysis.Interop { [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("D332DB9E-B9B3-4125-8207-A14884F53216"), SuppressUnmanagedCodeSecurity] internal interface IClrMetaHost { [return: MarshalAs(UnmanagedType.Interface)] object GetRuntime( [In, MarshalAs(UnmanagedType.LPWStr)] string version, [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceId); [PreserveSig] int GetVersionFromFile( [In, MarshalAs(UnmanagedType.LPWStr)] string filePath, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder buffer, [In, Out, MarshalAs(UnmanagedType.U4)] ref int bufferLength); [return: MarshalAs(UnmanagedType.Interface)] object EnumerateInstalledRuntimes(); [return: MarshalAs(UnmanagedType.Interface)] object EnumerateLoadedRuntimes( [In] IntPtr processHandle); // Placeholder for RequestRuntimeLoadedNotification [PreserveSig] int Reserved01( [In] IntPtr reserved1); [return: MarshalAs(UnmanagedType.Interface)] object QueryLegacyV2RuntimeBinding( [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceId); void ExitProcess( [In, MarshalAs(UnmanagedType.U4)] int exitCode); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/CSharp/Test/Symbol/Symbols/AnonymousTypesSemanticsTests.cs
// 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. #nullable disable using System; using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols { public class AnonymousTypesSemanticsTests : CompilingTestBase { [Fact()] public void AnonymousTypeSymbols_Simple() { var source = @" public class ClassA { public struct SSS { } public static void Test1(int x) { object v1 = [# new { [# aa #] = 1, [# BB #] = """", [# CCC #] = new SSS() } #]; object v2 = [# new { [# aa #] = new SSS(), [# BB #] = 123.456, [# CCC #] = [# new { (new ClassA()).[# aa #], ClassA.[# BB #], ClassA.[# CCC #] } #] } #]; object v3 = [# new {} #]; var v4 = [# new {} #]; } public int aa { get { return 123; } } public const string BB = ""-=-=-""; public static SSS CCC = new SSS(); }"; var data = Compile(source, 14); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2, 3); var info1 = GetAnonymousTypeInfoSummary(data, 4, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 3).Span, 5, 6, 7); var info2 = GetAnonymousTypeInfoSummary(data, 8, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 5).Span, 9, 10, 11); Assert.Equal("AnonymousTypePublicSymbol", info0.Type.GetSymbol().GetType().Name); Assert.False(((INamedTypeSymbol)info0.Type).IsSerializable); Assert.Equal(info0.Type, info2.Type); Assert.NotEqual(info0.Type, info1.Type); var info3 = GetAnonymousTypeInfoSummary(data, 12, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 7).Span); var info4 = GetAnonymousTypeInfoSummary(data, 13, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 8).Span); Assert.Equal(info3.Type, info4.Type); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_Simple_OperationTree() { string source = @" class ClassA { public struct SSS { } public static void Test1(int x) /*<bind>*/{ object v1 = new { aa = 1, BB = """", CCC = new SSS() }; object v2 = new { aa = new SSS(), BB = 123.456, CCC = new { (new ClassA()).aa, ClassA.BB, ClassA.CCC } }; object v3 = new { }; var v4 = new { }; }/*</bind>*/ public int aa { get { return 123; } } public const string BB = ""-=-= -""; public static SSS CCC = new SSS(); } "; string expectedOperationTree = @" IBlockOperation (4 statements, 4 locals) (OperationKind.Block, Type: null) (Syntax: '{ ... }') Locals: Local_1: System.Object v1 Local_2: System.Object v2 Local_3: System.Object v3 Local_4: <empty anonymous type> v4 IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null) (Syntax: 'object v1 = ... };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'object v1 = ... }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v1) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'v1 = new ... }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= new ... }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new ... }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'aa = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.aa { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: """") (Syntax: 'BB = """"') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: """") (Syntax: '""""') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ClassA.SSS) (Syntax: 'CCC = new SSS()') Left: IPropertyReferenceOperation: ClassA.SSS <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.CCC { get; } (OperationKind.PropertyReference, Type: ClassA.SSS) (Syntax: 'CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: IObjectCreationOperation (Constructor: ClassA.SSS..ctor()) (OperationKind.ObjectCreation, Type: ClassA.SSS) (Syntax: 'new SSS()') Arguments(0) Initializer: null Initializer: null IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null) (Syntax: 'object v2 = ... };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'object v2 = ... }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v2) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'v2 = new ... }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= new ... }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new ... }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ClassA.SSS) (Syntax: 'aa = new SSS()') Left: IPropertyReferenceOperation: ClassA.SSS <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>.aa { get; } (OperationKind.PropertyReference, Type: ClassA.SSS) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>, IsImplicit) (Syntax: 'new ... }') Right: IObjectCreationOperation (Constructor: ClassA.SSS..ctor()) (OperationKind.ObjectCreation, Type: ClassA.SSS) (Syntax: 'new SSS()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Double, Constant: 123.456) (Syntax: 'BB = 123.456') Left: IPropertyReferenceOperation: System.Double <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.Double) (Syntax: 'BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 123.456) (Syntax: '123.456') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>) (Syntax: 'CCC = new ... }') Left: IPropertyReferenceOperation: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>.CCC { get; } (OperationKind.PropertyReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>) (Syntax: 'CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>, IsImplicit) (Syntax: 'new ... }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '(new ClassA()).aa') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.aa { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '(new ClassA()).aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: IPropertyReferenceOperation: System.Int32 ClassA.aa { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: '(new ClassA()).aa') Instance Receiver: IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: ""-=-= -"", IsImplicit) (Syntax: 'ClassA.BB') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'ClassA.BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: IFieldReferenceOperation: System.String ClassA.BB (Static) (OperationKind.FieldReference, Type: System.String, Constant: ""-=-= -"") (Syntax: 'ClassA.BB') Instance Receiver: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ClassA.SSS, IsImplicit) (Syntax: 'ClassA.CCC') Left: IPropertyReferenceOperation: ClassA.SSS <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.CCC { get; } (OperationKind.PropertyReference, Type: ClassA.SSS, IsImplicit) (Syntax: 'ClassA.CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: IFieldReferenceOperation: ClassA.SSS ClassA.CCC (Static) (OperationKind.FieldReference, Type: ClassA.SSS) (Syntax: 'ClassA.CCC') Instance Receiver: null Initializer: null IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null) (Syntax: 'object v3 = new { };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'object v3 = new { }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v3) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'v3 = new { }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= new { }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new { }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) Initializer: null IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null) (Syntax: 'var v4 = new { };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var v4 = new { }') Declarators: IVariableDeclaratorOperation (Symbol: <empty anonymous type> v4) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'v4 = new { }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= new { }') IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) Initializer: null "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<BlockSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_ContextualKeywordsInFields() { var source = @" class ClassA { static void Test1(int x) { object v1 = [# new { [# var #] = ""var"", [# get #] = new {}, [# partial #] = [# new { (new ClassA()).[# select #], [# global #] } #] } #]; } public int select { get { return 123; } } public const string global = ""-=-=-""; }"; var data = Compile(source, 7); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2, 3); var info1 = GetAnonymousTypeInfoSummary(data, 4, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 3).Span, 5, 6); Assert.Equal( "<anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>", info0.Type.ToTestDisplayString()); Assert.Equal( "<anonymous type: System.Int32 select, System.String global>..ctor(System.Int32 select, System.String global)", info1.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_ContextualKeywordsInFields_OperationTree() { string source = @" class ClassA { static void Test1(int x) { object v1 = /*<bind>*/new { var = ""var"", get = new { }, partial = new { (new ClassA()).select, global } }/*</bind>*/; } public int select { get { return 123; } } public const string global = "" -=-= -""; } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: ""var"") (Syntax: 'var = ""var""') Left: IPropertyReferenceOperation: System.String <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>.var { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'var') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""var"") (Syntax: '""var""') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <empty anonymous type>) (Syntax: 'get = new { }') Left: IPropertyReferenceOperation: <empty anonymous type> <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>.get { get; } (OperationKind.PropertyReference, Type: <empty anonymous type>) (Syntax: 'get') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>, IsImplicit) (Syntax: 'new ... }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <anonymous type: System.Int32 select, System.String global>) (Syntax: 'partial = n ... }') Left: IPropertyReferenceOperation: <anonymous type: System.Int32 select, System.String global> <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>.partial { get; } (OperationKind.PropertyReference, Type: <anonymous type: System.Int32 select, System.String global>) (Syntax: 'partial') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>, IsImplicit) (Syntax: 'new ... }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 select, System.String global>) (Syntax: 'new ... }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '(new ClassA()).select') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 select, System.String global>.select { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '(new ClassA()).select') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 select, System.String global>, IsImplicit) (Syntax: 'new ... }') Right: IPropertyReferenceOperation: System.Int32 ClassA.select { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: '(new ClassA()).select') Instance Receiver: IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: "" -=-= -"", IsImplicit) (Syntax: 'global') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 select, System.String global>.global { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'global') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 select, System.String global>, IsImplicit) (Syntax: 'new ... }') Right: IFieldReferenceOperation: System.String ClassA.global (Static) (OperationKind.FieldReference, Type: System.String, Constant: "" -=-= -"") (Syntax: 'global') Instance Receiver: null "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_DelegateMembers() { var source = @" delegate bool D1(); class ClassA { void Main() { var at1 = [# new { [# module #] = (D1)(() => false)} #].module(); } }"; var data = Compile(source, 2); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1); Assert.Equal("<anonymous type: D1 module>", info0.Type.ToTestDisplayString()); Assert.Equal("<anonymous type: D1 module>..ctor(D1 module)", info0.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_DelegateMembers_OperationTree() { string source = @" delegate bool D1(); class ClassA { void Main() { var at1 = /*<bind>*/new { module = (D1)(() => false) }/*</bind>*/.module(); } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: D1 module>) (Syntax: 'new { modul ... => false) }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: D1) (Syntax: 'module = (D ... ) => false)') Left: IPropertyReferenceOperation: D1 <anonymous type: D1 module>.module { get; } (OperationKind.PropertyReference, Type: D1) (Syntax: 'module') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: D1 module>, IsImplicit) (Syntax: 'new { modul ... => false) }') Right: IDelegateCreationOperation (OperationKind.DelegateCreation, Type: D1) (Syntax: '(D1)(() => false)') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => false') IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: 'false') IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: 'false') ReturnedValue: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_BaseAccessInMembers() { var source = @" delegate bool D1(); class ClassB { protected System.Func<int, int> F = x => x; } class ClassA: ClassB { void Main() { var at1 = [# [# new { base.[# F #] } #].F(1) #]; } }"; var data = Compile(source, 3); var info0 = GetAnonymousTypeInfoSummary(data, 1, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 2); Assert.Equal("<anonymous type: System.Func<System.Int32, System.Int32> F>", info0.Type.ToTestDisplayString()); var info1 = data.Model.GetSemanticInfoSummary(data.Nodes[0]); Assert.Equal("System.Int32 System.Func<System.Int32, System.Int32>.Invoke(System.Int32 arg)", info1.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_BaseAccessInMembers_OperationTree() { string source = @" delegate bool D1(); class ClassB { protected System.Func<int, int> F = x => x; } class ClassA : ClassB { void Main() { var at1 = /*<bind>*/new { base.F }/*</bind>*/.F(1); } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Func<System.Int32, System.Int32> F>) (Syntax: 'new { base.F }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Func<System.Int32, System.Int32>, IsImplicit) (Syntax: 'base.F') Left: IPropertyReferenceOperation: System.Func<System.Int32, System.Int32> <anonymous type: System.Func<System.Int32, System.Int32> F>.F { get; } (OperationKind.PropertyReference, Type: System.Func<System.Int32, System.Int32>, IsImplicit) (Syntax: 'base.F') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Func<System.Int32, System.Int32> F>, IsImplicit) (Syntax: 'new { base.F }') Right: IFieldReferenceOperation: System.Func<System.Int32, System.Int32> ClassB.F (OperationKind.FieldReference, Type: System.Func<System.Int32, System.Int32>) (Syntax: 'base.F') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: ClassB) (Syntax: 'base') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_InFieldInitializer() { var source = @" class ClassA { private static object F = [# new { [# F123 #] = typeof(ClassA) } #]; }"; var data = Compile(source, 2); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1); Assert.Equal("<anonymous type: System.Type F123>", info0.Type.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_InFieldInitializer_OperationTree() { string source = @" class ClassA { private static object F = /*<bind>*/new { F123 = typeof(ClassA) }/*</bind>*/; } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Type F123>) (Syntax: 'new { F123 ... f(ClassA) }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Type) (Syntax: 'F123 = typeof(ClassA)') Left: IPropertyReferenceOperation: System.Type <anonymous type: System.Type F123>.F123 { get; } (OperationKind.PropertyReference, Type: System.Type) (Syntax: 'F123') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Type F123>, IsImplicit) (Syntax: 'new { F123 ... f(ClassA) }') Right: ITypeOfOperation (OperationKind.TypeOf, Type: System.Type) (Syntax: 'typeof(ClassA)') TypeOperand: ClassA "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_Equals() { var source = @" class ClassA { static void Test1(int x) { bool result = [# new { f1 = 1, f2 = """" }.Equals(new { }) #]; } }"; var data = Compile(source, 1); var info = data.Model.GetSemanticInfoSummary(data.Nodes[0]); var method = info.Symbol; Assert.NotNull(method); Assert.Equal(SymbolKind.Method, method.Kind); Assert.Equal("object.Equals(object)", method.ToDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_Equals_OperationTree() { string source = @" class ClassA { static void Test1(int x) { bool result = /*<bind>*/new { f1 = 1, f2 = """" }.Equals(new { })/*</bind>*/; } } "; string expectedOperationTree = @" IInvocationOperation (virtual System.Boolean System.Object.Equals(System.Object obj)) (OperationKind.Invocation, Type: System.Boolean) (Syntax: 'new { f1 = ... ls(new { })') Instance Receiver: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 f1, System.String f2>) (Syntax: 'new { f1 = 1, f2 = """" }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'f1 = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 f1, System.String f2>.f1 { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'f1') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 f1, System.String f2>, IsImplicit) (Syntax: 'new { f1 = 1, f2 = """" }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: """") (Syntax: 'f2 = """"') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 f1, System.String f2>.f2 { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'f2') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 f1, System.String f2>, IsImplicit) (Syntax: 'new { f1 = 1, f2 = """" }') Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: """") (Syntax: '""""') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: null) (Syntax: 'new { }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new { }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<InvocationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_ToString() { var source = @" class ClassA { static void Test1(int x) { string result = [# new { f1 = 1, f2 = """" }.ToString() #]; } }"; var data = Compile(source, 1); var info = data.Model.GetSemanticInfoSummary(data.Nodes[0]); var method = info.Symbol; Assert.NotNull(method); Assert.Equal(SymbolKind.Method, method.Kind); Assert.Equal("object.ToString()", method.ToDisplayString()); } [Fact()] public void AnonymousTypeSymbols_GetHashCode() { var source = @" class ClassA { static void Test1(int x) { int result = [# new { f1 = 1, f2 = """" }.GetHashCode() #]; } }"; var data = Compile(source, 1); var info = data.Model.GetSemanticInfoSummary(data.Nodes[0]); var method = info.Symbol; Assert.NotNull(method); Assert.Equal(SymbolKind.Method, method.Kind); Assert.Equal("object.GetHashCode()", method.ToDisplayString()); } [Fact()] public void AnonymousTypeSymbols_Ctor() { var source = @" class ClassA { static void Test1(int x) { var result = [# new { f1 = 1, f2 = """" } #]; } }"; var data = Compile(source, 1); var info = data.Model.GetSemanticInfoSummary(data.Nodes[0]); var method = info.Symbol; Assert.NotNull(method); Assert.Equal(SymbolKind.Method, method.Kind); Assert.Equal("<anonymous type: int f1, string f2>..ctor(int, string)", method.ToDisplayString()); Assert.Equal("<anonymous type: System.Int32 f1, System.String f2>..ctor(System.Int32 f1, System.String f2)", method.ToTestDisplayString()); } [Fact()] public void AnonymousTypeTemplateCannotConstruct() { var source = @" class ClassA { object F = [# new { [# F123 #] = typeof(ClassA) } #]; }"; var data = Compile(source, 2); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1); var type = info0.Type; Assert.Equal("<anonymous type: System.Type F123>", type.ToTestDisplayString()); Assert.True(type.IsDefinition); AssertCannotConstruct(type); } [Fact()] public void AnonymousTypeTemplateCannotConstruct_Empty() { var source = @" class ClassA { object F = [# new { } #]; }"; var data = Compile(source, 1); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span); var type = info0.Type; Assert.Equal("<empty anonymous type>", type.ToTestDisplayString()); Assert.True(type.IsDefinition); AssertCannotConstruct(type); } [Fact()] public void AnonymousTypeFieldDeclarationIdentifier() { var source = @" class ClassA { object F = new { [# F123 #] = typeof(ClassA) }; }"; var data = Compile(source, 1); var info = data.Model.GetSymbolInfo((ExpressionSyntax)data.Nodes[0]); Assert.NotNull(info.Symbol); Assert.Equal(SymbolKind.Property, info.Symbol.Kind); Assert.Equal("System.Type <anonymous type: System.Type F123>.F123 { get; }", info.Symbol.ToTestDisplayString()); } [Fact()] public void AnonymousTypeFieldCreatedInQuery() { var source = LINQ + @" class ClassA { void m() { var o = from x in new List1<int>(1, 2, 3) select [# new { [# x #], [# y #] = x } #]; } }"; var data = Compile(source, 3); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, NumberOfNewKeywords(LINQ) + 2).Span, 1, 2); var info1 = data.Model.GetSymbolInfo(((AnonymousObjectMemberDeclaratorSyntax)data.Nodes[1]).Expression); Assert.NotNull(info1.Symbol); Assert.Equal(SymbolKind.RangeVariable, info1.Symbol.Kind); Assert.Equal("x", info1.Symbol.ToDisplayString()); var info2 = data.Model.GetSymbolInfo((ExpressionSyntax)data.Nodes[2]); Assert.NotNull(info2.Symbol); Assert.Equal(SymbolKind.Property, info2.Symbol.Kind); Assert.Equal("System.Int32 <anonymous type: System.Int32 x, System.Int32 y>.y { get; }", info2.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeFieldCreatedInQuery_OperationTree() { string source = @" using System.Collections.Generic; using System.Linq; class ClassA { void m() { var o = from x in new List<int>() { 1, 2, 3 } select /*<bind>*/new { x, y = x }/*</bind>*/; } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 x, System.Int32 y>) (Syntax: 'new { x, y = x }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'x') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, System.Int32 y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'x') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, System.Int32 y>, IsImplicit) (Syntax: 'new { x, y = x }') Right: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'y = x') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, System.Int32 y>.y { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'y') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, System.Int32 y>, IsImplicit) (Syntax: 'new { x, y = x }') Right: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeFieldCreatedInQuery2() { var source = LINQ + @" class ClassA { void m() { var o = from x in new List1<int>(1, 2, 3) let y = """" select [# new { [# x #], [# y #] } #]; } }"; var data = Compile(source, 3); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, NumberOfNewKeywords(LINQ) + 2).Span, 1, 2); Assert.Equal("<anonymous type: System.Int32 x, System.String y>", info0.Type.ToTestDisplayString()); var info1 = data.Model.GetSymbolInfo(((AnonymousObjectMemberDeclaratorSyntax)data.Nodes[1]).Expression); Assert.NotNull(info1.Symbol); Assert.Equal(SymbolKind.RangeVariable, info1.Symbol.Kind); Assert.Equal("x", info1.Symbol.ToDisplayString()); var info2 = data.Model.GetSymbolInfo(((AnonymousObjectMemberDeclaratorSyntax)data.Nodes[2]).Expression); Assert.NotNull(info2.Symbol); Assert.Equal(SymbolKind.RangeVariable, info2.Symbol.Kind); Assert.Equal("y", info2.Symbol.ToDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeFieldCreatedInQuery2_OperationTree() { string source = @" using System.Collections.Generic; using System.Linq; class ClassA { void m() { var o = from x in new List<int>() { 1, 2, 3 } let y = """" select /*<bind>*/new { x, y }/*</bind>*/; } } "; // OperationKind.None is for Range variables, IOperation support for it is NYI. string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 x, System.String y>) (Syntax: 'new { x, y }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'x') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, System.String y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'x') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, System.String y>, IsImplicit) (Syntax: 'new { x, y }') Right: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, System.String y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'x') Instance Receiver: IParameterReferenceOperation: <>h__TransparentIdentifier0 (OperationKind.ParameterReference, Type: <anonymous type: System.Int32 x, System.String y>, IsImplicit) (Syntax: 'x') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, IsImplicit) (Syntax: 'y') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 x, System.String y>.y { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'y') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, System.String y>, IsImplicit) (Syntax: 'new { x, y }') Right: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 x, System.String y>.y { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'y') Instance Receiver: IParameterReferenceOperation: <>h__TransparentIdentifier0 (OperationKind.ParameterReference, Type: <anonymous type: System.Int32 x, System.String y>, IsImplicit) (Syntax: 'y') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeFieldCreatedInLambda() { var source = @" using System; class ClassA { void m() { var o = (Action)(() => ( [# new { [# x #] = 1, [# y #] = [# new { } #] } #]).ToString());; } }"; var data = Compile(source, 4); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2); var info1 = GetAnonymousTypeInfoSummary(data, 3, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 2).Span); Assert.Equal("<anonymous type: System.Int32 x, <empty anonymous type> y>..ctor(System.Int32 x, <empty anonymous type> y)", info0.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeFieldCreatedInLambda_OperationTree() { string source = @" using System; class ClassA { void m() { var o = (Action)(() => (/*<bind>*/new { x = 1, y = new { } }/*</bind>*/).ToString()); ; } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>) (Syntax: 'new { x = 1 ... = new { } }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'x = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, <empty anonymous type> y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'x') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>, IsImplicit) (Syntax: 'new { x = 1 ... = new { } }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <empty anonymous type>) (Syntax: 'y = new { }') Left: IPropertyReferenceOperation: <empty anonymous type> <anonymous type: System.Int32 x, <empty anonymous type> y>.y { get; } (OperationKind.PropertyReference, Type: <empty anonymous type>) (Syntax: 'y') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>, IsImplicit) (Syntax: 'new { x = 1 ... = new { } }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeFieldCreatedInLambda2() { var source = @" using System; class ClassA { void m() { var o = (Action) (() => ((Func<string>) (() => ( [# new { [# x #] = 1, [# y #] = [# new { } #] } #]).ToString()) ).Invoke()); } }"; var data = Compile(source, 4); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2); var info1 = GetAnonymousTypeInfoSummary(data, 3, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 2).Span); Assert.Equal("<anonymous type: System.Int32 x, <empty anonymous type> y>..ctor(System.Int32 x, <empty anonymous type> y)", info0.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeFieldCreatedInLambda2_OperationTree() { string source = @" using System; class ClassA { void m() { var o = (Action) (() => ((Func<string>)(() => (/*<bind>*/new { x = 1, y = new { } }/*</bind>*/).ToString()) ).Invoke()); } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>) (Syntax: 'new { x = 1 ... = new { } }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'x = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, <empty anonymous type> y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'x') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>, IsImplicit) (Syntax: 'new { x = 1 ... = new { } }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <empty anonymous type>) (Syntax: 'y = new { }') Left: IPropertyReferenceOperation: <empty anonymous type> <anonymous type: System.Int32 x, <empty anonymous type> y>.y { get; } (OperationKind.PropertyReference, Type: <empty anonymous type>) (Syntax: 'y') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>, IsImplicit) (Syntax: 'new { x = 1 ... = new { } }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [ClrOnlyFact] public void AnonymousTypeSymbols_DontCrashIfNameIsQueriedBeforeEmit() { var source = @" public class ClassA { public static void Test1(int x) { object v1 = [# new { [# aa #] = 1, [# BB #] = 2 } #]; object v2 = [# new { } #]; } }"; var data = Compile(source, 4); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2); CheckAnonymousType(info0.Type, "", ""); info0 = GetAnonymousTypeInfoSummary(data, 3, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 2).Span); CheckAnonymousType(info0.Type, "", ""); // perform emit CompileAndVerify( data.Compilation, symbolValidator: module => CheckAnonymousTypes(module) ); } #region "AnonymousTypeSymbols_DontCrashIfNameIsQueriedBeforeEmit" private static void CheckAnonymousType(TypeSymbol type, string name, string metadataName) { Assert.NotNull(type); Assert.Equal(name, type.Name); Assert.Equal(metadataName, type.MetadataName); } private static void CheckAnonymousType(ITypeSymbol type, string name, string metadataName) { Assert.NotNull(type); Assert.Equal(name, type.Name); Assert.Equal(metadataName, type.MetadataName); } private void CheckAnonymousTypes(ModuleSymbol module) { var ns = module.GlobalNamespace; Assert.NotNull(ns); CheckAnonymousType(ns.GetMember<NamedTypeSymbol>("<>f__AnonymousType0"), "<>f__AnonymousType0", "<>f__AnonymousType0`2"); CheckAnonymousType(ns.GetMember<NamedTypeSymbol>("<>f__AnonymousType1"), "<>f__AnonymousType1", "<>f__AnonymousType1"); } #endregion [Fact()] public void AnonymousTypeSymbols_Error_Simple() { var source = @" public class ClassA { public static void Test1(int x) { object v1 = [# new { [# aa #] = xyz, [# BB #] = """", [# CCC #] = new SSS() } #]; object v2 = [# new { [# aa #] = new SSS(), [# BB #] = 123.456, [# CCC #] = [# new { (new ClassA()).[# aa #], ClassA.[# BB #], ClassA.[# CCC #] } #] } #]; } }"; var data = Compile(source, 12, // (8,25): error CS0103: The name 'xyz' does not exist in the current context // aa = xyz, Diagnostic(ErrorCode.ERR_NameNotInContext, "xyz").WithArguments("xyz"), // (10,29): error CS0246: The type or namespace name 'SSS' could not be found (are you missing a using directive or an assembly reference?) // CCC = new SSS() Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "SSS").WithArguments("SSS"), // (15,29): error CS0246: The type or namespace name 'SSS' could not be found (are you missing a using directive or an assembly reference?) // aa = new SSS(), Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "SSS").WithArguments("SSS"), // (19,35): error CS1061: 'ClassA' does not contain a definition for 'aa' and no extension method 'aa' accepting a first argument of type 'ClassA' could be found (are you missing a using directive or an assembly reference?) // (new ClassA()). aa , Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "aa").WithArguments("ClassA", "aa"), // (20,27): error CS0117: 'ClassA' does not contain a definition for 'BB' // ClassA. BB , Diagnostic(ErrorCode.ERR_NoSuchMember, "BB").WithArguments("ClassA", "BB"), // (21,27): error CS0117: 'ClassA' does not contain a definition for 'CCC' // ClassA. CCC Diagnostic(ErrorCode.ERR_NoSuchMember, "CCC").WithArguments("ClassA", "CCC") ); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2, 3); var info1 = GetAnonymousTypeInfoSummary(data, 4, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 3).Span, 5, 6, 7); var info2 = GetAnonymousTypeInfoSummary(data, 8, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 5).Span, 9, 10, 11); Assert.Equal("<anonymous type: ? aa, System.String BB, SSS CCC>", info0.Type.ToTestDisplayString()); Assert.Equal("<anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>", info1.Type.ToTestDisplayString()); Assert.Equal("<anonymous type: ? aa, ? BB, ? CCC>", info2.Type.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_Error_Simple_OperationTree() { string source = @" class ClassA { public static void Test1(int x) /*<bind>*/{ object v1 = new { aa = xyz, BB = """", CCC = new SSS() }; object v2 = new { aa = new SSS(), BB = 123.456, CCC = new { (new ClassA()).aa, ClassA.BB, ClassA.CCC } }; }/*</bind>*/ } "; string expectedOperationTree = @" IBlockOperation (2 statements, 2 locals) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '{ ... }') Locals: Local_1: System.Object v1 Local_2: System.Object v2 IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null, IsInvalid) (Syntax: 'object v1 = ... };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'object v1 = ... }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v1) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'v1 = new ... }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null, IsInvalid) (Syntax: '= new ... }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsInvalid, IsImplicit) (Syntax: 'new ... }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: ? aa, System.String BB, SSS CCC>, IsInvalid) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: 'aa = xyz') Left: IPropertyReferenceOperation: ? <anonymous type: ? aa, System.String BB, SSS CCC>.aa { get; } (OperationKind.PropertyReference, Type: ?) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, System.String BB, SSS CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'xyz') Children(0) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: """") (Syntax: 'BB = """"') Left: IPropertyReferenceOperation: System.String <anonymous type: ? aa, System.String BB, SSS CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, System.String BB, SSS CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: """") (Syntax: '""""') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: SSS, IsInvalid) (Syntax: 'CCC = new SSS()') Left: IPropertyReferenceOperation: SSS <anonymous type: ? aa, System.String BB, SSS CCC>.CCC { get; } (OperationKind.PropertyReference, Type: SSS) (Syntax: 'CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, System.String BB, SSS CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: SSS, IsInvalid) (Syntax: 'new SSS()') Children(0) Initializer: null IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null, IsInvalid) (Syntax: 'object v2 = ... };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'object v2 = ... }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v2) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'v2 = new ... }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null, IsInvalid) (Syntax: '= new ... }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsInvalid, IsImplicit) (Syntax: 'new ... }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>, IsInvalid) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: SSS, IsInvalid) (Syntax: 'aa = new SSS()') Left: IPropertyReferenceOperation: SSS <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>.aa { get; } (OperationKind.PropertyReference, Type: SSS) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: SSS, IsInvalid) (Syntax: 'new SSS()') Children(0) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Double, Constant: 123.456) (Syntax: 'BB = 123.456') Left: IPropertyReferenceOperation: System.Double <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.Double) (Syntax: 'BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 123.456) (Syntax: '123.456') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid) (Syntax: 'CCC = new ... }') Left: IPropertyReferenceOperation: <anonymous type: ? aa, ? BB, ? CCC> <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>.CCC { get; } (OperationKind.PropertyReference, Type: <anonymous type: ? aa, ? BB, ? CCC>) (Syntax: 'CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid, IsImplicit) (Syntax: '(new ClassA()).aa') Left: IPropertyReferenceOperation: ? <anonymous type: ? aa, ? BB, ? CCC>.aa { get; } (OperationKind.PropertyReference, Type: ?, IsInvalid, IsImplicit) (Syntax: '(new ClassA()).aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: '(new ClassA()).aa') Children(1): IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid, IsImplicit) (Syntax: 'ClassA.BB') Left: IPropertyReferenceOperation: ? <anonymous type: ? aa, ? BB, ? CCC>.BB { get; } (OperationKind.PropertyReference, Type: ?, IsInvalid, IsImplicit) (Syntax: 'ClassA.BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'ClassA.BB') Children(1): IOperation: (OperationKind.None, Type: null) (Syntax: 'ClassA') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid, IsImplicit) (Syntax: 'ClassA.CCC') Left: IPropertyReferenceOperation: ? <anonymous type: ? aa, ? BB, ? CCC>.CCC { get; } (OperationKind.PropertyReference, Type: ?, IsInvalid, IsImplicit) (Syntax: 'ClassA.CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'ClassA.CCC') Children(1): IOperation: (OperationKind.None, Type: null) (Syntax: 'ClassA') Initializer: null "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0103: The name 'xyz' does not exist in the current context // aa = xyz, Diagnostic(ErrorCode.ERR_NameNotInContext, "xyz").WithArguments("xyz").WithLocation(8, 18), // CS0246: The type or namespace name 'SSS' could not be found (are you missing a using directive or an assembly reference?) // CCC = new SSS() Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "SSS").WithArguments("SSS").WithLocation(10, 23), // CS0246: The type or namespace name 'SSS' could not be found (are you missing a using directive or an assembly reference?) // aa = new SSS(), Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "SSS").WithArguments("SSS").WithLocation(15, 22), // CS1061: 'ClassA' does not contain a definition for 'aa' and no extension method 'aa' accepting a first argument of type 'ClassA' could be found (are you missing a using directive or an assembly reference?) // (new ClassA()).aa, Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "aa").WithArguments("ClassA", "aa").WithLocation(19, 32), // CS0117: 'ClassA' does not contain a definition for 'BB' // ClassA.BB, Diagnostic(ErrorCode.ERR_NoSuchMember, "BB").WithArguments("ClassA", "BB").WithLocation(20, 24), // CS0117: 'ClassA' does not contain a definition for 'CCC' // ClassA.CCC Diagnostic(ErrorCode.ERR_NoSuchMember, "CCC").WithArguments("ClassA", "CCC").WithLocation(21, 24) }; VerifyOperationTreeAndDiagnosticsForTest<BlockSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_Error_InUsingStatement() { var source = @" public class ClassA { public static void Test1(int x) { using (var v1 = [# new { } #]) { } } }"; var data = Compile(source, 1, // (6,16): error CS1674: '<empty anonymous type>': type used in a using statement must be implicitly convertible to 'System.IDisposable'. // using (var v1 = new { } ) Diagnostic(ErrorCode.ERR_NoConvToIDisp, "var v1 = new { }").WithArguments("<empty anonymous type>") ); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span); Assert.Equal("<empty anonymous type>", info0.Type.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_Error_InUsingStatement_OperationTree() { string source = @" class ClassA { public static void Test1(int x) { using (/*<bind>*/var v1 = new { }/*</bind>*/) { } } } "; string expectedOperationTree = @" IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'var v1 = new { }') Declarators: IVariableDeclaratorOperation (Symbol: <empty anonymous type> v1) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'v1 = new { }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null, IsInvalid) (Syntax: '= new { }') IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>, IsInvalid) (Syntax: 'new { }') Initializers(0) Initializer: null"; var expectedDiagnostics = new DiagnosticDescription[] { // CS1674: '<empty anonymous type>': type used in a using statement must be implicitly convertible to 'System.IDisposable'. // using (/*<bind>*/var v1 = new { }/*</bind>*/) Diagnostic(ErrorCode.ERR_NoConvToIDisp, "var v1 = new { }").WithArguments("<empty anonymous type>").WithLocation(6, 26) }; VerifyOperationTreeAndDiagnosticsForTest<VariableDeclarationSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_Error_DuplicateName() { var source = @" public class ClassA { public static void Test1(int x) { object v1 = [# new { [# aa #] = 1, ClassA.[# aa #], [# bb #] = 1.2 } #]; } public static string aa = ""-field-aa-""; }"; var data = Compile(source, 4, // (9,13): error CS0833: An anonymous type cannot have multiple properties with the same name // ClassA. aa , Diagnostic(ErrorCode.ERR_AnonymousTypeDuplicatePropertyName, "ClassA. aa") ); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, /*2,*/ 3); Assert.Equal("<anonymous type: System.Int32 aa, System.String $1, System.Double bb>", info0.Type.ToTestDisplayString()); var properties = (from m in info0.Type.GetMembers() where m.Kind == SymbolKind.Property select m).ToArray(); Assert.Equal(3, properties.Length); Assert.Equal("System.Int32 <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.aa { get; }", properties[0].ToTestDisplayString()); Assert.Equal("System.String <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.$1 { get; }", properties[1].ToTestDisplayString()); Assert.Equal("System.Double <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.bb { get; }", properties[2].ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(20338, "https://github.com/dotnet/roslyn/issues/20338")] public void AnonymousTypeSymbols_Error_DuplicateName_OperationTree() { string source = @" class ClassA { public static void Test1(int x) { object v1 = /*<bind>*/new { aa = 1, ClassA.aa, bb = 1.2 }/*</bind>*/; } public static string aa = ""-field-aa-""; } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 aa, System.String $1, System.Double bb>, IsInvalid) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'aa = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.aa { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String $1, System.Double bb>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, IsInvalid, IsImplicit) (Syntax: 'ClassA.aa') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.$1 { get; } (OperationKind.PropertyReference, Type: System.String, IsInvalid, IsImplicit) (Syntax: 'ClassA.aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String $1, System.Double bb>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IFieldReferenceOperation: System.String ClassA.aa (Static) (OperationKind.FieldReference, Type: System.String, IsInvalid) (Syntax: 'ClassA.aa') Instance Receiver: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Double, Constant: 1.2) (Syntax: 'bb = 1.2') Left: IPropertyReferenceOperation: System.Double <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.bb { get; } (OperationKind.PropertyReference, Type: System.Double) (Syntax: 'bb') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String $1, System.Double bb>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 1.2) (Syntax: '1.2') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0833: An anonymous type cannot have multiple properties with the same name // ClassA.aa, Diagnostic(ErrorCode.ERR_AnonymousTypeDuplicatePropertyName, "ClassA.aa").WithLocation(9, 13) }; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_LookupSymbols() { var source = @" public class ClassA { public static void Test1(int x) { object v1 = [# new { [# aa #] = """", [# abc #] = 123.456 } #]; object v2 = [# new{ } #]; } }"; var data = Compile(source, 4); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2); Assert.Equal("<anonymous type: System.String aa, System.Double abc>", info0.Type.ToTestDisplayString()); var pos = data.Nodes[0].Span.End; var syms = data.Model.LookupSymbols(pos, container: info0.Type).Select(x => x.ToTestDisplayString()).OrderBy(x => x).ToArray(); Assert.Equal(8, syms.Length); int index = 0; Assert.Equal("System.Boolean System.Object.Equals(System.Object obj)", syms[index++]); Assert.Equal("System.Boolean System.Object.Equals(System.Object objA, System.Object objB)", syms[index++]); Assert.Equal("System.Boolean System.Object.ReferenceEquals(System.Object objA, System.Object objB)", syms[index++]); Assert.Equal("System.Double <anonymous type: System.String aa, System.Double abc>.abc { get; }", syms[index++]); Assert.Equal("System.Int32 System.Object.GetHashCode()", syms[index++]); Assert.Equal("System.String <anonymous type: System.String aa, System.Double abc>.aa { get; }", syms[index++]); Assert.Equal("System.String System.Object.ToString()", syms[index++]); Assert.Equal("System.Type System.Object.GetType()", syms[index++]); info0 = GetAnonymousTypeInfoSummary(data, 3, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 2).Span); Assert.Equal("<empty anonymous type>", info0.Type.ToTestDisplayString()); pos = data.Nodes[3].Span.End; syms = data.Model.LookupSymbols(pos, container: info0.Type).Select(x => x.ToTestDisplayString()).OrderBy(x => x).ToArray(); Assert.Equal(6, syms.Length); index = 0; Assert.Equal("System.Boolean System.Object.Equals(System.Object obj)", syms[index++]); Assert.Equal("System.Boolean System.Object.Equals(System.Object objA, System.Object objB)", syms[index++]); Assert.Equal("System.Boolean System.Object.ReferenceEquals(System.Object objA, System.Object objB)", syms[index++]); Assert.Equal("System.Int32 System.Object.GetHashCode()", syms[index++]); Assert.Equal("System.String System.Object.ToString()", syms[index++]); Assert.Equal("System.Type System.Object.GetType()", syms[index++]); } [WorkItem(543189, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543189")] [Fact()] public void CheckAnonymousTypeAsConstValue() { var source = @" public class A { const int i = /*<bind>*/(new {a = 2}).a/*</bind>*/; }"; var comp = CreateCompilation(source); var tuple = GetBindingNodeAndModel<ExpressionSyntax>(comp); var info = tuple.Item2.GetSymbolInfo(tuple.Item1); Assert.NotNull(info.Symbol); Assert.Equal("<anonymous type: int a>.a", info.Symbol.ToDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void CheckAnonymousTypeAsConstValue_OperationTree() { string source = @" class A { const int i = (/*<bind>*/new { a = 2 }/*</bind>*/).a; } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 a>, IsInvalid) (Syntax: 'new { a = 2 }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 2) (Syntax: 'a = 2') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 a>.a { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'a') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 a>, IsInvalid, IsImplicit) (Syntax: 'new { a = 2 }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0836: Cannot use anonymous type in a constant expression // const int i = (/*<bind>*/new { a = 2 }/*</bind>*/).a; Diagnostic(ErrorCode.ERR_AnonymousTypeNotAvailable, "new").WithLocation(4, 30) }; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [WorkItem(546416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416")] [ClrOnlyFact] public void TestAnonymousTypeInsideGroupBy_Queryable() { CompileAndVerify( @"using System.Linq; public class Product { public int ProductID; public string ProductName; public int SupplierID; } public class DB { public IQueryable<Product> Products; } public class Program { public static void Main() { var db = new DB(); var q0 = db.Products.GroupBy(p => new { Conditional = false ? new { p.ProductID, p.ProductName, p.SupplierID } : new { p.ProductID, p.ProductName, p.SupplierID } }).ToList(); } }").VerifyDiagnostics(); } [CompilerTrait(CompilerFeature.IOperation)] [WorkItem(546416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416")] [ClrOnlyFact] public void TestAnonymousTypeInsideGroupBy_Queryable_OperationTree() { string source = @" using System.Linq; class Product { public int ProductID; public string ProductName; public int SupplierID; } class DB { public IQueryable<Product> Products; } class Program { public static void Main() { var db = new DB(); var q0 = db.Products.GroupBy(p => /*<bind>*/new { Conditional = false ? new { p.ProductID, p.ProductName, p.SupplierID } : new { p.ProductID, p.ProductName, p.SupplierID } }/*</bind>*/).ToList(); } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID> Conditional>) (Syntax: 'new { Condi ... plierID } }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'Conditional ... upplierID }') Left: IPropertyReferenceOperation: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID> <anonymous type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID> Conditional>.Conditional { get; } (OperationKind.PropertyReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'Conditional') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID> Conditional>, IsImplicit) (Syntax: 'new { Condi ... plierID } }') Right: IConditionalOperation (OperationKind.Conditional, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'false ? new ... upplierID }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') WhenTrue: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'new { p.Pro ... upplierID }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'p.ProductID') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.ProductID { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'p.ProductID') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.Int32 Product.ProductID (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'p.ProductID') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, IsImplicit) (Syntax: 'p.ProductName') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.ProductName { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'p.ProductName') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.String Product.ProductName (OperationKind.FieldReference, Type: System.String) (Syntax: 'p.ProductName') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'p.SupplierID') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.SupplierID { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'p.SupplierID') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.Int32 Product.SupplierID (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'p.SupplierID') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') WhenFalse: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'new { p.Pro ... upplierID }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'p.ProductID') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.ProductID { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'p.ProductID') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.Int32 Product.ProductID (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'p.ProductID') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, IsImplicit) (Syntax: 'p.ProductName') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.ProductName { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'p.ProductName') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.String Product.ProductName (OperationKind.FieldReference, Type: System.String) (Syntax: 'p.ProductName') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'p.SupplierID') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.SupplierID { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'p.SupplierID') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.Int32 Product.SupplierID (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'p.SupplierID') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0649: Field 'Product.ProductName' is never assigned to, and will always have its default value null // public string ProductName; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "ProductName").WithArguments("Product.ProductName", "null").WithLocation(7, 19), // CS0649: Field 'Product.SupplierID' is never assigned to, and will always have its default value 0 // public int SupplierID; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "SupplierID").WithArguments("Product.SupplierID", "0").WithLocation(8, 16), // CS0649: Field 'Product.ProductID' is never assigned to, and will always have its default value 0 // public int ProductID; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "ProductID").WithArguments("Product.ProductID", "0").WithLocation(6, 16), // CS0649: Field 'DB.Products' is never assigned to, and will always have its default value null // public IQueryable<Product> Products; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "Products").WithArguments("DB.Products", "null").WithLocation(12, 32) }; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [WorkItem(546416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416")] [ClrOnlyFact] public void TestAnonymousTypeInsideGroupBy_Enumerable() { CompileAndVerify( @"using System.Linq; using System.Collections.Generic; public class Product { public int ProductID; public string ProductName; public int SupplierID; } public class DB { public IEnumerable<Product> Products; } public class Program { public static void Main() { var db = new DB(); var q0 = db.Products.GroupBy(p => new { Conditional = false ? new { p.ProductID, p.ProductName, p.SupplierID } : new { p.ProductID, p.ProductName, p.SupplierID } }).ToList(); } }").VerifyDiagnostics(); } [WorkItem(546416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416")] [ClrOnlyFact] public void TestAnonymousTypeInsideGroupBy_Enumerable2() { CompileAndVerify( @"using System.Linq; using System.Collections.Generic; public class Product { public int ProductID; public int SupplierID; } public class DB { public IEnumerable<Product> Products; } public class Program { public static void Main() { var db = new DB(); var q0 = db.Products.GroupBy(p => new { Conditional = false ? new { p.ProductID, p.SupplierID } : new { p.ProductID, p.SupplierID } }).ToList(); var q1 = db.Products.GroupBy(p => new { Conditional = false ? new { p.ProductID, p.SupplierID } : new { p.ProductID, p.SupplierID } }).ToList(); } }").VerifyDiagnostics(); } [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(22588, "https://github.com/dotnet/roslyn/issues/22588")] public void AnonymousTypeSymbols_ErrorCases() { string source = @" class ClassA { static void Test1(int x) { var obj = /*<bind>*/new { f1 = null, f2 = M, f3 = default }/*</bind>*/; } static void M() { } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: error f1, error f2, ? f3>, IsInvalid) (Syntax: 'new { f1 = ... = default }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: error, Constant: null, IsInvalid) (Syntax: 'f1 = null') Left: IPropertyReferenceOperation: error <anonymous type: error f1, error f2, ? f3>.f1 { get; } (OperationKind.PropertyReference, Type: error, IsInvalid) (Syntax: 'f1') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: error f1, error f2, ? f3>, IsInvalid, IsImplicit) (Syntax: 'new { f1 = ... = default }') Right: ILiteralOperation (OperationKind.Literal, Type: null, Constant: null, IsInvalid) (Syntax: 'null') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: error, IsInvalid) (Syntax: 'f2 = M') Left: IPropertyReferenceOperation: error <anonymous type: error f1, error f2, ? f3>.f2 { get; } (OperationKind.PropertyReference, Type: error, IsInvalid) (Syntax: 'f2') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: error f1, error f2, ? f3>, IsInvalid, IsImplicit) (Syntax: 'new { f1 = ... = default }') Right: IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'M') Children(1): IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: ClassA, IsInvalid, IsImplicit) (Syntax: 'M') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: 'f3 = default') Left: IPropertyReferenceOperation: ? <anonymous type: error f1, error f2, ? f3>.f3 { get; } (OperationKind.PropertyReference, Type: ?) (Syntax: 'f3') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: error f1, error f2, ? f3>, IsInvalid, IsImplicit) (Syntax: 'new { f1 = ... = default }') Right: IDefaultValueOperation (OperationKind.DefaultValue, Type: ?, IsInvalid) (Syntax: 'default') "; var expectedDiagnostics = new DiagnosticDescription[] { // file.cs(6,35): error CS0828: Cannot assign '<null>' to anonymous type property // var obj = /*<bind>*/new { f1 = null, f2 = M, f3 = default }/*</bind>*/; Diagnostic(ErrorCode.ERR_AnonymousTypePropertyAssignedBadValue, "f1 = null").WithArguments("<null>").WithLocation(6, 35), // file.cs(6,46): error CS0828: Cannot assign 'method group' to anonymous type property // var obj = /*<bind>*/new { f1 = null, f2 = M, f3 = default }/*</bind>*/; Diagnostic(ErrorCode.ERR_AnonymousTypePropertyAssignedBadValue, "f2 = M").WithArguments("method group").WithLocation(6, 46), // file.cs(6,59): error CS8716: There is no target type for the default literal. // var obj = /*<bind>*/new { f1 = null, f2 = M, f3 = default }/*</bind>*/; Diagnostic(ErrorCode.ERR_DefaultLiteralNoTargetType, "default").WithLocation(6, 59) }; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(27338, "https://github.com/dotnet/roslyn/issues/27338")] public void AnonymousTypeCreation_MixedInitializers() { string source = @" using System.Collections.Generic; using System.Linq; class ClassA { void M(int a) { var o = /*<bind>*/new { a, b = 1 }/*</bind>*/; } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 a, System.Int32 b>) (Syntax: 'new { a, b = 1 }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'a') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 a, System.Int32 b>.a { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 a, System.Int32 b>, IsImplicit) (Syntax: 'new { a, b = 1 }') Right: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'b = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 a, System.Int32 b>.b { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 a, System.Int32 b>, IsImplicit) (Syntax: 'new { a, b = 1 }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } #region "Utility methods" private void AssertCannotConstruct(ISymbol type) { var namedType = type as INamedTypeSymbol; Assert.NotNull(namedType); var objType = namedType.BaseType; Assert.NotNull(objType); Assert.Equal("System.Object", objType.ToTestDisplayString()); ITypeSymbol[] args = new ITypeSymbol[namedType.Arity]; for (int i = 0; i < namedType.Arity; i++) { args[i] = objType; } Assert.Throws<InvalidOperationException>(() => namedType.Construct(args)); } private CompilationUtils.SemanticInfoSummary GetAnonymousTypeInfoSummary(TestData data, int node, TextSpan typeSpan, params int[] fields) { var info = data.Model.GetSemanticInfoSummary(data.Nodes[node]); var type = info.Type; Assert.True(type.IsAnonymousType); Assert.False(type.CanBeReferencedByName); Assert.Equal("System.Object", type.BaseType.ToTestDisplayString()); Assert.Equal(0, type.Interfaces.Length); Assert.Equal(1, type.Locations.Length); Assert.Equal(typeSpan, type.Locations[0].SourceSpan); foreach (int field in fields) { CheckFieldNameAndLocation(data, type, data.Nodes[field]); } return info; } private void CheckFieldNameAndLocation(TestData data, ITypeSymbol type, SyntaxNode identifier) { var anonymousType = (INamedTypeSymbol)type; var current = identifier; while (current.Span == identifier.Span && !current.IsKind(SyntaxKind.IdentifierName)) { current = current.ChildNodes().Single(); } var node = (IdentifierNameSyntax)current; Assert.NotNull(node); var span = node.Span; var fieldName = node.ToString(); var property = anonymousType.GetMember<IPropertySymbol>(fieldName); Assert.NotNull(property); Assert.Equal(fieldName, property.Name); Assert.Equal(1, property.Locations.Length); Assert.Equal(span, property.Locations[0].SourceSpan); IMethodSymbol getter = property.GetMethod; Assert.NotNull(getter); Assert.Equal("get_" + fieldName, getter.Name); } private struct TestData { public CSharpCompilation Compilation; public SyntaxTree Tree; public List<SyntaxNode> Nodes; public SemanticModel Model; } private TestData Compile(string source, int expectedIntervals, params DiagnosticDescription[] diagnostics) { var intervals = ExtractTextIntervals(ref source); Assert.Equal(expectedIntervals, intervals.Count); var compilation = Compile(source); compilation.VerifyDiagnostics(diagnostics); var tree = compilation.SyntaxTrees[0]; var nodes = new List<SyntaxNode>(); foreach (var span in intervals) { var stack = new Stack<SyntaxNode>(); stack.Push(tree.GetCompilationUnitRoot()); while (stack.Count > 0) { var node = stack.Pop(); if (span.Contains(node.Span)) { nodes.Add(node); break; } foreach (var child in node.ChildNodes()) { stack.Push(child); } } } Assert.Equal(expectedIntervals, nodes.Count); return new TestData() { Compilation = compilation, Tree = tree, Model = compilation.GetSemanticModel(tree), Nodes = nodes }; } private CSharpCompilation Compile(string source) => CreateCompilationWithMscorlib40( source, options: TestOptions.ReleaseDll, parseOptions: TestOptions.Regular); private static List<TextSpan> ExtractTextIntervals(ref string source) { const string startTag = "[#"; const string endTag = "#]"; List<TextSpan> intervals = new List<TextSpan>(); var all = (from s in FindAll(source, startTag) select new { start = true, offset = s }).Union( from s in FindAll(source, endTag) select new { start = false, offset = s } ).OrderBy(value => value.offset).ToList(); while (all.Count > 0) { int i = 1; bool added = false; while (i < all.Count) { if (all[i - 1].start && !all[i].start) { intervals.Add(TextSpan.FromBounds(all[i - 1].offset, all[i].offset)); all.RemoveAt(i); all.RemoveAt(i - 1); added = true; } else { i++; } } Assert.True(added); } source = source.Replace(startTag, " ").Replace(endTag, " "); intervals.Sort((x, y) => x.Start.CompareTo(y.Start)); return intervals; } private static IEnumerable<int> FindAll(string source, string what) { int index = source.IndexOf(what, StringComparison.Ordinal); while (index >= 0) { yield return index; index = source.IndexOf(what, index + 1, StringComparison.Ordinal); } } private int NumberOfNewKeywords(string source) { int cnt = 0; foreach (var line in source.Split(new String[] { Environment.NewLine }, StringSplitOptions.None)) { if (!string.IsNullOrWhiteSpace(line)) { if (!line.Trim().StartsWith("//", StringComparison.Ordinal)) { for (int index = line.IndexOf("new ", StringComparison.Ordinal); index >= 0;) { cnt++; index = line.IndexOf("new ", index + 1, StringComparison.Ordinal); } } } } return cnt; } #endregion } }
// 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. #nullable disable using System; using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols { public class AnonymousTypesSemanticsTests : CompilingTestBase { [Fact()] public void AnonymousTypeSymbols_Simple() { var source = @" public class ClassA { public struct SSS { } public static void Test1(int x) { object v1 = [# new { [# aa #] = 1, [# BB #] = """", [# CCC #] = new SSS() } #]; object v2 = [# new { [# aa #] = new SSS(), [# BB #] = 123.456, [# CCC #] = [# new { (new ClassA()).[# aa #], ClassA.[# BB #], ClassA.[# CCC #] } #] } #]; object v3 = [# new {} #]; var v4 = [# new {} #]; } public int aa { get { return 123; } } public const string BB = ""-=-=-""; public static SSS CCC = new SSS(); }"; var data = Compile(source, 14); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2, 3); var info1 = GetAnonymousTypeInfoSummary(data, 4, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 3).Span, 5, 6, 7); var info2 = GetAnonymousTypeInfoSummary(data, 8, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 5).Span, 9, 10, 11); Assert.Equal("AnonymousTypePublicSymbol", info0.Type.GetSymbol().GetType().Name); Assert.False(((INamedTypeSymbol)info0.Type).IsSerializable); Assert.Equal(info0.Type, info2.Type); Assert.NotEqual(info0.Type, info1.Type); var info3 = GetAnonymousTypeInfoSummary(data, 12, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 7).Span); var info4 = GetAnonymousTypeInfoSummary(data, 13, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 8).Span); Assert.Equal(info3.Type, info4.Type); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_Simple_OperationTree() { string source = @" class ClassA { public struct SSS { } public static void Test1(int x) /*<bind>*/{ object v1 = new { aa = 1, BB = """", CCC = new SSS() }; object v2 = new { aa = new SSS(), BB = 123.456, CCC = new { (new ClassA()).aa, ClassA.BB, ClassA.CCC } }; object v3 = new { }; var v4 = new { }; }/*</bind>*/ public int aa { get { return 123; } } public const string BB = ""-=-= -""; public static SSS CCC = new SSS(); } "; string expectedOperationTree = @" IBlockOperation (4 statements, 4 locals) (OperationKind.Block, Type: null) (Syntax: '{ ... }') Locals: Local_1: System.Object v1 Local_2: System.Object v2 Local_3: System.Object v3 Local_4: <empty anonymous type> v4 IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null) (Syntax: 'object v1 = ... };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'object v1 = ... }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v1) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'v1 = new ... }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= new ... }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new ... }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'aa = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.aa { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: """") (Syntax: 'BB = """"') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: """") (Syntax: '""""') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ClassA.SSS) (Syntax: 'CCC = new SSS()') Left: IPropertyReferenceOperation: ClassA.SSS <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.CCC { get; } (OperationKind.PropertyReference, Type: ClassA.SSS) (Syntax: 'CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: IObjectCreationOperation (Constructor: ClassA.SSS..ctor()) (OperationKind.ObjectCreation, Type: ClassA.SSS) (Syntax: 'new SSS()') Arguments(0) Initializer: null Initializer: null IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null) (Syntax: 'object v2 = ... };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'object v2 = ... }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v2) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'v2 = new ... }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= new ... }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new ... }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ClassA.SSS) (Syntax: 'aa = new SSS()') Left: IPropertyReferenceOperation: ClassA.SSS <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>.aa { get; } (OperationKind.PropertyReference, Type: ClassA.SSS) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>, IsImplicit) (Syntax: 'new ... }') Right: IObjectCreationOperation (Constructor: ClassA.SSS..ctor()) (OperationKind.ObjectCreation, Type: ClassA.SSS) (Syntax: 'new SSS()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Double, Constant: 123.456) (Syntax: 'BB = 123.456') Left: IPropertyReferenceOperation: System.Double <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.Double) (Syntax: 'BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 123.456) (Syntax: '123.456') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>) (Syntax: 'CCC = new ... }') Left: IPropertyReferenceOperation: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>.CCC { get; } (OperationKind.PropertyReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>) (Syntax: 'CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ClassA.SSS aa, System.Double BB, <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC> CCC>, IsImplicit) (Syntax: 'new ... }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '(new ClassA()).aa') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.aa { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '(new ClassA()).aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: IPropertyReferenceOperation: System.Int32 ClassA.aa { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: '(new ClassA()).aa') Instance Receiver: IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: ""-=-= -"", IsImplicit) (Syntax: 'ClassA.BB') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'ClassA.BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: IFieldReferenceOperation: System.String ClassA.BB (Static) (OperationKind.FieldReference, Type: System.String, Constant: ""-=-= -"") (Syntax: 'ClassA.BB') Instance Receiver: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ClassA.SSS, IsImplicit) (Syntax: 'ClassA.CCC') Left: IPropertyReferenceOperation: ClassA.SSS <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>.CCC { get; } (OperationKind.PropertyReference, Type: ClassA.SSS, IsImplicit) (Syntax: 'ClassA.CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String BB, ClassA.SSS CCC>, IsImplicit) (Syntax: 'new ... }') Right: IFieldReferenceOperation: ClassA.SSS ClassA.CCC (Static) (OperationKind.FieldReference, Type: ClassA.SSS) (Syntax: 'ClassA.CCC') Instance Receiver: null Initializer: null IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null) (Syntax: 'object v3 = new { };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'object v3 = new { }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v3) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'v3 = new { }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= new { }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new { }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) Initializer: null IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null) (Syntax: 'var v4 = new { };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null) (Syntax: 'var v4 = new { }') Declarators: IVariableDeclaratorOperation (Symbol: <empty anonymous type> v4) (OperationKind.VariableDeclarator, Type: null) (Syntax: 'v4 = new { }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null) (Syntax: '= new { }') IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) Initializer: null "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<BlockSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_ContextualKeywordsInFields() { var source = @" class ClassA { static void Test1(int x) { object v1 = [# new { [# var #] = ""var"", [# get #] = new {}, [# partial #] = [# new { (new ClassA()).[# select #], [# global #] } #] } #]; } public int select { get { return 123; } } public const string global = ""-=-=-""; }"; var data = Compile(source, 7); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2, 3); var info1 = GetAnonymousTypeInfoSummary(data, 4, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 3).Span, 5, 6); Assert.Equal( "<anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>", info0.Type.ToTestDisplayString()); Assert.Equal( "<anonymous type: System.Int32 select, System.String global>..ctor(System.Int32 select, System.String global)", info1.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_ContextualKeywordsInFields_OperationTree() { string source = @" class ClassA { static void Test1(int x) { object v1 = /*<bind>*/new { var = ""var"", get = new { }, partial = new { (new ClassA()).select, global } }/*</bind>*/; } public int select { get { return 123; } } public const string global = "" -=-= -""; } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: ""var"") (Syntax: 'var = ""var""') Left: IPropertyReferenceOperation: System.String <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>.var { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'var') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: ""var"") (Syntax: '""var""') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <empty anonymous type>) (Syntax: 'get = new { }') Left: IPropertyReferenceOperation: <empty anonymous type> <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>.get { get; } (OperationKind.PropertyReference, Type: <empty anonymous type>) (Syntax: 'get') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>, IsImplicit) (Syntax: 'new ... }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <anonymous type: System.Int32 select, System.String global>) (Syntax: 'partial = n ... }') Left: IPropertyReferenceOperation: <anonymous type: System.Int32 select, System.String global> <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>.partial { get; } (OperationKind.PropertyReference, Type: <anonymous type: System.Int32 select, System.String global>) (Syntax: 'partial') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.String var, <empty anonymous type> get, <anonymous type: System.Int32 select, System.String global> partial>, IsImplicit) (Syntax: 'new ... }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 select, System.String global>) (Syntax: 'new ... }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: '(new ClassA()).select') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 select, System.String global>.select { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: '(new ClassA()).select') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 select, System.String global>, IsImplicit) (Syntax: 'new ... }') Right: IPropertyReferenceOperation: System.Int32 ClassA.select { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: '(new ClassA()).select') Instance Receiver: IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: "" -=-= -"", IsImplicit) (Syntax: 'global') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 select, System.String global>.global { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'global') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 select, System.String global>, IsImplicit) (Syntax: 'new ... }') Right: IFieldReferenceOperation: System.String ClassA.global (Static) (OperationKind.FieldReference, Type: System.String, Constant: "" -=-= -"") (Syntax: 'global') Instance Receiver: null "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_DelegateMembers() { var source = @" delegate bool D1(); class ClassA { void Main() { var at1 = [# new { [# module #] = (D1)(() => false)} #].module(); } }"; var data = Compile(source, 2); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1); Assert.Equal("<anonymous type: D1 module>", info0.Type.ToTestDisplayString()); Assert.Equal("<anonymous type: D1 module>..ctor(D1 module)", info0.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_DelegateMembers_OperationTree() { string source = @" delegate bool D1(); class ClassA { void Main() { var at1 = /*<bind>*/new { module = (D1)(() => false) }/*</bind>*/.module(); } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: D1 module>) (Syntax: 'new { modul ... => false) }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: D1) (Syntax: 'module = (D ... ) => false)') Left: IPropertyReferenceOperation: D1 <anonymous type: D1 module>.module { get; } (OperationKind.PropertyReference, Type: D1) (Syntax: 'module') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: D1 module>, IsImplicit) (Syntax: 'new { modul ... => false) }') Right: IDelegateCreationOperation (OperationKind.DelegateCreation, Type: D1) (Syntax: '(D1)(() => false)') Target: IAnonymousFunctionOperation (Symbol: lambda expression) (OperationKind.AnonymousFunction, Type: null) (Syntax: '() => false') IBlockOperation (1 statements) (OperationKind.Block, Type: null, IsImplicit) (Syntax: 'false') IReturnOperation (OperationKind.Return, Type: null, IsImplicit) (Syntax: 'false') ReturnedValue: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_BaseAccessInMembers() { var source = @" delegate bool D1(); class ClassB { protected System.Func<int, int> F = x => x; } class ClassA: ClassB { void Main() { var at1 = [# [# new { base.[# F #] } #].F(1) #]; } }"; var data = Compile(source, 3); var info0 = GetAnonymousTypeInfoSummary(data, 1, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 2); Assert.Equal("<anonymous type: System.Func<System.Int32, System.Int32> F>", info0.Type.ToTestDisplayString()); var info1 = data.Model.GetSemanticInfoSummary(data.Nodes[0]); Assert.Equal("System.Int32 System.Func<System.Int32, System.Int32>.Invoke(System.Int32 arg)", info1.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_BaseAccessInMembers_OperationTree() { string source = @" delegate bool D1(); class ClassB { protected System.Func<int, int> F = x => x; } class ClassA : ClassB { void Main() { var at1 = /*<bind>*/new { base.F }/*</bind>*/.F(1); } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Func<System.Int32, System.Int32> F>) (Syntax: 'new { base.F }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Func<System.Int32, System.Int32>, IsImplicit) (Syntax: 'base.F') Left: IPropertyReferenceOperation: System.Func<System.Int32, System.Int32> <anonymous type: System.Func<System.Int32, System.Int32> F>.F { get; } (OperationKind.PropertyReference, Type: System.Func<System.Int32, System.Int32>, IsImplicit) (Syntax: 'base.F') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Func<System.Int32, System.Int32> F>, IsImplicit) (Syntax: 'new { base.F }') Right: IFieldReferenceOperation: System.Func<System.Int32, System.Int32> ClassB.F (OperationKind.FieldReference, Type: System.Func<System.Int32, System.Int32>) (Syntax: 'base.F') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: ClassB) (Syntax: 'base') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_InFieldInitializer() { var source = @" class ClassA { private static object F = [# new { [# F123 #] = typeof(ClassA) } #]; }"; var data = Compile(source, 2); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1); Assert.Equal("<anonymous type: System.Type F123>", info0.Type.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_InFieldInitializer_OperationTree() { string source = @" class ClassA { private static object F = /*<bind>*/new { F123 = typeof(ClassA) }/*</bind>*/; } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Type F123>) (Syntax: 'new { F123 ... f(ClassA) }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Type) (Syntax: 'F123 = typeof(ClassA)') Left: IPropertyReferenceOperation: System.Type <anonymous type: System.Type F123>.F123 { get; } (OperationKind.PropertyReference, Type: System.Type) (Syntax: 'F123') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Type F123>, IsImplicit) (Syntax: 'new { F123 ... f(ClassA) }') Right: ITypeOfOperation (OperationKind.TypeOf, Type: System.Type) (Syntax: 'typeof(ClassA)') TypeOperand: ClassA "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_Equals() { var source = @" class ClassA { static void Test1(int x) { bool result = [# new { f1 = 1, f2 = """" }.Equals(new { }) #]; } }"; var data = Compile(source, 1); var info = data.Model.GetSemanticInfoSummary(data.Nodes[0]); var method = info.Symbol; Assert.NotNull(method); Assert.Equal(SymbolKind.Method, method.Kind); Assert.Equal("object.Equals(object)", method.ToDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_Equals_OperationTree() { string source = @" class ClassA { static void Test1(int x) { bool result = /*<bind>*/new { f1 = 1, f2 = """" }.Equals(new { })/*</bind>*/; } } "; string expectedOperationTree = @" IInvocationOperation (virtual System.Boolean System.Object.Equals(System.Object obj)) (OperationKind.Invocation, Type: System.Boolean) (Syntax: 'new { f1 = ... ls(new { })') Instance Receiver: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 f1, System.String f2>) (Syntax: 'new { f1 = 1, f2 = """" }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'f1 = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 f1, System.String f2>.f1 { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'f1') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 f1, System.String f2>, IsImplicit) (Syntax: 'new { f1 = 1, f2 = """" }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: """") (Syntax: 'f2 = """"') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 f1, System.String f2>.f2 { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'f2') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 f1, System.String f2>, IsImplicit) (Syntax: 'new { f1 = 1, f2 = """" }') Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: """") (Syntax: '""""') Arguments(1): IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: obj) (OperationKind.Argument, Type: null) (Syntax: 'new { }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new { }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<InvocationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_ToString() { var source = @" class ClassA { static void Test1(int x) { string result = [# new { f1 = 1, f2 = """" }.ToString() #]; } }"; var data = Compile(source, 1); var info = data.Model.GetSemanticInfoSummary(data.Nodes[0]); var method = info.Symbol; Assert.NotNull(method); Assert.Equal(SymbolKind.Method, method.Kind); Assert.Equal("object.ToString()", method.ToDisplayString()); } [Fact()] public void AnonymousTypeSymbols_GetHashCode() { var source = @" class ClassA { static void Test1(int x) { int result = [# new { f1 = 1, f2 = """" }.GetHashCode() #]; } }"; var data = Compile(source, 1); var info = data.Model.GetSemanticInfoSummary(data.Nodes[0]); var method = info.Symbol; Assert.NotNull(method); Assert.Equal(SymbolKind.Method, method.Kind); Assert.Equal("object.GetHashCode()", method.ToDisplayString()); } [Fact()] public void AnonymousTypeSymbols_Ctor() { var source = @" class ClassA { static void Test1(int x) { var result = [# new { f1 = 1, f2 = """" } #]; } }"; var data = Compile(source, 1); var info = data.Model.GetSemanticInfoSummary(data.Nodes[0]); var method = info.Symbol; Assert.NotNull(method); Assert.Equal(SymbolKind.Method, method.Kind); Assert.Equal("<anonymous type: int f1, string f2>..ctor(int, string)", method.ToDisplayString()); Assert.Equal("<anonymous type: System.Int32 f1, System.String f2>..ctor(System.Int32 f1, System.String f2)", method.ToTestDisplayString()); } [Fact()] public void AnonymousTypeTemplateCannotConstruct() { var source = @" class ClassA { object F = [# new { [# F123 #] = typeof(ClassA) } #]; }"; var data = Compile(source, 2); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1); var type = info0.Type; Assert.Equal("<anonymous type: System.Type F123>", type.ToTestDisplayString()); Assert.True(type.IsDefinition); AssertCannotConstruct(type); } [Fact()] public void AnonymousTypeTemplateCannotConstruct_Empty() { var source = @" class ClassA { object F = [# new { } #]; }"; var data = Compile(source, 1); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span); var type = info0.Type; Assert.Equal("<empty anonymous type>", type.ToTestDisplayString()); Assert.True(type.IsDefinition); AssertCannotConstruct(type); } [Fact()] public void AnonymousTypeFieldDeclarationIdentifier() { var source = @" class ClassA { object F = new { [# F123 #] = typeof(ClassA) }; }"; var data = Compile(source, 1); var info = data.Model.GetSymbolInfo((ExpressionSyntax)data.Nodes[0]); Assert.NotNull(info.Symbol); Assert.Equal(SymbolKind.Property, info.Symbol.Kind); Assert.Equal("System.Type <anonymous type: System.Type F123>.F123 { get; }", info.Symbol.ToTestDisplayString()); } [Fact()] public void AnonymousTypeFieldCreatedInQuery() { var source = LINQ + @" class ClassA { void m() { var o = from x in new List1<int>(1, 2, 3) select [# new { [# x #], [# y #] = x } #]; } }"; var data = Compile(source, 3); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, NumberOfNewKeywords(LINQ) + 2).Span, 1, 2); var info1 = data.Model.GetSymbolInfo(((AnonymousObjectMemberDeclaratorSyntax)data.Nodes[1]).Expression); Assert.NotNull(info1.Symbol); Assert.Equal(SymbolKind.RangeVariable, info1.Symbol.Kind); Assert.Equal("x", info1.Symbol.ToDisplayString()); var info2 = data.Model.GetSymbolInfo((ExpressionSyntax)data.Nodes[2]); Assert.NotNull(info2.Symbol); Assert.Equal(SymbolKind.Property, info2.Symbol.Kind); Assert.Equal("System.Int32 <anonymous type: System.Int32 x, System.Int32 y>.y { get; }", info2.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeFieldCreatedInQuery_OperationTree() { string source = @" using System.Collections.Generic; using System.Linq; class ClassA { void m() { var o = from x in new List<int>() { 1, 2, 3 } select /*<bind>*/new { x, y = x }/*</bind>*/; } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 x, System.Int32 y>) (Syntax: 'new { x, y = x }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'x') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, System.Int32 y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'x') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, System.Int32 y>, IsImplicit) (Syntax: 'new { x, y = x }') Right: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32) (Syntax: 'y = x') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, System.Int32 y>.y { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'y') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, System.Int32 y>, IsImplicit) (Syntax: 'new { x, y = x }') Right: IParameterReferenceOperation: x (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'x') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeFieldCreatedInQuery2() { var source = LINQ + @" class ClassA { void m() { var o = from x in new List1<int>(1, 2, 3) let y = """" select [# new { [# x #], [# y #] } #]; } }"; var data = Compile(source, 3); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, NumberOfNewKeywords(LINQ) + 2).Span, 1, 2); Assert.Equal("<anonymous type: System.Int32 x, System.String y>", info0.Type.ToTestDisplayString()); var info1 = data.Model.GetSymbolInfo(((AnonymousObjectMemberDeclaratorSyntax)data.Nodes[1]).Expression); Assert.NotNull(info1.Symbol); Assert.Equal(SymbolKind.RangeVariable, info1.Symbol.Kind); Assert.Equal("x", info1.Symbol.ToDisplayString()); var info2 = data.Model.GetSymbolInfo(((AnonymousObjectMemberDeclaratorSyntax)data.Nodes[2]).Expression); Assert.NotNull(info2.Symbol); Assert.Equal(SymbolKind.RangeVariable, info2.Symbol.Kind); Assert.Equal("y", info2.Symbol.ToDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeFieldCreatedInQuery2_OperationTree() { string source = @" using System.Collections.Generic; using System.Linq; class ClassA { void m() { var o = from x in new List<int>() { 1, 2, 3 } let y = """" select /*<bind>*/new { x, y }/*</bind>*/; } } "; // OperationKind.None is for Range variables, IOperation support for it is NYI. string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 x, System.String y>) (Syntax: 'new { x, y }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'x') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, System.String y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'x') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, System.String y>, IsImplicit) (Syntax: 'new { x, y }') Right: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, System.String y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'x') Instance Receiver: IParameterReferenceOperation: <>h__TransparentIdentifier0 (OperationKind.ParameterReference, Type: <anonymous type: System.Int32 x, System.String y>, IsImplicit) (Syntax: 'x') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, IsImplicit) (Syntax: 'y') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 x, System.String y>.y { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'y') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, System.String y>, IsImplicit) (Syntax: 'new { x, y }') Right: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 x, System.String y>.y { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'y') Instance Receiver: IParameterReferenceOperation: <>h__TransparentIdentifier0 (OperationKind.ParameterReference, Type: <anonymous type: System.Int32 x, System.String y>, IsImplicit) (Syntax: 'y') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeFieldCreatedInLambda() { var source = @" using System; class ClassA { void m() { var o = (Action)(() => ( [# new { [# x #] = 1, [# y #] = [# new { } #] } #]).ToString());; } }"; var data = Compile(source, 4); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2); var info1 = GetAnonymousTypeInfoSummary(data, 3, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 2).Span); Assert.Equal("<anonymous type: System.Int32 x, <empty anonymous type> y>..ctor(System.Int32 x, <empty anonymous type> y)", info0.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeFieldCreatedInLambda_OperationTree() { string source = @" using System; class ClassA { void m() { var o = (Action)(() => (/*<bind>*/new { x = 1, y = new { } }/*</bind>*/).ToString()); ; } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>) (Syntax: 'new { x = 1 ... = new { } }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'x = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, <empty anonymous type> y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'x') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>, IsImplicit) (Syntax: 'new { x = 1 ... = new { } }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <empty anonymous type>) (Syntax: 'y = new { }') Left: IPropertyReferenceOperation: <empty anonymous type> <anonymous type: System.Int32 x, <empty anonymous type> y>.y { get; } (OperationKind.PropertyReference, Type: <empty anonymous type>) (Syntax: 'y') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>, IsImplicit) (Syntax: 'new { x = 1 ... = new { } }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeFieldCreatedInLambda2() { var source = @" using System; class ClassA { void m() { var o = (Action) (() => ((Func<string>) (() => ( [# new { [# x #] = 1, [# y #] = [# new { } #] } #]).ToString()) ).Invoke()); } }"; var data = Compile(source, 4); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2); var info1 = GetAnonymousTypeInfoSummary(data, 3, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 2).Span); Assert.Equal("<anonymous type: System.Int32 x, <empty anonymous type> y>..ctor(System.Int32 x, <empty anonymous type> y)", info0.Symbol.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeFieldCreatedInLambda2_OperationTree() { string source = @" using System; class ClassA { void m() { var o = (Action) (() => ((Func<string>)(() => (/*<bind>*/new { x = 1, y = new { } }/*</bind>*/).ToString()) ).Invoke()); } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>) (Syntax: 'new { x = 1 ... = new { } }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'x = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 x, <empty anonymous type> y>.x { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'x') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>, IsImplicit) (Syntax: 'new { x = 1 ... = new { } }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <empty anonymous type>) (Syntax: 'y = new { }') Left: IPropertyReferenceOperation: <empty anonymous type> <anonymous type: System.Int32 x, <empty anonymous type> y>.y { get; } (OperationKind.PropertyReference, Type: <empty anonymous type>) (Syntax: 'y') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 x, <empty anonymous type> y>, IsImplicit) (Syntax: 'new { x = 1 ... = new { } }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>) (Syntax: 'new { }') Initializers(0) "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [ClrOnlyFact] public void AnonymousTypeSymbols_DontCrashIfNameIsQueriedBeforeEmit() { var source = @" public class ClassA { public static void Test1(int x) { object v1 = [# new { [# aa #] = 1, [# BB #] = 2 } #]; object v2 = [# new { } #]; } }"; var data = Compile(source, 4); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2); CheckAnonymousType(info0.Type, "", ""); info0 = GetAnonymousTypeInfoSummary(data, 3, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 2).Span); CheckAnonymousType(info0.Type, "", ""); // perform emit CompileAndVerify( data.Compilation, symbolValidator: module => CheckAnonymousTypes(module) ); } #region "AnonymousTypeSymbols_DontCrashIfNameIsQueriedBeforeEmit" private static void CheckAnonymousType(TypeSymbol type, string name, string metadataName) { Assert.NotNull(type); Assert.Equal(name, type.Name); Assert.Equal(metadataName, type.MetadataName); } private static void CheckAnonymousType(ITypeSymbol type, string name, string metadataName) { Assert.NotNull(type); Assert.Equal(name, type.Name); Assert.Equal(metadataName, type.MetadataName); } private void CheckAnonymousTypes(ModuleSymbol module) { var ns = module.GlobalNamespace; Assert.NotNull(ns); CheckAnonymousType(ns.GetMember<NamedTypeSymbol>("<>f__AnonymousType0"), "<>f__AnonymousType0", "<>f__AnonymousType0`2"); CheckAnonymousType(ns.GetMember<NamedTypeSymbol>("<>f__AnonymousType1"), "<>f__AnonymousType1", "<>f__AnonymousType1"); } #endregion [Fact()] public void AnonymousTypeSymbols_Error_Simple() { var source = @" public class ClassA { public static void Test1(int x) { object v1 = [# new { [# aa #] = xyz, [# BB #] = """", [# CCC #] = new SSS() } #]; object v2 = [# new { [# aa #] = new SSS(), [# BB #] = 123.456, [# CCC #] = [# new { (new ClassA()).[# aa #], ClassA.[# BB #], ClassA.[# CCC #] } #] } #]; } }"; var data = Compile(source, 12, // (8,25): error CS0103: The name 'xyz' does not exist in the current context // aa = xyz, Diagnostic(ErrorCode.ERR_NameNotInContext, "xyz").WithArguments("xyz"), // (10,29): error CS0246: The type or namespace name 'SSS' could not be found (are you missing a using directive or an assembly reference?) // CCC = new SSS() Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "SSS").WithArguments("SSS"), // (15,29): error CS0246: The type or namespace name 'SSS' could not be found (are you missing a using directive or an assembly reference?) // aa = new SSS(), Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "SSS").WithArguments("SSS"), // (19,35): error CS1061: 'ClassA' does not contain a definition for 'aa' and no extension method 'aa' accepting a first argument of type 'ClassA' could be found (are you missing a using directive or an assembly reference?) // (new ClassA()). aa , Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "aa").WithArguments("ClassA", "aa"), // (20,27): error CS0117: 'ClassA' does not contain a definition for 'BB' // ClassA. BB , Diagnostic(ErrorCode.ERR_NoSuchMember, "BB").WithArguments("ClassA", "BB"), // (21,27): error CS0117: 'ClassA' does not contain a definition for 'CCC' // ClassA. CCC Diagnostic(ErrorCode.ERR_NoSuchMember, "CCC").WithArguments("ClassA", "CCC") ); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2, 3); var info1 = GetAnonymousTypeInfoSummary(data, 4, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 3).Span, 5, 6, 7); var info2 = GetAnonymousTypeInfoSummary(data, 8, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 5).Span, 9, 10, 11); Assert.Equal("<anonymous type: ? aa, System.String BB, SSS CCC>", info0.Type.ToTestDisplayString()); Assert.Equal("<anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>", info1.Type.ToTestDisplayString()); Assert.Equal("<anonymous type: ? aa, ? BB, ? CCC>", info2.Type.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_Error_Simple_OperationTree() { string source = @" class ClassA { public static void Test1(int x) /*<bind>*/{ object v1 = new { aa = xyz, BB = """", CCC = new SSS() }; object v2 = new { aa = new SSS(), BB = 123.456, CCC = new { (new ClassA()).aa, ClassA.BB, ClassA.CCC } }; }/*</bind>*/ } "; string expectedOperationTree = @" IBlockOperation (2 statements, 2 locals) (OperationKind.Block, Type: null, IsInvalid) (Syntax: '{ ... }') Locals: Local_1: System.Object v1 Local_2: System.Object v2 IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null, IsInvalid) (Syntax: 'object v1 = ... };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'object v1 = ... }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v1) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'v1 = new ... }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null, IsInvalid) (Syntax: '= new ... }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsInvalid, IsImplicit) (Syntax: 'new ... }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: ? aa, System.String BB, SSS CCC>, IsInvalid) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: 'aa = xyz') Left: IPropertyReferenceOperation: ? <anonymous type: ? aa, System.String BB, SSS CCC>.aa { get; } (OperationKind.PropertyReference, Type: ?) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, System.String BB, SSS CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'xyz') Children(0) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, Constant: """") (Syntax: 'BB = """"') Left: IPropertyReferenceOperation: System.String <anonymous type: ? aa, System.String BB, SSS CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.String) (Syntax: 'BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, System.String BB, SSS CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.String, Constant: """") (Syntax: '""""') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: SSS, IsInvalid) (Syntax: 'CCC = new SSS()') Left: IPropertyReferenceOperation: SSS <anonymous type: ? aa, System.String BB, SSS CCC>.CCC { get; } (OperationKind.PropertyReference, Type: SSS) (Syntax: 'CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, System.String BB, SSS CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: SSS, IsInvalid) (Syntax: 'new SSS()') Children(0) Initializer: null IVariableDeclarationGroupOperation (1 declarations) (OperationKind.VariableDeclarationGroup, Type: null, IsInvalid) (Syntax: 'object v2 = ... };') IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'object v2 = ... }') Declarators: IVariableDeclaratorOperation (Symbol: System.Object v2) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'v2 = new ... }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null, IsInvalid) (Syntax: '= new ... }') IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsInvalid, IsImplicit) (Syntax: 'new ... }') Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) Operand: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>, IsInvalid) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: SSS, IsInvalid) (Syntax: 'aa = new SSS()') Left: IPropertyReferenceOperation: SSS <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>.aa { get; } (OperationKind.PropertyReference, Type: SSS) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: SSS, IsInvalid) (Syntax: 'new SSS()') Children(0) ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Double, Constant: 123.456) (Syntax: 'BB = 123.456') Left: IPropertyReferenceOperation: System.Double <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>.BB { get; } (OperationKind.PropertyReference, Type: System.Double) (Syntax: 'BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 123.456) (Syntax: '123.456') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid) (Syntax: 'CCC = new ... }') Left: IPropertyReferenceOperation: <anonymous type: ? aa, ? BB, ? CCC> <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>.CCC { get; } (OperationKind.PropertyReference, Type: <anonymous type: ? aa, ? BB, ? CCC>) (Syntax: 'CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: SSS aa, System.Double BB, <anonymous type: ? aa, ? BB, ? CCC> CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid, IsImplicit) (Syntax: '(new ClassA()).aa') Left: IPropertyReferenceOperation: ? <anonymous type: ? aa, ? BB, ? CCC>.aa { get; } (OperationKind.PropertyReference, Type: ?, IsInvalid, IsImplicit) (Syntax: '(new ClassA()).aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: '(new ClassA()).aa') Children(1): IObjectCreationOperation (Constructor: ClassA..ctor()) (OperationKind.ObjectCreation, Type: ClassA) (Syntax: 'new ClassA()') Arguments(0) Initializer: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid, IsImplicit) (Syntax: 'ClassA.BB') Left: IPropertyReferenceOperation: ? <anonymous type: ? aa, ? BB, ? CCC>.BB { get; } (OperationKind.PropertyReference, Type: ?, IsInvalid, IsImplicit) (Syntax: 'ClassA.BB') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'ClassA.BB') Children(1): IOperation: (OperationKind.None, Type: null) (Syntax: 'ClassA') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid, IsImplicit) (Syntax: 'ClassA.CCC') Left: IPropertyReferenceOperation: ? <anonymous type: ? aa, ? BB, ? CCC>.CCC { get; } (OperationKind.PropertyReference, Type: ?, IsInvalid, IsImplicit) (Syntax: 'ClassA.CCC') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: ? aa, ? BB, ? CCC>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'ClassA.CCC') Children(1): IOperation: (OperationKind.None, Type: null) (Syntax: 'ClassA') Initializer: null "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0103: The name 'xyz' does not exist in the current context // aa = xyz, Diagnostic(ErrorCode.ERR_NameNotInContext, "xyz").WithArguments("xyz").WithLocation(8, 18), // CS0246: The type or namespace name 'SSS' could not be found (are you missing a using directive or an assembly reference?) // CCC = new SSS() Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "SSS").WithArguments("SSS").WithLocation(10, 23), // CS0246: The type or namespace name 'SSS' could not be found (are you missing a using directive or an assembly reference?) // aa = new SSS(), Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "SSS").WithArguments("SSS").WithLocation(15, 22), // CS1061: 'ClassA' does not contain a definition for 'aa' and no extension method 'aa' accepting a first argument of type 'ClassA' could be found (are you missing a using directive or an assembly reference?) // (new ClassA()).aa, Diagnostic(ErrorCode.ERR_NoSuchMemberOrExtension, "aa").WithArguments("ClassA", "aa").WithLocation(19, 32), // CS0117: 'ClassA' does not contain a definition for 'BB' // ClassA.BB, Diagnostic(ErrorCode.ERR_NoSuchMember, "BB").WithArguments("ClassA", "BB").WithLocation(20, 24), // CS0117: 'ClassA' does not contain a definition for 'CCC' // ClassA.CCC Diagnostic(ErrorCode.ERR_NoSuchMember, "CCC").WithArguments("ClassA", "CCC").WithLocation(21, 24) }; VerifyOperationTreeAndDiagnosticsForTest<BlockSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_Error_InUsingStatement() { var source = @" public class ClassA { public static void Test1(int x) { using (var v1 = [# new { } #]) { } } }"; var data = Compile(source, 1, // (6,16): error CS1674: '<empty anonymous type>': type used in a using statement must be implicitly convertible to 'System.IDisposable'. // using (var v1 = new { } ) Diagnostic(ErrorCode.ERR_NoConvToIDisp, "var v1 = new { }").WithArguments("<empty anonymous type>") ); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span); Assert.Equal("<empty anonymous type>", info0.Type.ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void AnonymousTypeSymbols_Error_InUsingStatement_OperationTree() { string source = @" class ClassA { public static void Test1(int x) { using (/*<bind>*/var v1 = new { }/*</bind>*/) { } } } "; string expectedOperationTree = @" IVariableDeclarationOperation (1 declarators) (OperationKind.VariableDeclaration, Type: null, IsInvalid) (Syntax: 'var v1 = new { }') Declarators: IVariableDeclaratorOperation (Symbol: <empty anonymous type> v1) (OperationKind.VariableDeclarator, Type: null, IsInvalid) (Syntax: 'v1 = new { }') Initializer: IVariableInitializerOperation (OperationKind.VariableInitializer, Type: null, IsInvalid) (Syntax: '= new { }') IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <empty anonymous type>, IsInvalid) (Syntax: 'new { }') Initializers(0) Initializer: null"; var expectedDiagnostics = new DiagnosticDescription[] { // CS1674: '<empty anonymous type>': type used in a using statement must be implicitly convertible to 'System.IDisposable'. // using (/*<bind>*/var v1 = new { }/*</bind>*/) Diagnostic(ErrorCode.ERR_NoConvToIDisp, "var v1 = new { }").WithArguments("<empty anonymous type>").WithLocation(6, 26) }; VerifyOperationTreeAndDiagnosticsForTest<VariableDeclarationSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_Error_DuplicateName() { var source = @" public class ClassA { public static void Test1(int x) { object v1 = [# new { [# aa #] = 1, ClassA.[# aa #], [# bb #] = 1.2 } #]; } public static string aa = ""-field-aa-""; }"; var data = Compile(source, 4, // (9,13): error CS0833: An anonymous type cannot have multiple properties with the same name // ClassA. aa , Diagnostic(ErrorCode.ERR_AnonymousTypeDuplicatePropertyName, "ClassA. aa") ); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, /*2,*/ 3); Assert.Equal("<anonymous type: System.Int32 aa, System.String $1, System.Double bb>", info0.Type.ToTestDisplayString()); var properties = (from m in info0.Type.GetMembers() where m.Kind == SymbolKind.Property select m).ToArray(); Assert.Equal(3, properties.Length); Assert.Equal("System.Int32 <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.aa { get; }", properties[0].ToTestDisplayString()); Assert.Equal("System.String <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.$1 { get; }", properties[1].ToTestDisplayString()); Assert.Equal("System.Double <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.bb { get; }", properties[2].ToTestDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(20338, "https://github.com/dotnet/roslyn/issues/20338")] public void AnonymousTypeSymbols_Error_DuplicateName_OperationTree() { string source = @" class ClassA { public static void Test1(int x) { object v1 = /*<bind>*/new { aa = 1, ClassA.aa, bb = 1.2 }/*</bind>*/; } public static string aa = ""-field-aa-""; } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 aa, System.String $1, System.Double bb>, IsInvalid) (Syntax: 'new ... }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'aa = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.aa { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String $1, System.Double bb>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, IsInvalid, IsImplicit) (Syntax: 'ClassA.aa') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.$1 { get; } (OperationKind.PropertyReference, Type: System.String, IsInvalid, IsImplicit) (Syntax: 'ClassA.aa') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String $1, System.Double bb>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: IFieldReferenceOperation: System.String ClassA.aa (Static) (OperationKind.FieldReference, Type: System.String, IsInvalid) (Syntax: 'ClassA.aa') Instance Receiver: null ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Double, Constant: 1.2) (Syntax: 'bb = 1.2') Left: IPropertyReferenceOperation: System.Double <anonymous type: System.Int32 aa, System.String $1, System.Double bb>.bb { get; } (OperationKind.PropertyReference, Type: System.Double) (Syntax: 'bb') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 aa, System.String $1, System.Double bb>, IsInvalid, IsImplicit) (Syntax: 'new ... }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Double, Constant: 1.2) (Syntax: '1.2') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0833: An anonymous type cannot have multiple properties with the same name // ClassA.aa, Diagnostic(ErrorCode.ERR_AnonymousTypeDuplicatePropertyName, "ClassA.aa").WithLocation(9, 13) }; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [Fact()] public void AnonymousTypeSymbols_LookupSymbols() { var source = @" public class ClassA { public static void Test1(int x) { object v1 = [# new { [# aa #] = """", [# abc #] = 123.456 } #]; object v2 = [# new{ } #]; } }"; var data = Compile(source, 4); var info0 = GetAnonymousTypeInfoSummary(data, 0, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 1).Span, 1, 2); Assert.Equal("<anonymous type: System.String aa, System.Double abc>", info0.Type.ToTestDisplayString()); var pos = data.Nodes[0].Span.End; var syms = data.Model.LookupSymbols(pos, container: info0.Type).Select(x => x.ToTestDisplayString()).OrderBy(x => x).ToArray(); Assert.Equal(8, syms.Length); int index = 0; Assert.Equal("System.Boolean System.Object.Equals(System.Object obj)", syms[index++]); Assert.Equal("System.Boolean System.Object.Equals(System.Object objA, System.Object objB)", syms[index++]); Assert.Equal("System.Boolean System.Object.ReferenceEquals(System.Object objA, System.Object objB)", syms[index++]); Assert.Equal("System.Double <anonymous type: System.String aa, System.Double abc>.abc { get; }", syms[index++]); Assert.Equal("System.Int32 System.Object.GetHashCode()", syms[index++]); Assert.Equal("System.String <anonymous type: System.String aa, System.Double abc>.aa { get; }", syms[index++]); Assert.Equal("System.String System.Object.ToString()", syms[index++]); Assert.Equal("System.Type System.Object.GetType()", syms[index++]); info0 = GetAnonymousTypeInfoSummary(data, 3, data.Tree.FindNodeOrTokenByKind(SyntaxKind.NewKeyword, 2).Span); Assert.Equal("<empty anonymous type>", info0.Type.ToTestDisplayString()); pos = data.Nodes[3].Span.End; syms = data.Model.LookupSymbols(pos, container: info0.Type).Select(x => x.ToTestDisplayString()).OrderBy(x => x).ToArray(); Assert.Equal(6, syms.Length); index = 0; Assert.Equal("System.Boolean System.Object.Equals(System.Object obj)", syms[index++]); Assert.Equal("System.Boolean System.Object.Equals(System.Object objA, System.Object objB)", syms[index++]); Assert.Equal("System.Boolean System.Object.ReferenceEquals(System.Object objA, System.Object objB)", syms[index++]); Assert.Equal("System.Int32 System.Object.GetHashCode()", syms[index++]); Assert.Equal("System.String System.Object.ToString()", syms[index++]); Assert.Equal("System.Type System.Object.GetType()", syms[index++]); } [WorkItem(543189, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543189")] [Fact()] public void CheckAnonymousTypeAsConstValue() { var source = @" public class A { const int i = /*<bind>*/(new {a = 2}).a/*</bind>*/; }"; var comp = CreateCompilation(source); var tuple = GetBindingNodeAndModel<ExpressionSyntax>(comp); var info = tuple.Item2.GetSymbolInfo(tuple.Item1); Assert.NotNull(info.Symbol); Assert.Equal("<anonymous type: int a>.a", info.Symbol.ToDisplayString()); } [CompilerTrait(CompilerFeature.IOperation)] [Fact()] public void CheckAnonymousTypeAsConstValue_OperationTree() { string source = @" class A { const int i = (/*<bind>*/new { a = 2 }/*</bind>*/).a; } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 a>, IsInvalid) (Syntax: 'new { a = 2 }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 2) (Syntax: 'a = 2') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 a>.a { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'a') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 a>, IsInvalid, IsImplicit) (Syntax: 'new { a = 2 }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 2) (Syntax: '2') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0836: Cannot use anonymous type in a constant expression // const int i = (/*<bind>*/new { a = 2 }/*</bind>*/).a; Diagnostic(ErrorCode.ERR_AnonymousTypeNotAvailable, "new").WithLocation(4, 30) }; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [WorkItem(546416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416")] [ClrOnlyFact] public void TestAnonymousTypeInsideGroupBy_Queryable() { CompileAndVerify( @"using System.Linq; public class Product { public int ProductID; public string ProductName; public int SupplierID; } public class DB { public IQueryable<Product> Products; } public class Program { public static void Main() { var db = new DB(); var q0 = db.Products.GroupBy(p => new { Conditional = false ? new { p.ProductID, p.ProductName, p.SupplierID } : new { p.ProductID, p.ProductName, p.SupplierID } }).ToList(); } }").VerifyDiagnostics(); } [CompilerTrait(CompilerFeature.IOperation)] [WorkItem(546416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416")] [ClrOnlyFact] public void TestAnonymousTypeInsideGroupBy_Queryable_OperationTree() { string source = @" using System.Linq; class Product { public int ProductID; public string ProductName; public int SupplierID; } class DB { public IQueryable<Product> Products; } class Program { public static void Main() { var db = new DB(); var q0 = db.Products.GroupBy(p => /*<bind>*/new { Conditional = false ? new { p.ProductID, p.ProductName, p.SupplierID } : new { p.ProductID, p.ProductName, p.SupplierID } }/*</bind>*/).ToList(); } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID> Conditional>) (Syntax: 'new { Condi ... plierID } }') Initializers(1): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'Conditional ... upplierID }') Left: IPropertyReferenceOperation: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID> <anonymous type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID> Conditional>.Conditional { get; } (OperationKind.PropertyReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'Conditional') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID> Conditional>, IsImplicit) (Syntax: 'new { Condi ... plierID } }') Right: IConditionalOperation (OperationKind.Conditional, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'false ? new ... upplierID }') Condition: ILiteralOperation (OperationKind.Literal, Type: System.Boolean, Constant: False) (Syntax: 'false') WhenTrue: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'new { p.Pro ... upplierID }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'p.ProductID') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.ProductID { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'p.ProductID') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.Int32 Product.ProductID (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'p.ProductID') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, IsImplicit) (Syntax: 'p.ProductName') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.ProductName { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'p.ProductName') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.String Product.ProductName (OperationKind.FieldReference, Type: System.String) (Syntax: 'p.ProductName') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'p.SupplierID') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.SupplierID { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'p.SupplierID') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.Int32 Product.SupplierID (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'p.SupplierID') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') WhenFalse: IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>) (Syntax: 'new { p.Pro ... upplierID }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'p.ProductID') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.ProductID { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'p.ProductID') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.Int32 Product.ProductID (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'p.ProductID') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.String, IsImplicit) (Syntax: 'p.ProductName') Left: IPropertyReferenceOperation: System.String <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.ProductName { get; } (OperationKind.PropertyReference, Type: System.String, IsImplicit) (Syntax: 'p.ProductName') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.String Product.ProductName (OperationKind.FieldReference, Type: System.String) (Syntax: 'p.ProductName') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'p.SupplierID') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>.SupplierID { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'p.SupplierID') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 ProductID, System.String ProductName, System.Int32 SupplierID>, IsImplicit) (Syntax: 'new { p.Pro ... upplierID }') Right: IFieldReferenceOperation: System.Int32 Product.SupplierID (OperationKind.FieldReference, Type: System.Int32) (Syntax: 'p.SupplierID') Instance Receiver: IParameterReferenceOperation: p (OperationKind.ParameterReference, Type: Product) (Syntax: 'p') "; var expectedDiagnostics = new DiagnosticDescription[] { // CS0649: Field 'Product.ProductName' is never assigned to, and will always have its default value null // public string ProductName; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "ProductName").WithArguments("Product.ProductName", "null").WithLocation(7, 19), // CS0649: Field 'Product.SupplierID' is never assigned to, and will always have its default value 0 // public int SupplierID; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "SupplierID").WithArguments("Product.SupplierID", "0").WithLocation(8, 16), // CS0649: Field 'Product.ProductID' is never assigned to, and will always have its default value 0 // public int ProductID; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "ProductID").WithArguments("Product.ProductID", "0").WithLocation(6, 16), // CS0649: Field 'DB.Products' is never assigned to, and will always have its default value null // public IQueryable<Product> Products; Diagnostic(ErrorCode.WRN_UnassignedInternalField, "Products").WithArguments("DB.Products", "null").WithLocation(12, 32) }; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [WorkItem(546416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416")] [ClrOnlyFact] public void TestAnonymousTypeInsideGroupBy_Enumerable() { CompileAndVerify( @"using System.Linq; using System.Collections.Generic; public class Product { public int ProductID; public string ProductName; public int SupplierID; } public class DB { public IEnumerable<Product> Products; } public class Program { public static void Main() { var db = new DB(); var q0 = db.Products.GroupBy(p => new { Conditional = false ? new { p.ProductID, p.ProductName, p.SupplierID } : new { p.ProductID, p.ProductName, p.SupplierID } }).ToList(); } }").VerifyDiagnostics(); } [WorkItem(546416, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546416")] [ClrOnlyFact] public void TestAnonymousTypeInsideGroupBy_Enumerable2() { CompileAndVerify( @"using System.Linq; using System.Collections.Generic; public class Product { public int ProductID; public int SupplierID; } public class DB { public IEnumerable<Product> Products; } public class Program { public static void Main() { var db = new DB(); var q0 = db.Products.GroupBy(p => new { Conditional = false ? new { p.ProductID, p.SupplierID } : new { p.ProductID, p.SupplierID } }).ToList(); var q1 = db.Products.GroupBy(p => new { Conditional = false ? new { p.ProductID, p.SupplierID } : new { p.ProductID, p.SupplierID } }).ToList(); } }").VerifyDiagnostics(); } [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(22588, "https://github.com/dotnet/roslyn/issues/22588")] public void AnonymousTypeSymbols_ErrorCases() { string source = @" class ClassA { static void Test1(int x) { var obj = /*<bind>*/new { f1 = null, f2 = M, f3 = default }/*</bind>*/; } static void M() { } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: error f1, error f2, ? f3>, IsInvalid) (Syntax: 'new { f1 = ... = default }') Initializers(3): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: error, Constant: null, IsInvalid) (Syntax: 'f1 = null') Left: IPropertyReferenceOperation: error <anonymous type: error f1, error f2, ? f3>.f1 { get; } (OperationKind.PropertyReference, Type: error, IsInvalid) (Syntax: 'f1') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: error f1, error f2, ? f3>, IsInvalid, IsImplicit) (Syntax: 'new { f1 = ... = default }') Right: ILiteralOperation (OperationKind.Literal, Type: null, Constant: null, IsInvalid) (Syntax: 'null') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: error, IsInvalid) (Syntax: 'f2 = M') Left: IPropertyReferenceOperation: error <anonymous type: error f1, error f2, ? f3>.f2 { get; } (OperationKind.PropertyReference, Type: error, IsInvalid) (Syntax: 'f2') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: error f1, error f2, ? f3>, IsInvalid, IsImplicit) (Syntax: 'new { f1 = ... = default }') Right: IOperation: (OperationKind.None, Type: null, IsInvalid) (Syntax: 'M') Children(1): IInstanceReferenceOperation (ReferenceKind: ContainingTypeInstance) (OperationKind.InstanceReference, Type: ClassA, IsInvalid, IsImplicit) (Syntax: 'M') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: 'f3 = default') Left: IPropertyReferenceOperation: ? <anonymous type: error f1, error f2, ? f3>.f3 { get; } (OperationKind.PropertyReference, Type: ?) (Syntax: 'f3') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: error f1, error f2, ? f3>, IsInvalid, IsImplicit) (Syntax: 'new { f1 = ... = default }') Right: IDefaultValueOperation (OperationKind.DefaultValue, Type: ?, IsInvalid) (Syntax: 'default') "; var expectedDiagnostics = new DiagnosticDescription[] { // file.cs(6,35): error CS0828: Cannot assign '<null>' to anonymous type property // var obj = /*<bind>*/new { f1 = null, f2 = M, f3 = default }/*</bind>*/; Diagnostic(ErrorCode.ERR_AnonymousTypePropertyAssignedBadValue, "f1 = null").WithArguments("<null>").WithLocation(6, 35), // file.cs(6,46): error CS0828: Cannot assign 'method group' to anonymous type property // var obj = /*<bind>*/new { f1 = null, f2 = M, f3 = default }/*</bind>*/; Diagnostic(ErrorCode.ERR_AnonymousTypePropertyAssignedBadValue, "f2 = M").WithArguments("method group").WithLocation(6, 46), // file.cs(6,59): error CS8716: There is no target type for the default literal. // var obj = /*<bind>*/new { f1 = null, f2 = M, f3 = default }/*</bind>*/; Diagnostic(ErrorCode.ERR_DefaultLiteralNoTargetType, "default").WithLocation(6, 59) }; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } [CompilerTrait(CompilerFeature.IOperation)] [Fact, WorkItem(27338, "https://github.com/dotnet/roslyn/issues/27338")] public void AnonymousTypeCreation_MixedInitializers() { string source = @" using System.Collections.Generic; using System.Linq; class ClassA { void M(int a) { var o = /*<bind>*/new { a, b = 1 }/*</bind>*/; } } "; string expectedOperationTree = @" IAnonymousObjectCreationOperation (OperationKind.AnonymousObjectCreation, Type: <anonymous type: System.Int32 a, System.Int32 b>) (Syntax: 'new { a, b = 1 }') Initializers(2): ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, IsImplicit) (Syntax: 'a') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 a, System.Int32 b>.a { get; } (OperationKind.PropertyReference, Type: System.Int32, IsImplicit) (Syntax: 'a') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 a, System.Int32 b>, IsImplicit) (Syntax: 'new { a, b = 1 }') Right: IParameterReferenceOperation: a (OperationKind.ParameterReference, Type: System.Int32) (Syntax: 'a') ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Int32, Constant: 1) (Syntax: 'b = 1') Left: IPropertyReferenceOperation: System.Int32 <anonymous type: System.Int32 a, System.Int32 b>.b { get; } (OperationKind.PropertyReference, Type: System.Int32) (Syntax: 'b') Instance Receiver: IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: <anonymous type: System.Int32 a, System.Int32 b>, IsImplicit) (Syntax: 'new { a, b = 1 }') Right: ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') "; var expectedDiagnostics = DiagnosticDescription.None; VerifyOperationTreeAndDiagnosticsForTest<AnonymousObjectCreationExpressionSyntax>(source, expectedOperationTree, expectedDiagnostics); } #region "Utility methods" private void AssertCannotConstruct(ISymbol type) { var namedType = type as INamedTypeSymbol; Assert.NotNull(namedType); var objType = namedType.BaseType; Assert.NotNull(objType); Assert.Equal("System.Object", objType.ToTestDisplayString()); ITypeSymbol[] args = new ITypeSymbol[namedType.Arity]; for (int i = 0; i < namedType.Arity; i++) { args[i] = objType; } Assert.Throws<InvalidOperationException>(() => namedType.Construct(args)); } private CompilationUtils.SemanticInfoSummary GetAnonymousTypeInfoSummary(TestData data, int node, TextSpan typeSpan, params int[] fields) { var info = data.Model.GetSemanticInfoSummary(data.Nodes[node]); var type = info.Type; Assert.True(type.IsAnonymousType); Assert.False(type.CanBeReferencedByName); Assert.Equal("System.Object", type.BaseType.ToTestDisplayString()); Assert.Equal(0, type.Interfaces.Length); Assert.Equal(1, type.Locations.Length); Assert.Equal(typeSpan, type.Locations[0].SourceSpan); foreach (int field in fields) { CheckFieldNameAndLocation(data, type, data.Nodes[field]); } return info; } private void CheckFieldNameAndLocation(TestData data, ITypeSymbol type, SyntaxNode identifier) { var anonymousType = (INamedTypeSymbol)type; var current = identifier; while (current.Span == identifier.Span && !current.IsKind(SyntaxKind.IdentifierName)) { current = current.ChildNodes().Single(); } var node = (IdentifierNameSyntax)current; Assert.NotNull(node); var span = node.Span; var fieldName = node.ToString(); var property = anonymousType.GetMember<IPropertySymbol>(fieldName); Assert.NotNull(property); Assert.Equal(fieldName, property.Name); Assert.Equal(1, property.Locations.Length); Assert.Equal(span, property.Locations[0].SourceSpan); IMethodSymbol getter = property.GetMethod; Assert.NotNull(getter); Assert.Equal("get_" + fieldName, getter.Name); } private struct TestData { public CSharpCompilation Compilation; public SyntaxTree Tree; public List<SyntaxNode> Nodes; public SemanticModel Model; } private TestData Compile(string source, int expectedIntervals, params DiagnosticDescription[] diagnostics) { var intervals = ExtractTextIntervals(ref source); Assert.Equal(expectedIntervals, intervals.Count); var compilation = Compile(source); compilation.VerifyDiagnostics(diagnostics); var tree = compilation.SyntaxTrees[0]; var nodes = new List<SyntaxNode>(); foreach (var span in intervals) { var stack = new Stack<SyntaxNode>(); stack.Push(tree.GetCompilationUnitRoot()); while (stack.Count > 0) { var node = stack.Pop(); if (span.Contains(node.Span)) { nodes.Add(node); break; } foreach (var child in node.ChildNodes()) { stack.Push(child); } } } Assert.Equal(expectedIntervals, nodes.Count); return new TestData() { Compilation = compilation, Tree = tree, Model = compilation.GetSemanticModel(tree), Nodes = nodes }; } private CSharpCompilation Compile(string source) => CreateCompilationWithMscorlib40( source, options: TestOptions.ReleaseDll, parseOptions: TestOptions.Regular); private static List<TextSpan> ExtractTextIntervals(ref string source) { const string startTag = "[#"; const string endTag = "#]"; List<TextSpan> intervals = new List<TextSpan>(); var all = (from s in FindAll(source, startTag) select new { start = true, offset = s }).Union( from s in FindAll(source, endTag) select new { start = false, offset = s } ).OrderBy(value => value.offset).ToList(); while (all.Count > 0) { int i = 1; bool added = false; while (i < all.Count) { if (all[i - 1].start && !all[i].start) { intervals.Add(TextSpan.FromBounds(all[i - 1].offset, all[i].offset)); all.RemoveAt(i); all.RemoveAt(i - 1); added = true; } else { i++; } } Assert.True(added); } source = source.Replace(startTag, " ").Replace(endTag, " "); intervals.Sort((x, y) => x.Start.CompareTo(y.Start)); return intervals; } private static IEnumerable<int> FindAll(string source, string what) { int index = source.IndexOf(what, StringComparison.Ordinal); while (index >= 0) { yield return index; index = source.IndexOf(what, index + 1, StringComparison.Ordinal); } } private int NumberOfNewKeywords(string source) { int cnt = 0; foreach (var line in source.Split(new String[] { Environment.NewLine }, StringSplitOptions.None)) { if (!string.IsNullOrWhiteSpace(line)) { if (!line.Trim().StartsWith("//", StringComparison.Ordinal)) { for (int index = line.IndexOf("new ", StringComparison.Ordinal); index >= 0;) { cnt++; index = line.IndexOf("new ", index + 1, StringComparison.Ordinal); } } } } return cnt; } #endregion } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Test/Core/Diagnostics/SuppressMessageAttributeTests.cs
// 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. #nullable disable using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Diagnostics { public abstract partial class SuppressMessageAttributeTests { #region Local Suppression public static IEnumerable<string[]> QualifiedAttributeNames { get; } = new[] { new[] { "System.Diagnostics.CodeAnalysis.SuppressMessageAttribute" }, new[] { "System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute" }, }; public static IEnumerable<string[]> SimpleAttributeNames { get; } = new[] { new[] { "SuppressMessage" }, new[] { "UnconditionalSuppressMessage" } }; [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task LocalSuppressionOnType(string attrName) { await VerifyCSharpAsync(@" [" + attrName + @"(""Test"", ""Declaration"")] public class C { } public class C1 { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }, Diagnostic("Declaration", "C1")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task MultipleLocalSuppressionsOnSingleSymbol(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [" + attrName + @"(""Test"", ""Declaration"")] [" + attrName + @"(""Test"", ""TypeDeclaration"")] public class C { } ", new DiagnosticAnalyzer[] { new WarningOnNamePrefixDeclarationAnalyzer("C"), new WarningOnTypeDeclarationAnalyzer() }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task DuplicateLocalSuppressions(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [" + attrName + @"(""Test"", ""Declaration"")] [" + attrName + @"(""Test"", ""Declaration"")] public class C { } ", new DiagnosticAnalyzer[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task LocalSuppressionOnMember(string attrName) { await VerifyCSharpAsync(@" public class C { [" + attrName + @"(""Test"", ""Declaration"")] public void Goo() {} public void Goo1() {} } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("Goo") }, Diagnostic("Declaration", "Goo1")); } #endregion #region Global Suppression [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnNamespaces(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Namespace"", Target=""N"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Namespace"", Target=""N.N1"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Namespace"", Target=""N4"")] namespace N { namespace N1 { namespace N2.N3 { } } } namespace N4 { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("N") }, Diagnostic("Declaration", "N2"), Diagnostic("Declaration", "N3")); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnNamespaces_NamespaceAndDescendants(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""NamespaceAndDescendants"", Target=""N.N1"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""namespaceanddescendants"", Target=""N4"")] namespace N { namespace N1 { namespace N2.N3 { } } } namespace N4 { namespace N5 { } } namespace N.N1.N6.N7 { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("N") }, Diagnostic("Declaration", "N")); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnTypesAndNamespaces_NamespaceAndDescendants(string attrName) { var source = @" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""NamespaceAndDescendants"", Target=""N.N1.N2"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""NamespaceAndDescendants"", Target=""N4"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""C2"")] namespace N { namespace N1 { class C1 { } namespace N2.N3 { class C2 { } class C3 { class C4 { } } } } } namespace N4 { namespace N5 { class C5 { } } class C6 { } } namespace N.N1.N2.N7 { class C7 { } } "; await VerifyCSharpAsync(source, new[] { new WarningOnNamePrefixDeclarationAnalyzer("N") }, Diagnostic("Declaration", "N"), Diagnostic("Declaration", "N1")); await VerifyCSharpAsync(source, new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }, Diagnostic("Declaration", "C1")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnTypes(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""Ef"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""Egg"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""Ele`2"")] public class E { } public interface Ef { } public struct Egg { } public delegate void Ele<T1,T2>(T1 x, T2 y); ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("E") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnNestedTypes(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""type"", Target=""C.A1"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""type"", Target=""C+A2"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""member"", Target=""C+A3"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""member"", Target=""C.A4"")] public class C { public class A1 { } public class A2 { } public class A3 { } public delegate void A4(); } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("A") }, Diagnostic("Declaration", "A1"), Diagnostic("Declaration", "A3"), Diagnostic("Declaration", "A4")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GlobalSuppressionOnBasicModule(string attrName) { await VerifyBasicAsync(@" <assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""type"", Target=""M"")> Module M Class C End Class End Module ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("M") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnMembers(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Member"", Target=""C.#M1"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Member"", Target=""C.#M3`1()"")] public class C { int M1; public void M2() {} public static void M3<T>() {} } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("M") }, new[] { Diagnostic("Declaration", "M2") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnValueTupleMemberWithDocId(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Member"", Target=""~M:C.M~System.Threading.Tasks.Task{System.ValueTuple{System.Boolean,ErrorCode}}"")] enum ErrorCode {} class C { Task<(bool status, ErrorCode errorCode)> M() => null; } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("M") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task MultipleGlobalSuppressionsOnSingleSymbol(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] [assembly: " + attrName + @"(""Test"", ""TypeDeclaration"", Scope=""Type"", Target=""E"")] public class E { } ", new DiagnosticAnalyzer[] { new WarningOnNamePrefixDeclarationAnalyzer("E"), new WarningOnTypeDeclarationAnalyzer() }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task DuplicateGlobalSuppressions(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] public class E { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("E") }); } #endregion #region Syntax Semantics [Fact] public async Task WarningOnCommentAnalyzerCSharp() { await VerifyCSharpAsync("// Comment\r\n /* Comment */", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "// Comment"), Diagnostic("Comment", "/* Comment */")); } [Fact] public async Task WarningOnCommentAnalyzerBasic() { await VerifyBasicAsync("' Comment", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "' Comment")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GloballySuppressSyntaxDiagnosticsCSharp(string attrName) { await VerifyCSharpAsync(@" // before module attributes [module: " + attrName + @"(""Test"", ""Comment"")] // before class public class C { // before method public void Goo() // after method declaration { // inside method } } // after class ", new[] { new WarningOnCommentAnalyzer() }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GloballySuppressSyntaxDiagnosticsBasic(string attrName) { await VerifyBasicAsync(@" ' before module attributes <Module: " + attrName + @"(""Test"", ""Comment"")> ' before class Public Class C ' before sub Public Sub Goo() ' after sub statement ' inside sub End Sub End Class ' after class ", new[] { new WarningOnCommentAnalyzer() }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GloballySuppressSyntaxDiagnosticsOnTargetCSharp(string attrName) { await VerifyCSharpAsync(@" // before module attributes [module: " + attrName + @"(""Test"", ""Comment"", Scope=""Member"" Target=""C.Goo():System.Void"")] // before class public class C { // before method public void Goo() // after method declaration { // inside method } } // after class ", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "// before module attributes"), Diagnostic("Comment", "// before class"), Diagnostic("Comment", "// after class")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GloballySuppressSyntaxDiagnosticsOnTargetBasic(string attrName) { await VerifyBasicAsync(@" ' before module attributes <Module: " + attrName + @"(""Test"", ""Comment"", Scope:=""Member"", Target:=""C.Goo():System.Void"")> ' before class Public Class C ' before sub Public Sub Goo() ' after sub statement ' inside sub End Sub End Class ' after class ", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "' before module attributes"), Diagnostic("Comment", "' before class"), Diagnostic("Comment", "' after class")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNamespaceDeclarationCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" [assembly: " + attrName + @"(""Test"", ""Token"", Scope=""namespace"", Target=""A.B"")] namespace A [|{ namespace B { class C {} } }|] ", Diagnostic("Token", "{").WithLocation(4, 1), Diagnostic("Token", "class").WithLocation(7, 9), Diagnostic("Token", "C").WithLocation(7, 15), Diagnostic("Token", "{").WithLocation(7, 17), Diagnostic("Token", "}").WithLocation(7, 18), Diagnostic("Token", "}").WithLocation(9, 1)); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNamespaceAndChildDeclarationCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" [assembly: " + attrName + @"(""Test"", ""Token"", Scope=""NamespaceAndDescendants"", Target=""A.B"")] namespace A [|{ namespace B { class C {} } }|] ", Diagnostic("Token", "{").WithLocation(4, 1), Diagnostic("Token", "}").WithLocation(9, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNamespaceDeclarationBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" <assembly: " + attrName + @"(""Test"", ""Token"", Scope:=""Namespace"", Target:=""A.B"")> Namespace [|A Namespace B Class C End Class End Namespace End|] Namespace ", Diagnostic("Token", "A").WithLocation(3, 11), Diagnostic("Token", "Class").WithLocation(5, 9), Diagnostic("Token", "C").WithLocation(5, 15), Diagnostic("Token", "End").WithLocation(6, 9), Diagnostic("Token", "Class").WithLocation(6, 13), Diagnostic("Token", "End").WithLocation(8, 1)); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNamespaceAndDescendantsDeclarationBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" <assembly: " + attrName + @"(""Test"", ""Token"", Scope:=""NamespaceAndDescendants"", Target:=""A.B"")> Namespace [|A Namespace B Class C End Class End Namespace End|] Namespace ", Diagnostic("Token", "A").WithLocation(3, 11), Diagnostic("Token", "End").WithLocation(8, 1)); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [InlineData("Namespace")] [InlineData("NamespaceAndDescendants")] public async Task DontSuppressSyntaxDiagnosticsInRootNamespaceBasic(string scope) { await VerifyBasicAsync($@" <module: System.Diagnostics.SuppressMessage(""Test"", ""Comment"", Scope:=""{scope}"", Target:=""RootNamespace"")> ' In root namespace ", rootNamespace: "RootNamespace", analyzers: new[] { new WarningOnCommentAnalyzer() }, diagnostics: Diagnostic("Comment", "' In root namespace").WithLocation(3, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnTypesCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" using System.Diagnostics.CodeAnalysis; namespace N [|{ [" + attrName + @"(""Test"", ""Token"")] class C<T> {} [" + attrName + @"(""Test"", ""Token"")] struct S<T> {} [" + attrName + @"(""Test"", ""Token"")] interface I<T>{} [" + attrName + @"(""Test"", ""Token"")] enum E {} [" + attrName + @"(""Test"", ""Token"")] delegate void D(); }|] ", Diagnostic("Token", "{").WithLocation(5, 1), Diagnostic("Token", "}").WithLocation(20, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnTypesBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Namespace [|N <" + attrName + @"(""Test"", ""Token"")> Module M End Module <" + attrName + @"(""Test"", ""Token"")> Class C End Class <" + attrName + @"(""Test"", ""Token"")> Structure S End Structure <" + attrName + @"(""Test"", ""Token"")> Interface I End Interface <" + attrName + @"(""Test"", ""Token"")> Enum E None End Enum <" + attrName + @"(""Test"", ""Token"")> Delegate Sub D() End|] Namespace ", Diagnostic("Token", "N").WithLocation(4, 11), Diagnostic("Token", "End").WithLocation(28, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnFieldsCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" using System.Diagnostics.CodeAnalysis; class C [|{ [" + attrName + @"(""Test"", ""Token"")] int field1 = 1, field2 = 2; [" + attrName + @"(""Test"", ""Token"")] int field3 = 3; }|] ", Diagnostic("Token", "{"), Diagnostic("Token", "}")); } [Theory] [WorkItem(6379, "https://github.com/dotnet/roslyn/issues/6379")] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEnumFieldsCSharp(string attrName) { await VerifyCSharpAsync(@" // before module attributes [module: " + attrName + @"(""Test"", ""Comment"", Scope=""Member"" Target=""E.Field1"")] // before enum public enum E { // before Field1 declaration Field1, // after Field1 declaration Field2 // after Field2 declaration } // after enum ", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "// before module attributes"), Diagnostic("Comment", "// before enum"), Diagnostic("Comment", "// after Field1 declaration"), Diagnostic("Comment", "// after Field2 declaration"), Diagnostic("Comment", "// after enum")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnFieldsBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Class [|C <" + attrName + @"(""Test"", ""Token"")> Public field1 As Integer = 1, field2 As Double = 2.0 <" + attrName + @"(""Test"", ""Token"")> Public field3 As Integer = 3 End|] Class ", Diagnostic("Token", "C"), Diagnostic("Token", "End")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventsCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C [|{ [" + attrName + @"(""Test"", ""Token"")] public event System.Action<int> E1; [" + attrName + @"(""Test"", ""Token"")] public event System.Action<int> E2, E3; }|] ", Diagnostic("Token", "{"), Diagnostic("Token", "}")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventsBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Class [|C <" + attrName + @"(""Test"", ""Token"")> Public Event E1 As System.Action(Of Integer) <" + attrName + @"(""Test"", ""Token"")> Public Event E2(ByVal arg As Integer) End|] Class ", Diagnostic("Token", "C"), Diagnostic("Token", "End")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventAddAccessorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { public event System.Action<int> E [|{ [" + attrName + @"(""Test"", ""Token"")] add {} remove|] {} } } ", Diagnostic("Token", "{").WithLocation(5, 5), Diagnostic("Token", "remove").WithLocation(8, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventAddAccessorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Public Custom Event E As System.Action(Of Integer[|) <" + attrName + @"(""Test"", ""Token"")> AddHandler(value As Action(Of Integer)) End AddHandler RemoveHandler|](value As Action(Of Integer)) End RemoveHandler RaiseEvent(obj As Integer) End RaiseEvent End Event End Class ", Diagnostic("Token", ")"), Diagnostic("Token", "RemoveHandler")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventRemoveAccessorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { public event System.Action<int> E { add {[|} [" + attrName + @"(""Test"", ""Token"")] remove {} }|] } ", Diagnostic("Token", "}").WithLocation(6, 14), Diagnostic("Token", "}").WithLocation(9, 5)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventRemoveAccessorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Public Custom Event E As System.Action(Of Integer) AddHandler(value As Action(Of Integer)) End [|AddHandler <" + attrName + @"(""Test"", ""Token"")> RemoveHandler(value As Action(Of Integer)) End RemoveHandler RaiseEvent|](obj As Integer) End RaiseEvent End Event End Class ", Diagnostic("Token", "AddHandler"), Diagnostic("Token", "RaiseEvent")); } [WorkItem(1103442, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1103442")] [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnRaiseEventAccessorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Public Custom Event E As System.Action(Of Integer) AddHandler(value As Action(Of Integer)) End AddHandler RemoveHandler(value As Action(Of Integer)) End [|RemoveHandler <" + attrName + @"(""Test"", ""Token"")> RaiseEvent(obj As Integer) End RaiseEvent End|] Event End Class ", Diagnostic("Token", "RemoveHandler"), Diagnostic("Token", "End")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertyCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" using System.Diagnostics.CodeAnalysis; class C [|{ [" + attrName + @"(""Test"", ""Token"")] int Property1 { get; set; } [" + attrName + @"(""Test"", ""Token"")] int Property2 { get { return 2; } set { Property1 = 2; } } }|] ", Diagnostic("Token", "{").WithLocation(5, 1), Diagnostic("Token", "}").WithLocation(15, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertyBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Class [|C <" + attrName + @"(""Test"", ""Token"")> Property Property1 As Integer <" + attrName + @"(""Test"", ""Token"")> Property Property2 As Integer Get Return 2 End Get Set(value As Integer) Property1 = value End Set End Property End|] Class ", Diagnostic("Token", "C").WithLocation(4, 7), Diagnostic("Token", "End").WithLocation(17, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertyGetterCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x; int Property [|{ [" + attrName + @"(""Test"", ""Token"")] get { return 2; } set|] { x = 2; } } } ", Diagnostic("Token", "{").WithLocation(6, 5), Diagnostic("Token", "set").WithLocation(9, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertyGetterBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Private x As Integer Property [Property] As [|Integer <" + attrName + @"(""Test"", ""Token"")> Get Return 2 End Get Set|](value As Integer) x = value End Set End Property End Class ", Diagnostic("Token", "Integer").WithLocation(4, 28), Diagnostic("Token", "Set").WithLocation(9, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertySetterCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x; int Property [|{ [" + attrName + @"(""Test"", ""Token"")] get { return 2; } set|] { x = 2; } } } ", Diagnostic("Token", "{").WithLocation(6, 5), Diagnostic("Token", "set").WithLocation(9, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertySetterBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Private x As Integer Property [Property] As Integer Get Return 2 End [|Get <" + attrName + @"(""Test"", ""Token"")> Set(value As Integer) x = value End Set End|] Property End Class ", Diagnostic("Token", "Get").WithLocation(7, 13), Diagnostic("Token", "End").WithLocation(12, 5)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnIndexerCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x[|; [" + attrName + @"(""Test"", ""Token"")] int this[int i] { get { return 2; } set { x = 2; } } }|] ", Diagnostic("Token", ";").WithLocation(4, 10), Diagnostic("Token", "}").WithLocation(11, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnIndexerGetterCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x; int this[int i] [|{ [" + attrName + @"(""Test"", ""Token"")] get { return 2; } set|] { x = 2; } } } ", Diagnostic("Token", "{").WithLocation(6, 5), Diagnostic("Token", "set").WithLocation(9, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnIndexerSetterCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x; int this[int i] { get { return 2; [|} [" + attrName + @"(""Test"", ""Token"")] set { x = 2; } }|] } ", Diagnostic("Token", "}").WithLocation(7, 25), Diagnostic("Token", "}").WithLocation(10, 5)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnMethodCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" using System.Diagnostics.CodeAnalysis; abstract class C [|{ [" + attrName + @"(""Test"", ""Token"")] public void M1<T>() {} [" + attrName + @"(""Test"", ""Token"")] public abstract void M2(); }|] ", Diagnostic("Token", "{").WithLocation(5, 1), Diagnostic("Token", "}").WithLocation(11, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnMethodBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Public MustInherit Class [|C <" + attrName + @"(""Test"", ""Token"")> Public Function M2(Of T)() As Integer Return 0 End Function <" + attrName + @"(""Test"", ""Token"")> Public MustOverride Sub M3() End|] Class ", Diagnostic("Token", "C").WithLocation(4, 26), Diagnostic("Token", "End").WithLocation(12, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnOperatorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C [|{ [" + attrName + @"(""Test"", ""Token"")] public static C operator +(C a, C b) { return null; } }|] ", Diagnostic("Token", "{").WithLocation(3, 1), Diagnostic("Token", "}").WithLocation(9, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnOperatorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class [|C <" + attrName + @"(""Test"", ""Token"")> Public Shared Operator +(ByVal a As C, ByVal b As C) As C Return Nothing End Operator End|] Class ", Diagnostic("Token", "C").WithLocation(2, 7), Diagnostic("Token", "End").WithLocation(7, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnConstructorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class Base { public Base(int x) {} } class C : Base [|{ [" + attrName + @"(""Test"", ""Token"")] public C() : base(0) {} }|] ", Diagnostic("Token", "{").WithLocation(8, 1), Diagnostic("Token", "}").WithLocation(11, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnConstructorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class [|C <" + attrName + @"(""Test"", ""Token"")> Public Sub New() End Sub End|] Class ", Diagnostic("Token", "C").WithLocation(2, 7), Diagnostic("Token", "End").WithLocation(6, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnDestructorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C [|{ [" + attrName + @"(""Test"", ""Token"")] ~C() {} }|] ", Diagnostic("Token", "{").WithLocation(3, 1), Diagnostic("Token", "}").WithLocation(6, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNestedTypeCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C [|{ [" + attrName + @"(""Test"", ""Token"")] class D { class E { } } }|] ", Diagnostic("Token", "{").WithLocation(3, 1), Diagnostic("Token", "}").WithLocation(11, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNestedTypeBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class [|C <" + attrName + @"(""Test"", ""Token"")> Class D Class E End Class End Class End|] Class ", Diagnostic("Token", "C").WithLocation(2, 7), Diagnostic("Token", "End").WithLocation(8, 1)); } #endregion #region Special Cases [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageCompilationEnded(string attrName) { await VerifyCSharpAsync( @"[module: " + attrName + @"(""Test"", ""CompilationEnded"")]", new[] { new WarningOnCompilationEndedAnalyzer() }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageOnPropertyAccessor(string attrName) { await VerifyCSharpAsync(@" public class C { [" + attrName + @"(""Test"", ""Declaration"")] public string P { get; private set; } } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("get_") }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageOnDelegateInvoke(string attrName) { await VerifyCSharpAsync(@" public class C { [" + attrName + @"(""Test"", ""Declaration"")] delegate void D(); } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("Invoke") }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageOnCodeBodyCSharp(string attrName) { await VerifyCSharpAsync( @" public class C { [" + attrName + @"(""Test"", ""CodeBody"")] void Goo() { Goo(); } } ", new[] { new WarningOnCodeBodyAnalyzer(LanguageNames.CSharp) }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageOnCodeBodyBasic(string attrName) { await VerifyBasicAsync( @" Public Class C <" + attrName + @"(""Test"", ""CodeBody"")> Sub Goo() Goo() End Sub End Class ", new[] { new WarningOnCodeBodyAnalyzer(LanguageNames.VisualBasic) }); } #endregion #region Attribute Decoding [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task UnnecessaryScopeAndTarget(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [" + attrName + @"(""Test"", ""Declaration"", Scope=""Type"")] public class C1 { } [" + attrName + @"(""Test"", ""Declaration"", Target=""C"")] public class C2 { } [" + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""C"")] public class C3 { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task InvalidScopeOrTarget(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Class"", Target=""C"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Class"", Target=""E"")] public class C { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }, Diagnostic("Declaration", "C")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task MissingScopeOrTarget(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [module: " + attrName + @"(""Test"", ""Declaration"", Target=""C"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"")] public class C { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }, Diagnostic("Declaration", "C")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task InvalidAttributeConstructorParameters(string attrName) { await VerifyBasicAsync(@" Imports System.Diagnostics.CodeAnalysis <module: " + attrName + @"UndeclaredIdentifier, ""Comment"")> <module: " + attrName + @"(""Test"", UndeclaredIdentifier)> <module: " + attrName + @"(""Test"", ""Comment"", Scope:=UndeclaredIdentifier, Target:=""C"")> <module: " + attrName + @"(""Test"", ""Comment"", Scope:=""Type"", Target:=UndeclaredIdentifier)> Class C End Class ", new[] { new WarningOnTypeDeclarationAnalyzer() }, Diagnostic("TypeDeclaration", "C").WithLocation(9, 7)); } #endregion protected async Task VerifyCSharpAsync(string source, DiagnosticAnalyzer[] analyzers, params DiagnosticDescription[] diagnostics) { await VerifyAsync(source, LanguageNames.CSharp, analyzers, diagnostics); } protected Task VerifyTokenDiagnosticsCSharpAsync(string markup, params DiagnosticDescription[] diagnostics) { return VerifyTokenDiagnosticsAsync(markup, LanguageNames.CSharp, diagnostics); } protected async Task VerifyBasicAsync(string source, string rootNamespace, DiagnosticAnalyzer[] analyzers, params DiagnosticDescription[] diagnostics) { Assert.False(string.IsNullOrWhiteSpace(rootNamespace), string.Format("Invalid root namespace '{0}'", rootNamespace)); await VerifyAsync(source, LanguageNames.VisualBasic, analyzers, diagnostics, rootNamespace: rootNamespace); } protected async Task VerifyBasicAsync(string source, DiagnosticAnalyzer[] analyzers, params DiagnosticDescription[] diagnostics) { await VerifyAsync(source, LanguageNames.VisualBasic, analyzers, diagnostics); } protected Task VerifyTokenDiagnosticsBasicAsync(string markup, params DiagnosticDescription[] diagnostics) { return VerifyTokenDiagnosticsAsync(markup, LanguageNames.VisualBasic, diagnostics); } protected abstract Task VerifyAsync(string source, string language, DiagnosticAnalyzer[] analyzers, DiagnosticDescription[] diagnostics, string rootNamespace = null); // Generate a diagnostic on every token in the specified spans, and verify that only the specified diagnostics are not suppressed private Task VerifyTokenDiagnosticsAsync(string markup, string language, DiagnosticDescription[] diagnostics) { MarkupTestFile.GetSpans(markup, out var source, out ImmutableArray<TextSpan> spans); Assert.True(spans.Length > 0, "Must specify a span within which to generate diagnostics on each token"); return VerifyAsync(source, language, new DiagnosticAnalyzer[] { new WarningOnTokenAnalyzer(spans) }, diagnostics); } protected abstract bool ConsiderArgumentsForComparingDiagnostics { get; } protected DiagnosticDescription Diagnostic(string id, string squiggledText) { var arguments = this.ConsiderArgumentsForComparingDiagnostics && squiggledText != null ? new[] { squiggledText } : null; return new DiagnosticDescription(id, false, squiggledText, arguments, null, null, false); } } }
// 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. #nullable disable using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Diagnostics { public abstract partial class SuppressMessageAttributeTests { #region Local Suppression public static IEnumerable<string[]> QualifiedAttributeNames { get; } = new[] { new[] { "System.Diagnostics.CodeAnalysis.SuppressMessageAttribute" }, new[] { "System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute" }, }; public static IEnumerable<string[]> SimpleAttributeNames { get; } = new[] { new[] { "SuppressMessage" }, new[] { "UnconditionalSuppressMessage" } }; [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task LocalSuppressionOnType(string attrName) { await VerifyCSharpAsync(@" [" + attrName + @"(""Test"", ""Declaration"")] public class C { } public class C1 { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }, Diagnostic("Declaration", "C1")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task MultipleLocalSuppressionsOnSingleSymbol(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [" + attrName + @"(""Test"", ""Declaration"")] [" + attrName + @"(""Test"", ""TypeDeclaration"")] public class C { } ", new DiagnosticAnalyzer[] { new WarningOnNamePrefixDeclarationAnalyzer("C"), new WarningOnTypeDeclarationAnalyzer() }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task DuplicateLocalSuppressions(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [" + attrName + @"(""Test"", ""Declaration"")] [" + attrName + @"(""Test"", ""Declaration"")] public class C { } ", new DiagnosticAnalyzer[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task LocalSuppressionOnMember(string attrName) { await VerifyCSharpAsync(@" public class C { [" + attrName + @"(""Test"", ""Declaration"")] public void Goo() {} public void Goo1() {} } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("Goo") }, Diagnostic("Declaration", "Goo1")); } #endregion #region Global Suppression [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnNamespaces(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Namespace"", Target=""N"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Namespace"", Target=""N.N1"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Namespace"", Target=""N4"")] namespace N { namespace N1 { namespace N2.N3 { } } } namespace N4 { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("N") }, Diagnostic("Declaration", "N2"), Diagnostic("Declaration", "N3")); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnNamespaces_NamespaceAndDescendants(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""NamespaceAndDescendants"", Target=""N.N1"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""namespaceanddescendants"", Target=""N4"")] namespace N { namespace N1 { namespace N2.N3 { } } } namespace N4 { namespace N5 { } } namespace N.N1.N6.N7 { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("N") }, Diagnostic("Declaration", "N")); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnTypesAndNamespaces_NamespaceAndDescendants(string attrName) { var source = @" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""NamespaceAndDescendants"", Target=""N.N1.N2"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""NamespaceAndDescendants"", Target=""N4"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""C2"")] namespace N { namespace N1 { class C1 { } namespace N2.N3 { class C2 { } class C3 { class C4 { } } } } } namespace N4 { namespace N5 { class C5 { } } class C6 { } } namespace N.N1.N2.N7 { class C7 { } } "; await VerifyCSharpAsync(source, new[] { new WarningOnNamePrefixDeclarationAnalyzer("N") }, Diagnostic("Declaration", "N"), Diagnostic("Declaration", "N1")); await VerifyCSharpAsync(source, new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }, Diagnostic("Declaration", "C1")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnTypes(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""Ef"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""Egg"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""Ele`2"")] public class E { } public interface Ef { } public struct Egg { } public delegate void Ele<T1,T2>(T1 x, T2 y); ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("E") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnNestedTypes(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""type"", Target=""C.A1"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""type"", Target=""C+A2"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""member"", Target=""C+A3"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""member"", Target=""C.A4"")] public class C { public class A1 { } public class A2 { } public class A3 { } public delegate void A4(); } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("A") }, Diagnostic("Declaration", "A1"), Diagnostic("Declaration", "A3"), Diagnostic("Declaration", "A4")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GlobalSuppressionOnBasicModule(string attrName) { await VerifyBasicAsync(@" <assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""type"", Target=""M"")> Module M Class C End Class End Module ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("M") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnMembers(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Member"", Target=""C.#M1"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Member"", Target=""C.#M3`1()"")] public class C { int M1; public void M2() {} public static void M3<T>() {} } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("M") }, new[] { Diagnostic("Declaration", "M2") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task GlobalSuppressionOnValueTupleMemberWithDocId(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Member"", Target=""~M:C.M~System.Threading.Tasks.Task{System.ValueTuple{System.Boolean,ErrorCode}}"")] enum ErrorCode {} class C { Task<(bool status, ErrorCode errorCode)> M() => null; } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("M") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task MultipleGlobalSuppressionsOnSingleSymbol(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] [assembly: " + attrName + @"(""Test"", ""TypeDeclaration"", Scope=""Type"", Target=""E"")] public class E { } ", new DiagnosticAnalyzer[] { new WarningOnNamePrefixDeclarationAnalyzer("E"), new WarningOnTypeDeclarationAnalyzer() }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task DuplicateGlobalSuppressions(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] [assembly: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] public class E { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("E") }); } #endregion #region Syntax Semantics [Fact] public async Task WarningOnCommentAnalyzerCSharp() { await VerifyCSharpAsync("// Comment\r\n /* Comment */", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "// Comment"), Diagnostic("Comment", "/* Comment */")); } [Fact] public async Task WarningOnCommentAnalyzerBasic() { await VerifyBasicAsync("' Comment", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "' Comment")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GloballySuppressSyntaxDiagnosticsCSharp(string attrName) { await VerifyCSharpAsync(@" // before module attributes [module: " + attrName + @"(""Test"", ""Comment"")] // before class public class C { // before method public void Goo() // after method declaration { // inside method } } // after class ", new[] { new WarningOnCommentAnalyzer() }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GloballySuppressSyntaxDiagnosticsBasic(string attrName) { await VerifyBasicAsync(@" ' before module attributes <Module: " + attrName + @"(""Test"", ""Comment"")> ' before class Public Class C ' before sub Public Sub Goo() ' after sub statement ' inside sub End Sub End Class ' after class ", new[] { new WarningOnCommentAnalyzer() }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GloballySuppressSyntaxDiagnosticsOnTargetCSharp(string attrName) { await VerifyCSharpAsync(@" // before module attributes [module: " + attrName + @"(""Test"", ""Comment"", Scope=""Member"" Target=""C.Goo():System.Void"")] // before class public class C { // before method public void Goo() // after method declaration { // inside method } } // after class ", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "// before module attributes"), Diagnostic("Comment", "// before class"), Diagnostic("Comment", "// after class")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task GloballySuppressSyntaxDiagnosticsOnTargetBasic(string attrName) { await VerifyBasicAsync(@" ' before module attributes <Module: " + attrName + @"(""Test"", ""Comment"", Scope:=""Member"", Target:=""C.Goo():System.Void"")> ' before class Public Class C ' before sub Public Sub Goo() ' after sub statement ' inside sub End Sub End Class ' after class ", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "' before module attributes"), Diagnostic("Comment", "' before class"), Diagnostic("Comment", "' after class")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNamespaceDeclarationCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" [assembly: " + attrName + @"(""Test"", ""Token"", Scope=""namespace"", Target=""A.B"")] namespace A [|{ namespace B { class C {} } }|] ", Diagnostic("Token", "{").WithLocation(4, 1), Diagnostic("Token", "class").WithLocation(7, 9), Diagnostic("Token", "C").WithLocation(7, 15), Diagnostic("Token", "{").WithLocation(7, 17), Diagnostic("Token", "}").WithLocation(7, 18), Diagnostic("Token", "}").WithLocation(9, 1)); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNamespaceAndChildDeclarationCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" [assembly: " + attrName + @"(""Test"", ""Token"", Scope=""NamespaceAndDescendants"", Target=""A.B"")] namespace A [|{ namespace B { class C {} } }|] ", Diagnostic("Token", "{").WithLocation(4, 1), Diagnostic("Token", "}").WithLocation(9, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNamespaceDeclarationBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" <assembly: " + attrName + @"(""Test"", ""Token"", Scope:=""Namespace"", Target:=""A.B"")> Namespace [|A Namespace B Class C End Class End Namespace End|] Namespace ", Diagnostic("Token", "A").WithLocation(3, 11), Diagnostic("Token", "Class").WithLocation(5, 9), Diagnostic("Token", "C").WithLocation(5, 15), Diagnostic("Token", "End").WithLocation(6, 9), Diagnostic("Token", "Class").WithLocation(6, 13), Diagnostic("Token", "End").WithLocation(8, 1)); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNamespaceAndDescendantsDeclarationBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" <assembly: " + attrName + @"(""Test"", ""Token"", Scope:=""NamespaceAndDescendants"", Target:=""A.B"")> Namespace [|A Namespace B Class C End Class End Namespace End|] Namespace ", Diagnostic("Token", "A").WithLocation(3, 11), Diagnostic("Token", "End").WithLocation(8, 1)); } [Theory, WorkItem(486, "https://github.com/dotnet/roslyn/issues/486")] [InlineData("Namespace")] [InlineData("NamespaceAndDescendants")] public async Task DontSuppressSyntaxDiagnosticsInRootNamespaceBasic(string scope) { await VerifyBasicAsync($@" <module: System.Diagnostics.SuppressMessage(""Test"", ""Comment"", Scope:=""{scope}"", Target:=""RootNamespace"")> ' In root namespace ", rootNamespace: "RootNamespace", analyzers: new[] { new WarningOnCommentAnalyzer() }, diagnostics: Diagnostic("Comment", "' In root namespace").WithLocation(3, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnTypesCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" using System.Diagnostics.CodeAnalysis; namespace N [|{ [" + attrName + @"(""Test"", ""Token"")] class C<T> {} [" + attrName + @"(""Test"", ""Token"")] struct S<T> {} [" + attrName + @"(""Test"", ""Token"")] interface I<T>{} [" + attrName + @"(""Test"", ""Token"")] enum E {} [" + attrName + @"(""Test"", ""Token"")] delegate void D(); }|] ", Diagnostic("Token", "{").WithLocation(5, 1), Diagnostic("Token", "}").WithLocation(20, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnTypesBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Namespace [|N <" + attrName + @"(""Test"", ""Token"")> Module M End Module <" + attrName + @"(""Test"", ""Token"")> Class C End Class <" + attrName + @"(""Test"", ""Token"")> Structure S End Structure <" + attrName + @"(""Test"", ""Token"")> Interface I End Interface <" + attrName + @"(""Test"", ""Token"")> Enum E None End Enum <" + attrName + @"(""Test"", ""Token"")> Delegate Sub D() End|] Namespace ", Diagnostic("Token", "N").WithLocation(4, 11), Diagnostic("Token", "End").WithLocation(28, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnFieldsCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" using System.Diagnostics.CodeAnalysis; class C [|{ [" + attrName + @"(""Test"", ""Token"")] int field1 = 1, field2 = 2; [" + attrName + @"(""Test"", ""Token"")] int field3 = 3; }|] ", Diagnostic("Token", "{"), Diagnostic("Token", "}")); } [Theory] [WorkItem(6379, "https://github.com/dotnet/roslyn/issues/6379")] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEnumFieldsCSharp(string attrName) { await VerifyCSharpAsync(@" // before module attributes [module: " + attrName + @"(""Test"", ""Comment"", Scope=""Member"" Target=""E.Field1"")] // before enum public enum E { // before Field1 declaration Field1, // after Field1 declaration Field2 // after Field2 declaration } // after enum ", new[] { new WarningOnCommentAnalyzer() }, Diagnostic("Comment", "// before module attributes"), Diagnostic("Comment", "// before enum"), Diagnostic("Comment", "// after Field1 declaration"), Diagnostic("Comment", "// after Field2 declaration"), Diagnostic("Comment", "// after enum")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnFieldsBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Class [|C <" + attrName + @"(""Test"", ""Token"")> Public field1 As Integer = 1, field2 As Double = 2.0 <" + attrName + @"(""Test"", ""Token"")> Public field3 As Integer = 3 End|] Class ", Diagnostic("Token", "C"), Diagnostic("Token", "End")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventsCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C [|{ [" + attrName + @"(""Test"", ""Token"")] public event System.Action<int> E1; [" + attrName + @"(""Test"", ""Token"")] public event System.Action<int> E2, E3; }|] ", Diagnostic("Token", "{"), Diagnostic("Token", "}")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventsBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Class [|C <" + attrName + @"(""Test"", ""Token"")> Public Event E1 As System.Action(Of Integer) <" + attrName + @"(""Test"", ""Token"")> Public Event E2(ByVal arg As Integer) End|] Class ", Diagnostic("Token", "C"), Diagnostic("Token", "End")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventAddAccessorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { public event System.Action<int> E [|{ [" + attrName + @"(""Test"", ""Token"")] add {} remove|] {} } } ", Diagnostic("Token", "{").WithLocation(5, 5), Diagnostic("Token", "remove").WithLocation(8, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventAddAccessorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Public Custom Event E As System.Action(Of Integer[|) <" + attrName + @"(""Test"", ""Token"")> AddHandler(value As Action(Of Integer)) End AddHandler RemoveHandler|](value As Action(Of Integer)) End RemoveHandler RaiseEvent(obj As Integer) End RaiseEvent End Event End Class ", Diagnostic("Token", ")"), Diagnostic("Token", "RemoveHandler")); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventRemoveAccessorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { public event System.Action<int> E { add {[|} [" + attrName + @"(""Test"", ""Token"")] remove {} }|] } ", Diagnostic("Token", "}").WithLocation(6, 14), Diagnostic("Token", "}").WithLocation(9, 5)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnEventRemoveAccessorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Public Custom Event E As System.Action(Of Integer) AddHandler(value As Action(Of Integer)) End [|AddHandler <" + attrName + @"(""Test"", ""Token"")> RemoveHandler(value As Action(Of Integer)) End RemoveHandler RaiseEvent|](obj As Integer) End RaiseEvent End Event End Class ", Diagnostic("Token", "AddHandler"), Diagnostic("Token", "RaiseEvent")); } [WorkItem(1103442, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1103442")] [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnRaiseEventAccessorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Public Custom Event E As System.Action(Of Integer) AddHandler(value As Action(Of Integer)) End AddHandler RemoveHandler(value As Action(Of Integer)) End [|RemoveHandler <" + attrName + @"(""Test"", ""Token"")> RaiseEvent(obj As Integer) End RaiseEvent End|] Event End Class ", Diagnostic("Token", "RemoveHandler"), Diagnostic("Token", "End")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertyCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" using System.Diagnostics.CodeAnalysis; class C [|{ [" + attrName + @"(""Test"", ""Token"")] int Property1 { get; set; } [" + attrName + @"(""Test"", ""Token"")] int Property2 { get { return 2; } set { Property1 = 2; } } }|] ", Diagnostic("Token", "{").WithLocation(5, 1), Diagnostic("Token", "}").WithLocation(15, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertyBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Class [|C <" + attrName + @"(""Test"", ""Token"")> Property Property1 As Integer <" + attrName + @"(""Test"", ""Token"")> Property Property2 As Integer Get Return 2 End Get Set(value As Integer) Property1 = value End Set End Property End|] Class ", Diagnostic("Token", "C").WithLocation(4, 7), Diagnostic("Token", "End").WithLocation(17, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertyGetterCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x; int Property [|{ [" + attrName + @"(""Test"", ""Token"")] get { return 2; } set|] { x = 2; } } } ", Diagnostic("Token", "{").WithLocation(6, 5), Diagnostic("Token", "set").WithLocation(9, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertyGetterBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Private x As Integer Property [Property] As [|Integer <" + attrName + @"(""Test"", ""Token"")> Get Return 2 End Get Set|](value As Integer) x = value End Set End Property End Class ", Diagnostic("Token", "Integer").WithLocation(4, 28), Diagnostic("Token", "Set").WithLocation(9, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertySetterCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x; int Property [|{ [" + attrName + @"(""Test"", ""Token"")] get { return 2; } set|] { x = 2; } } } ", Diagnostic("Token", "{").WithLocation(6, 5), Diagnostic("Token", "set").WithLocation(9, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnPropertySetterBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class C Private x As Integer Property [Property] As Integer Get Return 2 End [|Get <" + attrName + @"(""Test"", ""Token"")> Set(value As Integer) x = value End Set End|] Property End Class ", Diagnostic("Token", "Get").WithLocation(7, 13), Diagnostic("Token", "End").WithLocation(12, 5)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnIndexerCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x[|; [" + attrName + @"(""Test"", ""Token"")] int this[int i] { get { return 2; } set { x = 2; } } }|] ", Diagnostic("Token", ";").WithLocation(4, 10), Diagnostic("Token", "}").WithLocation(11, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnIndexerGetterCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x; int this[int i] [|{ [" + attrName + @"(""Test"", ""Token"")] get { return 2; } set|] { x = 2; } } } ", Diagnostic("Token", "{").WithLocation(6, 5), Diagnostic("Token", "set").WithLocation(9, 9)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnIndexerSetterCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C { int x; int this[int i] { get { return 2; [|} [" + attrName + @"(""Test"", ""Token"")] set { x = 2; } }|] } ", Diagnostic("Token", "}").WithLocation(7, 25), Diagnostic("Token", "}").WithLocation(10, 5)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnMethodCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" using System.Diagnostics.CodeAnalysis; abstract class C [|{ [" + attrName + @"(""Test"", ""Token"")] public void M1<T>() {} [" + attrName + @"(""Test"", ""Token"")] public abstract void M2(); }|] ", Diagnostic("Token", "{").WithLocation(5, 1), Diagnostic("Token", "}").WithLocation(11, 1)); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnMethodBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Imports System.Diagnostics.CodeAnalysis Public MustInherit Class [|C <" + attrName + @"(""Test"", ""Token"")> Public Function M2(Of T)() As Integer Return 0 End Function <" + attrName + @"(""Test"", ""Token"")> Public MustOverride Sub M3() End|] Class ", Diagnostic("Token", "C").WithLocation(4, 26), Diagnostic("Token", "End").WithLocation(12, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnOperatorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C [|{ [" + attrName + @"(""Test"", ""Token"")] public static C operator +(C a, C b) { return null; } }|] ", Diagnostic("Token", "{").WithLocation(3, 1), Diagnostic("Token", "}").WithLocation(9, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnOperatorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class [|C <" + attrName + @"(""Test"", ""Token"")> Public Shared Operator +(ByVal a As C, ByVal b As C) As C Return Nothing End Operator End|] Class ", Diagnostic("Token", "C").WithLocation(2, 7), Diagnostic("Token", "End").WithLocation(7, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnConstructorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class Base { public Base(int x) {} } class C : Base [|{ [" + attrName + @"(""Test"", ""Token"")] public C() : base(0) {} }|] ", Diagnostic("Token", "{").WithLocation(8, 1), Diagnostic("Token", "}").WithLocation(11, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnConstructorBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class [|C <" + attrName + @"(""Test"", ""Token"")> Public Sub New() End Sub End|] Class ", Diagnostic("Token", "C").WithLocation(2, 7), Diagnostic("Token", "End").WithLocation(6, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnDestructorCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C [|{ [" + attrName + @"(""Test"", ""Token"")] ~C() {} }|] ", Diagnostic("Token", "{").WithLocation(3, 1), Diagnostic("Token", "}").WithLocation(6, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNestedTypeCSharp(string attrName) { await VerifyTokenDiagnosticsCSharpAsync(@" class C [|{ [" + attrName + @"(""Test"", ""Token"")] class D { class E { } } }|] ", Diagnostic("Token", "{").WithLocation(3, 1), Diagnostic("Token", "}").WithLocation(11, 1)); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressSyntaxDiagnosticsOnNestedTypeBasic(string attrName) { await VerifyTokenDiagnosticsBasicAsync(@" Class [|C <" + attrName + @"(""Test"", ""Token"")> Class D Class E End Class End Class End|] Class ", Diagnostic("Token", "C").WithLocation(2, 7), Diagnostic("Token", "End").WithLocation(8, 1)); } #endregion #region Special Cases [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageCompilationEnded(string attrName) { await VerifyCSharpAsync( @"[module: " + attrName + @"(""Test"", ""CompilationEnded"")]", new[] { new WarningOnCompilationEndedAnalyzer() }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageOnPropertyAccessor(string attrName) { await VerifyCSharpAsync(@" public class C { [" + attrName + @"(""Test"", ""Declaration"")] public string P { get; private set; } } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("get_") }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageOnDelegateInvoke(string attrName) { await VerifyCSharpAsync(@" public class C { [" + attrName + @"(""Test"", ""Declaration"")] delegate void D(); } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("Invoke") }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageOnCodeBodyCSharp(string attrName) { await VerifyCSharpAsync( @" public class C { [" + attrName + @"(""Test"", ""CodeBody"")] void Goo() { Goo(); } } ", new[] { new WarningOnCodeBodyAnalyzer(LanguageNames.CSharp) }); } [Theory] [MemberData(nameof(QualifiedAttributeNames))] public async Task SuppressMessageOnCodeBodyBasic(string attrName) { await VerifyBasicAsync( @" Public Class C <" + attrName + @"(""Test"", ""CodeBody"")> Sub Goo() Goo() End Sub End Class ", new[] { new WarningOnCodeBodyAnalyzer(LanguageNames.VisualBasic) }); } #endregion #region Attribute Decoding [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task UnnecessaryScopeAndTarget(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [" + attrName + @"(""Test"", ""Declaration"", Scope=""Type"")] public class C1 { } [" + attrName + @"(""Test"", ""Declaration"", Target=""C"")] public class C2 { } [" + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""C"")] public class C3 { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task InvalidScopeOrTarget(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Class"", Target=""C"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"", Target=""E"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Class"", Target=""E"")] public class C { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }, Diagnostic("Declaration", "C")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task MissingScopeOrTarget(string attrName) { await VerifyCSharpAsync(@" using System.Diagnostics.CodeAnalysis; [module: " + attrName + @"(""Test"", ""Declaration"", Target=""C"")] [module: " + attrName + @"(""Test"", ""Declaration"", Scope=""Type"")] public class C { } ", new[] { new WarningOnNamePrefixDeclarationAnalyzer("C") }, Diagnostic("Declaration", "C")); } [Theory] [MemberData(nameof(SimpleAttributeNames))] public async Task InvalidAttributeConstructorParameters(string attrName) { await VerifyBasicAsync(@" Imports System.Diagnostics.CodeAnalysis <module: " + attrName + @"UndeclaredIdentifier, ""Comment"")> <module: " + attrName + @"(""Test"", UndeclaredIdentifier)> <module: " + attrName + @"(""Test"", ""Comment"", Scope:=UndeclaredIdentifier, Target:=""C"")> <module: " + attrName + @"(""Test"", ""Comment"", Scope:=""Type"", Target:=UndeclaredIdentifier)> Class C End Class ", new[] { new WarningOnTypeDeclarationAnalyzer() }, Diagnostic("TypeDeclaration", "C").WithLocation(9, 7)); } #endregion protected async Task VerifyCSharpAsync(string source, DiagnosticAnalyzer[] analyzers, params DiagnosticDescription[] diagnostics) { await VerifyAsync(source, LanguageNames.CSharp, analyzers, diagnostics); } protected Task VerifyTokenDiagnosticsCSharpAsync(string markup, params DiagnosticDescription[] diagnostics) { return VerifyTokenDiagnosticsAsync(markup, LanguageNames.CSharp, diagnostics); } protected async Task VerifyBasicAsync(string source, string rootNamespace, DiagnosticAnalyzer[] analyzers, params DiagnosticDescription[] diagnostics) { Assert.False(string.IsNullOrWhiteSpace(rootNamespace), string.Format("Invalid root namespace '{0}'", rootNamespace)); await VerifyAsync(source, LanguageNames.VisualBasic, analyzers, diagnostics, rootNamespace: rootNamespace); } protected async Task VerifyBasicAsync(string source, DiagnosticAnalyzer[] analyzers, params DiagnosticDescription[] diagnostics) { await VerifyAsync(source, LanguageNames.VisualBasic, analyzers, diagnostics); } protected Task VerifyTokenDiagnosticsBasicAsync(string markup, params DiagnosticDescription[] diagnostics) { return VerifyTokenDiagnosticsAsync(markup, LanguageNames.VisualBasic, diagnostics); } protected abstract Task VerifyAsync(string source, string language, DiagnosticAnalyzer[] analyzers, DiagnosticDescription[] diagnostics, string rootNamespace = null); // Generate a diagnostic on every token in the specified spans, and verify that only the specified diagnostics are not suppressed private Task VerifyTokenDiagnosticsAsync(string markup, string language, DiagnosticDescription[] diagnostics) { MarkupTestFile.GetSpans(markup, out var source, out ImmutableArray<TextSpan> spans); Assert.True(spans.Length > 0, "Must specify a span within which to generate diagnostics on each token"); return VerifyAsync(source, language, new DiagnosticAnalyzer[] { new WarningOnTokenAnalyzer(spans) }, diagnostics); } protected abstract bool ConsiderArgumentsForComparingDiagnostics { get; } protected DiagnosticDescription Diagnostic(string id, string squiggledText) { var arguments = this.ConsiderArgumentsForComparingDiagnostics && squiggledText != null ? new[] { squiggledText } : null; return new DiagnosticDescription(id, false, squiggledText, arguments, null, null, false); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Rules/NextGetAdjustSpacesOperation.cs
// 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 System.Collections.Immutable; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Formatting.Rules { [NonDefaultable] internal readonly struct NextGetAdjustSpacesOperation { private readonly ImmutableArray<AbstractFormattingRule> _formattingRules; private readonly int _index; public NextGetAdjustSpacesOperation( ImmutableArray<AbstractFormattingRule> formattingRules, int index) { _formattingRules = formattingRules; _index = index; } private NextGetAdjustSpacesOperation NextOperation => new(_formattingRules, _index + 1); public AdjustSpacesOperation? Invoke(in SyntaxToken previousToken, in SyntaxToken currentToken) { // If we have no remaining handlers to execute, then we'll execute our last handler if (_index >= _formattingRules.Length) { return null; } else { // Call the handler at the index, passing a continuation that will come back to here with index + 1 return _formattingRules[_index].GetAdjustSpacesOperation(in previousToken, in currentToken, NextOperation); } } } }
// 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 System.Collections.Immutable; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Formatting.Rules { [NonDefaultable] internal readonly struct NextGetAdjustSpacesOperation { private readonly ImmutableArray<AbstractFormattingRule> _formattingRules; private readonly int _index; public NextGetAdjustSpacesOperation( ImmutableArray<AbstractFormattingRule> formattingRules, int index) { _formattingRules = formattingRules; _index = index; } private NextGetAdjustSpacesOperation NextOperation => new(_formattingRules, _index + 1); public AdjustSpacesOperation? Invoke(in SyntaxToken previousToken, in SyntaxToken currentToken) { // If we have no remaining handlers to execute, then we'll execute our last handler if (_index >= _formattingRules.Length) { return null; } else { // Call the handler at the index, passing a continuation that will come back to here with index + 1 return _formattingRules[_index].GetAdjustSpacesOperation(in previousToken, in currentToken, NextOperation); } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/CSharp/Portable/Symbols/NullableContextKind.cs
// 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. #nullable disable using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols { /// <summary> /// Used by symbol implementations (source and metadata) to represent the value /// that was mapped from, or will be mapped to a [NullableContext] attribute. /// </summary> internal enum NullableContextKind : byte { /// <summary> /// Uninitialized state /// </summary> Unknown = 0, /// <summary> /// No [NullableContext] attribute /// </summary> None, /// <summary> /// [NullableContext(0)] /// </summary> Oblivious, /// <summary> /// [NullableContext(1)] /// </summary> NotAnnotated, /// <summary> /// [NullableContext(2)] /// </summary> Annotated, } internal static class NullableContextExtensions { internal static bool TryGetByte(this NullableContextKind kind, out byte? value) { switch (kind) { case NullableContextKind.Unknown: value = null; return false; case NullableContextKind.None: value = null; return true; case NullableContextKind.Oblivious: value = NullableAnnotationExtensions.ObliviousAttributeValue; return true; case NullableContextKind.NotAnnotated: value = NullableAnnotationExtensions.NotAnnotatedAttributeValue; return true; case NullableContextKind.Annotated: value = NullableAnnotationExtensions.AnnotatedAttributeValue; return true; default: throw ExceptionUtilities.UnexpectedValue(kind); } } internal static NullableContextKind ToNullableContextFlags(this byte? value) { switch (value) { case null: return NullableContextKind.None; case NullableAnnotationExtensions.ObliviousAttributeValue: return NullableContextKind.Oblivious; case NullableAnnotationExtensions.NotAnnotatedAttributeValue: return NullableContextKind.NotAnnotated; case NullableAnnotationExtensions.AnnotatedAttributeValue: return NullableContextKind.Annotated; default: throw ExceptionUtilities.UnexpectedValue(value); } } } }
// 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. #nullable disable using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols { /// <summary> /// Used by symbol implementations (source and metadata) to represent the value /// that was mapped from, or will be mapped to a [NullableContext] attribute. /// </summary> internal enum NullableContextKind : byte { /// <summary> /// Uninitialized state /// </summary> Unknown = 0, /// <summary> /// No [NullableContext] attribute /// </summary> None, /// <summary> /// [NullableContext(0)] /// </summary> Oblivious, /// <summary> /// [NullableContext(1)] /// </summary> NotAnnotated, /// <summary> /// [NullableContext(2)] /// </summary> Annotated, } internal static class NullableContextExtensions { internal static bool TryGetByte(this NullableContextKind kind, out byte? value) { switch (kind) { case NullableContextKind.Unknown: value = null; return false; case NullableContextKind.None: value = null; return true; case NullableContextKind.Oblivious: value = NullableAnnotationExtensions.ObliviousAttributeValue; return true; case NullableContextKind.NotAnnotated: value = NullableAnnotationExtensions.NotAnnotatedAttributeValue; return true; case NullableContextKind.Annotated: value = NullableAnnotationExtensions.AnnotatedAttributeValue; return true; default: throw ExceptionUtilities.UnexpectedValue(kind); } } internal static NullableContextKind ToNullableContextFlags(this byte? value) { switch (value) { case null: return NullableContextKind.None; case NullableAnnotationExtensions.ObliviousAttributeValue: return NullableContextKind.Oblivious; case NullableAnnotationExtensions.NotAnnotatedAttributeValue: return NullableContextKind.NotAnnotated; case NullableAnnotationExtensions.AnnotatedAttributeValue: return NullableContextKind.Annotated; default: throw ExceptionUtilities.UnexpectedValue(value); } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableSegmentedDictionaryTest.cs
// 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. // NOTE: This code is derived from an implementation originally in dotnet/runtime: // https://github.com/dotnet/runtime/blob/v5.0.2/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryTest.cs // // See the commentary in https://github.com/dotnet/roslyn/pull/50156 for notes on incorporating changes made to the // reference implementation. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Reflection; using Microsoft.CodeAnalysis.Collections; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Collections { public partial class ImmutableSegmentedDictionaryTest : ImmutableDictionaryTestBase { [Fact] public void AddExistingKeySameValueTest() { AddExistingKeySameValueTestHelper(Empty<string, string>(StringComparer.Ordinal), "Company", "Microsoft", "Microsoft"); } [Fact] public void AddExistingKeyDifferentValueTest() { AddExistingKeyDifferentValueTestHelper(Empty<string, string>(StringComparer.Ordinal), "Company", "Microsoft", "MICROSOFT"); } [Fact] public void UnorderedChangeTest() { var map = Empty<string, string>(StringComparer.Ordinal) .Add("Johnny", "Appleseed") .Add("JOHNNY", "Appleseed"); Assert.Equal(2, map.Count); Assert.True(map.ContainsKey("Johnny")); Assert.False(map.ContainsKey("johnny")); var newMap = map.WithComparer(StringComparer.OrdinalIgnoreCase); Assert.Equal(1, newMap.Count); Assert.True(newMap.ContainsKey("Johnny")); Assert.True(newMap.ContainsKey("johnny")); // because it's case insensitive } [Fact] public void ToSortedTest() { var map = Empty<string, string>(StringComparer.Ordinal) .Add("Johnny", "Appleseed") .Add("JOHNNY", "Appleseed"); var sortedMap = map.ToImmutableSortedDictionary(StringComparer.Ordinal); Assert.Equal(sortedMap.Count, map.Count); CollectionAssertAreEquivalent<KeyValuePair<string, string>>(sortedMap.ToList(), map.ToList()); } [Fact] public void SetItemUpdateEqualKeyTest() { var map = Empty<string, int>().WithComparer(StringComparer.OrdinalIgnoreCase) .SetItem("A", 1); map = map.SetItem("a", 2); Assert.Equal("A", map.Keys.Single()); } [Fact] public void ContainsValueTest() { ContainsValueTestHelper(ImmutableSegmentedDictionary<int, GenericParameterHelper>.Empty, 1, new GenericParameterHelper()); } [Fact] public void ContainsValue_NoSuchValue_ReturnsFalse() { ImmutableSegmentedDictionary<int, string?> dictionary = new Dictionary<int, string?> { { 1, "a" }, { 2, "b" } }.ToImmutableSegmentedDictionary(); Assert.False(dictionary.ContainsValue("c")); Assert.False(dictionary.ContainsValue(null)); } [Fact] public void Create() { IEnumerable<KeyValuePair<string, string>> pairs = new Dictionary<string, string> { { "a", "b" } }; var keyComparer = StringComparer.OrdinalIgnoreCase; var dictionary = ImmutableSegmentedDictionary.Create<string, string>(); Assert.Equal(0, dictionary.Count); Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); dictionary = ImmutableSegmentedDictionary.Create<string, string>(keyComparer); Assert.Equal(0, dictionary.Count); Assert.Same(keyComparer, dictionary.KeyComparer); dictionary = ImmutableSegmentedDictionary.CreateRange(pairs); Assert.Equal(1, dictionary.Count); Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); dictionary = ImmutableSegmentedDictionary.CreateRange(keyComparer, pairs); Assert.Equal(1, dictionary.Count); Assert.Same(keyComparer, dictionary.KeyComparer); } [Fact] public void ToImmutableDictionary() { IEnumerable<KeyValuePair<string, string>> pairs = new Dictionary<string, string> { { "a", "B" } }; var keyComparer = StringComparer.OrdinalIgnoreCase; ImmutableSegmentedDictionary<string, string> dictionary = pairs.ToImmutableSegmentedDictionary(); Assert.Equal(1, dictionary.Count); Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); dictionary = pairs.ToImmutableSegmentedDictionary(keyComparer); Assert.Equal(1, dictionary.Count); Assert.Same(keyComparer, dictionary.KeyComparer); dictionary = pairs.ToImmutableSegmentedDictionary(p => p.Key.ToUpperInvariant(), p => p.Value.ToLowerInvariant()); Assert.Equal(1, dictionary.Count); Assert.Equal("A", dictionary.Keys.Single()); Assert.Equal("b", dictionary.Values.Single()); Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); dictionary = pairs.ToImmutableSegmentedDictionary(p => p.Key.ToUpperInvariant(), p => p.Value.ToLowerInvariant(), keyComparer); Assert.Equal(1, dictionary.Count); Assert.Equal("A", dictionary.Keys.Single()); Assert.Equal("b", dictionary.Values.Single()); Assert.Same(keyComparer, dictionary.KeyComparer); var list = new int[] { 1, 2 }; var intDictionary = list.ToImmutableSegmentedDictionary(n => (double)n); Assert.Equal(1, intDictionary[1.0]); Assert.Equal(2, intDictionary[2.0]); Assert.Equal(2, intDictionary.Count); var stringIntDictionary = list.ToImmutableSegmentedDictionary(n => n.ToString(), StringComparer.OrdinalIgnoreCase); Assert.Same(StringComparer.OrdinalIgnoreCase, stringIntDictionary.KeyComparer); Assert.Equal(1, stringIntDictionary["1"]); Assert.Equal(2, stringIntDictionary["2"]); Assert.Equal(2, intDictionary.Count); Assert.Throws<ArgumentNullException>("keySelector", () => list.ToImmutableSegmentedDictionary<int, int>(null!)); Assert.Throws<ArgumentNullException>("keySelector", () => list.ToImmutableSegmentedDictionary<int, int, int>(null!, v => v)); Assert.Throws<ArgumentNullException>("elementSelector", () => list.ToImmutableSegmentedDictionary<int, int, int>(k => k, null!)); list.ToDictionary(k => k, v => v, null); // verifies BCL behavior is to not throw. list.ToImmutableSegmentedDictionary(k => k, v => v, null); } [Fact] public void ToImmutableDictionaryOptimized() { var dictionary = ImmutableSegmentedDictionary.Create<string, string>(); var result = dictionary.ToImmutableSegmentedDictionary(); Assert.True(IsSame(dictionary, result)); var cultureComparer = StringComparer.CurrentCulture; result = dictionary.WithComparer(cultureComparer); Assert.Same(cultureComparer, result.KeyComparer); } [Fact] public void WithComparer() { var map = ImmutableSegmentedDictionary.Create<string, string>().Add("a", "1").Add("B", "1"); Assert.Same(EqualityComparer<string>.Default, map.KeyComparer); Assert.True(map.ContainsKey("a")); Assert.False(map.ContainsKey("A")); map = map.WithComparer(StringComparer.OrdinalIgnoreCase); Assert.Same(StringComparer.OrdinalIgnoreCase, map.KeyComparer); Assert.Equal(2, map.Count); Assert.True(map.ContainsKey("a")); Assert.True(map.ContainsKey("A")); Assert.True(map.ContainsKey("b")); } [Fact] public void WithComparerCollisions() { // First check where collisions have matching values. var map = ImmutableSegmentedDictionary.Create<string, string>() .Add("a", "1").Add("A", "1"); map = map.WithComparer(StringComparer.OrdinalIgnoreCase); Assert.Same(StringComparer.OrdinalIgnoreCase, map.KeyComparer); Assert.Equal(1, map.Count); Assert.True(map.ContainsKey("a")); Assert.Equal("1", map["a"]); // Now check where collisions have conflicting values. map = ImmutableSegmentedDictionary.Create<string, string>() .Add("a", "1").Add("A", "2").Add("b", "3"); Assert.Throws<ArgumentException>(null, () => map.WithComparer(StringComparer.OrdinalIgnoreCase)); } [Fact] public void CollisionExceptionMessageContainsKey() { var map = ImmutableSegmentedDictionary.Create<string, string>() .Add("firstKey", "1").Add("secondKey", "2"); var exception = Assert.Throws<ArgumentException>(null, () => map.Add("firstKey", "3")); Assert.Contains("firstKey", exception.Message); } [Fact] public void WithComparerEmptyCollection() { var map = ImmutableSegmentedDictionary.Create<string, string>(); Assert.Same(EqualityComparer<string>.Default, map.KeyComparer); map = map.WithComparer(StringComparer.OrdinalIgnoreCase); Assert.Same(StringComparer.OrdinalIgnoreCase, map.KeyComparer); } [Fact] public void GetValueOrDefaultOfIImmutableDictionary() { IImmutableDictionary<string, int> empty = ImmutableSegmentedDictionary.Create<string, int>(); IImmutableDictionary<string, int> populated = ImmutableSegmentedDictionary.Create<string, int>().Add("a", 5); Assert.Equal(0, empty.GetValueOrDefault("a")); Assert.Equal(1, empty.GetValueOrDefault("a", 1)); Assert.Equal(5, populated.GetValueOrDefault("a")); Assert.Equal(5, populated.GetValueOrDefault("a", 1)); } [Fact] public void GetValueOrDefaultOfConcreteType() { var empty = ImmutableSegmentedDictionary.Create<string, int>(); var populated = ImmutableSegmentedDictionary.Create<string, int>().Add("a", 5); Assert.Equal(0, empty.GetValueOrDefault("a")); Assert.Equal(1, empty.GetValueOrDefault("a", 1)); Assert.Equal(5, populated.GetValueOrDefault("a")); Assert.Equal(5, populated.GetValueOrDefault("a", 1)); } [Fact(Skip = "Not implemented: https://github.com/dotnet/roslyn/issues/50657")] public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSegmentedDictionary.Create<int, int>()); ImmutableSegmentedDictionary<string, int> dict = ImmutableSegmentedDictionary.Create<string, int>().Add("One", 1).Add("Two", 2); DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(dict); object rootNode = DebuggerAttributes.GetFieldValue(ImmutableSegmentedDictionary.Create<string, string>(), "_root") ?? throw new InvalidOperationException(); DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute<DebuggerBrowsableAttribute>()!.State == DebuggerBrowsableState.RootHidden); KeyValuePair<string, int>[]? items = itemProperty.GetValue(info.Instance) as KeyValuePair<string, int>[]; Assert.Equal(dict, items); } [Fact(Skip = "Not implemented: https://github.com/dotnet/roslyn/issues/50657")] public static void TestDebuggerAttributes_Null() { Type proxyType = DebuggerAttributes.GetProxyType(ImmutableSegmentedDictionary.Create<string, int>()); TargetInvocationException tie = Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(proxyType, (object?)null)); Assert.IsType<ArgumentNullException>(tie.InnerException); } [Fact] public void Clear_NoComparer_ReturnsEmptyWithoutComparer() { ImmutableSegmentedDictionary<string, int> dictionary = new Dictionary<string, int> { { "a", 1 } }.ToImmutableSegmentedDictionary(); Assert.True(IsSame(ImmutableSegmentedDictionary<string, int>.Empty, dictionary.Clear())); Assert.NotEmpty(dictionary); } [Fact] public void Clear_HasComparer_ReturnsEmptyWithOriginalComparer() { ImmutableSegmentedDictionary<string, int> dictionary = new Dictionary<string, int> { { "a", 1 } }.ToImmutableSegmentedDictionary(StringComparer.OrdinalIgnoreCase); ImmutableSegmentedDictionary<string, int> clearedDictionary = dictionary.Clear(); Assert.False(IsSame(ImmutableSegmentedDictionary<string, int>.Empty, clearedDictionary.Clear())); Assert.NotEmpty(dictionary); clearedDictionary = clearedDictionary.Add("a", 1); Assert.True(clearedDictionary.ContainsKey("A")); } [Fact] public void Indexer_KeyNotFoundException_ContainsKeyInMessage() { var map = ImmutableSegmentedDictionary.Create<string, string>() .Add("a", "1").Add("b", "2"); var missingKey = "__ThisKeyDoesNotExist__"; var exception = Assert.Throws<KeyNotFoundException>(() => map[missingKey]); Assert.Contains(missingKey, exception.Message); } protected override IImmutableDictionary<TKey, TValue> Empty<TKey, TValue>() { return ImmutableSegmentedDictionaryTest.Empty<TKey, TValue>(); } protected override IImmutableDictionary<string, TValue> Empty<TValue>(StringComparer comparer) { return ImmutableSegmentedDictionary.Create<string, TValue>(comparer); } protected override IEqualityComparer<TValue> GetValueComparer<TKey, TValue>(IImmutableDictionary<TKey, TValue> dictionary) { return EqualityComparer<TValue>.Default; } private protected static void ContainsValueTestHelper<TKey, TValue>(ImmutableSegmentedDictionary<TKey, TValue> map, TKey key, TValue value) where TKey : notnull { Assert.False(map.ContainsValue(value)); Assert.True(map.Add(key, value).ContainsValue(value)); } private static ImmutableSegmentedDictionary<TKey, TValue> Empty<TKey, TValue>(IEqualityComparer<TKey>? keyComparer = null) where TKey : notnull { return ImmutableSegmentedDictionary<TKey, TValue>.Empty.WithComparer(keyComparer); } /// <summary> /// An ordinal comparer for case-insensitive strings. /// </summary> private class MyStringOrdinalComparer : EqualityComparer<CaseInsensitiveString?> { public override bool Equals(CaseInsensitiveString? x, CaseInsensitiveString? y) { return StringComparer.Ordinal.Equals(x!.Value, y!.Value); } public override int GetHashCode(CaseInsensitiveString obj) { return StringComparer.Ordinal.GetHashCode(obj.Value); } } /// <summary> /// A string-wrapper that considers equality based on case insensitivity. /// </summary> private class CaseInsensitiveString { public CaseInsensitiveString(string value) { Value = value; } public string Value { get; private set; } public override int GetHashCode() { return StringComparer.OrdinalIgnoreCase.GetHashCode(this.Value); } public override bool Equals(object? obj) { return StringComparer.OrdinalIgnoreCase.Equals(this.Value, ((CaseInsensitiveString?)obj)!.Value); } } } }
// 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. // NOTE: This code is derived from an implementation originally in dotnet/runtime: // https://github.com/dotnet/runtime/blob/v5.0.2/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryTest.cs // // See the commentary in https://github.com/dotnet/roslyn/pull/50156 for notes on incorporating changes made to the // reference implementation. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Reflection; using Microsoft.CodeAnalysis.Collections; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Collections { public partial class ImmutableSegmentedDictionaryTest : ImmutableDictionaryTestBase { [Fact] public void AddExistingKeySameValueTest() { AddExistingKeySameValueTestHelper(Empty<string, string>(StringComparer.Ordinal), "Company", "Microsoft", "Microsoft"); } [Fact] public void AddExistingKeyDifferentValueTest() { AddExistingKeyDifferentValueTestHelper(Empty<string, string>(StringComparer.Ordinal), "Company", "Microsoft", "MICROSOFT"); } [Fact] public void UnorderedChangeTest() { var map = Empty<string, string>(StringComparer.Ordinal) .Add("Johnny", "Appleseed") .Add("JOHNNY", "Appleseed"); Assert.Equal(2, map.Count); Assert.True(map.ContainsKey("Johnny")); Assert.False(map.ContainsKey("johnny")); var newMap = map.WithComparer(StringComparer.OrdinalIgnoreCase); Assert.Equal(1, newMap.Count); Assert.True(newMap.ContainsKey("Johnny")); Assert.True(newMap.ContainsKey("johnny")); // because it's case insensitive } [Fact] public void ToSortedTest() { var map = Empty<string, string>(StringComparer.Ordinal) .Add("Johnny", "Appleseed") .Add("JOHNNY", "Appleseed"); var sortedMap = map.ToImmutableSortedDictionary(StringComparer.Ordinal); Assert.Equal(sortedMap.Count, map.Count); CollectionAssertAreEquivalent<KeyValuePair<string, string>>(sortedMap.ToList(), map.ToList()); } [Fact] public void SetItemUpdateEqualKeyTest() { var map = Empty<string, int>().WithComparer(StringComparer.OrdinalIgnoreCase) .SetItem("A", 1); map = map.SetItem("a", 2); Assert.Equal("A", map.Keys.Single()); } [Fact] public void ContainsValueTest() { ContainsValueTestHelper(ImmutableSegmentedDictionary<int, GenericParameterHelper>.Empty, 1, new GenericParameterHelper()); } [Fact] public void ContainsValue_NoSuchValue_ReturnsFalse() { ImmutableSegmentedDictionary<int, string?> dictionary = new Dictionary<int, string?> { { 1, "a" }, { 2, "b" } }.ToImmutableSegmentedDictionary(); Assert.False(dictionary.ContainsValue("c")); Assert.False(dictionary.ContainsValue(null)); } [Fact] public void Create() { IEnumerable<KeyValuePair<string, string>> pairs = new Dictionary<string, string> { { "a", "b" } }; var keyComparer = StringComparer.OrdinalIgnoreCase; var dictionary = ImmutableSegmentedDictionary.Create<string, string>(); Assert.Equal(0, dictionary.Count); Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); dictionary = ImmutableSegmentedDictionary.Create<string, string>(keyComparer); Assert.Equal(0, dictionary.Count); Assert.Same(keyComparer, dictionary.KeyComparer); dictionary = ImmutableSegmentedDictionary.CreateRange(pairs); Assert.Equal(1, dictionary.Count); Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); dictionary = ImmutableSegmentedDictionary.CreateRange(keyComparer, pairs); Assert.Equal(1, dictionary.Count); Assert.Same(keyComparer, dictionary.KeyComparer); } [Fact] public void ToImmutableDictionary() { IEnumerable<KeyValuePair<string, string>> pairs = new Dictionary<string, string> { { "a", "B" } }; var keyComparer = StringComparer.OrdinalIgnoreCase; ImmutableSegmentedDictionary<string, string> dictionary = pairs.ToImmutableSegmentedDictionary(); Assert.Equal(1, dictionary.Count); Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); dictionary = pairs.ToImmutableSegmentedDictionary(keyComparer); Assert.Equal(1, dictionary.Count); Assert.Same(keyComparer, dictionary.KeyComparer); dictionary = pairs.ToImmutableSegmentedDictionary(p => p.Key.ToUpperInvariant(), p => p.Value.ToLowerInvariant()); Assert.Equal(1, dictionary.Count); Assert.Equal("A", dictionary.Keys.Single()); Assert.Equal("b", dictionary.Values.Single()); Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); dictionary = pairs.ToImmutableSegmentedDictionary(p => p.Key.ToUpperInvariant(), p => p.Value.ToLowerInvariant(), keyComparer); Assert.Equal(1, dictionary.Count); Assert.Equal("A", dictionary.Keys.Single()); Assert.Equal("b", dictionary.Values.Single()); Assert.Same(keyComparer, dictionary.KeyComparer); var list = new int[] { 1, 2 }; var intDictionary = list.ToImmutableSegmentedDictionary(n => (double)n); Assert.Equal(1, intDictionary[1.0]); Assert.Equal(2, intDictionary[2.0]); Assert.Equal(2, intDictionary.Count); var stringIntDictionary = list.ToImmutableSegmentedDictionary(n => n.ToString(), StringComparer.OrdinalIgnoreCase); Assert.Same(StringComparer.OrdinalIgnoreCase, stringIntDictionary.KeyComparer); Assert.Equal(1, stringIntDictionary["1"]); Assert.Equal(2, stringIntDictionary["2"]); Assert.Equal(2, intDictionary.Count); Assert.Throws<ArgumentNullException>("keySelector", () => list.ToImmutableSegmentedDictionary<int, int>(null!)); Assert.Throws<ArgumentNullException>("keySelector", () => list.ToImmutableSegmentedDictionary<int, int, int>(null!, v => v)); Assert.Throws<ArgumentNullException>("elementSelector", () => list.ToImmutableSegmentedDictionary<int, int, int>(k => k, null!)); list.ToDictionary(k => k, v => v, null); // verifies BCL behavior is to not throw. list.ToImmutableSegmentedDictionary(k => k, v => v, null); } [Fact] public void ToImmutableDictionaryOptimized() { var dictionary = ImmutableSegmentedDictionary.Create<string, string>(); var result = dictionary.ToImmutableSegmentedDictionary(); Assert.True(IsSame(dictionary, result)); var cultureComparer = StringComparer.CurrentCulture; result = dictionary.WithComparer(cultureComparer); Assert.Same(cultureComparer, result.KeyComparer); } [Fact] public void WithComparer() { var map = ImmutableSegmentedDictionary.Create<string, string>().Add("a", "1").Add("B", "1"); Assert.Same(EqualityComparer<string>.Default, map.KeyComparer); Assert.True(map.ContainsKey("a")); Assert.False(map.ContainsKey("A")); map = map.WithComparer(StringComparer.OrdinalIgnoreCase); Assert.Same(StringComparer.OrdinalIgnoreCase, map.KeyComparer); Assert.Equal(2, map.Count); Assert.True(map.ContainsKey("a")); Assert.True(map.ContainsKey("A")); Assert.True(map.ContainsKey("b")); } [Fact] public void WithComparerCollisions() { // First check where collisions have matching values. var map = ImmutableSegmentedDictionary.Create<string, string>() .Add("a", "1").Add("A", "1"); map = map.WithComparer(StringComparer.OrdinalIgnoreCase); Assert.Same(StringComparer.OrdinalIgnoreCase, map.KeyComparer); Assert.Equal(1, map.Count); Assert.True(map.ContainsKey("a")); Assert.Equal("1", map["a"]); // Now check where collisions have conflicting values. map = ImmutableSegmentedDictionary.Create<string, string>() .Add("a", "1").Add("A", "2").Add("b", "3"); Assert.Throws<ArgumentException>(null, () => map.WithComparer(StringComparer.OrdinalIgnoreCase)); } [Fact] public void CollisionExceptionMessageContainsKey() { var map = ImmutableSegmentedDictionary.Create<string, string>() .Add("firstKey", "1").Add("secondKey", "2"); var exception = Assert.Throws<ArgumentException>(null, () => map.Add("firstKey", "3")); Assert.Contains("firstKey", exception.Message); } [Fact] public void WithComparerEmptyCollection() { var map = ImmutableSegmentedDictionary.Create<string, string>(); Assert.Same(EqualityComparer<string>.Default, map.KeyComparer); map = map.WithComparer(StringComparer.OrdinalIgnoreCase); Assert.Same(StringComparer.OrdinalIgnoreCase, map.KeyComparer); } [Fact] public void GetValueOrDefaultOfIImmutableDictionary() { IImmutableDictionary<string, int> empty = ImmutableSegmentedDictionary.Create<string, int>(); IImmutableDictionary<string, int> populated = ImmutableSegmentedDictionary.Create<string, int>().Add("a", 5); Assert.Equal(0, empty.GetValueOrDefault("a")); Assert.Equal(1, empty.GetValueOrDefault("a", 1)); Assert.Equal(5, populated.GetValueOrDefault("a")); Assert.Equal(5, populated.GetValueOrDefault("a", 1)); } [Fact] public void GetValueOrDefaultOfConcreteType() { var empty = ImmutableSegmentedDictionary.Create<string, int>(); var populated = ImmutableSegmentedDictionary.Create<string, int>().Add("a", 5); Assert.Equal(0, empty.GetValueOrDefault("a")); Assert.Equal(1, empty.GetValueOrDefault("a", 1)); Assert.Equal(5, populated.GetValueOrDefault("a")); Assert.Equal(5, populated.GetValueOrDefault("a", 1)); } [Fact(Skip = "Not implemented: https://github.com/dotnet/roslyn/issues/50657")] public void DebuggerAttributesValid() { DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSegmentedDictionary.Create<int, int>()); ImmutableSegmentedDictionary<string, int> dict = ImmutableSegmentedDictionary.Create<string, int>().Add("One", 1).Add("Two", 2); DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(dict); object rootNode = DebuggerAttributes.GetFieldValue(ImmutableSegmentedDictionary.Create<string, string>(), "_root") ?? throw new InvalidOperationException(); DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute<DebuggerBrowsableAttribute>()!.State == DebuggerBrowsableState.RootHidden); KeyValuePair<string, int>[]? items = itemProperty.GetValue(info.Instance) as KeyValuePair<string, int>[]; Assert.Equal(dict, items); } [Fact(Skip = "Not implemented: https://github.com/dotnet/roslyn/issues/50657")] public static void TestDebuggerAttributes_Null() { Type proxyType = DebuggerAttributes.GetProxyType(ImmutableSegmentedDictionary.Create<string, int>()); TargetInvocationException tie = Assert.Throws<TargetInvocationException>(() => Activator.CreateInstance(proxyType, (object?)null)); Assert.IsType<ArgumentNullException>(tie.InnerException); } [Fact] public void Clear_NoComparer_ReturnsEmptyWithoutComparer() { ImmutableSegmentedDictionary<string, int> dictionary = new Dictionary<string, int> { { "a", 1 } }.ToImmutableSegmentedDictionary(); Assert.True(IsSame(ImmutableSegmentedDictionary<string, int>.Empty, dictionary.Clear())); Assert.NotEmpty(dictionary); } [Fact] public void Clear_HasComparer_ReturnsEmptyWithOriginalComparer() { ImmutableSegmentedDictionary<string, int> dictionary = new Dictionary<string, int> { { "a", 1 } }.ToImmutableSegmentedDictionary(StringComparer.OrdinalIgnoreCase); ImmutableSegmentedDictionary<string, int> clearedDictionary = dictionary.Clear(); Assert.False(IsSame(ImmutableSegmentedDictionary<string, int>.Empty, clearedDictionary.Clear())); Assert.NotEmpty(dictionary); clearedDictionary = clearedDictionary.Add("a", 1); Assert.True(clearedDictionary.ContainsKey("A")); } [Fact] public void Indexer_KeyNotFoundException_ContainsKeyInMessage() { var map = ImmutableSegmentedDictionary.Create<string, string>() .Add("a", "1").Add("b", "2"); var missingKey = "__ThisKeyDoesNotExist__"; var exception = Assert.Throws<KeyNotFoundException>(() => map[missingKey]); Assert.Contains(missingKey, exception.Message); } protected override IImmutableDictionary<TKey, TValue> Empty<TKey, TValue>() { return ImmutableSegmentedDictionaryTest.Empty<TKey, TValue>(); } protected override IImmutableDictionary<string, TValue> Empty<TValue>(StringComparer comparer) { return ImmutableSegmentedDictionary.Create<string, TValue>(comparer); } protected override IEqualityComparer<TValue> GetValueComparer<TKey, TValue>(IImmutableDictionary<TKey, TValue> dictionary) { return EqualityComparer<TValue>.Default; } private protected static void ContainsValueTestHelper<TKey, TValue>(ImmutableSegmentedDictionary<TKey, TValue> map, TKey key, TValue value) where TKey : notnull { Assert.False(map.ContainsValue(value)); Assert.True(map.Add(key, value).ContainsValue(value)); } private static ImmutableSegmentedDictionary<TKey, TValue> Empty<TKey, TValue>(IEqualityComparer<TKey>? keyComparer = null) where TKey : notnull { return ImmutableSegmentedDictionary<TKey, TValue>.Empty.WithComparer(keyComparer); } /// <summary> /// An ordinal comparer for case-insensitive strings. /// </summary> private class MyStringOrdinalComparer : EqualityComparer<CaseInsensitiveString?> { public override bool Equals(CaseInsensitiveString? x, CaseInsensitiveString? y) { return StringComparer.Ordinal.Equals(x!.Value, y!.Value); } public override int GetHashCode(CaseInsensitiveString obj) { return StringComparer.Ordinal.GetHashCode(obj.Value); } } /// <summary> /// A string-wrapper that considers equality based on case insensitivity. /// </summary> private class CaseInsensitiveString { public CaseInsensitiveString(string value) { Value = value; } public string Value { get; private set; } public override int GetHashCode() { return StringComparer.OrdinalIgnoreCase.GetHashCode(this.Value); } public override bool Equals(object? obj) { return StringComparer.OrdinalIgnoreCase.Equals(this.Value, ((CaseInsensitiveString?)obj)!.Value); } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Analyzers/CSharp/Tests/UseExpressionBody/UseExpressionBodyForLocalFunctionsAnalyzerTests.cs
// 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 System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.UseExpressionBody; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Testing; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { using VerifyCS = CSharpCodeFixVerifier< UseExpressionBodyDiagnosticAnalyzer, UseExpressionBodyCodeFixProvider>; public class UseExpressionBodyForLocalFunctionsAnalyzerTests { private static async Task TestWithUseExpressionBody(string code, string fixedCode) { await new VerifyCS.Test { TestCode = code, FixedCode = fixedCode, Options = { { CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, ExpressionBodyPreference.WhenPossible } } }.RunAsync(); } private static async Task TestWithUseExpressionBodyWhenOnSingleLine(string code, string fixedCode) { await new VerifyCS.Test { TestCode = code, FixedCode = fixedCode, Options = { { CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, ExpressionBodyPreference.WhenOnSingleLine } } }.RunAsync(); } private static async Task TestWithUseBlockBody(string code, string fixedCode, ReferenceAssemblies? referenceAssemblies = null) { await new VerifyCS.Test { TestCode = code, FixedCode = fixedCode, Options = { { CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, ExpressionBodyPreference.Never } }, ReferenceAssemblies = referenceAssemblies ?? ReferenceAssemblies.Default, }.RunAsync(); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBody1() { var code = @" class C { void Test() { } void Goo() { {|IDE0061:void Bar() { Test(); }|} } }"; var fixedCode = @" class C { void Test() { } void Goo() { void Bar() => Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBody2() { var code = @" class C { int Test() { return 0; } void Goo() { {|IDE0061:int Bar() { return Test(); }|} } }"; var fixedCode = @" class C { int Test() { return 0; } void Goo() { int Bar() => Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBody3() { var code = @" using System; class C { void Goo() { {|IDE0061:int Bar() { throw new NotImplementedException(); }|} } }"; var fixedCode = @" using System; class C { void Goo() { int Bar() => throw new NotImplementedException(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBody4() { var code = @" using System; class C { void Goo() { {|IDE0061:int Bar() { throw new NotImplementedException(); // comment }|} } }"; var fixedCode = @" using System; class C { void Goo() { int Bar() => throw new NotImplementedException(); // comment } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBodyWhenOnSingleLineMissing() { var code = @" class C { void Goo() { int Bar() { return 1 + 2 + 3; } } }"; await TestWithUseExpressionBodyWhenOnSingleLine(code, code); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBodyWhenOnSingleLine() { var code = @" class C { void Goo() { {|IDE0061:int Bar() { return 1 + 2 + 3; }|} } }"; var fixedCode = @" class C { void Goo() { int Bar() => 1 + 2 + 3; } }"; await TestWithUseExpressionBodyWhenOnSingleLine(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBody1() { var code = @" class C { void Test() { } void Goo() { {|IDE0061:void Bar() => Test();|} } }"; var fixedCode = @" class C { void Test() { } void Goo() { void Bar() { Test(); } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBody2() { var code = @" class C { int Test() { return 0; } void Goo() { {|IDE0061:int Bar() => Test();|} } }"; var fixedCode = @" class C { int Test() { return 0; } void Goo() { int Bar() { return Test(); } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBody3() { var code = @" using System; class C { void Goo() { {|IDE0061:int Bar() => throw new NotImplementedException();|} } }"; var fixedCode = @" using System; class C { void Goo() { int Bar() { throw new NotImplementedException(); } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBody4() { var code = @" using System; class C { void Goo() { {|IDE0061:int Bar() => throw new NotImplementedException();|} // comment } }"; var fixedCode = @" using System; class C { void Goo() { int Bar() { throw new NotImplementedException(); // comment } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments1() { var code = @" class C { void Test() { } void Goo() { {|IDE0061:void Bar() { // Comment Test(); }|} } }"; var fixedCode = @" class C { void Test() { } void Goo() { void Bar() => // Comment Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments2() { var code = @" class C { int Test() { return 0; } void Goo() { {|IDE0061:int Bar() { // Comment return Test(); }|} } }"; var fixedCode = @" class C { int Test() { return 0; } void Goo() { int Bar() => // Comment Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments3() { var code = @" using System; class C { Exception Test() { return new Exception(); } void Goo() { {|IDE0061:void Bar() { // Comment throw Test(); }|} } }"; var fixedCode = @" using System; class C { Exception Test() { return new Exception(); } void Goo() { void Bar() => // Comment throw Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments4() { var code = @" class C { void Test() { } void Goo() { {|IDE0061:void Bar() { Test(); // Comment }|} } }"; var fixedCode = @" class C { void Test() { } void Goo() { void Bar() => Test(); // Comment } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments5() { var code = @" class C { int Test() { return 0; } void Goo() { {|IDE0061:int Bar() { return Test(); // Comment }|} } }"; var fixedCode = @" class C { int Test() { return 0; } void Goo() { int Bar() => Test(); // Comment } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments6() { var code = @" using System; class C { Exception Test() { return new Exception(); } void Goo() { {|IDE0061:void Bar() { throw Test(); // Comment }|} } }"; var fixedCode = @" using System; class C { Exception Test() { return new Exception(); } void Goo() { void Bar() => throw Test(); // Comment } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestDirectives1() { var code = @" #define DEBUG using System; class Program { void Method() { {|IDE0061:void Bar() { #if DEBUG Console.WriteLine(); #endif }|} } }"; var fixedCode = @" #define DEBUG using System; class Program { void Method() { void Bar() => #if DEBUG Console.WriteLine(); #endif } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestDirectives2() { var code = @" #define DEBUG using System; class Program { void Method() { {|IDE0061:void Bar() { #if DEBUG Console.WriteLine(0); #else Console.WriteLine(1); #endif }|} } }"; var fixedCode = @" #define DEBUG using System; class Program { void Method() { void Bar() => #if DEBUG Console.WriteLine(0); #else Console.WriteLine(1); #endif } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync1() { var code = @" using System.Threading.Tasks; class C { async Task Goo() { {|IDE0061:async Task Bar() => await Test();|} } Task Test() { return Task.CompletedTask; } }"; var fixedCode = @" using System.Threading.Tasks; class C { async Task Goo() { async Task Bar() { await Test(); } } Task Test() { return Task.CompletedTask; } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync2() { var code = @" using System.Threading.Tasks; class C { async void Goo() { {|IDE0061:async void Bar() => await Test();|} } Task Test() { return Task.CompletedTask; } }"; var fixedCode = @" using System.Threading.Tasks; class C { async void Goo() { async void Bar() { await Test(); } } Task Test() { return Task.CompletedTask; } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync3() { var code = @" using System.Threading.Tasks; class C { void Goo() { {|IDE0061:async ValueTask Test() => await Bar();|} } Task Bar() { return Task.CompletedTask; } }"; var fixedCode = @" using System.Threading.Tasks; class C { void Goo() { async ValueTask Test() { await Bar(); } } Task Bar() { return Task.CompletedTask; } }"; await TestWithUseBlockBody(code, fixedCode, ReferenceAssemblies.NetStandard.NetStandard21); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync4() { var code = @" using System.Threading.Tasks; class C { void Goo() { {|IDE0061:Task<int> Test() => Bar();|} } Task<int> Bar() { return Task.FromResult(0); } }"; var fixedCode = @" using System.Threading.Tasks; class C { void Goo() { Task<int> Test() { return Bar(); } } Task<int> Bar() { return Task.FromResult(0); } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync5() { var code = @" using System.Threading.Tasks; class C { void Goo() { {|IDE0061:Task Test() => Bar();|} } Task Bar() { return Task.CompletedTask; } }"; var fixedCode = @" using System.Threading.Tasks; class C { void Goo() { Task Test() { return Bar(); } } Task Bar() { return Task.CompletedTask; } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyNestedLocalFunction() { var code = @" class C { void NestedTest() { } void Goo() { void Bar() { {|IDE0061:void Test() => NestedTest();|} } } }"; var fixedCode = @" class C { void NestedTest() { } void Goo() { void Bar() { void Test() { NestedTest(); } } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBodyNestedLocalFunction() { var code = @" class C { void NestedTest() { } void Goo() { void Bar() { {|IDE0061:void Test() { NestedTest(); }|} } } }"; var fixedCode = @" class C { void NestedTest() { } void Goo() { void Bar() { void Test() => NestedTest(); } } }"; await TestWithUseExpressionBody(code, fixedCode); } } }
// 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 System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; using Microsoft.CodeAnalysis.CSharp.UseExpressionBody; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Testing; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseExpressionBody { using VerifyCS = CSharpCodeFixVerifier< UseExpressionBodyDiagnosticAnalyzer, UseExpressionBodyCodeFixProvider>; public class UseExpressionBodyForLocalFunctionsAnalyzerTests { private static async Task TestWithUseExpressionBody(string code, string fixedCode) { await new VerifyCS.Test { TestCode = code, FixedCode = fixedCode, Options = { { CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, ExpressionBodyPreference.WhenPossible } } }.RunAsync(); } private static async Task TestWithUseExpressionBodyWhenOnSingleLine(string code, string fixedCode) { await new VerifyCS.Test { TestCode = code, FixedCode = fixedCode, Options = { { CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, ExpressionBodyPreference.WhenOnSingleLine } } }.RunAsync(); } private static async Task TestWithUseBlockBody(string code, string fixedCode, ReferenceAssemblies? referenceAssemblies = null) { await new VerifyCS.Test { TestCode = code, FixedCode = fixedCode, Options = { { CSharpCodeStyleOptions.PreferExpressionBodiedLocalFunctions, ExpressionBodyPreference.Never } }, ReferenceAssemblies = referenceAssemblies ?? ReferenceAssemblies.Default, }.RunAsync(); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBody1() { var code = @" class C { void Test() { } void Goo() { {|IDE0061:void Bar() { Test(); }|} } }"; var fixedCode = @" class C { void Test() { } void Goo() { void Bar() => Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBody2() { var code = @" class C { int Test() { return 0; } void Goo() { {|IDE0061:int Bar() { return Test(); }|} } }"; var fixedCode = @" class C { int Test() { return 0; } void Goo() { int Bar() => Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBody3() { var code = @" using System; class C { void Goo() { {|IDE0061:int Bar() { throw new NotImplementedException(); }|} } }"; var fixedCode = @" using System; class C { void Goo() { int Bar() => throw new NotImplementedException(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBody4() { var code = @" using System; class C { void Goo() { {|IDE0061:int Bar() { throw new NotImplementedException(); // comment }|} } }"; var fixedCode = @" using System; class C { void Goo() { int Bar() => throw new NotImplementedException(); // comment } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBodyWhenOnSingleLineMissing() { var code = @" class C { void Goo() { int Bar() { return 1 + 2 + 3; } } }"; await TestWithUseExpressionBodyWhenOnSingleLine(code, code); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBodyWhenOnSingleLine() { var code = @" class C { void Goo() { {|IDE0061:int Bar() { return 1 + 2 + 3; }|} } }"; var fixedCode = @" class C { void Goo() { int Bar() => 1 + 2 + 3; } }"; await TestWithUseExpressionBodyWhenOnSingleLine(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBody1() { var code = @" class C { void Test() { } void Goo() { {|IDE0061:void Bar() => Test();|} } }"; var fixedCode = @" class C { void Test() { } void Goo() { void Bar() { Test(); } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBody2() { var code = @" class C { int Test() { return 0; } void Goo() { {|IDE0061:int Bar() => Test();|} } }"; var fixedCode = @" class C { int Test() { return 0; } void Goo() { int Bar() { return Test(); } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBody3() { var code = @" using System; class C { void Goo() { {|IDE0061:int Bar() => throw new NotImplementedException();|} } }"; var fixedCode = @" using System; class C { void Goo() { int Bar() { throw new NotImplementedException(); } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBody4() { var code = @" using System; class C { void Goo() { {|IDE0061:int Bar() => throw new NotImplementedException();|} // comment } }"; var fixedCode = @" using System; class C { void Goo() { int Bar() { throw new NotImplementedException(); // comment } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments1() { var code = @" class C { void Test() { } void Goo() { {|IDE0061:void Bar() { // Comment Test(); }|} } }"; var fixedCode = @" class C { void Test() { } void Goo() { void Bar() => // Comment Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments2() { var code = @" class C { int Test() { return 0; } void Goo() { {|IDE0061:int Bar() { // Comment return Test(); }|} } }"; var fixedCode = @" class C { int Test() { return 0; } void Goo() { int Bar() => // Comment Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments3() { var code = @" using System; class C { Exception Test() { return new Exception(); } void Goo() { {|IDE0061:void Bar() { // Comment throw Test(); }|} } }"; var fixedCode = @" using System; class C { Exception Test() { return new Exception(); } void Goo() { void Bar() => // Comment throw Test(); } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments4() { var code = @" class C { void Test() { } void Goo() { {|IDE0061:void Bar() { Test(); // Comment }|} } }"; var fixedCode = @" class C { void Test() { } void Goo() { void Bar() => Test(); // Comment } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments5() { var code = @" class C { int Test() { return 0; } void Goo() { {|IDE0061:int Bar() { return Test(); // Comment }|} } }"; var fixedCode = @" class C { int Test() { return 0; } void Goo() { int Bar() => Test(); // Comment } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestComments6() { var code = @" using System; class C { Exception Test() { return new Exception(); } void Goo() { {|IDE0061:void Bar() { throw Test(); // Comment }|} } }"; var fixedCode = @" using System; class C { Exception Test() { return new Exception(); } void Goo() { void Bar() => throw Test(); // Comment } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestDirectives1() { var code = @" #define DEBUG using System; class Program { void Method() { {|IDE0061:void Bar() { #if DEBUG Console.WriteLine(); #endif }|} } }"; var fixedCode = @" #define DEBUG using System; class Program { void Method() { void Bar() => #if DEBUG Console.WriteLine(); #endif } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestDirectives2() { var code = @" #define DEBUG using System; class Program { void Method() { {|IDE0061:void Bar() { #if DEBUG Console.WriteLine(0); #else Console.WriteLine(1); #endif }|} } }"; var fixedCode = @" #define DEBUG using System; class Program { void Method() { void Bar() => #if DEBUG Console.WriteLine(0); #else Console.WriteLine(1); #endif } }"; await TestWithUseExpressionBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync1() { var code = @" using System.Threading.Tasks; class C { async Task Goo() { {|IDE0061:async Task Bar() => await Test();|} } Task Test() { return Task.CompletedTask; } }"; var fixedCode = @" using System.Threading.Tasks; class C { async Task Goo() { async Task Bar() { await Test(); } } Task Test() { return Task.CompletedTask; } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync2() { var code = @" using System.Threading.Tasks; class C { async void Goo() { {|IDE0061:async void Bar() => await Test();|} } Task Test() { return Task.CompletedTask; } }"; var fixedCode = @" using System.Threading.Tasks; class C { async void Goo() { async void Bar() { await Test(); } } Task Test() { return Task.CompletedTask; } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync3() { var code = @" using System.Threading.Tasks; class C { void Goo() { {|IDE0061:async ValueTask Test() => await Bar();|} } Task Bar() { return Task.CompletedTask; } }"; var fixedCode = @" using System.Threading.Tasks; class C { void Goo() { async ValueTask Test() { await Bar(); } } Task Bar() { return Task.CompletedTask; } }"; await TestWithUseBlockBody(code, fixedCode, ReferenceAssemblies.NetStandard.NetStandard21); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync4() { var code = @" using System.Threading.Tasks; class C { void Goo() { {|IDE0061:Task<int> Test() => Bar();|} } Task<int> Bar() { return Task.FromResult(0); } }"; var fixedCode = @" using System.Threading.Tasks; class C { void Goo() { Task<int> Test() { return Bar(); } } Task<int> Bar() { return Task.FromResult(0); } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyAsync5() { var code = @" using System.Threading.Tasks; class C { void Goo() { {|IDE0061:Task Test() => Bar();|} } Task Bar() { return Task.CompletedTask; } }"; var fixedCode = @" using System.Threading.Tasks; class C { void Goo() { Task Test() { return Bar(); } } Task Bar() { return Task.CompletedTask; } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseBlockBodyNestedLocalFunction() { var code = @" class C { void NestedTest() { } void Goo() { void Bar() { {|IDE0061:void Test() => NestedTest();|} } } }"; var fixedCode = @" class C { void NestedTest() { } void Goo() { void Bar() { void Test() { NestedTest(); } } } }"; await TestWithUseBlockBody(code, fixedCode); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUseExpressionBody)] public async Task TestUseExpressionBodyNestedLocalFunction() { var code = @" class C { void NestedTest() { } void Goo() { void Bar() { {|IDE0061:void Test() { NestedTest(); }|} } } }"; var fixedCode = @" class C { void NestedTest() { } void Goo() { void Bar() { void Test() => NestedTest(); } } }"; await TestWithUseExpressionBody(code, fixedCode); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Def/Implementation/ProjectSystem/Legacy/AbstractLegacyProject_IAnalyzerConfigFileHost.cs
// 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. #nullable disable using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Interop; namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Legacy { internal abstract partial class AbstractLegacyProject : IAnalyzerConfigFileHost { void IAnalyzerConfigFileHost.AddAnalyzerConfigFile(string filePath) => VisualStudioProject.AddAnalyzerConfigFile(filePath); void IAnalyzerConfigFileHost.RemoveAnalyzerConfigFile(string filePath) => VisualStudioProject.RemoveAnalyzerConfigFile(filePath); } }
// 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. #nullable disable using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Interop; namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Legacy { internal abstract partial class AbstractLegacyProject : IAnalyzerConfigFileHost { void IAnalyzerConfigFileHost.AddAnalyzerConfigFile(string filePath) => VisualStudioProject.AddAnalyzerConfigFile(filePath); void IAnalyzerConfigFileHost.RemoveAnalyzerConfigFile(string filePath) => VisualStudioProject.RemoveAnalyzerConfigFile(filePath); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Core/Portable/Syntax/TranslationSyntaxReference.cs
// 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 System.Diagnostics; using System.Threading; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Syntax { /// <summary> /// This is a SyntaxReference implementation that lazily translates the result (SyntaxNode) of the /// original syntax reference to another one. /// </summary> internal abstract class TranslationSyntaxReference : SyntaxReference { private readonly SyntaxReference _reference; protected TranslationSyntaxReference(SyntaxReference reference) { _reference = reference; } public sealed override TextSpan Span { get { return _reference.Span; } } public sealed override SyntaxTree SyntaxTree { get { return _reference.SyntaxTree; } } public sealed override SyntaxNode GetSyntax(CancellationToken cancellationToken = default(CancellationToken)) { var node = Translate(_reference, cancellationToken); Debug.Assert(node.SyntaxTree == _reference.SyntaxTree); return node; } protected abstract SyntaxNode Translate(SyntaxReference reference, CancellationToken cancellationToken); } }
// 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 System.Diagnostics; using System.Threading; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Syntax { /// <summary> /// This is a SyntaxReference implementation that lazily translates the result (SyntaxNode) of the /// original syntax reference to another one. /// </summary> internal abstract class TranslationSyntaxReference : SyntaxReference { private readonly SyntaxReference _reference; protected TranslationSyntaxReference(SyntaxReference reference) { _reference = reference; } public sealed override TextSpan Span { get { return _reference.Span; } } public sealed override SyntaxTree SyntaxTree { get { return _reference.SyntaxTree; } } public sealed override SyntaxNode GetSyntax(CancellationToken cancellationToken = default(CancellationToken)) { var node = Translate(_reference, cancellationToken); Debug.Assert(node.SyntaxTree == _reference.SyntaxTree); return node; } protected abstract SyntaxNode Translate(SyntaxReference reference, CancellationToken cancellationToken); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Impl/CodeModel/InternalElements/CodeOptionsStatement.cs
// 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. #nullable disable using System.Runtime.InteropServices; using Microsoft.CodeAnalysis; using Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Collections; using Microsoft.VisualStudio.LanguageServices.Implementation.Interop; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.InternalElements { [ComVisible(true)] [ComDefaultInterface(typeof(EnvDTE80.CodeElement2))] public sealed class CodeOptionsStatement : AbstractCodeElement { internal static EnvDTE80.CodeElement2 Create( CodeModelState state, FileCodeModel fileCodeModel, string name, int ordinal) { var element = new CodeOptionsStatement(state, fileCodeModel, name, ordinal); var result = (EnvDTE80.CodeElement2)ComAggregate.CreateAggregatedObject(element); return result; } internal static EnvDTE80.CodeElement2 CreateUnknown( CodeModelState state, FileCodeModel fileCodeModel, int nodeKind, string name) { var element = new CodeOptionsStatement(state, fileCodeModel, nodeKind, name); return (EnvDTE80.CodeElement2)ComAggregate.CreateAggregatedObject(element); } private readonly string _name; private readonly int _ordinal; private CodeOptionsStatement( CodeModelState state, FileCodeModel fileCodeModel, string name, int ordinal) : base(state, fileCodeModel) { _name = name; _ordinal = ordinal; } private CodeOptionsStatement( CodeModelState state, FileCodeModel fileCodeModel, int nodeKind, string name) : base(state, fileCodeModel, nodeKind) { _name = name; } internal override bool TryLookupNode(out SyntaxNode node) { node = null; var parentNode = this.FileCodeModel.GetSyntaxRoot(); if (parentNode == null) { return false; } if (!CodeModelService.TryGetOptionNode(parentNode, _name, _ordinal, out var optionNode)) { return false; } node = optionNode; return node != null; } public override EnvDTE.vsCMElement Kind { get { return EnvDTE.vsCMElement.vsCMElementOptionStmt; } } public override object Parent { get { return this.FileCodeModel; } } public override EnvDTE.CodeElements Children { get { return EmptyCollection.Create(this.State, this); } } protected override void SetName(string value) => throw Exceptions.ThrowENotImpl(); public override void RenameSymbol(string newName) => throw Exceptions.ThrowENotImpl(); } }
// 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. #nullable disable using System.Runtime.InteropServices; using Microsoft.CodeAnalysis; using Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.Collections; using Microsoft.VisualStudio.LanguageServices.Implementation.Interop; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.InternalElements { [ComVisible(true)] [ComDefaultInterface(typeof(EnvDTE80.CodeElement2))] public sealed class CodeOptionsStatement : AbstractCodeElement { internal static EnvDTE80.CodeElement2 Create( CodeModelState state, FileCodeModel fileCodeModel, string name, int ordinal) { var element = new CodeOptionsStatement(state, fileCodeModel, name, ordinal); var result = (EnvDTE80.CodeElement2)ComAggregate.CreateAggregatedObject(element); return result; } internal static EnvDTE80.CodeElement2 CreateUnknown( CodeModelState state, FileCodeModel fileCodeModel, int nodeKind, string name) { var element = new CodeOptionsStatement(state, fileCodeModel, nodeKind, name); return (EnvDTE80.CodeElement2)ComAggregate.CreateAggregatedObject(element); } private readonly string _name; private readonly int _ordinal; private CodeOptionsStatement( CodeModelState state, FileCodeModel fileCodeModel, string name, int ordinal) : base(state, fileCodeModel) { _name = name; _ordinal = ordinal; } private CodeOptionsStatement( CodeModelState state, FileCodeModel fileCodeModel, int nodeKind, string name) : base(state, fileCodeModel, nodeKind) { _name = name; } internal override bool TryLookupNode(out SyntaxNode node) { node = null; var parentNode = this.FileCodeModel.GetSyntaxRoot(); if (parentNode == null) { return false; } if (!CodeModelService.TryGetOptionNode(parentNode, _name, _ordinal, out var optionNode)) { return false; } node = optionNode; return node != null; } public override EnvDTE.vsCMElement Kind { get { return EnvDTE.vsCMElement.vsCMElementOptionStmt; } } public override object Parent { get { return this.FileCodeModel; } } public override EnvDTE.CodeElements Children { get { return EmptyCollection.Create(this.State, this); } } protected override void SetName(string value) => throw Exceptions.ThrowENotImpl(); public override void RenameSymbol(string newName) => throw Exceptions.ThrowENotImpl(); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Def/Implementation/Diagnostics/IVisualStudioDiagnosticAnalyzerService.cs
// 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 System; using System.Collections.Generic; using Microsoft.CodeAnalysis; using Microsoft.VisualStudio.Shell.Interop; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Diagnostics { internal interface IVisualStudioDiagnosticAnalyzerService { /// <summary> /// Gets a list of the diagnostics that are provided by this service. /// If the given <paramref name="hierarchy"/> is non-null and corresponds to an existing project in the workspace, then gets the diagnostics for the project. /// Otherwise, returns the global set of diagnostics enabled for the workspace. /// </summary> /// <returns>A mapping from analyzer name to the diagnostics produced by that analyzer</returns> /// <remarks> /// This is used by the Ruleset Editor from ManagedSourceCodeAnalysis.dll in VisualStudio. /// </remarks> IReadOnlyDictionary<string, IEnumerable<DiagnosticDescriptor>> GetAllDiagnosticDescriptors(IVsHierarchy? hierarchy); /// <summary> /// Runs all the applicable NuGet and VSIX diagnostic analyzers for the given project OR current solution in background and updates the error list. /// </summary> /// <param name="hierarchy"> /// If non-null hierarchy for a project, then analyzers are run on the project. /// Otherwise, analyzers are run on the current solution. /// </param> void RunAnalyzers(IVsHierarchy? hierarchy); /// <summary> /// Initializes the service. /// </summary> void Initialize(IServiceProvider serviceProvider); } }
// 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 System; using System.Collections.Generic; using Microsoft.CodeAnalysis; using Microsoft.VisualStudio.Shell.Interop; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Diagnostics { internal interface IVisualStudioDiagnosticAnalyzerService { /// <summary> /// Gets a list of the diagnostics that are provided by this service. /// If the given <paramref name="hierarchy"/> is non-null and corresponds to an existing project in the workspace, then gets the diagnostics for the project. /// Otherwise, returns the global set of diagnostics enabled for the workspace. /// </summary> /// <returns>A mapping from analyzer name to the diagnostics produced by that analyzer</returns> /// <remarks> /// This is used by the Ruleset Editor from ManagedSourceCodeAnalysis.dll in VisualStudio. /// </remarks> IReadOnlyDictionary<string, IEnumerable<DiagnosticDescriptor>> GetAllDiagnosticDescriptors(IVsHierarchy? hierarchy); /// <summary> /// Runs all the applicable NuGet and VSIX diagnostic analyzers for the given project OR current solution in background and updates the error list. /// </summary> /// <param name="hierarchy"> /// If non-null hierarchy for a project, then analyzers are run on the project. /// Otherwise, analyzers are run on the current solution. /// </param> void RunAnalyzers(IVsHierarchy? hierarchy); /// <summary> /// Initializes the service. /// </summary> void Initialize(IServiceProvider serviceProvider); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/CSharp/Portable/Syntax/InternalSyntax/SyntaxToken.MissingTokenWithTrivia.cs
// 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. #nullable disable using System; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax { internal partial class SyntaxToken { internal class MissingTokenWithTrivia : SyntaxTokenWithTrivia { internal MissingTokenWithTrivia(SyntaxKind kind, GreenNode leading, GreenNode trailing) : base(kind, leading, trailing) { this.flags &= ~NodeFlags.IsNotMissing; } internal MissingTokenWithTrivia(SyntaxKind kind, GreenNode leading, GreenNode trailing, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations) : base(kind, leading, trailing, diagnostics, annotations) { this.flags &= ~NodeFlags.IsNotMissing; } internal MissingTokenWithTrivia(ObjectReader reader) : base(reader) { this.flags &= ~NodeFlags.IsNotMissing; } static MissingTokenWithTrivia() { ObjectBinder.RegisterTypeReader(typeof(MissingTokenWithTrivia), r => new MissingTokenWithTrivia(r)); } public override string Text { get { return string.Empty; } } public override object Value { get { switch (this.Kind) { case SyntaxKind.IdentifierToken: return string.Empty; default: return null; } } } public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) { return new MissingTokenWithTrivia(this.Kind, trivia, this.TrailingField, this.GetDiagnostics(), this.GetAnnotations()); } public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) { return new MissingTokenWithTrivia(this.Kind, this.LeadingField, trivia, this.GetDiagnostics(), this.GetAnnotations()); } internal override GreenNode SetDiagnostics(DiagnosticInfo[] diagnostics) { return new MissingTokenWithTrivia(this.Kind, this.LeadingField, this.TrailingField, diagnostics, this.GetAnnotations()); } internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) { return new MissingTokenWithTrivia(this.Kind, this.LeadingField, this.TrailingField, this.GetDiagnostics(), annotations); } } } }
// 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. #nullable disable using System; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax { internal partial class SyntaxToken { internal class MissingTokenWithTrivia : SyntaxTokenWithTrivia { internal MissingTokenWithTrivia(SyntaxKind kind, GreenNode leading, GreenNode trailing) : base(kind, leading, trailing) { this.flags &= ~NodeFlags.IsNotMissing; } internal MissingTokenWithTrivia(SyntaxKind kind, GreenNode leading, GreenNode trailing, DiagnosticInfo[] diagnostics, SyntaxAnnotation[] annotations) : base(kind, leading, trailing, diagnostics, annotations) { this.flags &= ~NodeFlags.IsNotMissing; } internal MissingTokenWithTrivia(ObjectReader reader) : base(reader) { this.flags &= ~NodeFlags.IsNotMissing; } static MissingTokenWithTrivia() { ObjectBinder.RegisterTypeReader(typeof(MissingTokenWithTrivia), r => new MissingTokenWithTrivia(r)); } public override string Text { get { return string.Empty; } } public override object Value { get { switch (this.Kind) { case SyntaxKind.IdentifierToken: return string.Empty; default: return null; } } } public override SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) { return new MissingTokenWithTrivia(this.Kind, trivia, this.TrailingField, this.GetDiagnostics(), this.GetAnnotations()); } public override SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) { return new MissingTokenWithTrivia(this.Kind, this.LeadingField, trivia, this.GetDiagnostics(), this.GetAnnotations()); } internal override GreenNode SetDiagnostics(DiagnosticInfo[] diagnostics) { return new MissingTokenWithTrivia(this.Kind, this.LeadingField, this.TrailingField, diagnostics, this.GetAnnotations()); } internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) { return new MissingTokenWithTrivia(this.Kind, this.LeadingField, this.TrailingField, this.GetDiagnostics(), annotations); } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/CSharpTest/Classification/CopyPasteAndPrintingClassifierTests.cs
// 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 System; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Implementation.Classification; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text.Shared.Extensions; using Microsoft.VisualStudio.Text.Tagging; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Classification { [UseExportProvider] [Trait(Traits.Feature, Traits.Features.Classification)] public class CopyPasteAndPrintingClassifierTests { [WpfFact] public async Task TestGetTagsOnBufferTagger() { // don't crash using var workspace = TestWorkspace.CreateCSharp("class C { C c; }"); var document = workspace.Documents.First(); var listenerProvider = workspace.ExportProvider.GetExportedValue<IAsynchronousOperationListenerProvider>(); var provider = new CopyPasteAndPrintingClassificationBufferTaggerProvider( workspace.ExportProvider.GetExportedValue<IThreadingContext>(), workspace.ExportProvider.GetExportedValue<ClassificationTypeMap>(), listenerProvider); var tagger = provider.CreateTagger<IClassificationTag>(document.GetTextBuffer())!; using var disposable = (IDisposable)tagger; var waiter = listenerProvider.GetWaiter(FeatureAttribute.Classification); await waiter.ExpeditedWaitAsync(); var tags = tagger.GetTags(document.GetTextBuffer().CurrentSnapshot.GetSnapshotSpanCollection()); var allTags = tagger.GetAllTags(document.GetTextBuffer().CurrentSnapshot.GetSnapshotSpanCollection(), CancellationToken.None); Assert.Empty(tags); Assert.NotEmpty(allTags); Assert.Equal(1, allTags.Count()); } } }
// 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 System; using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Implementation.Classification; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text.Shared.Extensions; using Microsoft.VisualStudio.Text.Tagging; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Classification { [UseExportProvider] [Trait(Traits.Feature, Traits.Features.Classification)] public class CopyPasteAndPrintingClassifierTests { [WpfFact] public async Task TestGetTagsOnBufferTagger() { // don't crash using var workspace = TestWorkspace.CreateCSharp("class C { C c; }"); var document = workspace.Documents.First(); var listenerProvider = workspace.ExportProvider.GetExportedValue<IAsynchronousOperationListenerProvider>(); var provider = new CopyPasteAndPrintingClassificationBufferTaggerProvider( workspace.ExportProvider.GetExportedValue<IThreadingContext>(), workspace.ExportProvider.GetExportedValue<ClassificationTypeMap>(), listenerProvider); var tagger = provider.CreateTagger<IClassificationTag>(document.GetTextBuffer())!; using var disposable = (IDisposable)tagger; var waiter = listenerProvider.GetWaiter(FeatureAttribute.Classification); await waiter.ExpeditedWaitAsync(); var tags = tagger.GetTags(document.GetTextBuffer().CurrentSnapshot.GetSnapshotSpanCollection()); var allTags = tagger.GetAllTags(document.GetTextBuffer().CurrentSnapshot.GetSnapshotSpanCollection(), CancellationToken.None); Assert.Empty(tags); Assert.NotEmpty(allTags); Assert.Equal(1, allTags.Count()); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/Core/Portable/UnifiedSuggestions/UnifiedSuggestedActions/UnifiedSuggestedAction.cs
// 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 System; using Microsoft.CodeAnalysis.CodeActions; namespace Microsoft.CodeAnalysis.UnifiedSuggestions { /// <summary> /// Similar to SuggestedAction, but in a location that can be used by /// both local Roslyn and LSP. /// </summary> internal class UnifiedSuggestedAction : IUnifiedSuggestedAction { public Workspace Workspace { get; } public CodeAction OriginalCodeAction { get; } public CodeActionPriority CodeActionPriority { get; } public UnifiedSuggestedAction(Workspace workspace, CodeAction codeAction, CodeActionPriority codeActionPriority) { Workspace = workspace; OriginalCodeAction = codeAction; CodeActionPriority = codeActionPriority; } } }
// 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 System; using Microsoft.CodeAnalysis.CodeActions; namespace Microsoft.CodeAnalysis.UnifiedSuggestions { /// <summary> /// Similar to SuggestedAction, but in a location that can be used by /// both local Roslyn and LSP. /// </summary> internal class UnifiedSuggestedAction : IUnifiedSuggestedAction { public Workspace Workspace { get; } public CodeAction OriginalCodeAction { get; } public CodeActionPriority CodeActionPriority { get; } public UnifiedSuggestedAction(Workspace workspace, CodeAction codeAction, CodeActionPriority codeActionPriority) { Workspace = workspace; OriginalCodeAction = codeAction; CodeActionPriority = codeActionPriority; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Test/Core/Platform/Custom/OSVersion.cs
// 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. #nullable disable namespace Roslyn.Test.Utilities { public static class OSVersion { /// <summary> /// True when the operating system is at least Windows version 8 /// </summary> public static bool IsWin8 => System.Environment.OSVersion.Version.Build >= 9200; } }
// 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. #nullable disable namespace Roslyn.Test.Utilities { public static class OSVersion { /// <summary> /// True when the operating system is at least Windows version 8 /// </summary> public static bool IsWin8 => System.Environment.OSVersion.Version.Build >= 9200; } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/CSharp/Test/Symbol/Symbols/TypeResolutionTests.cs
// 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. #nullable disable using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using static Roslyn.Test.Utilities.TestMetadata; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols { public class TypeResolutionTests : CSharpTestBase { [Fact] public void TestGetTypeByNameAndArity() { string source1 = @" namespace System { public class TestClass { } public class TestClass<T> { } } "; string source2 = @" namespace System { public class TestClass { } } "; var c1 = CSharpCompilation.Create("Test1", syntaxTrees: new[] { Parse(source1) }, references: new[] { Net40.mscorlib }); Assert.Null(c1.GetTypeByMetadataName("DoesntExist")); Assert.Null(c1.GetTypeByMetadataName("DoesntExist`1")); Assert.Null(c1.GetTypeByMetadataName("DoesntExist`2")); NamedTypeSymbol c1TestClass = c1.GetTypeByMetadataName("System.TestClass"); Assert.NotNull(c1TestClass); NamedTypeSymbol c1TestClassT = c1.GetTypeByMetadataName("System.TestClass`1"); Assert.NotNull(c1TestClassT); Assert.Null(c1.GetTypeByMetadataName("System.TestClass`2")); var c2 = CSharpCompilation.Create("Test2", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(source2) }, references: new MetadataReference[] { new CSharpCompilationReference(c1), Net40.mscorlib }); NamedTypeSymbol c2TestClass = c2.GetTypeByMetadataName("System.TestClass"); Assert.Same(c2.Assembly, c2TestClass.ContainingAssembly); var c3 = CSharpCompilation.Create("Test3", references: new MetadataReference[] { new CSharpCompilationReference(c2), Net40.mscorlib }); NamedTypeSymbol c3TestClass = c3.GetTypeByMetadataName("System.TestClass"); Assert.NotSame(c2TestClass, c3TestClass); Assert.True(c3TestClass.ContainingAssembly.RepresentsTheSameAssemblyButHasUnresolvedReferencesByComparisonTo(c2TestClass.ContainingAssembly)); Assert.Null(c3.GetTypeByMetadataName("System.TestClass`1")); var c4 = CSharpCompilation.Create("Test4", references: new MetadataReference[] { new CSharpCompilationReference(c1), new CSharpCompilationReference(c2), Net40.mscorlib }); NamedTypeSymbol c4TestClass = c4.GetTypeByMetadataName("System.TestClass"); Assert.Null(c4TestClass); Assert.Same(c1TestClassT, c4.GetTypeByMetadataName("System.TestClass`1")); } public class C<S, T> { public class D { public class E<U, V> { public class F<W> { } } } } [ConditionalFact(typeof(ClrOnly), typeof(DesktopOnly))] public void TypeSymbolFromReflectionType() { var c = CSharpCompilation.Create("TypeSymbolFromReflectionType", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree("class C { }") }, references: new[] { MscorlibRef, MetadataReference.CreateFromImage(File.ReadAllBytes(typeof(TypeTests).GetTypeInfo().Assembly.Location)) }); var intSym = c.Assembly.GetTypeByReflectionType(typeof(int), includeReferences: true); Assert.NotNull(intSym); Assert.Equal(SpecialType.System_Int32, intSym.SpecialType); var strcmpSym = c.Assembly.GetTypeByReflectionType(typeof(StringComparison), includeReferences: true); Assert.NotNull(strcmpSym); Assert.Equal("System.StringComparison", strcmpSym.ToDisplayString()); var arraySym = c.Assembly.GetTypeByReflectionType(typeof(List<int>[][,,]), includeReferences: true); Assert.NotNull(arraySym); Assert.Equal("System.Collections.Generic.List<int>[][*,*,*]", arraySym.ToDisplayString()); var ptrSym = c.Assembly.GetTypeByReflectionType(typeof(char).MakePointerType().MakePointerType(), includeReferences: true); Assert.NotNull(ptrSym); Assert.Equal("char**", ptrSym.ToDisplayString()); string testType1 = typeof(C<,>).DeclaringType.FullName; var nestedSym1 = c.Assembly.GetTypeByReflectionType(typeof(C<int, bool>.D.E<double, float>.F<byte>), includeReferences: true); Assert.Equal(testType1 + ".C<int, bool>.D.E<double, float>.F<byte>", nestedSym1.ToDisplayString()); // Not supported atm: //string testType2 = typeof(C<,>).DeclaringType.FullName; //var nestedSym2 = c.Assembly.GetTypeByReflectionType(typeof(C<,>.D.E<,>.F<>), includeReferences: true); //Assert.Equal(testType2 + ".C<int, bool>.D.E<double, float>.F<byte>", nestedSym2.ToDisplayString()); // Process is defined in System, which isn't referenced: var err = c.Assembly.GetTypeByReflectionType(typeof(C<Process, bool>.D.E<double, float>.F<byte>), includeReferences: true); Assert.Null(err); err = c.Assembly.GetTypeByReflectionType(typeof(C<int, bool>.D.E<double, Process>.F<byte>), includeReferences: true); Assert.Null(err); err = c.Assembly.GetTypeByReflectionType(typeof(Process[]), includeReferences: true); Assert.Null(err); err = c.Assembly.GetTypeByReflectionType(typeof(SyntaxKind).MakePointerType(), includeReferences: true); Assert.Null(err); } [Fact] public void AmbiguousNestedTypeSymbolFromMetadata() { var code = "class A { class B { } }"; var c1 = CSharpCompilation.Create("Asm1", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(code) }); var c2 = CSharpCompilation.Create("Asm2", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(code) }); var c3 = CSharpCompilation.Create("Asm3", references: new[] { new CSharpCompilationReference(c1), new CSharpCompilationReference(c2) }); Assert.Null(c3.GetTypeByMetadataName("A+B")); } [Fact] public void DuplicateNestedTypeSymbol() { var code = "class A { class B { } class B { } }"; var c1 = CSharpCompilation.Create("Asm1", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(code) }); Assert.Equal("A.B", c1.GetTypeByMetadataName("A+B").ToTestDisplayString()); } } }
// 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. #nullable disable using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; using static Roslyn.Test.Utilities.TestMetadata; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols { public class TypeResolutionTests : CSharpTestBase { [Fact] public void TestGetTypeByNameAndArity() { string source1 = @" namespace System { public class TestClass { } public class TestClass<T> { } } "; string source2 = @" namespace System { public class TestClass { } } "; var c1 = CSharpCompilation.Create("Test1", syntaxTrees: new[] { Parse(source1) }, references: new[] { Net40.mscorlib }); Assert.Null(c1.GetTypeByMetadataName("DoesntExist")); Assert.Null(c1.GetTypeByMetadataName("DoesntExist`1")); Assert.Null(c1.GetTypeByMetadataName("DoesntExist`2")); NamedTypeSymbol c1TestClass = c1.GetTypeByMetadataName("System.TestClass"); Assert.NotNull(c1TestClass); NamedTypeSymbol c1TestClassT = c1.GetTypeByMetadataName("System.TestClass`1"); Assert.NotNull(c1TestClassT); Assert.Null(c1.GetTypeByMetadataName("System.TestClass`2")); var c2 = CSharpCompilation.Create("Test2", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(source2) }, references: new MetadataReference[] { new CSharpCompilationReference(c1), Net40.mscorlib }); NamedTypeSymbol c2TestClass = c2.GetTypeByMetadataName("System.TestClass"); Assert.Same(c2.Assembly, c2TestClass.ContainingAssembly); var c3 = CSharpCompilation.Create("Test3", references: new MetadataReference[] { new CSharpCompilationReference(c2), Net40.mscorlib }); NamedTypeSymbol c3TestClass = c3.GetTypeByMetadataName("System.TestClass"); Assert.NotSame(c2TestClass, c3TestClass); Assert.True(c3TestClass.ContainingAssembly.RepresentsTheSameAssemblyButHasUnresolvedReferencesByComparisonTo(c2TestClass.ContainingAssembly)); Assert.Null(c3.GetTypeByMetadataName("System.TestClass`1")); var c4 = CSharpCompilation.Create("Test4", references: new MetadataReference[] { new CSharpCompilationReference(c1), new CSharpCompilationReference(c2), Net40.mscorlib }); NamedTypeSymbol c4TestClass = c4.GetTypeByMetadataName("System.TestClass"); Assert.Null(c4TestClass); Assert.Same(c1TestClassT, c4.GetTypeByMetadataName("System.TestClass`1")); } public class C<S, T> { public class D { public class E<U, V> { public class F<W> { } } } } [ConditionalFact(typeof(ClrOnly), typeof(DesktopOnly))] public void TypeSymbolFromReflectionType() { var c = CSharpCompilation.Create("TypeSymbolFromReflectionType", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree("class C { }") }, references: new[] { MscorlibRef, MetadataReference.CreateFromImage(File.ReadAllBytes(typeof(TypeTests).GetTypeInfo().Assembly.Location)) }); var intSym = c.Assembly.GetTypeByReflectionType(typeof(int), includeReferences: true); Assert.NotNull(intSym); Assert.Equal(SpecialType.System_Int32, intSym.SpecialType); var strcmpSym = c.Assembly.GetTypeByReflectionType(typeof(StringComparison), includeReferences: true); Assert.NotNull(strcmpSym); Assert.Equal("System.StringComparison", strcmpSym.ToDisplayString()); var arraySym = c.Assembly.GetTypeByReflectionType(typeof(List<int>[][,,]), includeReferences: true); Assert.NotNull(arraySym); Assert.Equal("System.Collections.Generic.List<int>[][*,*,*]", arraySym.ToDisplayString()); var ptrSym = c.Assembly.GetTypeByReflectionType(typeof(char).MakePointerType().MakePointerType(), includeReferences: true); Assert.NotNull(ptrSym); Assert.Equal("char**", ptrSym.ToDisplayString()); string testType1 = typeof(C<,>).DeclaringType.FullName; var nestedSym1 = c.Assembly.GetTypeByReflectionType(typeof(C<int, bool>.D.E<double, float>.F<byte>), includeReferences: true); Assert.Equal(testType1 + ".C<int, bool>.D.E<double, float>.F<byte>", nestedSym1.ToDisplayString()); // Not supported atm: //string testType2 = typeof(C<,>).DeclaringType.FullName; //var nestedSym2 = c.Assembly.GetTypeByReflectionType(typeof(C<,>.D.E<,>.F<>), includeReferences: true); //Assert.Equal(testType2 + ".C<int, bool>.D.E<double, float>.F<byte>", nestedSym2.ToDisplayString()); // Process is defined in System, which isn't referenced: var err = c.Assembly.GetTypeByReflectionType(typeof(C<Process, bool>.D.E<double, float>.F<byte>), includeReferences: true); Assert.Null(err); err = c.Assembly.GetTypeByReflectionType(typeof(C<int, bool>.D.E<double, Process>.F<byte>), includeReferences: true); Assert.Null(err); err = c.Assembly.GetTypeByReflectionType(typeof(Process[]), includeReferences: true); Assert.Null(err); err = c.Assembly.GetTypeByReflectionType(typeof(SyntaxKind).MakePointerType(), includeReferences: true); Assert.Null(err); } [Fact] public void AmbiguousNestedTypeSymbolFromMetadata() { var code = "class A { class B { } }"; var c1 = CSharpCompilation.Create("Asm1", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(code) }); var c2 = CSharpCompilation.Create("Asm2", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(code) }); var c3 = CSharpCompilation.Create("Asm3", references: new[] { new CSharpCompilationReference(c1), new CSharpCompilationReference(c2) }); Assert.Null(c3.GetTypeByMetadataName("A+B")); } [Fact] public void DuplicateNestedTypeSymbol() { var code = "class A { class B { } class B { } }"; var c1 = CSharpCompilation.Create("Asm1", syntaxTrees: new[] { SyntaxFactory.ParseSyntaxTree(code) }); Assert.Equal("A.B", c1.GetTypeByMetadataName("A+B").ToTestDisplayString()); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/CoreTest/UtilityTest/BKTreeTests.cs
// 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. #nullable disable using System.Collections.Generic; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.UtilityTest { public class BKTreeTests { [Fact] public void SimpleTests() { string[] testValues = { "cook", "book", "books", "cake", "what", "water", "Cape", "Boon", "Cook", "Cart" }; var tree = BKTree.Create(testValues); var results1 = tree.Find("wat", threshold: 1); Assert.Single(results1, "what"); var results2 = tree.Find("wat", threshold: 2); Assert.True(results2.SetEquals(Expected("cart", "what", "water"))); var results3 = tree.Find("caqe", threshold: 1); Assert.True(results3.SetEquals(Expected("cake", "cape"))); } [Fact] public void PermutationTests() { string[] testValues = { "cook", "book", "books", "cake", "what", "water", "Cape", "Boon", "Cook", "Cart" }; TestTreeInvariants(testValues); } private static void TestTreeInvariants(string[] testValues) { var tree = BKTree.Create(testValues); foreach (var value in testValues) { // With a threshold of 0, we should only find exactly the item we're searching for. Assert.Single(tree.Find(value, threshold: 0), value.ToLower()); } foreach (var value in testValues) { // With a threshold of 1, we should always at least find the item we're looking for. // But we may also find additional items along with it. var items = tree.Find(value, threshold: 1); Assert.Contains(value.ToLower(), items); // We better not be finding all items. Assert.NotEqual(testValues.Length, items.Count); } foreach (var value in testValues) { // If we delete each individual character in each search string, we should still // find the value in the tree. for (var i = 0; i < value.Length; i++) { var items = tree.Find(Delete(value, i), threshold: null); Assert.Contains(value.ToLower(), items); // We better not be finding all items. Assert.NotEqual(testValues.Length, items.Count); } } foreach (var value in testValues) { // If we add a random character at any location in a string, we should still // be able to find it. for (var i = 0; i <= value.Length; i++) { var items = tree.Find(Insert(value, i, 'Z'), threshold: null); Assert.Contains(value.ToLower(), items); // We better not be finding all items. Assert.NotEqual(testValues.Length, items.Count); } } foreach (var value in testValues) { // If we transpose any characters in a string, we should still // be able to find it. for (var i = 0; i < value.Length - 1; i++) { var items = tree.Find(Transpose(value, i), threshold: null); Assert.Contains(value.ToLower(), items); } } } private static string Transpose(string value, int i) => value.Substring(0, i) + value[i + 1] + value[i] + value.Substring(i + 2); private static string Insert(string value, int i, char v) => value.Substring(0, i) + v + value.Substring(i); private static string Delete(string value, int i) => value.Substring(0, i) + value.Substring(i + 1); [Fact] public void Test2() { string[] testValues = { "Leeds", "York", "Bristol", "Leicester", "Hull", "Durham" }; var tree = BKTree.Create(testValues); var results = tree.Find("hill", threshold: null); Assert.True(results.SetEquals(Expected("hull"))); results = tree.Find("liecester", threshold: null); Assert.True(results.SetEquals(Expected("leicester"))); results = tree.Find("leicestre", threshold: null); Assert.True(results.SetEquals(Expected("leicester"))); results = tree.Find("lecester", threshold: null); Assert.True(results.SetEquals(Expected("leicester"))); } [Fact] public void TestSpillover() { string[] testValues = { /*root:*/ "Four", /*d=1*/ "Fou", "For", "Fur", "Our", "FourA", "FouAr", "FoAur", "FAour", "AFour", "Tour", /*d=2*/ "Fo", "Fu", "Fr", "or", "ur", "ou", "FourAb", "FouAbr", "FoAbur", "FAbour", "AbFour", "oFour", "Fuor", "Foru", "ours", /*d=3*/ "F", "o", "u", "r", "Fob", "Fox", "bur", "urn", "hur", "foraa", "found" }; TestTreeInvariants(testValues); } [Fact] public void Top1000() => TestTreeInvariants(EditDistanceTests.Top1000); private static IEnumerable<string> Expected(params string[] values) => values; } }
// 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. #nullable disable using System.Collections.Generic; using Roslyn.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.UtilityTest { public class BKTreeTests { [Fact] public void SimpleTests() { string[] testValues = { "cook", "book", "books", "cake", "what", "water", "Cape", "Boon", "Cook", "Cart" }; var tree = BKTree.Create(testValues); var results1 = tree.Find("wat", threshold: 1); Assert.Single(results1, "what"); var results2 = tree.Find("wat", threshold: 2); Assert.True(results2.SetEquals(Expected("cart", "what", "water"))); var results3 = tree.Find("caqe", threshold: 1); Assert.True(results3.SetEquals(Expected("cake", "cape"))); } [Fact] public void PermutationTests() { string[] testValues = { "cook", "book", "books", "cake", "what", "water", "Cape", "Boon", "Cook", "Cart" }; TestTreeInvariants(testValues); } private static void TestTreeInvariants(string[] testValues) { var tree = BKTree.Create(testValues); foreach (var value in testValues) { // With a threshold of 0, we should only find exactly the item we're searching for. Assert.Single(tree.Find(value, threshold: 0), value.ToLower()); } foreach (var value in testValues) { // With a threshold of 1, we should always at least find the item we're looking for. // But we may also find additional items along with it. var items = tree.Find(value, threshold: 1); Assert.Contains(value.ToLower(), items); // We better not be finding all items. Assert.NotEqual(testValues.Length, items.Count); } foreach (var value in testValues) { // If we delete each individual character in each search string, we should still // find the value in the tree. for (var i = 0; i < value.Length; i++) { var items = tree.Find(Delete(value, i), threshold: null); Assert.Contains(value.ToLower(), items); // We better not be finding all items. Assert.NotEqual(testValues.Length, items.Count); } } foreach (var value in testValues) { // If we add a random character at any location in a string, we should still // be able to find it. for (var i = 0; i <= value.Length; i++) { var items = tree.Find(Insert(value, i, 'Z'), threshold: null); Assert.Contains(value.ToLower(), items); // We better not be finding all items. Assert.NotEqual(testValues.Length, items.Count); } } foreach (var value in testValues) { // If we transpose any characters in a string, we should still // be able to find it. for (var i = 0; i < value.Length - 1; i++) { var items = tree.Find(Transpose(value, i), threshold: null); Assert.Contains(value.ToLower(), items); } } } private static string Transpose(string value, int i) => value.Substring(0, i) + value[i + 1] + value[i] + value.Substring(i + 2); private static string Insert(string value, int i, char v) => value.Substring(0, i) + v + value.Substring(i); private static string Delete(string value, int i) => value.Substring(0, i) + value.Substring(i + 1); [Fact] public void Test2() { string[] testValues = { "Leeds", "York", "Bristol", "Leicester", "Hull", "Durham" }; var tree = BKTree.Create(testValues); var results = tree.Find("hill", threshold: null); Assert.True(results.SetEquals(Expected("hull"))); results = tree.Find("liecester", threshold: null); Assert.True(results.SetEquals(Expected("leicester"))); results = tree.Find("leicestre", threshold: null); Assert.True(results.SetEquals(Expected("leicester"))); results = tree.Find("lecester", threshold: null); Assert.True(results.SetEquals(Expected("leicester"))); } [Fact] public void TestSpillover() { string[] testValues = { /*root:*/ "Four", /*d=1*/ "Fou", "For", "Fur", "Our", "FourA", "FouAr", "FoAur", "FAour", "AFour", "Tour", /*d=2*/ "Fo", "Fu", "Fr", "or", "ur", "ou", "FourAb", "FouAbr", "FoAbur", "FAbour", "AbFour", "oFour", "Fuor", "Foru", "ours", /*d=3*/ "F", "o", "u", "r", "Fob", "Fox", "bur", "urn", "hur", "foraa", "found" }; TestTreeInvariants(testValues); } [Fact] public void Top1000() => TestTreeInvariants(EditDistanceTests.Top1000); private static IEnumerable<string> Expected(params string[] values) => values; } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/Core/Implementation/IntelliSense/IController.cs
// 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. #nullable disable using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis.Shared.TestHooks; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense { internal interface IController<TModel> { void OnModelUpdated(TModel result, bool updateController); IAsyncToken BeginAsyncOperation(string name = "", object tag = null, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0); void StopModelComputation(); } }
// 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. #nullable disable using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis.Shared.TestHooks; namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense { internal interface IController<TModel> { void OnModelUpdated(TModel result, bool updateController); IAsyncToken BeginAsyncOperation(string name = "", object tag = null, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0); void StopModelComputation(); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/Core/Implementation/ITextBufferAssociatedViewService.cs
// 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. #nullable disable using System; using System.Collections.Generic; using System.Collections.ObjectModel; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; namespace Microsoft.CodeAnalysis.Editor { internal interface ITextBufferAssociatedViewService { IEnumerable<ITextView> GetAssociatedTextViews(ITextBuffer textBuffer); event EventHandler<SubjectBuffersConnectedEventArgs> SubjectBuffersConnected; } internal class SubjectBuffersConnectedEventArgs { public ReadOnlyCollection<ITextBuffer> SubjectBuffers { get; } public ITextView TextView { get; } public SubjectBuffersConnectedEventArgs(ITextView textView, ReadOnlyCollection<ITextBuffer> subjectBuffers) { this.TextView = textView; this.SubjectBuffers = subjectBuffers; } } }
// 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. #nullable disable using System; using System.Collections.Generic; using System.Collections.ObjectModel; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; namespace Microsoft.CodeAnalysis.Editor { internal interface ITextBufferAssociatedViewService { IEnumerable<ITextView> GetAssociatedTextViews(ITextBuffer textBuffer); event EventHandler<SubjectBuffersConnectedEventArgs> SubjectBuffersConnected; } internal class SubjectBuffersConnectedEventArgs { public ReadOnlyCollection<ITextBuffer> SubjectBuffers { get; } public ITextView TextView { get; } public SubjectBuffersConnectedEventArgs(ITextView textView, ReadOnlyCollection<ITextBuffer> subjectBuffers) { this.TextView = textView; this.SubjectBuffers = subjectBuffers; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpInteractiveFormsAndWpf.cs
// 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. #nullable disable using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.Threading; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Roslyn.VisualStudio.IntegrationTests.CSharp { [Collection(nameof(SharedIntegrationHostFixture))] public class CSharpInteractiveFormsAndWpf : AbstractInteractiveWindowTest { public CSharpInteractiveFormsAndWpf(VisualStudioInstanceFactory instanceFactory) : base(instanceFactory) { } public override async Task InitializeAsync() { await base.InitializeAsync().ConfigureAwait(true); VisualStudio.InteractiveWindow.SubmitText(@"#r ""System.Windows.Forms"" #r ""WindowsBase"" #r ""PresentationCore"" #r ""PresentationFramework"" #r ""System.Xaml"""); VisualStudio.InteractiveWindow.SubmitText(@"using System.Windows; using System.Windows.Forms; using Wpf = System.Windows.Controls;"); } [WpfFact] public async Task InteractiveWithDisplayFormAndWpfWindow() { // 1) Create and display form and WPF window VisualStudio.InteractiveWindow.SubmitText(@"Form form = new Form(); form.Text = ""win form text""; form.Show(); Window wind = new Window(); wind.Title = ""wpf window text""; wind.Show();"); using var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout); var form = await AutomationElementHelper.FindAutomationElementAsync("win form text").WithCancellation(cancellationTokenSource.Token); var wpf = await AutomationElementHelper.FindAutomationElementAsync("wpf window text").WithCancellation(cancellationTokenSource.Token); // 3) Add UI elements to windows and verify VisualStudio.InteractiveWindow.SubmitText(@"// add a label to the form Label l = new Label(); l.Text = ""forms label text""; form.Controls.Add(l); // set simple text as the body of the wpf window Wpf.TextBlock t = new Wpf.TextBlock(); t.Text = ""wpf body text""; wind.Content = t;"); var formLabel = form.FindDescendantByPath("text"); Assert.Equal("forms label text", formLabel.CurrentName); var wpfContent = wpf.FindDescendantByPath("text"); Assert.Equal("wpf body text", wpfContent.CurrentName); // 4) Close windows VisualStudio.InteractiveWindow.SubmitText(@"form.Close(); wind.Close();"); } } }
// 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. #nullable disable using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.Threading; using Roslyn.Test.Utilities; using Xunit; using Xunit.Abstractions; namespace Roslyn.VisualStudio.IntegrationTests.CSharp { [Collection(nameof(SharedIntegrationHostFixture))] public class CSharpInteractiveFormsAndWpf : AbstractInteractiveWindowTest { public CSharpInteractiveFormsAndWpf(VisualStudioInstanceFactory instanceFactory) : base(instanceFactory) { } public override async Task InitializeAsync() { await base.InitializeAsync().ConfigureAwait(true); VisualStudio.InteractiveWindow.SubmitText(@"#r ""System.Windows.Forms"" #r ""WindowsBase"" #r ""PresentationCore"" #r ""PresentationFramework"" #r ""System.Xaml"""); VisualStudio.InteractiveWindow.SubmitText(@"using System.Windows; using System.Windows.Forms; using Wpf = System.Windows.Controls;"); } [WpfFact] public async Task InteractiveWithDisplayFormAndWpfWindow() { // 1) Create and display form and WPF window VisualStudio.InteractiveWindow.SubmitText(@"Form form = new Form(); form.Text = ""win form text""; form.Show(); Window wind = new Window(); wind.Title = ""wpf window text""; wind.Show();"); using var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout); var form = await AutomationElementHelper.FindAutomationElementAsync("win form text").WithCancellation(cancellationTokenSource.Token); var wpf = await AutomationElementHelper.FindAutomationElementAsync("wpf window text").WithCancellation(cancellationTokenSource.Token); // 3) Add UI elements to windows and verify VisualStudio.InteractiveWindow.SubmitText(@"// add a label to the form Label l = new Label(); l.Text = ""forms label text""; form.Controls.Add(l); // set simple text as the body of the wpf window Wpf.TextBlock t = new Wpf.TextBlock(); t.Text = ""wpf body text""; wind.Content = t;"); var formLabel = form.FindDescendantByPath("text"); Assert.Equal("forms label text", formLabel.CurrentName); var wpfContent = wpf.FindDescendantByPath("text"); Assert.Equal("wpf body text", wpfContent.CurrentName); // 4) Close windows VisualStudio.InteractiveWindow.SubmitText(@"form.Close(); wind.Close();"); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Xaml/Impl/Features/AutoInsert/IXamlAutoInsertService.cs
// 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. #nullable disable using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Host; namespace Microsoft.VisualStudio.LanguageServices.Xaml.Features.AutoInsert { internal interface IXamlAutoInsertService : ILanguageService { public Task<XamlAutoInsertResult> GetAutoInsertAsync(TextDocument document, char typedChar, int position, CancellationToken cancellationToken); } }
// 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. #nullable disable using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Host; namespace Microsoft.VisualStudio.LanguageServices.Xaml.Features.AutoInsert { internal interface IXamlAutoInsertService : ILanguageService { public Task<XamlAutoInsertResult> GetAutoInsertAsync(TextDocument document, char typedChar, int position, CancellationToken cancellationToken); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/CSharpTest2/Recommendations/RegionKeywordRecommenderTests.cs
// 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. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations { public class RegionKeywordRecommenderTests : KeywordRecommenderTests { [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotAtRoot_Interactive() { await VerifyAbsenceAsync(SourceCodeKind.Script, @"$$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotAfterClass_Interactive() { await VerifyAbsenceAsync(SourceCodeKind.Script, @"class C { } $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotAfterGlobalStatement_Interactive() { await VerifyAbsenceAsync(SourceCodeKind.Script, @"System.Console.WriteLine(); $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotAfterGlobalVariableDeclaration_Interactive() { await VerifyAbsenceAsync(SourceCodeKind.Script, @"int i = 0; $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotInUsingAlias() { await VerifyAbsenceAsync( @"using Goo = $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotInGlobalUsingAlias() { await VerifyAbsenceAsync( @"global using Goo = $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotInEmptyStatement() { await VerifyAbsenceAsync(AddInsideMethod( @"$$")); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestAfterHash() { await VerifyKeywordAsync( @"#$$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestAfterHashAndSpace() { await VerifyKeywordAsync( @"# $$"); } } }
// 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. #nullable disable using System.Threading.Tasks; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Recommendations { public class RegionKeywordRecommenderTests : KeywordRecommenderTests { [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotAtRoot_Interactive() { await VerifyAbsenceAsync(SourceCodeKind.Script, @"$$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotAfterClass_Interactive() { await VerifyAbsenceAsync(SourceCodeKind.Script, @"class C { } $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotAfterGlobalStatement_Interactive() { await VerifyAbsenceAsync(SourceCodeKind.Script, @"System.Console.WriteLine(); $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotAfterGlobalVariableDeclaration_Interactive() { await VerifyAbsenceAsync(SourceCodeKind.Script, @"int i = 0; $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotInUsingAlias() { await VerifyAbsenceAsync( @"using Goo = $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotInGlobalUsingAlias() { await VerifyAbsenceAsync( @"global using Goo = $$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotInEmptyStatement() { await VerifyAbsenceAsync(AddInsideMethod( @"$$")); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestAfterHash() { await VerifyKeywordAsync( @"#$$"); } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestAfterHashAndSpace() { await VerifyKeywordAsync( @"# $$"); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/Core/Portable/ExtractClass/AbstractExtractClassRefactoringProvider.cs
// 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 System; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.PullMemberUp; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.ExtractClass { internal abstract class AbstractExtractClassRefactoringProvider : CodeRefactoringProvider { private readonly IExtractClassOptionsService? _optionsService; public AbstractExtractClassRefactoringProvider(IExtractClassOptionsService? service) { _optionsService = service; } protected abstract Task<SyntaxNode?> GetSelectedNodeAsync(CodeRefactoringContext context); protected abstract Task<SyntaxNode?> GetSelectedClassDeclarationAsync(CodeRefactoringContext context); public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context) { // For simplicity if we can't add a document the don't supply this refactoring. Not checking this results in known // cases that won't work because the refactoring may try to add a document. There's non-trivial // work to support a user interaction that makes sense for those cases. // See: https://github.com/dotnet/roslyn/issues/50868 if (!context.Document.Project.Solution.Workspace.CanApplyChange(ApplyChangesKind.AddDocument)) { return; } var optionsService = _optionsService ?? context.Document.Project.Solution.Workspace.Services.GetService<IExtractClassOptionsService>(); if (optionsService is null) { return; } // If we register the action on a class node, no need to find selected members. Just allow // the action to be invoked with the dialog and no selected members var action = await TryGetClassActionAsync(context, optionsService).ConfigureAwait(false) ?? await TryGetMemberActionAsync(context, optionsService).ConfigureAwait(false); if (action != null) { context.RegisterRefactoring(action, action.Span); } } private async Task<ExtractClassWithDialogCodeAction?> TryGetMemberActionAsync(CodeRefactoringContext context, IExtractClassOptionsService optionsService) { var selectedMemberNode = await GetSelectedNodeAsync(context).ConfigureAwait(false); if (selectedMemberNode is null) { return null; } var (document, span, cancellationToken) = context; var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var selectedMember = semanticModel.GetDeclaredSymbol(selectedMemberNode, cancellationToken); if (selectedMember is null || selectedMember.ContainingType is null) { return null; } // Use same logic as pull members up for determining if a selected member // is valid to be moved into a base if (!MemberAndDestinationValidator.IsMemberValid(selectedMember)) { return null; } var containingType = selectedMember.ContainingType; // Can't extract to a new type if there's already a base. Maybe // in the future we could inject a new type inbetween base and // current if (containingType.BaseType?.SpecialType != SpecialType.System_Object) { return null; } var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>(); var containingTypeDeclarationNode = selectedMemberNode.FirstAncestorOrSelf<SyntaxNode>(syntaxFacts.IsTypeDeclaration); return new ExtractClassWithDialogCodeAction(document, span, optionsService, containingType, containingTypeDeclarationNode!, selectedMember); } private async Task<ExtractClassWithDialogCodeAction?> TryGetClassActionAsync(CodeRefactoringContext context, IExtractClassOptionsService optionsService) { var selectedClassNode = await GetSelectedClassDeclarationAsync(context).ConfigureAwait(false); if (selectedClassNode is null) { return null; } var (document, span, cancellationToken) = context; var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var originalType = semanticModel.GetDeclaredSymbol(selectedClassNode, cancellationToken) as INamedTypeSymbol; if (originalType is null) { return null; } return new ExtractClassWithDialogCodeAction(document, span, optionsService, originalType, selectedClassNode); } } }
// 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 System; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.PullMemberUp; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.ExtractClass { internal abstract class AbstractExtractClassRefactoringProvider : CodeRefactoringProvider { private readonly IExtractClassOptionsService? _optionsService; public AbstractExtractClassRefactoringProvider(IExtractClassOptionsService? service) { _optionsService = service; } protected abstract Task<SyntaxNode?> GetSelectedNodeAsync(CodeRefactoringContext context); protected abstract Task<SyntaxNode?> GetSelectedClassDeclarationAsync(CodeRefactoringContext context); public override async Task ComputeRefactoringsAsync(CodeRefactoringContext context) { // For simplicity if we can't add a document the don't supply this refactoring. Not checking this results in known // cases that won't work because the refactoring may try to add a document. There's non-trivial // work to support a user interaction that makes sense for those cases. // See: https://github.com/dotnet/roslyn/issues/50868 if (!context.Document.Project.Solution.Workspace.CanApplyChange(ApplyChangesKind.AddDocument)) { return; } var optionsService = _optionsService ?? context.Document.Project.Solution.Workspace.Services.GetService<IExtractClassOptionsService>(); if (optionsService is null) { return; } // If we register the action on a class node, no need to find selected members. Just allow // the action to be invoked with the dialog and no selected members var action = await TryGetClassActionAsync(context, optionsService).ConfigureAwait(false) ?? await TryGetMemberActionAsync(context, optionsService).ConfigureAwait(false); if (action != null) { context.RegisterRefactoring(action, action.Span); } } private async Task<ExtractClassWithDialogCodeAction?> TryGetMemberActionAsync(CodeRefactoringContext context, IExtractClassOptionsService optionsService) { var selectedMemberNode = await GetSelectedNodeAsync(context).ConfigureAwait(false); if (selectedMemberNode is null) { return null; } var (document, span, cancellationToken) = context; var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var selectedMember = semanticModel.GetDeclaredSymbol(selectedMemberNode, cancellationToken); if (selectedMember is null || selectedMember.ContainingType is null) { return null; } // Use same logic as pull members up for determining if a selected member // is valid to be moved into a base if (!MemberAndDestinationValidator.IsMemberValid(selectedMember)) { return null; } var containingType = selectedMember.ContainingType; // Can't extract to a new type if there's already a base. Maybe // in the future we could inject a new type inbetween base and // current if (containingType.BaseType?.SpecialType != SpecialType.System_Object) { return null; } var syntaxFacts = document.GetRequiredLanguageService<ISyntaxFactsService>(); var containingTypeDeclarationNode = selectedMemberNode.FirstAncestorOrSelf<SyntaxNode>(syntaxFacts.IsTypeDeclaration); return new ExtractClassWithDialogCodeAction(document, span, optionsService, containingType, containingTypeDeclarationNode!, selectedMember); } private async Task<ExtractClassWithDialogCodeAction?> TryGetClassActionAsync(CodeRefactoringContext context, IExtractClassOptionsService optionsService) { var selectedClassNode = await GetSelectedClassDeclarationAsync(context).ConfigureAwait(false); if (selectedClassNode is null) { return null; } var (document, span, cancellationToken) = context; var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var originalType = semanticModel.GetDeclaredSymbol(selectedClassNode, cancellationToken) as INamedTypeSymbol; if (originalType is null) { return null; } return new ExtractClassWithDialogCodeAction(document, span, optionsService, originalType, selectedClassNode); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/CSharp/Portable/Completion/KeywordRecommenders/ReadOnlyKeywordRecommender.cs
// 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 System.Collections.Generic; using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; using Microsoft.CodeAnalysis.CSharp.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class ReadOnlyKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) { SyntaxKind.NewKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.InternalKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.StaticKeyword, }; public ReadOnlyKeywordRecommender() : base(SyntaxKind.ReadOnlyKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { return context.IsGlobalStatementContext || IsRefReadOnlyContext(context) || IsValidContextForType(context, cancellationToken) || context.SyntaxTree.IsGlobalMemberDeclarationContext(context.Position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) || context.IsMemberDeclarationContext( validModifiers: s_validMemberModifiers, validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructRecordTypeDeclarations, canBePartial: false, cancellationToken: cancellationToken) || IsStructAccessorContext(context); } private static bool IsRefReadOnlyContext(CSharpSyntaxContext context) => context.TargetToken.IsKind(SyntaxKind.RefKeyword) && (context.TargetToken.Parent.IsKind(SyntaxKind.RefType) || context.IsFunctionPointerTypeArgumentContext); private static bool IsValidContextForType(CSharpSyntaxContext context, CancellationToken cancellationToken) { return context.IsTypeDeclarationContext(validModifiers: SyntaxKindSet.AllTypeModifiers, validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructRecordTypeDeclarations, canBePartial: true, cancellationToken); } private static bool IsStructAccessorContext(CSharpSyntaxContext context) { var type = context.ContainingTypeDeclaration; return type is not null && type.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.RecordStructDeclaration && context.TargetToken.IsAnyAccessorDeclarationContext(context.Position, SyntaxKind.ReadOnlyKeyword); } } }
// 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 System.Collections.Generic; using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; using Microsoft.CodeAnalysis.CSharp.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class ReadOnlyKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) { SyntaxKind.NewKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.InternalKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.StaticKeyword, }; public ReadOnlyKeywordRecommender() : base(SyntaxKind.ReadOnlyKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { return context.IsGlobalStatementContext || IsRefReadOnlyContext(context) || IsValidContextForType(context, cancellationToken) || context.SyntaxTree.IsGlobalMemberDeclarationContext(context.Position, SyntaxKindSet.AllGlobalMemberModifiers, cancellationToken) || context.IsMemberDeclarationContext( validModifiers: s_validMemberModifiers, validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructRecordTypeDeclarations, canBePartial: false, cancellationToken: cancellationToken) || IsStructAccessorContext(context); } private static bool IsRefReadOnlyContext(CSharpSyntaxContext context) => context.TargetToken.IsKind(SyntaxKind.RefKeyword) && (context.TargetToken.Parent.IsKind(SyntaxKind.RefType) || context.IsFunctionPointerTypeArgumentContext); private static bool IsValidContextForType(CSharpSyntaxContext context, CancellationToken cancellationToken) { return context.IsTypeDeclarationContext(validModifiers: SyntaxKindSet.AllTypeModifiers, validTypeDeclarations: SyntaxKindSet.ClassInterfaceStructRecordTypeDeclarations, canBePartial: true, cancellationToken); } private static bool IsStructAccessorContext(CSharpSyntaxContext context) { var type = context.ContainingTypeDeclaration; return type is not null && type.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.RecordStructDeclaration && context.TargetToken.IsAnyAccessorDeclarationContext(context.Position, SyntaxKind.ReadOnlyKeyword); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Test/Core/Syntax/SourceUtilities.cs
// 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.CodeAnalysis.Text; using System; using System.Collections.Generic; using System.Text; namespace Roslyn.Test.Utilities.Syntax { internal sealed class RandomizedSourceText : SourceText { private readonly char[] _buffer = new char[2048]; public RandomizedSourceText() { var random = new Random(12345); for (var i = 0; i < _buffer.Length; i++) { _buffer[i] = (char)random.Next(); } } public override char this[int position] => _buffer[position % _buffer.Length]; public override Encoding Encoding => Encoding.UTF8; public override int Length { get { return 40 * 1000 * 1000; } } public override void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { for (var i = 0; i < count; i++) { destination[destinationIndex + i] = this[sourceIndex + i]; } } } }
// 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.CodeAnalysis.Text; using System; using System.Collections.Generic; using System.Text; namespace Roslyn.Test.Utilities.Syntax { internal sealed class RandomizedSourceText : SourceText { private readonly char[] _buffer = new char[2048]; public RandomizedSourceText() { var random = new Random(12345); for (var i = 0; i < _buffer.Length; i++) { _buffer[i] = (char)random.Next(); } } public override char this[int position] => _buffer[position % _buffer.Length]; public override Encoding Encoding => Encoding.UTF8; public override int Length { get { return 40 * 1000 * 1000; } } public override void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { for (var i = 0; i < count; i++) { destination[destinationIndex + i] = this[sourceIndex + i]; } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Core/CodeAnalysisTest/Collections/ImmutablesTestBase.cs
// 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. // NOTE: This code is derived from an implementation originally in dotnet/runtime: // https://github.com/dotnet/runtime/blob/v5.0.2/src/libraries/System.Collections.Immutable/tests/ImmutableTestBase.cs // // See the commentary in https://github.com/dotnet/roslyn/pull/50156 for notes on incorporating changes made to the // reference implementation. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Reflection; using System.Text; using Microsoft.CodeAnalysis.Collections; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Collections { public abstract partial class ImmutablesTestBase { /// <summary> /// Gets the number of operations to perform in randomized tests. /// </summary> protected static int RandomOperationsCount { get { return 100; } } internal static void AssertAreSame<T>(T expected, T actual) { if (typeof(T).GetTypeInfo().IsValueType) { Assert.Equal(expected, actual); //, message, formattingArgs); } else { Assert.Same((object?)expected, (object?)actual); //, message, formattingArgs); } } internal static void CollectionAssertAreEquivalent<T>(ICollection<T> expected, ICollection<T> actual) { Assert.Equal(expected.Count, actual.Count); foreach (var value in expected) { Assert.Contains(value, actual); } } protected static bool IsSame<T>(IImmutableList<T> first, IImmutableList<T> second) { if (first is ImmutableSegmentedList<T> firstSegmented && second is ImmutableSegmentedList<T> secondSegmented) { return firstSegmented == secondSegmented; } else if (first.GetType() != second.GetType()) { // If the instances do not have the same type, they cannot be the same return false; } else if (first.GetType().IsValueType) { throw new NotSupportedException($"Unable to compare '{first.GetType()}' for identity."); } return first == second; } protected static bool IsSame<TKey, TValue>(IImmutableDictionary<TKey, TValue> first, IImmutableDictionary<TKey, TValue> second) where TKey : notnull { if (first is ImmutableSegmentedDictionary<TKey, TValue> firstSegmented && second is ImmutableSegmentedDictionary<TKey, TValue> secondSegmented) { return firstSegmented == secondSegmented; } else if (first.GetType() != second.GetType()) { // If the instances do not have the same type, they cannot be the same return false; } else if (first.GetType().IsValueType) { throw new NotSupportedException($"Unable to compare '{first.GetType()}' for identity."); } return first == second; } protected static string ToString(System.Collections.IEnumerable sequence) { var sb = new StringBuilder(); sb.Append('{'); int count = 0; foreach (object item in sequence) { if (count > 0) { sb.Append(','); } if (count == 10) { sb.Append("..."); break; } sb.Append(item); count++; } sb.Append('}'); return sb.ToString(); } protected static object ToStringDeferred(System.Collections.IEnumerable sequence) { return new DeferredToString(() => ToString(sequence)); } protected static void ManuallyEnumerateTest<T>(IList<T> expectedResults, IEnumerator<T> enumerator) { T[] manualArray = new T[expectedResults.Count]; int i = 0; Assert.Equal(default(T), enumerator.Current); while (enumerator.MoveNext()) { manualArray[i++] = enumerator.Current; } Assert.False(enumerator.MoveNext()); Assert.Equal(default(T), enumerator.Current); Assert.False(enumerator.MoveNext()); Assert.Equal(default(T), enumerator.Current); Assert.Equal(expectedResults.Count, i); //, "Enumeration did not produce enough elements."); Assert.Equal<T>(expectedResults, manualArray); } /// <summary> /// Generates an array of unique values. /// </summary> /// <param name="length">The desired length of the array.</param> /// <returns>An array of doubles.</returns> protected static double[] GenerateDummyFillData(int length = 1000) { Assert.InRange(length, 0, int.MaxValue); int seed = unchecked((int)DateTime.Now.Ticks); Debug.WriteLine("Random seed {0}", seed); var random = new Random(seed); var inputs = new double[length]; var ensureUniqueness = new HashSet<double>(); for (int i = 0; i < inputs.Length; i++) { double input; do { input = random.NextDouble(); } while (!ensureUniqueness.Add(input)); inputs[i] = input; } Assert.NotNull(inputs); Assert.Equal(length, inputs.Length); return inputs; } private class DeferredToString { private readonly Func<string> _generator; internal DeferredToString(Func<string> generator) { Debug.Assert(generator != null); _generator = generator; } public override string ToString() { return _generator(); } } } }
// 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. // NOTE: This code is derived from an implementation originally in dotnet/runtime: // https://github.com/dotnet/runtime/blob/v5.0.2/src/libraries/System.Collections.Immutable/tests/ImmutableTestBase.cs // // See the commentary in https://github.com/dotnet/roslyn/pull/50156 for notes on incorporating changes made to the // reference implementation. using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Reflection; using System.Text; using Microsoft.CodeAnalysis.Collections; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Collections { public abstract partial class ImmutablesTestBase { /// <summary> /// Gets the number of operations to perform in randomized tests. /// </summary> protected static int RandomOperationsCount { get { return 100; } } internal static void AssertAreSame<T>(T expected, T actual) { if (typeof(T).GetTypeInfo().IsValueType) { Assert.Equal(expected, actual); //, message, formattingArgs); } else { Assert.Same((object?)expected, (object?)actual); //, message, formattingArgs); } } internal static void CollectionAssertAreEquivalent<T>(ICollection<T> expected, ICollection<T> actual) { Assert.Equal(expected.Count, actual.Count); foreach (var value in expected) { Assert.Contains(value, actual); } } protected static bool IsSame<T>(IImmutableList<T> first, IImmutableList<T> second) { if (first is ImmutableSegmentedList<T> firstSegmented && second is ImmutableSegmentedList<T> secondSegmented) { return firstSegmented == secondSegmented; } else if (first.GetType() != second.GetType()) { // If the instances do not have the same type, they cannot be the same return false; } else if (first.GetType().IsValueType) { throw new NotSupportedException($"Unable to compare '{first.GetType()}' for identity."); } return first == second; } protected static bool IsSame<TKey, TValue>(IImmutableDictionary<TKey, TValue> first, IImmutableDictionary<TKey, TValue> second) where TKey : notnull { if (first is ImmutableSegmentedDictionary<TKey, TValue> firstSegmented && second is ImmutableSegmentedDictionary<TKey, TValue> secondSegmented) { return firstSegmented == secondSegmented; } else if (first.GetType() != second.GetType()) { // If the instances do not have the same type, they cannot be the same return false; } else if (first.GetType().IsValueType) { throw new NotSupportedException($"Unable to compare '{first.GetType()}' for identity."); } return first == second; } protected static string ToString(System.Collections.IEnumerable sequence) { var sb = new StringBuilder(); sb.Append('{'); int count = 0; foreach (object item in sequence) { if (count > 0) { sb.Append(','); } if (count == 10) { sb.Append("..."); break; } sb.Append(item); count++; } sb.Append('}'); return sb.ToString(); } protected static object ToStringDeferred(System.Collections.IEnumerable sequence) { return new DeferredToString(() => ToString(sequence)); } protected static void ManuallyEnumerateTest<T>(IList<T> expectedResults, IEnumerator<T> enumerator) { T[] manualArray = new T[expectedResults.Count]; int i = 0; Assert.Equal(default(T), enumerator.Current); while (enumerator.MoveNext()) { manualArray[i++] = enumerator.Current; } Assert.False(enumerator.MoveNext()); Assert.Equal(default(T), enumerator.Current); Assert.False(enumerator.MoveNext()); Assert.Equal(default(T), enumerator.Current); Assert.Equal(expectedResults.Count, i); //, "Enumeration did not produce enough elements."); Assert.Equal<T>(expectedResults, manualArray); } /// <summary> /// Generates an array of unique values. /// </summary> /// <param name="length">The desired length of the array.</param> /// <returns>An array of doubles.</returns> protected static double[] GenerateDummyFillData(int length = 1000) { Assert.InRange(length, 0, int.MaxValue); int seed = unchecked((int)DateTime.Now.Ticks); Debug.WriteLine("Random seed {0}", seed); var random = new Random(seed); var inputs = new double[length]; var ensureUniqueness = new HashSet<double>(); for (int i = 0; i < inputs.Length; i++) { double input; do { input = random.NextDouble(); } while (!ensureUniqueness.Add(input)); inputs[i] = input; } Assert.NotNull(inputs); Assert.Equal(length, inputs.Length); return inputs; } private class DeferredToString { private readonly Func<string> _generator; internal DeferredToString(Func<string> generator) { Debug.Assert(generator != null); _generator = generator; } public override string ToString() { return _generator(); } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/Core/Portable/Intents/IIntentProvider.cs
// 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 System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Features.Intents { internal interface IIntentProvider { Task<ImmutableArray<IntentProcessorResult>> ComputeIntentAsync( Document priorDocument, TextSpan priorSelection, Document currentDocument, string? serializedIntentData, CancellationToken cancellationToken); } }
// 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 System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Features.Intents { internal interface IIntentProvider { Task<ImmutableArray<IntentProcessorResult>> ComputeIntentAsync( Document priorDocument, TextSpan priorSelection, Document currentDocument, string? serializedIntentData, CancellationToken cancellationToken); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/CSharp/Test/PersistentStorage/Mocks/FileSystemServiceMock.cs
// 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. // Copy of https://devdiv.visualstudio.com/DevDiv/_git/VS.CloudCache?path=%2Ftest%2FMicrosoft.VisualStudio.Cache.Tests%2FMocks&_a=contents&version=GBmain // Try to keep in sync and avoid unnecessary changes here. using System; using System.Collections.Generic; using System.IO; using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.ServiceHub.Framework; using Microsoft.VisualStudio.RpcContracts.FileSystem; namespace Microsoft.CodeAnalysis.UnitTests.WorkspaceServices.Mocks { internal class FileSystemServiceMock : IFileSystem { public event EventHandler<DirectoryEntryChangedEventArgs>? DirectoryEntryChanged; public event EventHandler<RootEntriesChangedEventArgs>? RootEntriesChanged; public Task<Uri> ConvertLocalFileNameToRemoteUriAsync(string fileName, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> ConvertLocalFileNameToRemoteUriAsync(string fileName, string remoteScheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> ConvertLocalUriToRemoteUriAsync(Uri localUri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> ConvertLocalUriToRemoteUriAsync(Uri localUri, string remoteScheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> ConvertRemoteFileNameToRemoteUriAsync(string _1, CancellationToken _2) => throw new NotImplementedException(); public Task<Uri> ConvertRemoteFileNameToRemoteUriAsync(string _1, string _2, CancellationToken _3) => throw new NotImplementedException(); public Task<Uri> ConvertRemoteUriToLocalUriAsync(Uri remoteUri, CancellationToken cancellationToken) => Task.FromResult(remoteUri); public Task<string> ConvertRemoteUriToRemoteFileNameAsync(Uri _1, CancellationToken _2) => throw new NotImplementedException(); public Task CopyAsync(Uri sourceUri, Uri destinationUri, bool overwrite, IProgress<OperationProgressData>? progress, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task CreateDirectoryAsync(Uri uri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task DeleteAsync(Uri uri, bool recursive, IProgress<OperationProgressData>? progress, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> DownloadFileAsync(Uri remoteUri, IProgress<OperationProgressData>? progress, CancellationToken cancellationToken) => throw new NotImplementedException(); public IAsyncEnumerable<Microsoft.VisualStudio.RpcContracts.FileSystem.DirectoryInfo> EnumerateDirectoriesAsync(Uri uri, string searchPattern, SearchOption searchOption, CancellationToken cancellationToken) => throw new NotImplementedException(); public IAsyncEnumerable<DirectoryEntryInfo> EnumerateDirectoryEntriesAsync(Uri uri, string searchPattern, SearchOption searchOption, CancellationToken cancellationToken) => throw new NotImplementedException(); public IAsyncEnumerable<Microsoft.VisualStudio.RpcContracts.FileSystem.FileInfo> EnumerateFilesAsync(Uri uri, string searchPattern, SearchOption searchOption, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<string> GetDefaultRemoteUriSchemeAsync(CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<UriDisplayInfo> GetDisplayInfoAsync(Uri uri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<UriDisplayInfo> GetDisplayInfoAsync(string fileName, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<DirectoryEntryInfo?> GetInfoAsync(Uri uri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<ServiceMoniker> GetMonikerForFileSystemProviderAsync(string scheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<ServiceMoniker> GetMonikerForRemoteFileSystemProviderAsync(string scheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<IReadOnlyList<Uri>> GetRootEntriesAsync(string scheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<IReadOnlyList<Uri>> GetRootEntriesAsync(CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<IReadOnlyList<string>> GetSupportedSchemesAsync(CancellationToken cancellationToken) => throw new NotImplementedException(); public Task MoveAsync(Uri oldUri, Uri newUri, bool overwrite, IProgress<OperationProgressData>? progress, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task ReadFileAsync(Uri uri, PipeWriter writer, CancellationToken cancellationToken) => throw new NotImplementedException(); public ValueTask UnwatchAsync(WatchResult watchResult, CancellationToken cancellationToken) => throw new NotImplementedException(); public ValueTask<WatchResult> WatchDirectoryAsync(Uri uri, bool recursive, CancellationToken cancellationToken) => throw new NotImplementedException(); public ValueTask<WatchResult> WatchFileAsync(Uri uri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task WriteFileAsync(Uri uri, PipeReader reader, bool overwrite, CancellationToken cancellationToken) => throw new NotImplementedException(); protected virtual void OnDirectoryEntryChanged(DirectoryEntryChangedEventArgs args) => this.DirectoryEntryChanged?.Invoke(this, args); protected virtual void OnRootEntriesChanged(RootEntriesChangedEventArgs args) => this.RootEntriesChanged?.Invoke(this, args); } }
// 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. // Copy of https://devdiv.visualstudio.com/DevDiv/_git/VS.CloudCache?path=%2Ftest%2FMicrosoft.VisualStudio.Cache.Tests%2FMocks&_a=contents&version=GBmain // Try to keep in sync and avoid unnecessary changes here. using System; using System.Collections.Generic; using System.IO; using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Microsoft.ServiceHub.Framework; using Microsoft.VisualStudio.RpcContracts.FileSystem; namespace Microsoft.CodeAnalysis.UnitTests.WorkspaceServices.Mocks { internal class FileSystemServiceMock : IFileSystem { public event EventHandler<DirectoryEntryChangedEventArgs>? DirectoryEntryChanged; public event EventHandler<RootEntriesChangedEventArgs>? RootEntriesChanged; public Task<Uri> ConvertLocalFileNameToRemoteUriAsync(string fileName, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> ConvertLocalFileNameToRemoteUriAsync(string fileName, string remoteScheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> ConvertLocalUriToRemoteUriAsync(Uri localUri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> ConvertLocalUriToRemoteUriAsync(Uri localUri, string remoteScheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> ConvertRemoteFileNameToRemoteUriAsync(string _1, CancellationToken _2) => throw new NotImplementedException(); public Task<Uri> ConvertRemoteFileNameToRemoteUriAsync(string _1, string _2, CancellationToken _3) => throw new NotImplementedException(); public Task<Uri> ConvertRemoteUriToLocalUriAsync(Uri remoteUri, CancellationToken cancellationToken) => Task.FromResult(remoteUri); public Task<string> ConvertRemoteUriToRemoteFileNameAsync(Uri _1, CancellationToken _2) => throw new NotImplementedException(); public Task CopyAsync(Uri sourceUri, Uri destinationUri, bool overwrite, IProgress<OperationProgressData>? progress, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task CreateDirectoryAsync(Uri uri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task DeleteAsync(Uri uri, bool recursive, IProgress<OperationProgressData>? progress, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<Uri> DownloadFileAsync(Uri remoteUri, IProgress<OperationProgressData>? progress, CancellationToken cancellationToken) => throw new NotImplementedException(); public IAsyncEnumerable<Microsoft.VisualStudio.RpcContracts.FileSystem.DirectoryInfo> EnumerateDirectoriesAsync(Uri uri, string searchPattern, SearchOption searchOption, CancellationToken cancellationToken) => throw new NotImplementedException(); public IAsyncEnumerable<DirectoryEntryInfo> EnumerateDirectoryEntriesAsync(Uri uri, string searchPattern, SearchOption searchOption, CancellationToken cancellationToken) => throw new NotImplementedException(); public IAsyncEnumerable<Microsoft.VisualStudio.RpcContracts.FileSystem.FileInfo> EnumerateFilesAsync(Uri uri, string searchPattern, SearchOption searchOption, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<string> GetDefaultRemoteUriSchemeAsync(CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<UriDisplayInfo> GetDisplayInfoAsync(Uri uri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<UriDisplayInfo> GetDisplayInfoAsync(string fileName, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<DirectoryEntryInfo?> GetInfoAsync(Uri uri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<ServiceMoniker> GetMonikerForFileSystemProviderAsync(string scheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<ServiceMoniker> GetMonikerForRemoteFileSystemProviderAsync(string scheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<IReadOnlyList<Uri>> GetRootEntriesAsync(string scheme, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<IReadOnlyList<Uri>> GetRootEntriesAsync(CancellationToken cancellationToken) => throw new NotImplementedException(); public Task<IReadOnlyList<string>> GetSupportedSchemesAsync(CancellationToken cancellationToken) => throw new NotImplementedException(); public Task MoveAsync(Uri oldUri, Uri newUri, bool overwrite, IProgress<OperationProgressData>? progress, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task ReadFileAsync(Uri uri, PipeWriter writer, CancellationToken cancellationToken) => throw new NotImplementedException(); public ValueTask UnwatchAsync(WatchResult watchResult, CancellationToken cancellationToken) => throw new NotImplementedException(); public ValueTask<WatchResult> WatchDirectoryAsync(Uri uri, bool recursive, CancellationToken cancellationToken) => throw new NotImplementedException(); public ValueTask<WatchResult> WatchFileAsync(Uri uri, CancellationToken cancellationToken) => throw new NotImplementedException(); public Task WriteFileAsync(Uri uri, PipeReader reader, bool overwrite, CancellationToken cancellationToken) => throw new NotImplementedException(); protected virtual void OnDirectoryEntryChanged(DirectoryEntryChangedEventArgs args) => this.DirectoryEntryChanged?.Invoke(this, args); protected virtual void OnRootEntriesChanged(RootEntriesChangedEventArgs args) => this.RootEntriesChanged?.Invoke(this, args); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs
// 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 System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Symbols; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis { using MetadataOrDiagnostic = System.Object; internal abstract class CommonReferenceManager { /// <summary> /// Must be acquired whenever the following data are about to be modified: /// - Compilation.lazyAssemblySymbol /// - Compilation.referenceManager /// - ReferenceManager state /// - <see cref="AssemblyMetadata.CachedSymbols"/> /// - <see cref="Compilation.RetargetingAssemblySymbols"/> /// /// All the above data should be updated at once while holding this lock. /// Once lazyAssemblySymbol is set the Compilation.referenceManager field and ReferenceManager /// state should not change. /// </summary> internal static object SymbolCacheAndReferenceManagerStateGuard = new object(); /// <summary> /// Enumerates all referenced assemblies. /// </summary> internal abstract IEnumerable<KeyValuePair<MetadataReference, IAssemblySymbolInternal>> GetReferencedAssemblies(); /// <summary> /// Enumerates all referenced assemblies and their aliases. /// </summary> internal abstract IEnumerable<(IAssemblySymbolInternal AssemblySymbol, ImmutableArray<string> Aliases)> GetReferencedAssemblyAliases(); internal abstract MetadataReference? GetMetadataReference(IAssemblySymbolInternal? assemblySymbol); internal abstract ImmutableArray<MetadataReference> ExplicitReferences { get; } internal abstract ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?> ImplicitReferenceResolutions { get; } } internal partial class CommonReferenceManager<TCompilation, TAssemblySymbol> : CommonReferenceManager { /// <summary> /// If the compilation being built represents an assembly its assembly name. /// If the compilation being built represents a module, the name of the /// containing assembly or <see cref="Compilation.UnspecifiedModuleAssemblyName"/> /// if not specified (/moduleassemblyname command line option). /// </summary> internal readonly string SimpleAssemblyName; /// <summary> /// Used to compares assembly identities. /// May implement unification and portability policies specific to the target platform. /// </summary> internal readonly AssemblyIdentityComparer IdentityComparer; /// <summary> /// Metadata observed by the compiler. /// May be shared across multiple Reference Managers. /// Access only under lock(<see cref="ObservedMetadata"/>). /// </summary> internal readonly Dictionary<MetadataReference, MetadataOrDiagnostic> ObservedMetadata; /// <summary> /// Once this is non-zero the state of the manager is fully initialized and immutable. /// </summary> private int _isBound; /// <summary> /// True if the compilation has a reference that refers back to the assembly being compiled. /// </summary> /// <remarks> /// If we have a circular reference the bound references can't be shared with other compilations. /// </remarks> private ThreeState _lazyHasCircularReference; /// <summary> /// A map from a metadata reference to an index to <see cref="_lazyReferencedAssemblies"/> array. Do not access /// directly, use <see cref="_lazyReferencedAssembliesMap"/> property instead. /// </summary> private Dictionary<MetadataReference, int>? _lazyReferencedAssembliesMap; /// <summary> /// A map from a net-module metadata reference to the index of the corresponding module /// symbol in the source assembly symbol for the current compilation. /// </summary> /// <remarks> /// Subtract one from the index (for the manifest module) to find the corresponding elements /// of <see cref="_lazyReferencedModules"/> and <see cref="_lazyReferencedModulesReferences"/>. /// </remarks> private Dictionary<MetadataReference, int>? _lazyReferencedModuleIndexMap; /// <summary> /// Maps (containing syntax tree file name, reference string) of #r directive to a resolved metadata reference. /// If multiple #r's in the same tree use the same value as a reference the resolved metadata reference is the same as well. /// </summary> private IDictionary<(string, string), MetadataReference>? _lazyReferenceDirectiveMap; /// <summary> /// Array of unique bound #r references. /// </summary> /// <remarks> /// The references are in the order they appear in syntax trees. This order is currently preserved /// as syntax trees are added or removed, but we might decide to share reference manager between compilations /// with different order of #r's. It doesn't seem this would be an issue since all #r's within the compilation /// have the same "priority" with respect to each other. /// </remarks> private ImmutableArray<MetadataReference> _lazyDirectiveReferences; private ImmutableArray<MetadataReference> _lazyExplicitReferences; /// <summary> /// Stores the results of implicit reference resolutions. /// If <see cref="MetadataReferenceResolver.ResolveMissingAssemblies"/> is true the reference manager attempts to resolve assembly identities, /// that do not match any explicit metadata references passed to the compilation (or specified via #r directive). /// For each such assembly identity <see cref="MetadataReferenceResolver.ResolveMissingAssembly(MetadataReference, AssemblyIdentity)"/> is called /// and its result is captured in this map. /// The map also stores failures - the reference is null if the assembly of the given identity is not found by the resolver. /// This is important to maintain consistency, especially across multiple submissions (e.g. the reference is not found during compilation of the first submission /// but then it is available when the second submission is compiled). /// </summary> private ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?>? _lazyImplicitReferenceResolutions; /// <summary> /// Diagnostics produced during reference resolution and binding. /// </summary> /// <remarks> /// When reporting diagnostics be sure not to include any information that can't be shared among /// compilations that share the same reference manager (such as full identity of the compilation, /// simple assembly name is ok). /// </remarks> private ImmutableArray<Diagnostic> _lazyDiagnostics; /// <summary> /// COR library symbol, or null if the compilation itself is the COR library. /// </summary> /// <remarks> /// If the compilation being built is the COR library we don't want to store its source assembly symbol /// here since we wouldn't be able to share the state among subsequent compilations that are derived from it /// (each of them has its own source assembly symbol). /// </remarks> private TAssemblySymbol? _lazyCorLibraryOpt; /// <summary> /// Standalone modules referenced by the compilation (doesn't include the manifest module of the compilation). /// </summary> /// <remarks> /// <see cref="_lazyReferencedModules"/>[i] corresponds to <see cref="_lazyReferencedModulesReferences"/>[i]. /// </remarks> private ImmutableArray<PEModule> _lazyReferencedModules; /// <summary> /// References of standalone modules referenced by the compilation (doesn't include the manifest module of the compilation). /// </summary> /// <remarks> /// <see cref="_lazyReferencedModules"/>[i] corresponds to <see cref="_lazyReferencedModulesReferences"/>[i]. /// </remarks> private ImmutableArray<ModuleReferences<TAssemblySymbol>> _lazyReferencedModulesReferences; /// <summary> /// Assemblies referenced directly by the source module of the compilation. /// </summary> private ImmutableArray<TAssemblySymbol> _lazyReferencedAssemblies; /// <summary> /// Aliases used by assemblies referenced directly by the source module of the compilation. /// </summary> /// <remarks> /// Aliases <see cref="_lazyAliasesOfReferencedAssemblies"/>[i] are of an assembly <see cref="_lazyReferencedAssemblies"/>[i]. /// </remarks> private ImmutableArray<ImmutableArray<string>> _lazyAliasesOfReferencedAssemblies; /// <summary> /// A map capturing <see cref="MetadataReference"/>s that were "merged" to a single referenced assembly /// associated with a key in the map. /// The keys are a subset of keys from <see cref="_lazyReferencedAssembliesMap"/>. /// </summary> private ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>>? _lazyMergedAssemblyReferencesMap; /// <summary> /// Unified assemblies referenced directly by the source module of the compilation. /// </summary> private ImmutableArray<UnifiedAssembly<TAssemblySymbol>> _lazyUnifiedAssemblies; public CommonReferenceManager(string simpleAssemblyName, AssemblyIdentityComparer identityComparer, Dictionary<MetadataReference, MetadataOrDiagnostic>? observedMetadata) { Debug.Assert(simpleAssemblyName != null); Debug.Assert(identityComparer != null); this.SimpleAssemblyName = simpleAssemblyName; this.IdentityComparer = identityComparer; this.ObservedMetadata = observedMetadata ?? new Dictionary<MetadataReference, MetadataOrDiagnostic>(); } internal ImmutableArray<Diagnostic> Diagnostics { get { AssertBound(); return _lazyDiagnostics; } } internal bool HasCircularReference { get { AssertBound(); return _lazyHasCircularReference == ThreeState.True; } } internal Dictionary<MetadataReference, int> ReferencedAssembliesMap { get { AssertBound(); return _lazyReferencedAssembliesMap; } } internal Dictionary<MetadataReference, int> ReferencedModuleIndexMap { get { AssertBound(); return _lazyReferencedModuleIndexMap; } } internal IDictionary<(string, string), MetadataReference> ReferenceDirectiveMap { get { AssertBound(); return _lazyReferenceDirectiveMap; } } internal ImmutableArray<MetadataReference> DirectiveReferences { get { AssertBound(); return _lazyDirectiveReferences; } } internal override ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?> ImplicitReferenceResolutions { get { AssertBound(); return _lazyImplicitReferenceResolutions; } } internal override ImmutableArray<MetadataReference> ExplicitReferences { get { AssertBound(); return _lazyExplicitReferences; } } #region Symbols necessary to set up source assembly and module internal TAssemblySymbol? CorLibraryOpt { get { AssertBound(); return _lazyCorLibraryOpt; } } internal ImmutableArray<PEModule> ReferencedModules { get { AssertBound(); return _lazyReferencedModules; } } internal ImmutableArray<ModuleReferences<TAssemblySymbol>> ReferencedModulesReferences { get { AssertBound(); return _lazyReferencedModulesReferences; } } internal ImmutableArray<TAssemblySymbol> ReferencedAssemblies { get { AssertBound(); return _lazyReferencedAssemblies; } } internal ImmutableArray<ImmutableArray<string>> AliasesOfReferencedAssemblies { get { AssertBound(); return _lazyAliasesOfReferencedAssemblies; } } internal ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>> MergedAssemblyReferencesMap { get { AssertBound(); Debug.Assert(_lazyMergedAssemblyReferencesMap != null); return _lazyMergedAssemblyReferencesMap; } } internal ImmutableArray<UnifiedAssembly<TAssemblySymbol>> UnifiedAssemblies { get { AssertBound(); return _lazyUnifiedAssemblies; } } #endregion /// <summary> /// Call only while holding <see cref="CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard"/>. /// </summary> [Conditional("DEBUG")] internal void AssertUnbound() { Debug.Assert(_isBound == 0); Debug.Assert(_lazyHasCircularReference == ThreeState.Unknown); Debug.Assert(_lazyReferencedAssembliesMap == null); Debug.Assert(_lazyReferencedModuleIndexMap == null); Debug.Assert(_lazyReferenceDirectiveMap == null); Debug.Assert(_lazyDirectiveReferences.IsDefault); Debug.Assert(_lazyImplicitReferenceResolutions == null); Debug.Assert(_lazyExplicitReferences.IsDefault); Debug.Assert(_lazyReferencedModules.IsDefault); Debug.Assert(_lazyReferencedModulesReferences.IsDefault); Debug.Assert(_lazyReferencedAssemblies.IsDefault); Debug.Assert(_lazyAliasesOfReferencedAssemblies.IsDefault); Debug.Assert(_lazyMergedAssemblyReferencesMap == null); Debug.Assert(_lazyUnifiedAssemblies.IsDefault); Debug.Assert(_lazyCorLibraryOpt == null); } [Conditional("DEBUG")] [MemberNotNull(nameof(_lazyReferencedAssembliesMap), nameof(_lazyReferencedModuleIndexMap), nameof(_lazyReferenceDirectiveMap), nameof(_lazyImplicitReferenceResolutions))] internal void AssertBound() { Debug.Assert(_isBound != 0); Debug.Assert(_lazyHasCircularReference != ThreeState.Unknown); Debug.Assert(_lazyReferencedAssembliesMap != null); Debug.Assert(_lazyReferencedModuleIndexMap != null); Debug.Assert(_lazyReferenceDirectiveMap != null); Debug.Assert(!_lazyDirectiveReferences.IsDefault); Debug.Assert(_lazyImplicitReferenceResolutions != null); Debug.Assert(!_lazyExplicitReferences.IsDefault); Debug.Assert(!_lazyReferencedModules.IsDefault); Debug.Assert(!_lazyReferencedModulesReferences.IsDefault); Debug.Assert(!_lazyReferencedAssemblies.IsDefault); Debug.Assert(!_lazyAliasesOfReferencedAssemblies.IsDefault); Debug.Assert(_lazyMergedAssemblyReferencesMap != null); Debug.Assert(!_lazyUnifiedAssemblies.IsDefault); // lazyCorLibrary is null if the compilation is corlib Debug.Assert(_lazyReferencedAssemblies.Length == 0 || _lazyCorLibraryOpt != null); } [Conditional("DEBUG")] internal void AssertCanReuseForCompilation(TCompilation compilation) { Debug.Assert(compilation.MakeSourceAssemblySimpleName() == this.SimpleAssemblyName); } internal bool IsBound { get { return _isBound != 0; } } /// <summary> /// Call only while holding <see cref="CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard"/>. /// </summary> internal void InitializeNoLock( Dictionary<MetadataReference, int> referencedAssembliesMap, Dictionary<MetadataReference, int> referencedModulesMap, IDictionary<(string, string), MetadataReference> boundReferenceDirectiveMap, ImmutableArray<MetadataReference> directiveReferences, ImmutableArray<MetadataReference> explicitReferences, ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?> implicitReferenceResolutions, bool containsCircularReferences, ImmutableArray<Diagnostic> diagnostics, TAssemblySymbol? corLibraryOpt, ImmutableArray<PEModule> referencedModules, ImmutableArray<ModuleReferences<TAssemblySymbol>> referencedModulesReferences, ImmutableArray<TAssemblySymbol> referencedAssemblies, ImmutableArray<ImmutableArray<string>> aliasesOfReferencedAssemblies, ImmutableArray<UnifiedAssembly<TAssemblySymbol>> unifiedAssemblies, Dictionary<MetadataReference, ImmutableArray<MetadataReference>>? mergedAssemblyReferencesMapOpt) { AssertUnbound(); Debug.Assert(referencedModules.Length == referencedModulesReferences.Length); Debug.Assert(referencedModules.Length == referencedModulesMap.Count); Debug.Assert(referencedAssemblies.Length == aliasesOfReferencedAssemblies.Length); _lazyReferencedAssembliesMap = referencedAssembliesMap; _lazyReferencedModuleIndexMap = referencedModulesMap; _lazyDiagnostics = diagnostics; _lazyReferenceDirectiveMap = boundReferenceDirectiveMap; _lazyDirectiveReferences = directiveReferences; _lazyExplicitReferences = explicitReferences; _lazyImplicitReferenceResolutions = implicitReferenceResolutions; _lazyCorLibraryOpt = corLibraryOpt; _lazyReferencedModules = referencedModules; _lazyReferencedModulesReferences = referencedModulesReferences; _lazyReferencedAssemblies = referencedAssemblies; _lazyAliasesOfReferencedAssemblies = aliasesOfReferencedAssemblies; _lazyMergedAssemblyReferencesMap = mergedAssemblyReferencesMapOpt?.ToImmutableDictionary() ?? ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>>.Empty; _lazyUnifiedAssemblies = unifiedAssemblies; _lazyHasCircularReference = containsCircularReferences.ToThreeState(); // once we flip this bit the state of the manager is immutable and available to any readers: Interlocked.Exchange(ref _isBound, 1); } /// <summary> /// Global namespaces of assembly references that have been superseded by an assembly reference with a higher version are /// hidden behind <see cref="s_supersededAlias"/> to avoid ambiguity when they are accessed from source. /// All existing aliases of a superseded assembly are discarded. /// </summary> private static readonly ImmutableArray<string> s_supersededAlias = ImmutableArray.Create("<superseded>"); protected static void BuildReferencedAssembliesAndModulesMaps( BoundInputAssembly[] bindingResult, ImmutableArray<MetadataReference> references, ImmutableArray<ResolvedReference> referenceMap, int referencedModuleCount, int explicitlyReferencedAssemblyCount, IReadOnlyDictionary<string, List<ReferencedAssemblyIdentity>> assemblyReferencesBySimpleName, bool supersedeLowerVersions, out Dictionary<MetadataReference, int> referencedAssembliesMap, out Dictionary<MetadataReference, int> referencedModulesMap, out ImmutableArray<ImmutableArray<string>> aliasesOfReferencedAssemblies, out Dictionary<MetadataReference, ImmutableArray<MetadataReference>>? mergedAssemblyReferencesMapOpt) { referencedAssembliesMap = new Dictionary<MetadataReference, int>(referenceMap.Length); referencedModulesMap = new Dictionary<MetadataReference, int>(referencedModuleCount); var aliasesOfReferencedAssembliesBuilder = ArrayBuilder<ImmutableArray<string>>.GetInstance(referenceMap.Length - referencedModuleCount); bool hasRecursiveAliases = false; mergedAssemblyReferencesMapOpt = null; for (int i = 0; i < referenceMap.Length; i++) { if (referenceMap[i].IsSkipped) { continue; } if (referenceMap[i].Kind == MetadataImageKind.Module) { // add 1 for the manifest module: int moduleIndex = 1 + referenceMap[i].Index; referencedModulesMap.Add(references[i], moduleIndex); } else { // index into assembly data array int assemblyIndex = referenceMap[i].Index; Debug.Assert(aliasesOfReferencedAssembliesBuilder.Count == assemblyIndex); MetadataReference reference = references[i]; referencedAssembliesMap.Add(reference, assemblyIndex); aliasesOfReferencedAssembliesBuilder.Add(referenceMap[i].AliasesOpt); if (!referenceMap[i].MergedReferences.IsEmpty) { (mergedAssemblyReferencesMapOpt ??= new Dictionary<MetadataReference, ImmutableArray<MetadataReference>>()).Add(reference, referenceMap[i].MergedReferences); } hasRecursiveAliases |= !referenceMap[i].RecursiveAliasesOpt.IsDefault; } } if (hasRecursiveAliases) { PropagateRecursiveAliases(bindingResult, referenceMap, aliasesOfReferencedAssembliesBuilder); } Debug.Assert(!aliasesOfReferencedAssembliesBuilder.Any(a => a.IsDefault)); if (supersedeLowerVersions) { foreach (var assemblyReference in assemblyReferencesBySimpleName) { // the item in the list is the highest version, by construction for (int i = 1; i < assemblyReference.Value.Count; i++) { int assemblyIndex = assemblyReference.Value[i].GetAssemblyIndex(explicitlyReferencedAssemblyCount); aliasesOfReferencedAssembliesBuilder[assemblyIndex] = s_supersededAlias; } } } aliasesOfReferencedAssemblies = aliasesOfReferencedAssembliesBuilder.ToImmutableAndFree(); } /// <summary> /// Calculates map from the identities of specified symbols to the corresponding identities in the original EnC baseline metadata. /// The map only includes an entry for identities that differ, i.e. for symbols representing assembly references of the current compilation that have different identities /// than the corresponding identity in baseline metadata AssemblyRef table. The key comparer of the map ignores build and revision parts of the version number, /// since these might change if the original version included wildcard. /// </summary> /// <param name="symbols">Assembly symbols for references of the current compilation.</param> /// <param name="originalIdentities">Identities in the baseline. <paramref name="originalIdentities"/>[i] corresponds to <paramref name="symbols"/>[i].</param> internal static ImmutableDictionary<AssemblyIdentity, AssemblyIdentity> GetAssemblyReferenceIdentityBaselineMap(ImmutableArray<TAssemblySymbol> symbols, ImmutableArray<AssemblyIdentity> originalIdentities) { Debug.Assert(originalIdentities.Length == symbols.Length); ImmutableDictionary<AssemblyIdentity, AssemblyIdentity>.Builder? lazyBuilder = null; for (int i = 0; i < originalIdentities.Length; i++) { var symbolIdentity = symbols[i].Identity; var versionPattern = symbols[i].AssemblyVersionPattern; var originalIdentity = originalIdentities[i]; if (versionPattern is object) { Debug.Assert(versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); lazyBuilder = lazyBuilder ?? ImmutableDictionary.CreateBuilder<AssemblyIdentity, AssemblyIdentity>(); var sourceIdentity = symbolIdentity.WithVersion(versionPattern); if (lazyBuilder.ContainsKey(sourceIdentity)) { // The compilation references multiple assemblies whose versions only differ in auto-generated build and/or revision numbers. throw new NotSupportedException(CodeAnalysisResources.CompilationReferencesAssembliesWithDifferentAutoGeneratedVersion); } lazyBuilder.Add(sourceIdentity, originalIdentity); } else { // by construction of the arguments: Debug.Assert(originalIdentity == symbolIdentity); } } return lazyBuilder?.ToImmutable() ?? ImmutableDictionary<AssemblyIdentity, AssemblyIdentity>.Empty; } internal static bool CompareVersionPartsSpecifiedInSource(Version version, Version candidateVersion, TAssemblySymbol candidateSymbol) { // major and minor parts must match exactly if (version.Major != candidateVersion.Major || version.Minor != candidateVersion.Minor) { return false; } // build and revision parts can differ only if the corresponding source versions were auto-generated: var versionPattern = candidateSymbol.AssemblyVersionPattern; Debug.Assert(versionPattern is null || versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); if ((versionPattern is null || versionPattern.Build < ushort.MaxValue) && version.Build != candidateVersion.Build) { return false; } if (versionPattern is null && version.Revision != candidateVersion.Revision) { return false; } return true; } // #r references are recursive, their aliases should be merged into all their dependencies. // // For example, if a compilation has a reference to LibA with alias A and the user #r's LibB with alias B, // which references LibA, LibA should be available under both aliases A and B. B is usually "global", // which means LibA namespaces should become available to the compilation without any qualification when #r LibB // is encountered. // // Pairs: (assembly index -- index into bindingResult array; index of the #r reference in referenceMap array). private static void PropagateRecursiveAliases( BoundInputAssembly[] bindingResult, ImmutableArray<ResolvedReference> referenceMap, ArrayBuilder<ImmutableArray<string>> aliasesOfReferencedAssembliesBuilder) { var assemblyIndicesToProcess = ArrayBuilder<int>.GetInstance(); var visitedAssemblies = BitVector.Create(bindingResult.Length); // +1 for assembly being built Debug.Assert(bindingResult.Length == aliasesOfReferencedAssembliesBuilder.Count + 1); foreach (ResolvedReference reference in referenceMap) { if (!reference.IsSkipped && !reference.RecursiveAliasesOpt.IsDefault) { var recursiveAliases = reference.RecursiveAliasesOpt; Debug.Assert(reference.Kind == MetadataImageKind.Assembly); visitedAssemblies.Clear(); Debug.Assert(assemblyIndicesToProcess.Count == 0); assemblyIndicesToProcess.Add(reference.Index); while (assemblyIndicesToProcess.Count > 0) { int assemblyIndex = assemblyIndicesToProcess.Pop(); visitedAssemblies[assemblyIndex] = true; // merge aliases: aliasesOfReferencedAssembliesBuilder[assemblyIndex] = MergedAliases.Merge(aliasesOfReferencedAssembliesBuilder[assemblyIndex], recursiveAliases); // push dependencies onto the stack: // +1 for the assembly being built: var referenceBinding = bindingResult[assemblyIndex + 1].ReferenceBinding; Debug.Assert(referenceBinding is object); foreach (var binding in referenceBinding) { if (binding.IsBound) { // -1 for the assembly being built: int dependentAssemblyIndex = binding.DefinitionIndex - 1; if (!visitedAssemblies[dependentAssemblyIndex]) { assemblyIndicesToProcess.Add(dependentAssemblyIndex); } } } } } } for (int i = 0; i < aliasesOfReferencedAssembliesBuilder.Count; i++) { if (aliasesOfReferencedAssembliesBuilder[i].IsDefault) { aliasesOfReferencedAssembliesBuilder[i] = ImmutableArray<string>.Empty; } } assemblyIndicesToProcess.Free(); } #region Compilation APIs Implementation // for testing purposes internal IEnumerable<string> ExternAliases => AliasesOfReferencedAssemblies.SelectMany(aliases => aliases); internal sealed override IEnumerable<KeyValuePair<MetadataReference, IAssemblySymbolInternal>> GetReferencedAssemblies() { return ReferencedAssembliesMap.Select(ra => KeyValuePairUtil.Create(ra.Key, (IAssemblySymbolInternal)ReferencedAssemblies[ra.Value])); } internal TAssemblySymbol? GetReferencedAssemblySymbol(MetadataReference reference) { int index; return ReferencedAssembliesMap.TryGetValue(reference, out index) ? ReferencedAssemblies[index] : null; } internal int GetReferencedModuleIndex(MetadataReference reference) { int index; return ReferencedModuleIndexMap.TryGetValue(reference, out index) ? index : -1; } /// <summary> /// Gets the <see cref="MetadataReference"/> that corresponds to the assembly symbol. /// </summary> internal override MetadataReference? GetMetadataReference(IAssemblySymbolInternal? assemblySymbol) { foreach (var entry in ReferencedAssembliesMap) { if ((object)ReferencedAssemblies[entry.Value] == assemblySymbol) { return entry.Key; } } return null; } internal override IEnumerable<(IAssemblySymbolInternal AssemblySymbol, ImmutableArray<string> Aliases)> GetReferencedAssemblyAliases() { for (int i = 0; i < ReferencedAssemblies.Length; i++) { yield return (ReferencedAssemblies[i], AliasesOfReferencedAssemblies[i]); } } public bool DeclarationsAccessibleWithoutAlias(int referencedAssemblyIndex) { var aliases = AliasesOfReferencedAssemblies[referencedAssemblyIndex]; return aliases.Length == 0 || aliases.IndexOf(MetadataReferenceProperties.GlobalAlias, StringComparer.Ordinal) >= 0; } #endregion } }
// 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 System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Symbols; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis { using MetadataOrDiagnostic = System.Object; internal abstract class CommonReferenceManager { /// <summary> /// Must be acquired whenever the following data are about to be modified: /// - Compilation.lazyAssemblySymbol /// - Compilation.referenceManager /// - ReferenceManager state /// - <see cref="AssemblyMetadata.CachedSymbols"/> /// - <see cref="Compilation.RetargetingAssemblySymbols"/> /// /// All the above data should be updated at once while holding this lock. /// Once lazyAssemblySymbol is set the Compilation.referenceManager field and ReferenceManager /// state should not change. /// </summary> internal static object SymbolCacheAndReferenceManagerStateGuard = new object(); /// <summary> /// Enumerates all referenced assemblies. /// </summary> internal abstract IEnumerable<KeyValuePair<MetadataReference, IAssemblySymbolInternal>> GetReferencedAssemblies(); /// <summary> /// Enumerates all referenced assemblies and their aliases. /// </summary> internal abstract IEnumerable<(IAssemblySymbolInternal AssemblySymbol, ImmutableArray<string> Aliases)> GetReferencedAssemblyAliases(); internal abstract MetadataReference? GetMetadataReference(IAssemblySymbolInternal? assemblySymbol); internal abstract ImmutableArray<MetadataReference> ExplicitReferences { get; } internal abstract ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?> ImplicitReferenceResolutions { get; } } internal partial class CommonReferenceManager<TCompilation, TAssemblySymbol> : CommonReferenceManager { /// <summary> /// If the compilation being built represents an assembly its assembly name. /// If the compilation being built represents a module, the name of the /// containing assembly or <see cref="Compilation.UnspecifiedModuleAssemblyName"/> /// if not specified (/moduleassemblyname command line option). /// </summary> internal readonly string SimpleAssemblyName; /// <summary> /// Used to compares assembly identities. /// May implement unification and portability policies specific to the target platform. /// </summary> internal readonly AssemblyIdentityComparer IdentityComparer; /// <summary> /// Metadata observed by the compiler. /// May be shared across multiple Reference Managers. /// Access only under lock(<see cref="ObservedMetadata"/>). /// </summary> internal readonly Dictionary<MetadataReference, MetadataOrDiagnostic> ObservedMetadata; /// <summary> /// Once this is non-zero the state of the manager is fully initialized and immutable. /// </summary> private int _isBound; /// <summary> /// True if the compilation has a reference that refers back to the assembly being compiled. /// </summary> /// <remarks> /// If we have a circular reference the bound references can't be shared with other compilations. /// </remarks> private ThreeState _lazyHasCircularReference; /// <summary> /// A map from a metadata reference to an index to <see cref="_lazyReferencedAssemblies"/> array. Do not access /// directly, use <see cref="_lazyReferencedAssembliesMap"/> property instead. /// </summary> private Dictionary<MetadataReference, int>? _lazyReferencedAssembliesMap; /// <summary> /// A map from a net-module metadata reference to the index of the corresponding module /// symbol in the source assembly symbol for the current compilation. /// </summary> /// <remarks> /// Subtract one from the index (for the manifest module) to find the corresponding elements /// of <see cref="_lazyReferencedModules"/> and <see cref="_lazyReferencedModulesReferences"/>. /// </remarks> private Dictionary<MetadataReference, int>? _lazyReferencedModuleIndexMap; /// <summary> /// Maps (containing syntax tree file name, reference string) of #r directive to a resolved metadata reference. /// If multiple #r's in the same tree use the same value as a reference the resolved metadata reference is the same as well. /// </summary> private IDictionary<(string, string), MetadataReference>? _lazyReferenceDirectiveMap; /// <summary> /// Array of unique bound #r references. /// </summary> /// <remarks> /// The references are in the order they appear in syntax trees. This order is currently preserved /// as syntax trees are added or removed, but we might decide to share reference manager between compilations /// with different order of #r's. It doesn't seem this would be an issue since all #r's within the compilation /// have the same "priority" with respect to each other. /// </remarks> private ImmutableArray<MetadataReference> _lazyDirectiveReferences; private ImmutableArray<MetadataReference> _lazyExplicitReferences; /// <summary> /// Stores the results of implicit reference resolutions. /// If <see cref="MetadataReferenceResolver.ResolveMissingAssemblies"/> is true the reference manager attempts to resolve assembly identities, /// that do not match any explicit metadata references passed to the compilation (or specified via #r directive). /// For each such assembly identity <see cref="MetadataReferenceResolver.ResolveMissingAssembly(MetadataReference, AssemblyIdentity)"/> is called /// and its result is captured in this map. /// The map also stores failures - the reference is null if the assembly of the given identity is not found by the resolver. /// This is important to maintain consistency, especially across multiple submissions (e.g. the reference is not found during compilation of the first submission /// but then it is available when the second submission is compiled). /// </summary> private ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?>? _lazyImplicitReferenceResolutions; /// <summary> /// Diagnostics produced during reference resolution and binding. /// </summary> /// <remarks> /// When reporting diagnostics be sure not to include any information that can't be shared among /// compilations that share the same reference manager (such as full identity of the compilation, /// simple assembly name is ok). /// </remarks> private ImmutableArray<Diagnostic> _lazyDiagnostics; /// <summary> /// COR library symbol, or null if the compilation itself is the COR library. /// </summary> /// <remarks> /// If the compilation being built is the COR library we don't want to store its source assembly symbol /// here since we wouldn't be able to share the state among subsequent compilations that are derived from it /// (each of them has its own source assembly symbol). /// </remarks> private TAssemblySymbol? _lazyCorLibraryOpt; /// <summary> /// Standalone modules referenced by the compilation (doesn't include the manifest module of the compilation). /// </summary> /// <remarks> /// <see cref="_lazyReferencedModules"/>[i] corresponds to <see cref="_lazyReferencedModulesReferences"/>[i]. /// </remarks> private ImmutableArray<PEModule> _lazyReferencedModules; /// <summary> /// References of standalone modules referenced by the compilation (doesn't include the manifest module of the compilation). /// </summary> /// <remarks> /// <see cref="_lazyReferencedModules"/>[i] corresponds to <see cref="_lazyReferencedModulesReferences"/>[i]. /// </remarks> private ImmutableArray<ModuleReferences<TAssemblySymbol>> _lazyReferencedModulesReferences; /// <summary> /// Assemblies referenced directly by the source module of the compilation. /// </summary> private ImmutableArray<TAssemblySymbol> _lazyReferencedAssemblies; /// <summary> /// Aliases used by assemblies referenced directly by the source module of the compilation. /// </summary> /// <remarks> /// Aliases <see cref="_lazyAliasesOfReferencedAssemblies"/>[i] are of an assembly <see cref="_lazyReferencedAssemblies"/>[i]. /// </remarks> private ImmutableArray<ImmutableArray<string>> _lazyAliasesOfReferencedAssemblies; /// <summary> /// A map capturing <see cref="MetadataReference"/>s that were "merged" to a single referenced assembly /// associated with a key in the map. /// The keys are a subset of keys from <see cref="_lazyReferencedAssembliesMap"/>. /// </summary> private ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>>? _lazyMergedAssemblyReferencesMap; /// <summary> /// Unified assemblies referenced directly by the source module of the compilation. /// </summary> private ImmutableArray<UnifiedAssembly<TAssemblySymbol>> _lazyUnifiedAssemblies; public CommonReferenceManager(string simpleAssemblyName, AssemblyIdentityComparer identityComparer, Dictionary<MetadataReference, MetadataOrDiagnostic>? observedMetadata) { Debug.Assert(simpleAssemblyName != null); Debug.Assert(identityComparer != null); this.SimpleAssemblyName = simpleAssemblyName; this.IdentityComparer = identityComparer; this.ObservedMetadata = observedMetadata ?? new Dictionary<MetadataReference, MetadataOrDiagnostic>(); } internal ImmutableArray<Diagnostic> Diagnostics { get { AssertBound(); return _lazyDiagnostics; } } internal bool HasCircularReference { get { AssertBound(); return _lazyHasCircularReference == ThreeState.True; } } internal Dictionary<MetadataReference, int> ReferencedAssembliesMap { get { AssertBound(); return _lazyReferencedAssembliesMap; } } internal Dictionary<MetadataReference, int> ReferencedModuleIndexMap { get { AssertBound(); return _lazyReferencedModuleIndexMap; } } internal IDictionary<(string, string), MetadataReference> ReferenceDirectiveMap { get { AssertBound(); return _lazyReferenceDirectiveMap; } } internal ImmutableArray<MetadataReference> DirectiveReferences { get { AssertBound(); return _lazyDirectiveReferences; } } internal override ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?> ImplicitReferenceResolutions { get { AssertBound(); return _lazyImplicitReferenceResolutions; } } internal override ImmutableArray<MetadataReference> ExplicitReferences { get { AssertBound(); return _lazyExplicitReferences; } } #region Symbols necessary to set up source assembly and module internal TAssemblySymbol? CorLibraryOpt { get { AssertBound(); return _lazyCorLibraryOpt; } } internal ImmutableArray<PEModule> ReferencedModules { get { AssertBound(); return _lazyReferencedModules; } } internal ImmutableArray<ModuleReferences<TAssemblySymbol>> ReferencedModulesReferences { get { AssertBound(); return _lazyReferencedModulesReferences; } } internal ImmutableArray<TAssemblySymbol> ReferencedAssemblies { get { AssertBound(); return _lazyReferencedAssemblies; } } internal ImmutableArray<ImmutableArray<string>> AliasesOfReferencedAssemblies { get { AssertBound(); return _lazyAliasesOfReferencedAssemblies; } } internal ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>> MergedAssemblyReferencesMap { get { AssertBound(); Debug.Assert(_lazyMergedAssemblyReferencesMap != null); return _lazyMergedAssemblyReferencesMap; } } internal ImmutableArray<UnifiedAssembly<TAssemblySymbol>> UnifiedAssemblies { get { AssertBound(); return _lazyUnifiedAssemblies; } } #endregion /// <summary> /// Call only while holding <see cref="CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard"/>. /// </summary> [Conditional("DEBUG")] internal void AssertUnbound() { Debug.Assert(_isBound == 0); Debug.Assert(_lazyHasCircularReference == ThreeState.Unknown); Debug.Assert(_lazyReferencedAssembliesMap == null); Debug.Assert(_lazyReferencedModuleIndexMap == null); Debug.Assert(_lazyReferenceDirectiveMap == null); Debug.Assert(_lazyDirectiveReferences.IsDefault); Debug.Assert(_lazyImplicitReferenceResolutions == null); Debug.Assert(_lazyExplicitReferences.IsDefault); Debug.Assert(_lazyReferencedModules.IsDefault); Debug.Assert(_lazyReferencedModulesReferences.IsDefault); Debug.Assert(_lazyReferencedAssemblies.IsDefault); Debug.Assert(_lazyAliasesOfReferencedAssemblies.IsDefault); Debug.Assert(_lazyMergedAssemblyReferencesMap == null); Debug.Assert(_lazyUnifiedAssemblies.IsDefault); Debug.Assert(_lazyCorLibraryOpt == null); } [Conditional("DEBUG")] [MemberNotNull(nameof(_lazyReferencedAssembliesMap), nameof(_lazyReferencedModuleIndexMap), nameof(_lazyReferenceDirectiveMap), nameof(_lazyImplicitReferenceResolutions))] internal void AssertBound() { Debug.Assert(_isBound != 0); Debug.Assert(_lazyHasCircularReference != ThreeState.Unknown); Debug.Assert(_lazyReferencedAssembliesMap != null); Debug.Assert(_lazyReferencedModuleIndexMap != null); Debug.Assert(_lazyReferenceDirectiveMap != null); Debug.Assert(!_lazyDirectiveReferences.IsDefault); Debug.Assert(_lazyImplicitReferenceResolutions != null); Debug.Assert(!_lazyExplicitReferences.IsDefault); Debug.Assert(!_lazyReferencedModules.IsDefault); Debug.Assert(!_lazyReferencedModulesReferences.IsDefault); Debug.Assert(!_lazyReferencedAssemblies.IsDefault); Debug.Assert(!_lazyAliasesOfReferencedAssemblies.IsDefault); Debug.Assert(_lazyMergedAssemblyReferencesMap != null); Debug.Assert(!_lazyUnifiedAssemblies.IsDefault); // lazyCorLibrary is null if the compilation is corlib Debug.Assert(_lazyReferencedAssemblies.Length == 0 || _lazyCorLibraryOpt != null); } [Conditional("DEBUG")] internal void AssertCanReuseForCompilation(TCompilation compilation) { Debug.Assert(compilation.MakeSourceAssemblySimpleName() == this.SimpleAssemblyName); } internal bool IsBound { get { return _isBound != 0; } } /// <summary> /// Call only while holding <see cref="CommonReferenceManager.SymbolCacheAndReferenceManagerStateGuard"/>. /// </summary> internal void InitializeNoLock( Dictionary<MetadataReference, int> referencedAssembliesMap, Dictionary<MetadataReference, int> referencedModulesMap, IDictionary<(string, string), MetadataReference> boundReferenceDirectiveMap, ImmutableArray<MetadataReference> directiveReferences, ImmutableArray<MetadataReference> explicitReferences, ImmutableDictionary<AssemblyIdentity, PortableExecutableReference?> implicitReferenceResolutions, bool containsCircularReferences, ImmutableArray<Diagnostic> diagnostics, TAssemblySymbol? corLibraryOpt, ImmutableArray<PEModule> referencedModules, ImmutableArray<ModuleReferences<TAssemblySymbol>> referencedModulesReferences, ImmutableArray<TAssemblySymbol> referencedAssemblies, ImmutableArray<ImmutableArray<string>> aliasesOfReferencedAssemblies, ImmutableArray<UnifiedAssembly<TAssemblySymbol>> unifiedAssemblies, Dictionary<MetadataReference, ImmutableArray<MetadataReference>>? mergedAssemblyReferencesMapOpt) { AssertUnbound(); Debug.Assert(referencedModules.Length == referencedModulesReferences.Length); Debug.Assert(referencedModules.Length == referencedModulesMap.Count); Debug.Assert(referencedAssemblies.Length == aliasesOfReferencedAssemblies.Length); _lazyReferencedAssembliesMap = referencedAssembliesMap; _lazyReferencedModuleIndexMap = referencedModulesMap; _lazyDiagnostics = diagnostics; _lazyReferenceDirectiveMap = boundReferenceDirectiveMap; _lazyDirectiveReferences = directiveReferences; _lazyExplicitReferences = explicitReferences; _lazyImplicitReferenceResolutions = implicitReferenceResolutions; _lazyCorLibraryOpt = corLibraryOpt; _lazyReferencedModules = referencedModules; _lazyReferencedModulesReferences = referencedModulesReferences; _lazyReferencedAssemblies = referencedAssemblies; _lazyAliasesOfReferencedAssemblies = aliasesOfReferencedAssemblies; _lazyMergedAssemblyReferencesMap = mergedAssemblyReferencesMapOpt?.ToImmutableDictionary() ?? ImmutableDictionary<MetadataReference, ImmutableArray<MetadataReference>>.Empty; _lazyUnifiedAssemblies = unifiedAssemblies; _lazyHasCircularReference = containsCircularReferences.ToThreeState(); // once we flip this bit the state of the manager is immutable and available to any readers: Interlocked.Exchange(ref _isBound, 1); } /// <summary> /// Global namespaces of assembly references that have been superseded by an assembly reference with a higher version are /// hidden behind <see cref="s_supersededAlias"/> to avoid ambiguity when they are accessed from source. /// All existing aliases of a superseded assembly are discarded. /// </summary> private static readonly ImmutableArray<string> s_supersededAlias = ImmutableArray.Create("<superseded>"); protected static void BuildReferencedAssembliesAndModulesMaps( BoundInputAssembly[] bindingResult, ImmutableArray<MetadataReference> references, ImmutableArray<ResolvedReference> referenceMap, int referencedModuleCount, int explicitlyReferencedAssemblyCount, IReadOnlyDictionary<string, List<ReferencedAssemblyIdentity>> assemblyReferencesBySimpleName, bool supersedeLowerVersions, out Dictionary<MetadataReference, int> referencedAssembliesMap, out Dictionary<MetadataReference, int> referencedModulesMap, out ImmutableArray<ImmutableArray<string>> aliasesOfReferencedAssemblies, out Dictionary<MetadataReference, ImmutableArray<MetadataReference>>? mergedAssemblyReferencesMapOpt) { referencedAssembliesMap = new Dictionary<MetadataReference, int>(referenceMap.Length); referencedModulesMap = new Dictionary<MetadataReference, int>(referencedModuleCount); var aliasesOfReferencedAssembliesBuilder = ArrayBuilder<ImmutableArray<string>>.GetInstance(referenceMap.Length - referencedModuleCount); bool hasRecursiveAliases = false; mergedAssemblyReferencesMapOpt = null; for (int i = 0; i < referenceMap.Length; i++) { if (referenceMap[i].IsSkipped) { continue; } if (referenceMap[i].Kind == MetadataImageKind.Module) { // add 1 for the manifest module: int moduleIndex = 1 + referenceMap[i].Index; referencedModulesMap.Add(references[i], moduleIndex); } else { // index into assembly data array int assemblyIndex = referenceMap[i].Index; Debug.Assert(aliasesOfReferencedAssembliesBuilder.Count == assemblyIndex); MetadataReference reference = references[i]; referencedAssembliesMap.Add(reference, assemblyIndex); aliasesOfReferencedAssembliesBuilder.Add(referenceMap[i].AliasesOpt); if (!referenceMap[i].MergedReferences.IsEmpty) { (mergedAssemblyReferencesMapOpt ??= new Dictionary<MetadataReference, ImmutableArray<MetadataReference>>()).Add(reference, referenceMap[i].MergedReferences); } hasRecursiveAliases |= !referenceMap[i].RecursiveAliasesOpt.IsDefault; } } if (hasRecursiveAliases) { PropagateRecursiveAliases(bindingResult, referenceMap, aliasesOfReferencedAssembliesBuilder); } Debug.Assert(!aliasesOfReferencedAssembliesBuilder.Any(a => a.IsDefault)); if (supersedeLowerVersions) { foreach (var assemblyReference in assemblyReferencesBySimpleName) { // the item in the list is the highest version, by construction for (int i = 1; i < assemblyReference.Value.Count; i++) { int assemblyIndex = assemblyReference.Value[i].GetAssemblyIndex(explicitlyReferencedAssemblyCount); aliasesOfReferencedAssembliesBuilder[assemblyIndex] = s_supersededAlias; } } } aliasesOfReferencedAssemblies = aliasesOfReferencedAssembliesBuilder.ToImmutableAndFree(); } /// <summary> /// Calculates map from the identities of specified symbols to the corresponding identities in the original EnC baseline metadata. /// The map only includes an entry for identities that differ, i.e. for symbols representing assembly references of the current compilation that have different identities /// than the corresponding identity in baseline metadata AssemblyRef table. The key comparer of the map ignores build and revision parts of the version number, /// since these might change if the original version included wildcard. /// </summary> /// <param name="symbols">Assembly symbols for references of the current compilation.</param> /// <param name="originalIdentities">Identities in the baseline. <paramref name="originalIdentities"/>[i] corresponds to <paramref name="symbols"/>[i].</param> internal static ImmutableDictionary<AssemblyIdentity, AssemblyIdentity> GetAssemblyReferenceIdentityBaselineMap(ImmutableArray<TAssemblySymbol> symbols, ImmutableArray<AssemblyIdentity> originalIdentities) { Debug.Assert(originalIdentities.Length == symbols.Length); ImmutableDictionary<AssemblyIdentity, AssemblyIdentity>.Builder? lazyBuilder = null; for (int i = 0; i < originalIdentities.Length; i++) { var symbolIdentity = symbols[i].Identity; var versionPattern = symbols[i].AssemblyVersionPattern; var originalIdentity = originalIdentities[i]; if (versionPattern is object) { Debug.Assert(versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); lazyBuilder = lazyBuilder ?? ImmutableDictionary.CreateBuilder<AssemblyIdentity, AssemblyIdentity>(); var sourceIdentity = symbolIdentity.WithVersion(versionPattern); if (lazyBuilder.ContainsKey(sourceIdentity)) { // The compilation references multiple assemblies whose versions only differ in auto-generated build and/or revision numbers. throw new NotSupportedException(CodeAnalysisResources.CompilationReferencesAssembliesWithDifferentAutoGeneratedVersion); } lazyBuilder.Add(sourceIdentity, originalIdentity); } else { // by construction of the arguments: Debug.Assert(originalIdentity == symbolIdentity); } } return lazyBuilder?.ToImmutable() ?? ImmutableDictionary<AssemblyIdentity, AssemblyIdentity>.Empty; } internal static bool CompareVersionPartsSpecifiedInSource(Version version, Version candidateVersion, TAssemblySymbol candidateSymbol) { // major and minor parts must match exactly if (version.Major != candidateVersion.Major || version.Minor != candidateVersion.Minor) { return false; } // build and revision parts can differ only if the corresponding source versions were auto-generated: var versionPattern = candidateSymbol.AssemblyVersionPattern; Debug.Assert(versionPattern is null || versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); if ((versionPattern is null || versionPattern.Build < ushort.MaxValue) && version.Build != candidateVersion.Build) { return false; } if (versionPattern is null && version.Revision != candidateVersion.Revision) { return false; } return true; } // #r references are recursive, their aliases should be merged into all their dependencies. // // For example, if a compilation has a reference to LibA with alias A and the user #r's LibB with alias B, // which references LibA, LibA should be available under both aliases A and B. B is usually "global", // which means LibA namespaces should become available to the compilation without any qualification when #r LibB // is encountered. // // Pairs: (assembly index -- index into bindingResult array; index of the #r reference in referenceMap array). private static void PropagateRecursiveAliases( BoundInputAssembly[] bindingResult, ImmutableArray<ResolvedReference> referenceMap, ArrayBuilder<ImmutableArray<string>> aliasesOfReferencedAssembliesBuilder) { var assemblyIndicesToProcess = ArrayBuilder<int>.GetInstance(); var visitedAssemblies = BitVector.Create(bindingResult.Length); // +1 for assembly being built Debug.Assert(bindingResult.Length == aliasesOfReferencedAssembliesBuilder.Count + 1); foreach (ResolvedReference reference in referenceMap) { if (!reference.IsSkipped && !reference.RecursiveAliasesOpt.IsDefault) { var recursiveAliases = reference.RecursiveAliasesOpt; Debug.Assert(reference.Kind == MetadataImageKind.Assembly); visitedAssemblies.Clear(); Debug.Assert(assemblyIndicesToProcess.Count == 0); assemblyIndicesToProcess.Add(reference.Index); while (assemblyIndicesToProcess.Count > 0) { int assemblyIndex = assemblyIndicesToProcess.Pop(); visitedAssemblies[assemblyIndex] = true; // merge aliases: aliasesOfReferencedAssembliesBuilder[assemblyIndex] = MergedAliases.Merge(aliasesOfReferencedAssembliesBuilder[assemblyIndex], recursiveAliases); // push dependencies onto the stack: // +1 for the assembly being built: var referenceBinding = bindingResult[assemblyIndex + 1].ReferenceBinding; Debug.Assert(referenceBinding is object); foreach (var binding in referenceBinding) { if (binding.IsBound) { // -1 for the assembly being built: int dependentAssemblyIndex = binding.DefinitionIndex - 1; if (!visitedAssemblies[dependentAssemblyIndex]) { assemblyIndicesToProcess.Add(dependentAssemblyIndex); } } } } } } for (int i = 0; i < aliasesOfReferencedAssembliesBuilder.Count; i++) { if (aliasesOfReferencedAssembliesBuilder[i].IsDefault) { aliasesOfReferencedAssembliesBuilder[i] = ImmutableArray<string>.Empty; } } assemblyIndicesToProcess.Free(); } #region Compilation APIs Implementation // for testing purposes internal IEnumerable<string> ExternAliases => AliasesOfReferencedAssemblies.SelectMany(aliases => aliases); internal sealed override IEnumerable<KeyValuePair<MetadataReference, IAssemblySymbolInternal>> GetReferencedAssemblies() { return ReferencedAssembliesMap.Select(ra => KeyValuePairUtil.Create(ra.Key, (IAssemblySymbolInternal)ReferencedAssemblies[ra.Value])); } internal TAssemblySymbol? GetReferencedAssemblySymbol(MetadataReference reference) { int index; return ReferencedAssembliesMap.TryGetValue(reference, out index) ? ReferencedAssemblies[index] : null; } internal int GetReferencedModuleIndex(MetadataReference reference) { int index; return ReferencedModuleIndexMap.TryGetValue(reference, out index) ? index : -1; } /// <summary> /// Gets the <see cref="MetadataReference"/> that corresponds to the assembly symbol. /// </summary> internal override MetadataReference? GetMetadataReference(IAssemblySymbolInternal? assemblySymbol) { foreach (var entry in ReferencedAssembliesMap) { if ((object)ReferencedAssemblies[entry.Value] == assemblySymbol) { return entry.Key; } } return null; } internal override IEnumerable<(IAssemblySymbolInternal AssemblySymbol, ImmutableArray<string> Aliases)> GetReferencedAssemblyAliases() { for (int i = 0; i < ReferencedAssemblies.Length; i++) { yield return (ReferencedAssemblies[i], AliasesOfReferencedAssemblies[i]); } } public bool DeclarationsAccessibleWithoutAlias(int referencedAssemblyIndex) { var aliases = AliasesOfReferencedAssemblies[referencedAssemblyIndex]; return aliases.Length == 0 || aliases.IndexOf(MetadataReferenceProperties.GlobalAlias, StringComparer.Ordinal) >= 0; } #endregion } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/CSharpTest/EditAndContinue/TopLevelEditingTests.cs
// 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. #nullable disable using System; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.UnitTests; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests { [UseExportProvider] public class TopLevelEditingTests : EditingTestBase { #region Usings [Fact] public void Using_Global_Insert() { var src1 = @" using System.Collections.Generic; "; var src2 = @" global using D = System.Diagnostics; global using System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [global using D = System.Diagnostics;]@2", "Insert [global using System.Collections;]@40"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Delete1() { var src1 = @" using System.Diagnostics; "; var src2 = @""; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [using System.Diagnostics;]@2"); Assert.IsType<UsingDirectiveSyntax>(edits.Edits.First().OldNode); Assert.Null(edits.Edits.First().NewNode); } [Fact] public void Using_Delete2() { var src1 = @" using D = System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var src2 = @" using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [using D = System.Diagnostics;]@2", "Delete [using System.Collections;]@33"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Insert() { var src1 = @" using System.Collections.Generic; "; var src2 = @" using D = System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [using D = System.Diagnostics;]@2", "Insert [using System.Collections;]@33"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Update1() { var src1 = @" using System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var src2 = @" using System.Diagnostics; using X = System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [using System.Collections;]@29 -> [using X = System.Collections;]@29"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Update2() { var src1 = @" using System.Diagnostics; using X1 = System.Collections; using System.Collections.Generic; "; var src2 = @" using System.Diagnostics; using X2 = System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [using X1 = System.Collections;]@29 -> [using X2 = System.Collections;]@29"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Update3() { var src1 = @" using System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var src2 = @" using System; using System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [using System.Diagnostics;]@2 -> [using System;]@2"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Reorder1() { var src1 = @" using System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var src2 = @" using System.Collections; using System.Collections.Generic; using System.Diagnostics; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [using System.Diagnostics;]@2 -> @64"); } [Fact] public void Using_InsertDelete1() { var src1 = @" namespace N { using System.Collections; } namespace M { } "; var src2 = @" namespace N { } namespace M { using System.Collections; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [using System.Collections;]@43", "Delete [using System.Collections;]@22"); } [Fact] public void Using_InsertDelete2() { var src1 = @" namespace N { using System.Collections; } "; var src2 = @" using System.Collections; namespace N { } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [using System.Collections;]@2", "Delete [using System.Collections;]@22"); } [Fact] public void Using_Delete_ChangesCodeMeaning() { // This test specifically validates the scenario we _don't_ support, namely when inserting or deleting // a using directive, if existing code changes in meaning as a result, we don't issue edits for that code. // If this ever regresses then please buy a lottery ticket because the feature has magically fixed itself. var src1 = @" using System.IO; using DirectoryInfo = N.C; namespace N { public class C { public C(string a) { } public FileAttributes Attributes { get; set; } } public class D { public void M() { var d = new DirectoryInfo(""aa""); var x = directoryInfo.Attributes; } } }"; var src2 = @" using System.IO; namespace N { public class C { public C(string a) { } public FileAttributes Attributes { get; set; } } public class D { public void M() { var d = new DirectoryInfo(""aa""); var x = directoryInfo.Attributes; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [using DirectoryInfo = N.C;]@20"); edits.VerifySemantics(); } [Fact] public void Using_Insert_ForNewCode() { // As distinct from the above, this test validates a real world scenario of inserting a using directive // and changing code that utilizes the new directive to some effect. var src1 = @" namespace N { class Program { static void Main(string[] args) { } } }"; var src2 = @" using System; namespace N { class Program { static void Main(string[] args) { Console.WriteLine(""Hello World!""); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("N.Program.Main"))); } [Fact] public void Using_Delete_ForOldCode() { var src1 = @" using System; namespace N { class Program { static void Main(string[] args) { Console.WriteLine(""Hello World!""); } } }"; var src2 = @" namespace N { class Program { static void Main(string[] args) { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("N.Program.Main"))); } [Fact] public void Using_Insert_CreatesAmbiguousCode() { // This test validates that we still issue edits for changed valid code, even when unchanged // code has ambiguities after adding a using. var src1 = @" using System.Threading; namespace N { class C { void M() { // Timer exists in System.Threading and System.Timers var t = new Timer(s => System.Console.WriteLine(s)); } } }"; var src2 = @" using System.Threading; using System.Timers; namespace N { class C { void M() { // Timer exists in System.Threading and System.Timers var t = new Timer(s => System.Console.WriteLine(s)); } void M2() { // TimersDescriptionAttribute only exists in System.Timers System.Console.WriteLine(new TimersDescriptionAttribute("""")); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("N.C.M2"))); } #endregion #region Extern Alias [Fact] public void ExternAliasUpdate() { var src1 = "extern alias X;"; var src2 = "extern alias Y;"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [extern alias X;]@0 -> [extern alias Y;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Update, "extern alias Y;", CSharpFeaturesResources.extern_alias)); } [Fact] public void ExternAliasInsert() { var src1 = ""; var src2 = "extern alias Y;"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [extern alias Y;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "extern alias Y;", CSharpFeaturesResources.extern_alias)); } [Fact] public void ExternAliasDelete() { var src1 = "extern alias Y;"; var src2 = ""; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [extern alias Y;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.extern_alias)); } #endregion #region Assembly/Module Attributes [Fact] public void Insert_TopLevelAttribute() { var src1 = ""; var src2 = "[assembly: System.Obsolete(\"2\")]"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [[assembly: System.Obsolete(\"2\")]]@0", "Insert [System.Obsolete(\"2\")]@11"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "[assembly: System.Obsolete(\"2\")]", FeaturesResources.attribute)); } [Fact] public void Delete_TopLevelAttribute() { var src1 = "[assembly: System.Obsolete(\"2\")]"; var src2 = ""; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [[assembly: System.Obsolete(\"2\")]]@0", "Delete [System.Obsolete(\"2\")]@11"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, null, FeaturesResources.attribute)); } [Fact] public void Update_TopLevelAttribute() { var src1 = "[assembly: System.Obsolete(\"1\")]"; var src2 = "[assembly: System.Obsolete(\"2\")]"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[assembly: System.Obsolete(\"1\")]]@0 -> [[assembly: System.Obsolete(\"2\")]]@0", "Update [System.Obsolete(\"1\")]@11 -> [System.Obsolete(\"2\")]@11"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Update, "System.Obsolete(\"2\")", FeaturesResources.attribute)); } [Fact] public void Reorder_TopLevelAttribute() { var src1 = "[assembly: System.Obsolete(\"1\")][assembly: System.Obsolete(\"2\")]"; var src2 = "[assembly: System.Obsolete(\"2\")][assembly: System.Obsolete(\"1\")]"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [[assembly: System.Obsolete(\"2\")]]@32 -> @0"); edits.VerifyRudeDiagnostics(); } #endregion #region Types [Theory] [InlineData("class", "struct")] [InlineData("class", "record")] // TODO: Allow this conversion: https://github.com/dotnet/roslyn/issues/51874 [InlineData("class", "record struct")] [InlineData("class", "interface")] [InlineData("struct", "record struct")] // TODO: Allow this conversion: https://github.com/dotnet/roslyn/issues/51874 public void Type_Kind_Update(string oldKeyword, string newKeyword) { var src1 = oldKeyword + " C { }"; var src2 = newKeyword + " C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [" + oldKeyword + " C { }]@0 -> [" + newKeyword + " C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeKindUpdate, newKeyword + " C")); } [Theory] [InlineData("class", "struct")] [InlineData("class", "record")] [InlineData("class", "record struct")] [InlineData("class", "interface")] [InlineData("struct", "record struct")] public void Type_Kind_Update_Reloadable(string oldKeyword, string newKeyword) { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]" + oldKeyword + " C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]" + newKeyword + " C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate]" + oldKeyword + " C { }]@145 -> [[CreateNewOnMetadataUpdate]" + newKeyword + " C { }]@145"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Modifiers_Static_Remove() { var src1 = "public static class C { }"; var src2 = "public class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public static class C { }]@0 -> [public class C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public class C", FeaturesResources.class_)); } [Theory] [InlineData("public")] [InlineData("protected")] [InlineData("private")] [InlineData("private protected")] [InlineData("internal protected")] public void Type_Modifiers_Accessibility_Change(string accessibility) { var src1 = accessibility + " class C { }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [" + accessibility + " class C { }]@0 -> [class C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "class C", FeaturesResources.class_)); } [Theory] [InlineData("public", "public")] [InlineData("internal", "internal")] [InlineData("", "internal")] [InlineData("internal", "")] [InlineData("protected", "protected")] [InlineData("private", "private")] [InlineData("private protected", "private protected")] [InlineData("internal protected", "internal protected")] public void Type_Modifiers_Accessibility_Partial(string accessibilityA, string accessibilityB) { var srcA1 = accessibilityA + " partial class C { }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = accessibilityB + " partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(), }); } [Fact] public void Type_Modifiers_Internal_Remove() { var src1 = "internal interface C { }"; var src2 = "interface C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void Type_Modifiers_Internal_Add() { var src1 = "struct C { }"; var src2 = "internal struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void Type_Modifiers_Accessibility_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]public class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]internal class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate]public class C { }]@145 -> [[CreateNewOnMetadataUpdate]internal class C { }]@145"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Theory] [InlineData("class")] [InlineData("struct")] [InlineData("interface")] [InlineData("record")] [InlineData("record struct")] public void Type_Modifiers_NestedPrivateInInterface_Remove(string keyword) { var src1 = "interface C { private " + keyword + " S { } }"; var src2 = "interface C { " + keyword + " S { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, keyword + " S", GetResource(keyword))); } [Theory] [InlineData("class")] [InlineData("struct")] [InlineData("interface")] [InlineData("record")] [InlineData("record struct")] public void Type_Modifiers_NestedPrivateInClass_Add(string keyword) { var src1 = "class C { " + keyword + " S { } }"; var src2 = "class C { private " + keyword + " S { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Theory] [InlineData("class")] [InlineData("struct")] [InlineData("interface")] [InlineData("record")] [InlineData("record struct")] public void Type_Modifiers_NestedPublicInInterface_Add(string keyword) { var src1 = "interface C { " + keyword + " S { } }"; var src2 = "interface C { public " + keyword + " S { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact, WorkItem(48628, "https://github.com/dotnet/roslyn/issues/48628")] public void Type_Modifiers_Unsafe_Add() { var src1 = "public class C { }"; var src2 = "public unsafe class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public class C { }]@0 -> [public unsafe class C { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact, WorkItem(48628, "https://github.com/dotnet/roslyn/issues/48628")] public void Type_Modifiers_Unsafe_Remove() { var src1 = @" using System; unsafe delegate void D(); class C { unsafe class N { } public unsafe event Action<int> A { add { } remove { } } unsafe int F() => 0; unsafe int X; unsafe int Y { get; } unsafe C() {} unsafe ~C() {} } "; var src2 = @" using System; delegate void D(); class C { class N { } public event Action<int> A { add { } remove { } } int F() => 0; int X; int Y { get; } C() {} ~C() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [unsafe delegate void D();]@17 -> [delegate void D();]@17", "Update [unsafe class N { }]@60 -> [class N { }]@53", "Update [public unsafe event Action<int> A { add { } remove { } }]@84 -> [public event Action<int> A { add { } remove { } }]@70", "Update [unsafe int F() => 0;]@146 -> [int F() => 0;]@125", "Update [unsafe int X;]@172 -> [int X;]@144", "Update [unsafe int Y { get; }]@191 -> [int Y { get; }]@156", "Update [unsafe C() {}]@218 -> [C() {}]@176", "Update [unsafe ~C() {}]@237 -> [~C() {}]@188"); edits.VerifyRudeDiagnostics(); } [Fact, WorkItem(48628, "https://github.com/dotnet/roslyn/issues/48628")] public void Type_Modifiers_Unsafe_DeleteInsert() { var srcA1 = "partial class C { unsafe void F() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")) }), }); } [Fact] public void Type_Modifiers_Ref_Add() { var src1 = "public struct C { }"; var src2 = "public ref struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public struct C { }]@0 -> [public ref struct C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public ref struct C", CSharpFeaturesResources.struct_)); } [Fact] public void Type_Modifiers_Ref_Remove() { var src1 = "public ref struct C { }"; var src2 = "public struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public ref struct C { }]@0 -> [public struct C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public struct C", CSharpFeaturesResources.struct_)); } [Fact] public void Type_Modifiers_ReadOnly_Add() { var src1 = "public struct C { }"; var src2 = "public readonly struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public struct C { }]@0 -> [public readonly struct C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public readonly struct C", CSharpFeaturesResources.struct_)); } [Fact] public void Type_Modifiers_ReadOnly_Remove() { var src1 = "public readonly struct C { }"; var src2 = "public struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public readonly struct C { }]@0 -> [public struct C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public struct C", CSharpFeaturesResources.struct_)); } [Theory] [InlineData("[System.CLSCompliantAttribute]", "CLSCompliantAttribute")] [InlineData("[System.Diagnostics.CodeAnalysis.AllowNullAttribute]", "AllowNullAttribute")] [InlineData("[System.Diagnostics.CodeAnalysis.DisallowNullAttribute]", "DisallowNullAttribute")] [InlineData("[System.Diagnostics.CodeAnalysis.MaybeNullAttribute]", "MaybeNullAttribute")] [InlineData("[System.Diagnostics.CodeAnalysis.NotNullAttribute]", "NotNullAttribute")] [InlineData("[System.NonSerializedAttribute]", "NonSerializedAttribute")] [InlineData("[System.Reflection.AssemblyAlgorithmIdAttribute]", "AssemblyAlgorithmIdAttribute")] [InlineData("[System.Reflection.AssemblyCultureAttribute]", "AssemblyCultureAttribute")] [InlineData("[System.Reflection.AssemblyFlagsAttribute]", "AssemblyFlagsAttribute")] [InlineData("[System.Reflection.AssemblyVersionAttribute]", "AssemblyVersionAttribute")] [InlineData("[System.Runtime.CompilerServices.DllImportAttribute]", "DllImportAttribute")] [InlineData("[System.Runtime.CompilerServices.IndexerNameAttribute]", "IndexerNameAttribute")] [InlineData("[System.Runtime.CompilerServices.MethodImplAttribute]", "MethodImplAttribute")] [InlineData("[System.Runtime.CompilerServices.SpecialNameAttribute]", "SpecialNameAttribute")] [InlineData("[System.Runtime.CompilerServices.TypeForwardedToAttribute]", "TypeForwardedToAttribute")] [InlineData("[System.Runtime.InteropServices.ComImportAttribute]", "ComImportAttribute")] [InlineData("[System.Runtime.InteropServices.DefaultParameterValueAttribute]", "DefaultParameterValueAttribute")] [InlineData("[System.Runtime.InteropServices.FieldOffsetAttribute]", "FieldOffsetAttribute")] [InlineData("[System.Runtime.InteropServices.InAttribute]", "InAttribute")] [InlineData("[System.Runtime.InteropServices.MarshalAsAttribute]", "MarshalAsAttribute")] [InlineData("[System.Runtime.InteropServices.OptionalAttribute]", "OptionalAttribute")] [InlineData("[System.Runtime.InteropServices.OutAttribute]", "OutAttribute")] [InlineData("[System.Runtime.InteropServices.PreserveSigAttribute]", "PreserveSigAttribute")] [InlineData("[System.Runtime.InteropServices.StructLayoutAttribute]", "StructLayoutAttribute")] [InlineData("[System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeImportAttribute]", "WindowsRuntimeImportAttribute")] [InlineData("[System.Security.DynamicSecurityMethodAttribute]", "DynamicSecurityMethodAttribute")] [InlineData("[System.SerializableAttribute]", "SerializableAttribute")] [InlineData("[System.Runtime.CompilerServices.AsyncMethodBuilderAttribute]", "AsyncMethodBuilderAttribute")] public void Type_Attribute_Insert_SupportedByRuntime_NonCustomAttribute(string attributeType, string attributeName) { var src1 = @"class C { public void M(int a) {} }"; var src2 = attributeType + @"class C { public void M(int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { public void M(int a) {} }]@0 -> [" + attributeType + "class C { public void M(int a) {} }]@0"); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.ChangingNonCustomAttribute, "class C", attributeName, FeaturesResources.class_)); } [Fact] public void Type_Attribute_Update_NotSupportedByRuntime1() { var attribute = "public class A1Attribute : System.Attribute { }\n\n" + "public class A2Attribute : System.Attribute { }\n\n"; var src1 = attribute + "[A1]class C { }"; var src2 = attribute + "[A2]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A1]class C { }]@98 -> [[A2]class C { }]@98"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Update_NotSupportedByRuntime2() { var src1 = "[System.Obsolete(\"1\")]class C { }"; var src2 = "[System.Obsolete(\"2\")]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\")]class C { }]@0 -> [[System.Obsolete(\"2\")]class C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Delete_NotSupportedByRuntime1() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[A, B]class C { }"; var src2 = attribute + "[A]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A, B]class C { }]@96 -> [[A]class C { }]@96"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Delete_NotSupportedByRuntime2() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[B, A]class C { }"; var src2 = attribute + "[A]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[B, A]class C { }]@96 -> [[A]class C { }]@96"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Change_Reloadable() { var attributeSrc = @" public class A1 : System.Attribute { } public class A2 : System.Attribute { } public class A3 : System.Attribute { } "; var src1 = ReloadableAttributeSrc + attributeSrc + "[CreateNewOnMetadataUpdate, A1, A2]class C { }"; var src2 = ReloadableAttributeSrc + attributeSrc + "[CreateNewOnMetadataUpdate, A2, A3]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate, A1, A2]class C { }]@267 -> [[CreateNewOnMetadataUpdate, A2, A3]class C { }]@267"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Attribute_ReloadableRemove() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Attribute_ReloadableAdd() { var src1 = ReloadableAttributeSrc + "class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Attribute_ReloadableBase() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class B { } class C : B { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class B { } class C : B { void F() {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Attribute_Add() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[A]class C { }"; var src2 = attribute + "[A, B]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]class C { }]@96 -> [[A, B]class C { }]@96"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Attribute_Add_NotSupportedByRuntime1() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[A]class C { }"; var src2 = attribute + "[A, B]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]class C { }]@96 -> [[A, B]class C { }]@96"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Add_NotSupportedByRuntime2() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "class C { }"; var src2 = attribute + "[A]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { }]@48 -> [[A]class C { }]@48"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Reorder1() { var src1 = "[A(1), B(2), C(3)]class C { }"; var src2 = "[C(3), A(1), B(2)]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A(1), B(2), C(3)]class C { }]@0 -> [[C(3), A(1), B(2)]class C { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact] public void Type_Attribute_Reorder2() { var src1 = "[A, B, C]class C { }"; var src2 = "[B, C, A]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A, B, C]class C { }]@0 -> [[B, C, A]class C { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact] public void Type_Attribute_ReorderAndUpdate_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[System.Obsolete(\"1\"), A, B]class C { }"; var src2 = attribute + "[A, B, System.Obsolete(\"2\")]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\"), A, B]class C { }]@96 -> [[A, B, System.Obsolete(\"2\")]class C { }]@96"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Theory] [InlineData("class")] [InlineData("struct")] [InlineData("interface")] [InlineData("record")] [InlineData("record struct")] public void Type_Rename(string keyword) { var src1 = keyword + " C { }"; var src2 = keyword + " D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [" + keyword + " C { }]@0 -> [" + keyword + " D { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, keyword + " D", GetResource(keyword))); } [Fact] public void Type_Rename_AddAndDeleteMember() { var src1 = "class C { int x = 1; }"; var src2 = "class D { void F() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { int x = 1; }]@0 -> [class D { void F() { } }]@0", "Insert [void F() { }]@10", "Insert [()]@16", "Delete [int x = 1;]@10", "Delete [int x = 1]@10", "Delete [x = 1]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "class D", FeaturesResources.class_)); } [Fact] [WorkItem(54886, "https://github.com/dotnet/roslyn/issues/54886")] public void Type_Rename_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate]class C { }]@145 -> [[CreateNewOnMetadataUpdate]class D { }]@145"); // TODO: expected: Replace edit of D edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Renamed, "class D", FeaturesResources.class_)); } [Fact] [WorkItem(54886, "https://github.com/dotnet/roslyn/issues/54886")] public void Type_Rename_Reloadable_AddAndDeleteMember() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { int x = 1; }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class D { void F() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate]class C { int x = 1; }]@145 -> [[CreateNewOnMetadataUpdate]class D { void F() { } }]@145", "Insert [void F() { }]@182", "Insert [()]@188", "Delete [int x = 1;]@182", "Delete [int x = 1]@182", "Delete [x = 1]@186"); // TODO: expected: Replace edit of D edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Renamed, "class D", FeaturesResources.class_)); } [Fact] public void Interface_NoModifiers_Insert() { var src1 = ""; var src2 = "interface C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Interface_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { } "; var src2 = "namespace N { interface C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Interface_NoModifiers_IntoType_Insert() { var src1 = "interface N { }"; var src2 = "interface N { interface C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Class_NoModifiers_Insert() { var src1 = ""; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Class_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { class C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Class_NoModifiers_IntoType_Insert() { var src1 = "struct N { }"; var src2 = "struct N { class C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_NoModifiers_Insert() { var src1 = ""; var src2 = "struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { struct C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_NoModifiers_IntoType_Insert() { var src1 = "struct N { }"; var src2 = "struct N { struct C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Type_BaseType_Add_Unchanged() { var src1 = "class C { }"; var src2 = "class C : object { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { }]@0 -> [class C : object { }]@0"); edits.VerifySemantics(); } [Fact] public void Type_BaseType_Add_Changed() { var src1 = "class C { }"; var src2 = "class C : D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { }]@0 -> [class C : D { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Theory] [InlineData("string", "string?")] [InlineData("string[]", "string[]?")] [InlineData("object", "dynamic")] [InlineData("dynamic?", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Type_BaseType_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C : System.Collections.Generic.List<" + oldType + "> {}"; var src2 = "class C : System.Collections.Generic.List<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Type_BaseType_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C : System.Collections.Generic.List<" + oldType + "> {}"; var src2 = "class C : System.Collections.Generic.List<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Fact] public void Type_BaseType_Update_CompileTimeTypeUnchanged() { var src1 = "using A = System.Int32; using B = System.Int32; class C : System.Collections.Generic.List<A> {}"; var src2 = "using A = System.Int32; using B = System.Int32; class C : System.Collections.Generic.List<B> {}"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void Type_BaseInterface_Add() { var src1 = "class C { }"; var src2 = "class C : IDisposable { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { }]@0 -> [class C : IDisposable { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Fact] public void Type_BaseInterface_Delete_Inherited() { var src1 = @" interface B {} interface A : B {} class C : A, B {} "; var src2 = @" interface B {} interface A : B {} class C : A {} "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void Type_BaseInterface_Reorder() { var src1 = "class C : IGoo, IBar { }"; var src2 = "class C : IBar, IGoo { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C : IGoo, IBar { }]@0 -> [class C : IBar, IGoo { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Type_BaseInterface_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C : System.Collections.Generic.IEnumerable<" + oldType + "> {}"; var src2 = "class C : System.Collections.Generic.IEnumerable<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Type_BaseInterface_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C : System.Collections.Generic.IEnumerable<" + oldType + "> {}"; var src2 = "class C : System.Collections.Generic.IEnumerable<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Fact] public void Type_Base_Partial() { var srcA1 = "partial class C : B, I { }"; var srcB1 = "partial class C : J { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C : B, I, J { }"; var srcC = @" class B {} interface I {} interface J {}"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC, srcC) }, new[] { DocumentResults(), DocumentResults(), DocumentResults() }); } [Fact] public void Type_Base_Partial_InsertDeleteAndUpdate() { var srcA1 = "partial class C { }"; var srcB1 = ""; var srcC1 = "partial class C { }"; var srcA2 = ""; var srcB2 = "partial class C : D { }"; var srcC2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "partial class C", FeaturesResources.class_) }), DocumentResults(), }); } [Fact] public void Type_Base_InsertDelete() { var srcA1 = ""; var srcB1 = "class C : B, I { }"; var srcA2 = "class C : B, I { }"; var srcB2 = ""; var srcC = @" class B {} interface I {} interface J {}"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC, srcC) }, new[] { DocumentResults(), DocumentResults(), DocumentResults() }); } [Fact] public void Type_Reloadable_NotSupportedByRuntime() { var src1 = ReloadableAttributeSrc + @" [CreateNewOnMetadataUpdate] public class C { void F() { System.Console.WriteLine(1); } }"; var src2 = ReloadableAttributeSrc + @" [CreateNewOnMetadataUpdate] public class C { void F() { System.Console.WriteLine(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.ChangingReloadableTypeNotSupportedByRuntime, "void F()", "CreateNewOnMetadataUpdateAttribute")); } [Fact] public void Type_Insert_AbstractVirtualOverride() { var src1 = ""; var src2 = @" public abstract class C<T> { public abstract void F(); public virtual void G() {} public override string ToString() => null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Type_Insert_NotSupportedByRuntime() { var src1 = @" public class C { void F() { } }"; var src2 = @" public class C { void F() { } } public class D { void M() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "public class D", FeaturesResources.class_)); } [Fact] public void Type_Insert_Reloadable() { var src1 = ReloadableAttributeSrc + ""; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { void F() {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C"))); } [Fact] public void InterfaceInsert() { var src1 = ""; var src2 = @" public interface I { void F(); static void G() {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void RefStructInsert() { var src1 = ""; var src2 = "ref struct X { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [ref struct X { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_ReadOnly_Insert() { var src1 = ""; var src2 = "readonly struct X { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [readonly struct X { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_RefModifier_Add() { var src1 = "struct X { }"; var src2 = "ref struct X { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [struct X { }]@0 -> [ref struct X { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "ref struct X", CSharpFeaturesResources.struct_)); } [Fact] public void Struct_ReadonlyModifier_Add() { var src1 = "struct X { }"; var src2 = "readonly struct X { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [struct X { }]@0 -> [readonly struct X { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "readonly struct X", SyntaxFacts.GetText(SyntaxKind.StructKeyword))); } [Theory] [InlineData("ref")] [InlineData("readonly")] public void Struct_Modifiers_Partial_InsertDelete(string modifier) { var srcA1 = modifier + " partial struct S { }"; var srcB1 = "partial struct S { }"; var srcA2 = "partial struct S { }"; var srcB2 = modifier + " partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults() }); } [Fact] public void Class_ImplementingInterface_Add() { var src1 = @" using System; public interface ISample { string Get(); } public interface IConflict { string Get(); } public class BaseClass : ISample { public virtual string Get() => string.Empty; } "; var src2 = @" using System; public interface ISample { string Get(); } public interface IConflict { string Get(); } public class BaseClass : ISample { public virtual string Get() => string.Empty; } public class SubClass : BaseClass, IConflict { public override string Get() => string.Empty; string IConflict.Get() => String.Empty; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Insert [public class SubClass : BaseClass, IConflict { public override string Get() => string.Empty; string IConflict.Get() => String.Empty; }]@219", "Insert [public override string Get() => string.Empty;]@272", "Insert [string IConflict.Get() => String.Empty;]@325", "Insert [()]@298", "Insert [()]@345"); // Here we add a class implementing an interface and a method inside it with explicit interface specifier. // We want to be sure that adding the method will not tirgger a rude edit as it happens if adding a single method with explicit interface specifier. edits.VerifyRudeDiagnostics(); } [WorkItem(37128, "https://github.com/dotnet/roslyn/issues/37128")] [Fact] public void Interface_InsertMembers() { var src1 = @" using System; interface I { } "; var src2 = @" using System; interface I { static int StaticField = 10; static void StaticMethod() { } void VirtualMethod1() { } virtual void VirtualMethod2() { } abstract void AbstractMethod(); sealed void NonVirtualMethod() { } public static int operator +(I a, I b) => 1; static int StaticProperty1 { get => 1; set { } } static int StaticProperty2 => 1; virtual int VirtualProperty1 { get => 1; set { } } virtual int VirtualProperty2 { get => 1; } int VirtualProperty3 { get => 1; set { } } int VirtualProperty4 { get => 1; } abstract int AbstractProperty1 { get; set; } abstract int AbstractProperty2 { get; } sealed int NonVirtualProperty => 1; int this[byte virtualIndexer] => 1; int this[sbyte virtualIndexer] { get => 1; } virtual int this[ushort virtualIndexer] { get => 1; set {} } virtual int this[short virtualIndexer] { get => 1; set {} } abstract int this[uint abstractIndexer] { get; set; } abstract int this[int abstractIndexer] { get; } sealed int this[ulong nonVirtualIndexer] { get => 1; set {} } sealed int this[long nonVirtualIndexer] { get => 1; set {} } static event Action StaticEvent; static event Action StaticEvent2 { add { } remove { } } event Action VirtualEvent { add { } remove { } } abstract event Action AbstractEvent; sealed event Action NonVirtualEvent { add { } remove { } } abstract class C { } interface J { } enum E { } delegate void D(); } "; var edits = GetTopEdits(src1, src2); // TODO: InsertIntoInterface errors are reported due to https://github.com/dotnet/roslyn/issues/37128. edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoInterface, "static void StaticMethod()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertVirtual, "void VirtualMethod1()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertVirtual, "virtual void VirtualMethod2()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertVirtual, "abstract void AbstractMethod()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed void NonVirtualMethod()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertOperator, "public static int operator +(I a, I b)", FeaturesResources.operator_), Diagnostic(RudeEditKind.InsertIntoInterface, "static int StaticProperty1", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertIntoInterface, "static int StaticProperty2", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertIntoInterface, "static int StaticProperty2", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.InsertVirtual, "virtual int VirtualProperty1", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertVirtual, "virtual int VirtualProperty2", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertVirtual, "int VirtualProperty3", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertVirtual, "int VirtualProperty4", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertVirtual, "abstract int AbstractProperty1", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertVirtual, "abstract int AbstractProperty2", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed int NonVirtualProperty", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed int NonVirtualProperty", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.InsertVirtual, "int this[byte virtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "int this[byte virtualIndexer]", CSharpFeaturesResources.indexer_getter), Diagnostic(RudeEditKind.InsertVirtual, "int this[sbyte virtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "virtual int this[ushort virtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "virtual int this[short virtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "abstract int this[uint abstractIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "abstract int this[int abstractIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed int this[ulong nonVirtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed int this[long nonVirtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertIntoInterface, "static event Action StaticEvent2", FeaturesResources.event_), Diagnostic(RudeEditKind.InsertVirtual, "event Action VirtualEvent", FeaturesResources.event_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed event Action NonVirtualEvent", FeaturesResources.event_), Diagnostic(RudeEditKind.InsertIntoInterface, "StaticField = 10", FeaturesResources.field), Diagnostic(RudeEditKind.InsertIntoInterface, "StaticEvent", CSharpFeaturesResources.event_field), Diagnostic(RudeEditKind.InsertVirtual, "AbstractEvent", CSharpFeaturesResources.event_field)); } [Fact] public void Interface_InsertDelete() { var srcA1 = @" interface I { static void M() { } } "; var srcB1 = @" "; var srcA2 = @" "; var srcB2 = @" interface I { static void M() { } } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("M")) }), }); } [Fact] public void Type_Generic_InsertMembers() { var src1 = @" using System; class C<T> { } "; var src2 = @" using System; class C<T> { void M() {} int P1 { get; set; } int P2 { get => 1; set {} } int this[int i] { get => 1; set {} } event Action E { add {} remove {} } event Action EF; int F1, F2; enum E {} interface I {} class D {} } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoGenericType, "void M()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertIntoGenericType, "int P1", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertIntoGenericType, "int P2", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertIntoGenericType, "int this[int i]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertIntoGenericType, "event Action E", FeaturesResources.event_), Diagnostic(RudeEditKind.InsertIntoGenericType, "EF", CSharpFeaturesResources.event_field), Diagnostic(RudeEditKind.InsertIntoGenericType, "F1", FeaturesResources.field), Diagnostic(RudeEditKind.InsertIntoGenericType, "F2", FeaturesResources.field)); } [Fact] public void Type_Generic_InsertMembers_Reloadable() { var src1 = ReloadableAttributeSrc + @" [CreateNewOnMetadataUpdate] class C<T> { } "; var src2 = ReloadableAttributeSrc + @" [CreateNewOnMetadataUpdate] class C<T> { void M() {} int P1 { get; set; } int P2 { get => 1; set {} } int this[int i] { get => 1; set {} } event System.Action E { add {} remove {} } event System.Action EF; int F1, F2; enum E {} interface I {} class D {} } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Generic_DeleteInsert() { var srcA1 = @" class C<T> { void F() {} } struct S<T> { void F() {} } interface I<T> { void F() {} } "; var srcB1 = ""; var srcA2 = srcB1; var srcB2 = srcA1; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "class C<T>"), Diagnostic(RudeEditKind.GenericTypeUpdate, "struct S<T>"), Diagnostic(RudeEditKind.GenericTypeUpdate, "interface I<T>"), Diagnostic(RudeEditKind.GenericTypeUpdate, "void F()"), Diagnostic(RudeEditKind.GenericTypeUpdate, "void F()"), Diagnostic(RudeEditKind.GenericTypeUpdate, "void F()"), Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), }) }); } [Fact(Skip = "https://github.com/dotnet/roslyn/issues/54881")] [WorkItem(54881, "https://github.com/dotnet/roslyn/issues/54881")] public void Type_TypeParameter_Insert_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]public class C<T> { void F() { } }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]internal class C<T, S> { int x = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Delete() { var src1 = @" class C { void F() {} } struct S { void F() {} } interface I { void F() {} } "; var src2 = ""; GetTopEdits(src1, src2).VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(FeaturesResources.class_, "C")), Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(CSharpFeaturesResources.struct_, "S")), Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(FeaturesResources.interface_, "I"))); } [Fact] public void Type_Delete_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { void F() {} }"; var src2 = ReloadableAttributeSrc; GetTopEdits(src1, src2).VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(FeaturesResources.class_, "C"))); } [Fact] public void Type_Partial_DeleteDeclaration() { var srcA1 = "partial class C { void F() {} void M() { } }"; var srcB1 = "partial class C { void G() {} }"; var srcA2 = ""; var srcB2 = "partial class C { void G() {} void M() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(FeaturesResources.method, "C.F()")) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("M")), }) }); } [Fact] public void Type_Partial_InsertFirstDeclaration() { var src1 = ""; var src2 = "partial class C { void F() {} }"; GetTopEdits(src1, src2).VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C"), preserveLocalVariables: false) }); } [Fact] public void Type_Partial_InsertSecondDeclaration() { var srcA1 = "partial class C { void F() {} }"; var srcB1 = ""; var srcA2 = "partial class C { void F() {} }"; var srcB2 = "partial class C { void G() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("G"), preserveLocalVariables: false) }), }); } [Fact] public void Type_Partial_Reloadable() { var srcA1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { void F() {} }"; var srcB1 = ""; var srcA2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { void F() {} }"; var srcB2 = "partial class C { void G() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), }); } [Fact] public void Type_DeleteInsert() { var srcA1 = @" class C { void F() {} } struct S { void F() {} } interface I { void F() {} } "; var srcB1 = ""; var srcA2 = srcB1; var srcB2 = srcA1; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("F")), }) }); } [Fact] public void Type_DeleteInsert_Reloadable() { var srcA1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { void F() {} }"; var srcB1 = ""; var srcA2 = ReloadableAttributeSrc; var srcB2 = "[CreateNewOnMetadataUpdate]class C { void F() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C")), }) }); } [Fact] public void Type_NonInsertableMembers_DeleteInsert() { var srcA1 = @" abstract class C { public abstract void AbstractMethod(); public virtual void VirtualMethod() {} public override string ToString() => null; public void I.G() {} } interface I { void G(); void F() {} } "; var srcB1 = ""; var srcA2 = srcB1; var srcB2 = srcA1; // TODO: The methods without bodies do not need to be updated. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("AbstractMethod")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("VirtualMethod")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("ToString")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("I.G")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("G")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("F")), }) }); } [Fact] public void Type_Attribute_NonInsertableMembers_DeleteInsert() { var srcA1 = @" abstract class C { public abstract void AbstractMethod(); public virtual void VirtualMethod() {} public override string ToString() => null; public void I.G() {} } interface I { void G(); void F() {} } "; var srcB1 = ""; var srcA2 = ""; var srcB2 = @" abstract class C { [System.Obsolete]public abstract void AbstractMethod(); public virtual void VirtualMethod() {} public override string ToString() => null; public void I.G() {} } interface I { [System.Obsolete]void G(); void F() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("AbstractMethod")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("VirtualMethod")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("ToString")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("I.G")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("G")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("F")), }) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_DeleteInsert_DataMembers() { var srcA1 = @" class C { public int x = 1; public int y = 2; public int P { get; set; } = 3; public event System.Action E = new System.Action(null); } "; var srcB1 = ""; var srcA2 = ""; var srcB2 = @" class C { public int x = 1; public int y = 2; public int P { get; set; } = 3; public event System.Action E = new System.Action(null); } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true), }) }); } [Fact] public void Type_DeleteInsert_DataMembers_PartialSplit() { var srcA1 = @" class C { public int x = 1; public int y = 2; public int P { get; set; } = 3; } "; var srcB1 = ""; var srcA2 = @" partial class C { public int x = 1; public int y = 2; } "; var srcB2 = @" partial class C { public int P { get; set; } = 3; } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true), }) }); } [Fact] public void Type_DeleteInsert_DataMembers_PartialMerge() { var srcA1 = @" partial class C { public int x = 1; public int y = 2; } "; var srcB1 = @" partial class C { public int P { get; set; } = 3; }"; var srcA2 = @" class C { public int x = 1; public int y = 2; public int P { get; set; } = 3; } "; var srcB2 = @" "; // note that accessors are not updated since they do not have bodies EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true), }), DocumentResults() }); } #endregion #region Records [Fact] public void Record_Partial_MovePrimaryConstructor() { var src1 = @" partial record C { } partial record C(int X);"; var src2 = @" partial record C(int X); partial record C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_Name_Update() { var src1 = "record C { }"; var src2 = "record D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C { }]@0 -> [record D { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "record D", CSharpFeaturesResources.record_)); } [Fact] public void RecordStruct_NoModifiers_Insert() { var src1 = ""; var src2 = "record struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void RecordStruct_AddField() { var src1 = @" record struct C(int X) { }"; var src2 = @" record struct C(int X) { private int _y = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoStruct, "_y = 0", FeaturesResources.field, CSharpFeaturesResources.record_struct)); } [Fact] public void RecordStruct_AddProperty() { var src1 = @" record struct C(int X) { }"; var src2 = @" record struct C(int X) { public int Y { get; set; } = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoStruct, "public int Y { get; set; } = 0;", FeaturesResources.auto_property, CSharpFeaturesResources.record_struct)); } [Fact] public void Record_NoModifiers_Insert() { var src1 = ""; var src2 = "record C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { record C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_NoModifiers_IntoType_Insert() { var src1 = "struct N { }"; var src2 = "struct N { record C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_BaseTypeUpdate1() { var src1 = "record C { }"; var src2 = "record C : D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C { }]@0 -> [record C : D { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void Record_BaseTypeUpdate2() { var src1 = "record C : D1 { }"; var src2 = "record C : D2 { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C : D1 { }]@0 -> [record C : D2 { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void Record_BaseInterfaceUpdate1() { var src1 = "record C { }"; var src2 = "record C : IDisposable { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C { }]@0 -> [record C : IDisposable { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void Record_BaseInterfaceUpdate2() { var src1 = "record C : IGoo, IBar { }"; var src2 = "record C : IGoo { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C : IGoo, IBar { }]@0 -> [record C : IGoo { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void Record_BaseInterfaceUpdate3() { var src1 = "record C : IGoo, IBar { }"; var src2 = "record C : IBar, IGoo { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C : IGoo, IBar { }]@0 -> [record C : IBar, IGoo { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void RecordInsert_AbstractVirtualOverride() { var src1 = ""; var src2 = @" public abstract record C<T> { public abstract void F(); public virtual void G() {} public override void H() {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_ParameterlessConstructor() { var src1 = "record C { }"; var src2 = @" record C { public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.First(c => c.ToString() == "C.C()"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void RecordStruct_ImplementSynthesized_ParameterlessConstructor() { var src1 = "record struct C { }"; var src2 = @" record struct C { public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.First(c => c.ToString() == "C.C()"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_PrintMembers() { var src1 = "record C { }"; var src2 = @" record C { protected virtual bool PrintMembers(System.Text.StringBuilder builder) { return true; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers"))); edits.VerifyRudeDiagnostics(); } [Fact] public void RecordStruct_ImplementSynthesized_PrintMembers() { var src1 = "record struct C { }"; var src2 = @" record struct C { private readonly bool PrintMembers(System.Text.StringBuilder builder) { return true; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_WrongParameterName() { var src1 = "record C { }"; var src2 = @" record C { protected virtual bool PrintMembers(System.Text.StringBuilder sb) { return false; } public virtual bool Equals(C rhs) { return false; } protected C(C other) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ExplicitRecordMethodParameterNamesMustMatch, "protected virtual bool PrintMembers(System.Text.StringBuilder sb)", "PrintMembers(System.Text.StringBuilder builder)"), Diagnostic(RudeEditKind.ExplicitRecordMethodParameterNamesMustMatch, "public virtual bool Equals(C rhs)", "Equals(C other)"), Diagnostic(RudeEditKind.ExplicitRecordMethodParameterNamesMustMatch, "protected C(C other)", "C(C original)")); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.FirstOrDefault()?.Type.ToDisplayString() == "C"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Length == 0), preserveLocalVariables: true), }, EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Record_ImplementSynthesized_ToString() { var src1 = "record C { }"; var src2 = @" record C { public override string ToString() { return ""R""; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.ToString"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_UnImplementSynthesized_ToString() { var src1 = @" record C { public override string ToString() { return ""R""; } }"; var src2 = "record C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.ToString"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_Primary() { var src1 = "record C(int X);"; var src2 = "record C(int X, int Y);"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "int Y", FeaturesResources.parameter)); } [Fact] public void Record_UnimplementSynthesized_ParameterlessConstructor() { var src1 = @" record C { public C() { } }"; var src2 = "record C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.First(c => c.ToString() == "C.C()"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void RecordStruct_UnimplementSynthesized_ParameterlessConstructor() { var src1 = @" record struct C { public C() { } }"; var src2 = "record struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.First(c => c.ToString() == "C.C()"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_NotPrimary() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int Y { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.Y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_NotPrimary_WithConstructor() { var src1 = @" record C(int X) { public C(string fromAString) { } }"; var src2 = @" record C(int X) { public int Y { get; set; } public C(string fromAString) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.Y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_NotPrimary_WithExplicitMembers() { var src1 = @" record C(int X) { protected virtual bool PrintMembers(System.Text.StringBuilder builder) { return false; } public override int GetHashCode() { return 0; } public virtual bool Equals(C other) { return false; } public C(C original) { } }"; var src2 = @" record C(int X) { public int Y { get; set; } protected virtual bool PrintMembers(System.Text.StringBuilder builder) { return false; } public override int GetHashCode() { return 0; } public virtual bool Equals(C other) { return false; } public C(C original) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.Y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_NotPrimary_WithInitializer() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int Y { get; set; } = 1; }"; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.Y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField() { var src1 = "record C(int X) { }"; var src2 = "record C(int X) { private int _y; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField_WithExplicitMembers() { var src1 = @" record C(int X) { public C(C other) { } }"; var src2 = @" record C(int X) { private int _y; public C(C other) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField_WithInitializer() { var src1 = "record C(int X) { }"; var src2 = "record C(int X) { private int _y = 1; }"; var syntaxMap = GetSyntaxMap(src1, src2); var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField_WithExistingInitializer() { var src1 = "record C(int X) { private int _y = <N:0.0>1</N:0.0>; }"; var src2 = "record C(int X) { private int _y = <N:0.0>1</N:0.0>; private int _z; }"; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._z")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField_WithInitializerAndExistingInitializer() { var src1 = "record C(int X) { private int _y = <N:0.0>1</N:0.0>; }"; var src2 = "record C(int X) { private int _y = <N:0.0>1</N:0.0>; private int _z = 1; }"; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._z")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_DeleteField() { var src1 = "record C(int X) { private int _y; }"; var src2 = "record C(int X) { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Delete, "record C", DeletedSymbolDisplay(FeaturesResources.field, "_y"))); } [Fact] public void Record_DeleteProperty_Primary() { var src1 = "record C(int X, int Y) { }"; var src2 = "record C(int X) { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Delete, "record C", DeletedSymbolDisplay(FeaturesResources.parameter, "int Y"))); } [Fact] public void Record_DeleteProperty_NotPrimary() { var src1 = "record C(int X) { public int P { get; set; } }"; var src2 = "record C(int X) { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "record C", DeletedSymbolDisplay(FeaturesResources.auto_property, "P"))); } [Fact] public void Record_ImplementSynthesized_Property() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get; init; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_Property_WithBody() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get { return 4; } init { throw null; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_Property_WithExpressionBody() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get => 4; init => throw null; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_Property_InitToSet() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ImplementRecordParameterWithSet, "public int X", "X")); } [Fact] public void Record_ImplementSynthesized_Property_MakeReadOnly() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ImplementRecordParameterAsReadOnly, "public int X", "X")); } [Fact] public void Record_UnImplementSynthesized_Property() { var src1 = @" record C(int X) { public int X { get; init; } }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_UnImplementSynthesized_Property_WithExpressionBody() { var src1 = @" record C(int X) { public int X { get => 4; init => throw null; } }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_UnImplementSynthesized_Property_WithBody() { var src1 = @" record C(int X) { public int X { get { return 4; } init { } } }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_Property_Partial() { var srcA1 = @"partial record C(int X);"; var srcB1 = @"partial record C;"; var srcA2 = @"partial record C(int X);"; var srcB2 = @" partial record C { public int X { get; init; } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void Record_UnImplementSynthesized_Property_Partial() { var srcA1 = @"partial record C(int X);"; var srcB1 = @" partial record C { public int X { get; init; } }"; var srcA2 = @"partial record C(int X);"; var srcB2 = @"partial record C;"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void Record_ImplementSynthesized_Property_Partial_WithBody() { var srcA1 = @"partial record C(int X);"; var srcB1 = @"partial record C;"; var srcA2 = @"partial record C(int X);"; var srcB2 = @" partial record C { public int X { get { return 4; } init { throw null; } } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), partialType : "C", preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C")) }) }); } [Fact] public void Record_UnImplementSynthesized_Property_Partial_WithBody() { var srcA1 = @"partial record C(int X);"; var srcB1 = @" partial record C { public int X { get { return 4; } init { throw null; } } }"; var srcA2 = @"partial record C(int X);"; var srcB2 = @"partial record C;"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), partialType : "C", preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C")) }) }); } [Fact] public void Record_MoveProperty_Partial() { var srcA1 = @" partial record C(int X) { public int Y { get; init; } }"; var srcB1 = @" partial record C; "; var srcA2 = @" partial record C(int X); "; var srcB2 = @" partial record C { public int Y { get; init; } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.Y").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.Y").SetMethod) }), }); } [Fact] public void Record_UnImplementSynthesized_Property_WithInitializer() { var src1 = @" record C(int X) { public int X { get; init; } = 1; }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_UnImplementSynthesized_Property_WithInitializerMatchingCompilerGenerated() { var src1 = @" record C(int X) { public int X { get; init; } = X; }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_Property_Delete_NotPrimary() { var src1 = @" record C(int X) { public int Y { get; init; } }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "record C", DeletedSymbolDisplay(FeaturesResources.auto_property, "Y"))); } [Fact] public void Record_PropertyInitializer_Update_NotPrimary() { var src1 = "record C { int X { get; } = 0; }"; var src2 = "record C { int X { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Length == 0), preserveLocalVariables: true)); } [Fact] public void Record_PropertyInitializer_Update_Primary() { var src1 = "record C(int X) { int X { get; } = 0; }"; var src2 = "record C(int X) { int X { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); } #endregion #region Enums [Fact] public void Enum_NoModifiers_Insert() { var src1 = ""; var src2 = "enum C { A }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Enum_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { enum C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Enum_NoModifiers_IntoType_Insert() { var src1 = "struct N { }"; var src2 = "struct N { enum C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Enum_Attribute_Insert() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "enum E { }"; var src2 = attribute + "[A]enum E { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum E { }]@48 -> [[A]enum E { }]@48"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "enum E", FeaturesResources.enum_)); } [Fact] public void Enum_Member_Attribute_Delete() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "enum E { [A]X }"; var src2 = attribute + "enum E { X }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]X]@57 -> [X]@57"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "X", FeaturesResources.enum_value)); } [Fact] public void Enum_Member_Attribute_Insert() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "enum E { X }"; var src2 = attribute + "enum E { [A]X }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [X]@57 -> [[A]X]@57"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "[A]X", FeaturesResources.enum_value)); } [Fact] public void Enum_Member_Attribute_Update() { var attribute = "public class A1Attribute : System.Attribute { }\n\n" + "public class A2Attribute : System.Attribute { }\n\n"; var src1 = attribute + "enum E { [A1]X }"; var src2 = attribute + "enum E { [A2]X }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A1]X]@107 -> [[A2]X]@107"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "[A2]X", FeaturesResources.enum_value)); } [Fact] public void Enum_Member_Attribute_InsertDeleteAndUpdate() { var srcA1 = ""; var srcB1 = "enum N { A = 1 }"; var srcA2 = "enum N { [System.Obsolete]A = 1 }"; var srcB2 = ""; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("N.A")) }), DocumentResults() }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Enum_Rename() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Colors { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red = 1, Blue = 2, }]@0 -> [enum Colors { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "enum Colors", FeaturesResources.enum_)); } [Fact] public void Enum_BaseType_Add() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color : ushort { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red = 1, Blue = 2, }]@0 -> [enum Color : ushort { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.EnumUnderlyingTypeUpdate, "enum Color", FeaturesResources.enum_)); } [Fact] public void Enum_BaseType_Add_Unchanged() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color : int { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red = 1, Blue = 2, }]@0 -> [enum Color : int { Red = 1, Blue = 2, }]@0"); edits.VerifySemantics(); } [Fact] public void Enum_BaseType_Update() { var src1 = "enum Color : ushort { Red = 1, Blue = 2, }"; var src2 = "enum Color : long { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color : ushort { Red = 1, Blue = 2, }]@0 -> [enum Color : long { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.EnumUnderlyingTypeUpdate, "enum Color", FeaturesResources.enum_)); } [Fact] public void Enum_BaseType_Delete_Unchanged() { var src1 = "enum Color : int { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color : int { Red = 1, Blue = 2, }]@0 -> [enum Color { Red = 1, Blue = 2, }]@0"); edits.VerifySemantics(); } [Fact] public void Enum_BaseType_Delete_Changed() { var src1 = "enum Color : ushort { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color : ushort { Red = 1, Blue = 2, }]@0 -> [enum Color { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.EnumUnderlyingTypeUpdate, "enum Color", FeaturesResources.enum_)); } [Fact] public void EnumAccessibilityChange() { var src1 = "public enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public enum Color { Red = 1, Blue = 2, }]@0 -> [enum Color { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "enum Color", FeaturesResources.enum_)); } [Fact] public void EnumAccessibilityNoChange() { var src1 = "internal enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void EnumInitializerUpdate() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 3, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Blue = 2]@22 -> [Blue = 3]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Blue = 3", FeaturesResources.enum_value)); } [Fact] public void EnumInitializerUpdate2() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1 << 0, Blue = 2 << 1, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [Red = 1]@13 -> [Red = 1 << 0]@13", "Update [Blue = 2]@22 -> [Blue = 2 << 1]@27"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Blue = 2 << 1", FeaturesResources.enum_value)); } [Fact] public void EnumInitializerUpdate3() { var src1 = "enum Color { Red = int.MinValue }"; var src2 = "enum Color { Red = int.MaxValue }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [Red = int.MinValue]@13 -> [Red = int.MaxValue]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Red = int.MaxValue", FeaturesResources.enum_value)); } [Fact] public void EnumInitializerUpdate_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]enum Color { Red = 1 }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]enum Color { Red = 2 }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [Red = 1]@185 -> [Red = 2]@185"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("Color"))); } [Fact] public void EnumInitializerAdd() { var src1 = "enum Color { Red, }"; var src2 = "enum Color { Red = 1, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Red]@13 -> [Red = 1]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Red = 1", FeaturesResources.enum_value)); } [Fact] public void EnumInitializerDelete() { var src1 = "enum Color { Red = 1, }"; var src2 = "enum Color { Red, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Red = 1]@13 -> [Red]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Red", FeaturesResources.enum_value)); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916")] [Fact] public void EnumMemberAdd() { var src1 = "enum Color { Red }"; var src2 = "enum Color { Red, Blue}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red }]@0 -> [enum Color { Red, Blue}]@0", "Insert [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "Blue", FeaturesResources.enum_value)); } [Fact] public void EnumMemberAdd2() { var src1 = "enum Color { Red, }"; var src2 = "enum Color { Red, Blue}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "Blue", FeaturesResources.enum_value)); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916")] [Fact] public void EnumMemberAdd3() { var src1 = "enum Color { Red, }"; var src2 = "enum Color { Red, Blue,}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red, }]@0 -> [enum Color { Red, Blue,}]@0", "Insert [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "Blue", FeaturesResources.enum_value)); } [Fact] public void EnumMemberUpdate() { var src1 = "enum Color { Red }"; var src2 = "enum Color { Orange }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Red]@13 -> [Orange]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "Orange", FeaturesResources.enum_value)); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916")] [Fact] public void EnumMemberDelete() { var src1 = "enum Color { Red, Blue}"; var src2 = "enum Color { Red }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red, Blue}]@0 -> [enum Color { Red }]@0", "Delete [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "enum Color", DeletedSymbolDisplay(FeaturesResources.enum_value, "Blue"))); } [Fact] public void EnumMemberDelete2() { var src1 = "enum Color { Red, Blue}"; var src2 = "enum Color { Red, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "enum Color", DeletedSymbolDisplay(FeaturesResources.enum_value, "Blue"))); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916"), WorkItem(793197, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/793197")] [Fact] public void EnumTrailingCommaAdd() { var src1 = "enum Color { Red }"; var src2 = "enum Color { Red, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red }]@0 -> [enum Color { Red, }]@0"); edits.VerifySemantics(ActiveStatementsDescription.Empty, NoSemanticEdits); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916"), WorkItem(793197, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/793197")] [Fact] public void EnumTrailingCommaAdd_WithInitializer() { var src1 = "enum Color { Red = 1 }"; var src2 = "enum Color { Red = 1, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red = 1 }]@0 -> [enum Color { Red = 1, }]@0"); edits.VerifySemantics(ActiveStatementsDescription.Empty, NoSemanticEdits); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916"), WorkItem(793197, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/793197")] [Fact] public void EnumTrailingCommaDelete() { var src1 = "enum Color { Red, }"; var src2 = "enum Color { Red }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red, }]@0 -> [enum Color { Red }]@0"); edits.VerifySemantics(ActiveStatementsDescription.Empty, NoSemanticEdits); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916"), WorkItem(793197, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/793197")] [Fact] public void EnumTrailingCommaDelete_WithInitializer() { var src1 = "enum Color { Red = 1, }"; var src2 = "enum Color { Red = 1 }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red = 1, }]@0 -> [enum Color { Red = 1 }]@0"); edits.VerifySemantics(ActiveStatementsDescription.Empty, NoSemanticEdits); } #endregion #region Delegates [Fact] public void Delegates_NoModifiers_Insert() { var src1 = ""; var src2 = "delegate void D();"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { delegate void D(); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_NoModifiers_IntoType_Insert() { var src1 = "class C { }"; var src2 = "class C { delegate void D(); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_Public_IntoType_Insert() { var src1 = "class C { }"; var src2 = "class C { public delegate void D(); }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public delegate void D();]@10", "Insert [()]@32"); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_Generic_Insert() { var src1 = "class C { }"; var src2 = "class C { private delegate void D<T>(T a); }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [private delegate void D<T>(T a);]@10", "Insert [<T>]@33", "Insert [(T a)]@36", "Insert [T]@34", "Insert [T a]@37"); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_Delete() { var src1 = "class C { private delegate void D(); }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [private delegate void D();]@10", "Delete [()]@33"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.delegate_, "D"))); } [Fact] public void Delegates_Rename() { var src1 = "public delegate void D();"; var src2 = "public delegate void Z();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate void D();]@0 -> [public delegate void Z();]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "public delegate void Z()", FeaturesResources.delegate_)); } [Fact] public void Delegates_Accessibility_Update() { var src1 = "public delegate void D();"; var src2 = "private delegate void D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate void D();]@0 -> [private delegate void D();]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "private delegate void D()", FeaturesResources.delegate_)); } [Fact] public void Delegates_ReturnType_Update() { var src1 = "public delegate int D();"; var src2 = "public delegate void D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D();]@0 -> [public delegate void D();]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "public delegate void D()", FeaturesResources.delegate_)); } [Fact] public void Delegates_ReturnType_AddAttribute() { var attribute = "public class A : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "[return: A]public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D(int a);]@39 -> [[return: A]public delegate int D(int a);]@39"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.Invoke")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.BeginInvoke")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_Parameter_Insert() { var src1 = "public delegate int D();"; var src2 = "public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int a]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "int a", FeaturesResources.parameter)); } [Fact] public void Delegates_Parameter_Insert_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]public delegate int D();"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]internal delegate bool D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("D"))); } [Fact] public void Delegates_Parameter_Delete() { var src1 = "public delegate int D(int a);"; var src2 = "public delegate int D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [int a]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "public delegate int D()", DeletedSymbolDisplay(FeaturesResources.parameter, "int a"))); } [Fact] public void Delegates_Parameter_Rename() { var src1 = "public delegate int D(int a);"; var src2 = "public delegate int D(int b);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@22 -> [int b]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.RenamingNotSupportedByRuntime, "int b", FeaturesResources.parameter)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.Invoke")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.BeginInvoke")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_Parameter_Update() { var src1 = "public delegate int D(int a);"; var src2 = "public delegate int D(byte a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@22 -> [byte a]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "byte a", FeaturesResources.parameter)); } [Fact] public void Delegates_Parameter_AddAttribute_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "public delegate int D([A]int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@70 -> [[A]int a]@70"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Delegates_Parameter_AddAttribute() { var attribute = "public class A : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "public delegate int D([A]int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@61 -> [[A]int a]@61"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.Invoke")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.BeginInvoke")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_TypeParameter_Insert() { var src1 = "public delegate int D();"; var src2 = "public delegate int D<T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [<T>]@21", "Insert [T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "T", FeaturesResources.type_parameter)); } [Fact(Skip = "https://github.com/dotnet/roslyn/issues/54881")] [WorkItem(54881, "https://github.com/dotnet/roslyn/issues/54881")] public void Delegates_TypeParameter_Insert_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]public delegate int D<out T>();"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]internal delegate bool D<in T, out S>(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("D"))); } [Fact] public void Delegates_TypeParameter_Delete() { var src1 = "public delegate int D<T>();"; var src2 = "public delegate int D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [<T>]@21", "Delete [T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "public delegate int D()", DeletedSymbolDisplay(FeaturesResources.type_parameter, "T"))); } [Fact] public void Delegates_TypeParameter_Rename() { var src1 = "public delegate int D<T>();"; var src2 = "public delegate int D<S>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@22 -> [S]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "S", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "S")); } [Fact] public void Delegates_TypeParameter_Variance1() { var src1 = "public delegate int D<T>();"; var src2 = "public delegate int D<in T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@22 -> [in T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.VarianceUpdate, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void Delegates_TypeParameter_Variance2() { var src1 = "public delegate int D<out T>();"; var src2 = "public delegate int D<T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [out T]@22 -> [T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.VarianceUpdate, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void Delegates_TypeParameter_Variance3() { var src1 = "public delegate int D<out T>();"; var src2 = "public delegate int D<in T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [out T]@22 -> [in T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.VarianceUpdate, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void Delegates_TypeParameter_AddAttribute() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D<T>();"; var src2 = attribute + "public delegate int D<[A]T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@70 -> [[A]T]@70"); edits.VerifyRudeDiagnostics( EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void Delegates_Attribute_Add_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "[A]public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D(int a);]@48 -> [[A]public delegate int D(int a);]@48"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "public delegate int D(int a)", FeaturesResources.delegate_)); } [Fact] public void Delegates_Attribute_Add() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "[A]public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D(int a);]@48 -> [[A]public delegate int D(int a);]@48"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_Attribute_Add_WithReturnTypeAttribute() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "[return: A][A]public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D(int a);]@48 -> [[return: A][A]public delegate int D(int a);]@48"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.Invoke")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.BeginInvoke")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_ReadOnlyRef_Parameter_InsertWhole() { var src1 = ""; var src2 = "public delegate int D(in int b);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public delegate int D(in int b);]@0", "Insert [(in int b)]@21", "Insert [in int b]@22"); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_ReadOnlyRef_Parameter_InsertParameter() { var src1 = "public delegate int D();"; var src2 = "public delegate int D(in int b);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [in int b]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "in int b", FeaturesResources.parameter)); } [Fact] public void Delegates_ReadOnlyRef_Parameter_Update() { var src1 = "public delegate int D(int b);"; var src2 = "public delegate int D(in int b);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int b]@22 -> [in int b]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in int b", FeaturesResources.parameter)); } [Fact] public void Delegates_ReadOnlyRef_ReturnType_Insert() { var src1 = ""; var src2 = "public delegate ref readonly int D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public delegate ref readonly int D();]@0", "Insert [()]@34"); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_ReadOnlyRef_ReturnType_Update() { var src1 = "public delegate int D();"; var src2 = "public delegate ref readonly int D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D();]@0 -> [public delegate ref readonly int D();]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "public delegate ref readonly int D()", FeaturesResources.delegate_)); } #endregion #region Nested Types [Fact] public void NestedClass_ClassMove1() { var src1 = @"class C { class D { } }"; var src2 = @"class C { } class D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Move [class D { }]@10 -> @12"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "class D", FeaturesResources.class_)); } [Fact] public void NestedClass_ClassMove2() { var src1 = @"class C { class D { } class E { } class F { } }"; var src2 = @"class C { class D { } class F { } } class E { } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Move [class E { }]@23 -> @37"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "class E", FeaturesResources.class_)); } [Fact] public void NestedClass_ClassInsertMove1() { var src1 = @"class C { class D { } }"; var src2 = @"class C { class E { class D { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [class E { class D { } }]@10", "Move [class D { }]@10 -> @20"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "class D", FeaturesResources.class_)); } [Fact] public void NestedClass_Insert1() { var src1 = @"class C { }"; var src2 = @"class C { class D { class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [class D { class E { } }]@10", "Insert [class E { }]@20"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_Insert2() { var src1 = @"class C { }"; var src2 = @"class C { protected class D { public class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [protected class D { public class E { } }]@10", "Insert [public class E { }]@30"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_Insert3() { var src1 = @"class C { }"; var src2 = @"class C { private class D { public class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [private class D { public class E { } }]@10", "Insert [public class E { }]@28"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_Insert4() { var src1 = @"class C { }"; var src2 = @"class C { private class D { public D(int a, int b) { } public int P { get; set; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [private class D { public D(int a, int b) { } public int P { get; set; } }]@10", "Insert [public D(int a, int b) { }]@28", "Insert [public int P { get; set; }]@55", "Insert [(int a, int b)]@36", "Insert [{ get; set; }]@68", "Insert [int a]@37", "Insert [int b]@44", "Insert [get;]@70", "Insert [set;]@75"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_Insert_ReloadableIntoReloadable1() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { [CreateNewOnMetadataUpdate]class D { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void NestedClass_Insert_ReloadableIntoReloadable2() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { [CreateNewOnMetadataUpdate]class D { [CreateNewOnMetadataUpdate]class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void NestedClass_Insert_ReloadableIntoReloadable3() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { class D { [CreateNewOnMetadataUpdate]class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void NestedClass_Insert_ReloadableIntoReloadable4() { var src1 = ReloadableAttributeSrc + "class C { }"; var src2 = ReloadableAttributeSrc + "class C { [CreateNewOnMetadataUpdate]class D { [CreateNewOnMetadataUpdate]class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.D"))); } [Fact] public void NestedClass_Insert_Member_Reloadable() { var src1 = ReloadableAttributeSrc + "class C { [CreateNewOnMetadataUpdate]class D { } }"; var src2 = ReloadableAttributeSrc + "class C { [CreateNewOnMetadataUpdate]class D { int x; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C.D"))); } [Fact] public void NestedClass_InsertMemberWithInitializer1() { var src1 = @" class C { }"; var src2 = @" class C { private class D { public int P = 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.D"), preserveLocalVariables: false) }); } [WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] [Fact] public void NestedClass_Insert_PInvoke() { var src1 = @" using System; using System.Runtime.InteropServices; class C { }"; var src2 = @" using System; using System.Runtime.InteropServices; class C { abstract class D { public extern D(); public static extern int P { [DllImport(""msvcrt.dll"")]get; [DllImport(""msvcrt.dll"")]set; } [DllImport(""msvcrt.dll"")] public static extern int puts(string c); [DllImport(""msvcrt.dll"")] public static extern int operator +(D d, D g); [DllImport(""msvcrt.dll"")] public static extern explicit operator int (D d); } } "; var edits = GetTopEdits(src1, src2); // Adding P/Invoke is not supported by the CLR. edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertExtern, "public extern D()", FeaturesResources.constructor), Diagnostic(RudeEditKind.InsertExtern, "public static extern int P", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertExtern, "public static extern int puts(string c)", FeaturesResources.method), Diagnostic(RudeEditKind.InsertExtern, "public static extern int operator +(D d, D g)", FeaturesResources.operator_), Diagnostic(RudeEditKind.InsertExtern, "public static extern explicit operator int (D d)", CSharpFeaturesResources.conversion_operator)); } [WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] [Fact] public void NestedClass_Insert_VirtualAbstract() { var src1 = @" using System; using System.Runtime.InteropServices; class C { }"; var src2 = @" using System; using System.Runtime.InteropServices; class C { abstract class D { public abstract int P { get; } public abstract int this[int i] { get; } public abstract int puts(string c); public virtual event Action E { add { } remove { } } public virtual int Q { get { return 1; } } public virtual int this[string i] { get { return 1; } } public virtual int M(string c) { return 1; } } } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_TypeReorder1() { var src1 = @"class C { struct E { } class F { } delegate void D(); interface I {} }"; var src2 = @"class C { class F { } interface I {} delegate void D(); struct E { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [struct E { }]@10 -> @56", "Reorder [interface I {}]@54 -> @22"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_MethodDeleteInsert() { var src1 = @"public class C { public void goo() {} }"; var src2 = @"public class C { private class D { public void goo() {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [private class D { public void goo() {} }]@17", "Insert [public void goo() {}]@35", "Insert [()]@50", "Delete [public void goo() {}]@17", "Delete [()]@32"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "public class C", DeletedSymbolDisplay(FeaturesResources.method, "goo()"))); } [Fact] public void NestedClass_ClassDeleteInsert() { var src1 = @"public class C { public class X {} }"; var src2 = @"public class C { public class D { public class X {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public class D { public class X {} }]@17", "Move [public class X {}]@17 -> @34"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "public class X", FeaturesResources.class_)); } /// <summary> /// A new generic type can be added whether it's nested and inherits generic parameters from the containing type, or top-level. /// </summary> [Fact] public void NestedClassGeneric_Insert() { var src1 = @" using System; class C<T> { } "; var src2 = @" using System; class C<T> { class D {} struct S {} enum N {} interface I {} delegate void D(); } class D<T> { } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedEnum_InsertMember() { var src1 = "struct S { enum N { A = 1 } }"; var src2 = "struct S { enum N { A = 1, B = 2 } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum N { A = 1 }]@11 -> [enum N { A = 1, B = 2 }]@11", "Insert [B = 2]@27"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "B = 2", FeaturesResources.enum_value)); } [Fact, WorkItem(50876, "https://github.com/dotnet/roslyn/issues/50876")] public void NestedEnumInPartialType_InsertDelete() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { enum N { A = 1 } }"; var srcA2 = "partial struct S { enum N { A = 1 } }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults() }); } [Fact, WorkItem(50876, "https://github.com/dotnet/roslyn/issues/50876")] public void NestedEnumInPartialType_InsertDeleteAndUpdateMember() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { enum N { A = 1 } }"; var srcA2 = "partial struct S { enum N { A = 2 } }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "A = 2", FeaturesResources.enum_value), }), DocumentResults() }); } [Fact, WorkItem(50876, "https://github.com/dotnet/roslyn/issues/50876")] public void NestedEnumInPartialType_InsertDeleteAndUpdateBase() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { enum N : uint { A = 1 } }"; var srcA2 = "partial struct S { enum N : int { A = 1 } }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.EnumUnderlyingTypeUpdate, "enum N", FeaturesResources.enum_), }), DocumentResults() }); } [Fact, WorkItem(50876, "https://github.com/dotnet/roslyn/issues/50876")] public void NestedEnumInPartialType_InsertDeleteAndInsertMember() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { enum N { A = 1 } }"; var srcA2 = "partial struct S { enum N { A = 1, B = 2 } }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Insert, "B = 2", FeaturesResources.enum_value) }), DocumentResults() }); } [Fact] public void NestedDelegateInPartialType_InsertDelete() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { delegate void D(); }"; var srcA2 = "partial struct S { delegate void D(); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( // delegate does not have any user-defined method body and this does not need a PDB update semanticEdits: NoSemanticEdits), DocumentResults() }); } [Fact] public void NestedDelegateInPartialType_InsertDeleteAndChangeParameters() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { delegate void D(); }"; var srcA2 = "partial struct S { delegate void D(int x); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ChangingParameterTypes, "delegate void D(int x)", FeaturesResources.delegate_) }), DocumentResults() }); } [Fact] public void NestedDelegateInPartialType_InsertDeleteAndChangeReturnType() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { delegate ref int D(); }"; var srcA2 = "partial struct S { delegate ref readonly int D(); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.TypeUpdate, "delegate ref readonly int D()", FeaturesResources.delegate_) }), DocumentResults() }); } [Fact] public void NestedDelegateInPartialType_InsertDeleteAndChangeOptionalParameterValue() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { delegate void D(int x = 1); }"; var srcA2 = "partial struct S { delegate void D(int x = 2); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "int x = 2", FeaturesResources.parameter) }), DocumentResults() }); } [Fact] public void NestedPartialTypeInPartialType_InsertDeleteAndChange() { var srcA1 = "partial struct S { partial class C { void F1() {} } }"; var srcB1 = "partial struct S { partial class C { void F2(byte x) {} } }"; var srcC1 = "partial struct S { }"; var srcA2 = "partial struct S { partial class C { void F1() {} } }"; var srcB2 = "partial struct S { }"; var srcC2 = "partial struct S { partial class C { void F2(int x) {} } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial struct S", DeletedSymbolDisplay(FeaturesResources.method, "F2(byte x)")) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("S").GetMember<INamedTypeSymbol>("C").GetMember("F2")) }) }); } [Fact] public void Type_Partial_AddMultiple() { var srcA1 = ""; var srcB1 = ""; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C"), partialType: "C") }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C"), partialType: "C") }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Partial_InsertDeleteAndChange_Attribute() { var srcA1 = "partial class C { }"; var srcB1 = ""; var srcC1 = "partial class C { }"; var srcA2 = ""; var srcB2 = "[A]partial class C { }"; var srcC2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"), partialType: "C") }), DocumentResults(), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Partial_InsertDeleteAndChange_TypeParameterAttribute_NotSupportedByRuntime() { var srcA1 = "partial class C<T> { }"; var srcB1 = ""; var srcC1 = "partial class C<T> { }"; var srcA2 = ""; var srcB2 = "partial class C<[A]T> { }"; var srcC2 = "partial class C<T> { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "partial class C<[A]T>"), Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T") }), DocumentResults(), }); } [Fact] public void Type_Partial_InsertDeleteAndChange_Constraint() { var srcA1 = "partial class C<T> { }"; var srcB1 = ""; var srcC1 = "partial class C<T> { }"; var srcA2 = ""; var srcB2 = "partial class C<T> where T : new() { }"; var srcC2 = "partial class C<T> { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "partial class C<T>"), Diagnostic(RudeEditKind.ChangingConstraints, "where T : new()", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : new()") }), DocumentResults(), }); } [Fact] public void Type_Partial_InsertDeleteRefactor() { var srcA1 = "partial class C : I { void F() { } }"; var srcB1 = "[A][B]partial class C : J { void G() { } }"; var srcC1 = ""; var srcD1 = ""; var srcA2 = ""; var srcB2 = ""; var srcC2 = "[A]partial class C : I, J { void F() { } }"; var srcD2 = "[B]partial class C { void G() { } }"; var srcE = "interface I {} interface J {}"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2), GetTopEdits(srcD1, srcD2), GetTopEdits(srcE, srcE) }, new[] { DocumentResults(), DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("G")) }), DocumentResults(), }); } [Fact] public void Type_Partial_Attribute_AddMultiple() { var attributes = @" class A : System.Attribute {} class B : System.Attribute {} "; var srcA1 = "partial class C { }" + attributes; var srcB1 = "partial class C { }"; var srcA2 = "[A]partial class C { }" + attributes; var srcB2 = "[B]partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"), partialType: "C") }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"), partialType: "C") }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Partial_InsertDeleteRefactor_AttributeListSplitting() { var srcA1 = "partial class C { void F() { } }"; var srcB1 = "[A,B]partial class C { void G() { } }"; var srcC1 = ""; var srcD1 = ""; var srcA2 = ""; var srcB2 = ""; var srcC2 = "[A]partial class C { void F() { } }"; var srcD2 = "[B]partial class C { void G() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2), GetTopEdits(srcD1, srcD2) }, new[] { DocumentResults(), DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")) }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.G")) }), }); } [Fact] public void Type_Partial_InsertDeleteChangeMember() { var srcA1 = "partial class C { void F(int y = 1) { } }"; var srcB1 = "partial class C { void G(int x = 1) { } }"; var srcC1 = ""; var srcA2 = ""; var srcB2 = "partial class C { void G(int x = 2) { } }"; var srcC2 = "partial class C { void F(int y = 2) { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "int x = 2", FeaturesResources.parameter) }), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "int y = 2", FeaturesResources.parameter) }), }); } [Fact] public void NestedPartialTypeInPartialType_InsertDeleteAndInsertVirtual() { var srcA1 = "partial interface I { partial class C { virtual void F1() {} } }"; var srcB1 = "partial interface I { partial class C { virtual void F2() {} } }"; var srcC1 = "partial interface I { partial class C { } }"; var srcD1 = "partial interface I { partial class C { } }"; var srcE1 = "partial interface I { }"; var srcF1 = "partial interface I { }"; var srcA2 = "partial interface I { partial class C { } }"; var srcB2 = ""; var srcC2 = "partial interface I { partial class C { virtual void F1() {} } }"; // move existing virtual into existing partial decl var srcD2 = "partial interface I { partial class C { virtual void N1() {} } }"; // insert new virtual into existing partial decl var srcE2 = "partial interface I { partial class C { virtual void F2() {} } }"; // move existing virtual into a new partial decl var srcF2 = "partial interface I { partial class C { virtual void N2() {} } }"; // insert new virtual into new partial decl EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2), GetTopEdits(srcD1, srcD2), GetTopEdits(srcE1, srcE2), GetTopEdits(srcF1, srcF2) }, new[] { // A DocumentResults(), // B DocumentResults(), // C DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember<INamedTypeSymbol>("C").GetMember("F1")) }), // D DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InsertVirtual, "virtual void N1()", FeaturesResources.method) }), // E DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember<INamedTypeSymbol>("C").GetMember("F2")) }), // F DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InsertVirtual, "virtual void N2()", FeaturesResources.method) }), }); } #endregion #region Namespaces [Fact] public void Namespace_Insert() { var src1 = @""; var src2 = @"namespace C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [namespace C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "namespace C", FeaturesResources.namespace_)); } [Fact] public void Namespace_InsertNested() { var src1 = @"namespace C { }"; var src2 = @"namespace C { namespace D { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [namespace D { }]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "namespace D", FeaturesResources.namespace_)); } [Fact] public void Namespace_DeleteNested() { var src1 = @"namespace C { namespace D { } }"; var src2 = @"namespace C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [namespace D { }]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "namespace C", FeaturesResources.namespace_)); } [Fact] public void Namespace_Move() { var src1 = @"namespace C { namespace D { } }"; var src2 = @"namespace C { } namespace D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Move [namespace D { }]@14 -> @16"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "namespace D", FeaturesResources.namespace_)); } [Fact] public void Namespace_Reorder1() { var src1 = @"namespace C { namespace D { } class T { } namespace E { } }"; var src2 = @"namespace C { namespace E { } class T { } namespace D { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [class T { }]@30 -> @30", "Reorder [namespace E { }]@42 -> @14"); edits.VerifyRudeDiagnostics(); } [Fact] public void Namespace_Reorder2() { var src1 = @"namespace C { namespace D1 { } namespace D2 { } namespace D3 { } class T { } namespace E { } }"; var src2 = @"namespace C { namespace E { } class T { } namespace D1 { } namespace D2 { } namespace D3 { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [class T { }]@65 -> @65", "Reorder [namespace E { }]@77 -> @14"); edits.VerifyRudeDiagnostics(); } [Fact] public void Namespace_FileScoped_Insert() { var src1 = @""; var src2 = @"namespace C;"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [namespace C;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "namespace C", FeaturesResources.namespace_)); } [Fact] public void Namespace_FileScoped_Delete() { var src1 = @"namespace C;"; var src2 = @""; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [namespace C;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, null, FeaturesResources.namespace_)); } #endregion #region Members [Fact] public void PartialMember_DeleteInsert_SingleDocument() { var src1 = @" using System; partial class C { void M() {} int P1 { get; set; } int P2 { get => 1; set {} } int this[int i] { get => 1; set {} } int this[byte i] { get => 1; set {} } event Action E { add {} remove {} } event Action EF; int F1; int F2; } partial class C { } "; var src2 = @" using System; partial class C { } partial class C { void M() {} int P1 { get; set; } int P2 { get => 1; set {} } int this[int i] { get => 1; set {} } int this[byte i] { get => 1; set {} } event Action E { add {} remove {} } event Action EF; int F1, F2; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [void M() {}]@68", "Insert [int P1 { get; set; }]@85", "Insert [int P2 { get => 1; set {} }]@111", "Insert [int this[int i] { get => 1; set {} }]@144", "Insert [int this[byte i] { get => 1; set {} }]@186", "Insert [event Action E { add {} remove {} }]@229", "Insert [event Action EF;]@270", "Insert [int F1, F2;]@292", "Insert [()]@74", "Insert [{ get; set; }]@92", "Insert [{ get => 1; set {} }]@118", "Insert [[int i]]@152", "Insert [{ get => 1; set {} }]@160", "Insert [[byte i]]@194", "Insert [{ get => 1; set {} }]@203", "Insert [{ add {} remove {} }]@244", "Insert [Action EF]@276", "Insert [int F1, F2]@292", "Insert [get;]@94", "Insert [set;]@99", "Insert [get => 1;]@120", "Insert [set {}]@130", "Insert [int i]@153", "Insert [get => 1;]@162", "Insert [set {}]@172", "Insert [byte i]@195", "Insert [get => 1;]@205", "Insert [set {}]@215", "Insert [add {}]@246", "Insert [remove {}]@253", "Insert [EF]@283", "Insert [F1]@296", "Insert [F2]@300", "Delete [void M() {}]@43", "Delete [()]@49", "Delete [int P1 { get; set; }]@60", "Delete [{ get; set; }]@67", "Delete [get;]@69", "Delete [set;]@74", "Delete [int P2 { get => 1; set {} }]@86", "Delete [{ get => 1; set {} }]@93", "Delete [get => 1;]@95", "Delete [set {}]@105", "Delete [int this[int i] { get => 1; set {} }]@119", "Delete [[int i]]@127", "Delete [int i]@128", "Delete [{ get => 1; set {} }]@135", "Delete [get => 1;]@137", "Delete [set {}]@147", "Delete [int this[byte i] { get => 1; set {} }]@161", "Delete [[byte i]]@169", "Delete [byte i]@170", "Delete [{ get => 1; set {} }]@178", "Delete [get => 1;]@180", "Delete [set {}]@190", "Delete [event Action E { add {} remove {} }]@204", "Delete [{ add {} remove {} }]@219", "Delete [add {}]@221", "Delete [remove {}]@228", "Delete [event Action EF;]@245", "Delete [Action EF]@251", "Delete [EF]@258", "Delete [int F1;]@267", "Delete [int F1]@267", "Delete [F1]@271", "Delete [int F2;]@280", "Delete [int F2]@280", "Delete [F2]@284"); EditAndContinueValidation.VerifySemantics( new[] { edits }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P1").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P1").SetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P2").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P2").SetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Int32").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Int32").SetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Byte").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Byte").SetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").AddMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").RemoveMethod, preserveLocalVariables: false), }) }); } [Fact] public void PartialMember_InsertDelete_MultipleDocuments() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { void F() {} }"; var srcA2 = "partial class C { void F() {} }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F"), preserveLocalVariables: false) }), DocumentResults() }); } [Fact] public void PartialMember_DeleteInsert_MultipleDocuments() { var srcA1 = "partial class C { void F() {} }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { void F() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"), preserveLocalVariables: false) }) }); } [Fact] public void PartialMember_DeleteInsert_GenericMethod() { var srcA1 = "partial class C { void F<T>() {} }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { void F<T>() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.GenericMethodUpdate, "void F<T>()"), Diagnostic(RudeEditKind.GenericMethodUpdate, "T") }) }); } [Fact] public void PartialMember_DeleteInsert_GenericType() { var srcA1 = "partial class C<T> { void F() {} }"; var srcB1 = "partial class C<T> { }"; var srcA2 = "partial class C<T> { }"; var srcB2 = "partial class C<T> { void F() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "void F()") }) }); } [Fact] public void PartialMember_DeleteInsert_Destructor() { var srcA1 = "partial class C { ~C() {} }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { ~C() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("Finalize"), preserveLocalVariables: false), }) }); } [Fact] public void PartialNestedType_InsertDeleteAndChange() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { class D { void M() {} } interface I { } }"; var srcA2 = "partial class C { class D : I { void M() {} } interface I { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class D", FeaturesResources.class_), }), DocumentResults() }); } [Fact, WorkItem(51011, "https://github.com/dotnet/roslyn/issues/51011")] public void PartialMember_RenameInsertDelete() { // The syntactic analysis for A and B produce rename edits since it doesn't see that the member was in fact moved. // TODO: Currently, we don't even pass rename edits to semantic analysis where we could handle them as updates. var srcA1 = "partial class C { void F1() {} }"; var srcB1 = "partial class C { void F2() {} }"; var srcA2 = "partial class C { void F2() {} }"; var srcB2 = "partial class C { void F1() {} }"; // current outcome: GetTopEdits(srcA1, srcA2).VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Renamed, "void F2()", FeaturesResources.method)); GetTopEdits(srcB1, srcB2).VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Renamed, "void F1()", FeaturesResources.method)); // correct outcome: //EditAndContinueValidation.VerifySemantics( // new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, // new[] // { // DocumentResults(semanticEdits: new[] // { // SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F2")), // }), // DocumentResults( // semanticEdits: new[] // { // SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F1")), // }) // }); } [Fact] public void PartialMember_DeleteInsert_UpdateMethodBodyError() { var srcA1 = @" using System.Collections.Generic; partial class C { IEnumerable<int> F() { yield return 1; } } "; var srcB1 = @" using System.Collections.Generic; partial class C { } "; var srcA2 = @" using System.Collections.Generic; partial class C { } "; var srcB2 = @" using System.Collections.Generic; partial class C { IEnumerable<int> F() { yield return 1; yield return 2; } } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.Insert, "yield return 2;", CSharpFeaturesResources.yield_return_statement) }) }); } [Fact] public void PartialMember_DeleteInsert_UpdatePropertyAccessors() { var srcA1 = "partial class C { int P { get => 1; set { Console.WriteLine(1); } } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int P { get => 2; set { Console.WriteLine(2); } } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) }) }); } [Fact] public void PartialMember_DeleteInsert_UpdateAutoProperty() { var srcA1 = "partial class C { int P => 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int P => 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod) }) }); } [Fact] public void PartialMember_DeleteInsert_AddFieldInitializer() { var srcA1 = "partial class C { int f; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int f = 1; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void PartialMember_DeleteInsert_RemoveFieldInitializer() { var srcA1 = "partial class C { int f = 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int f; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void PartialMember_DeleteInsert_ConstructorWithInitializers() { var srcA1 = "partial class C { int f = 1; C(int x) { f = x; } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { int f = 1; }"; var srcB2 = "partial class C { C(int x) { f = x + 1; } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void PartialMember_DeleteInsert_MethodAddParameter() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { void F() {} }"; var srcA2 = "partial struct S { void F(int x) {} }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.F")) }), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial struct S", DeletedSymbolDisplay(FeaturesResources.method, "F()")) }) }); } [Fact] public void PartialMember_DeleteInsert_UpdateMethodParameterType() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { void F(int x); }"; var srcA2 = "partial struct S { void F(byte x); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.F")) }), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial struct S", DeletedSymbolDisplay(FeaturesResources.method, "F(int x)")) }) }); } [Fact] public void PartialMember_DeleteInsert_MethodAddTypeParameter() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { void F(); }"; var srcA2 = "partial struct S { void F<T>(); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InsertGenericMethod, "void F<T>()", FeaturesResources.method) }), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial struct S", DeletedSymbolDisplay(FeaturesResources.method, "F()")) }) }); } #endregion #region Methods [Theory] [InlineData("static")] [InlineData("virtual")] [InlineData("abstract")] [InlineData("override")] [InlineData("sealed override", "override")] public void Method_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "int F() => 0; }"; var src2 = "class C { " + newModifiers + "int F() => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "int F() => 0;]@10 -> [" + newModifiers + "int F() => 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "int F()", FeaturesResources.method)); } [Fact] public void Method_NewModifier_Add() { var src1 = "class C { int F() => 0; }"; var src2 = "class C { new int F() => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [int F() => 0;]@10 -> [new int F() => 0;]@10"); // Currently, an edit is produced eventhough there is no metadata/IL change. Consider improving. edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"))); } [Fact] public void Method_NewModifier_Remove() { var src1 = "class C { new int F() => 0; }"; var src2 = "class C { int F() => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [new int F() => 0;]@10 -> [int F() => 0;]@10"); // Currently, an edit is produced eventhough there is no metadata/IL change. Consider improving. edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"))); } [Fact] public void Method_ReadOnlyModifier_Add_InMutableStruct() { var src1 = @" struct S { public int M() => 1; }"; var src2 = @" struct S { public readonly int M() => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public readonly int M()", FeaturesResources.method)); } [Fact] public void Method_ReadOnlyModifier_Add_InReadOnlyStruct1() { var src1 = @" readonly struct S { public int M() => 1; }"; var src2 = @" readonly struct S { public readonly int M() => 1; }"; var edits = GetTopEdits(src1, src2); // Currently, an edit is produced eventhough the body nor IsReadOnly attribute have changed. Consider improving. edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IMethodSymbol>("M"))); } [Fact] public void Method_ReadOnlyModifier_Add_InReadOnlyStruct2() { var src1 = @" readonly struct S { public int M() => 1; }"; var src2 = @" struct S { public readonly int M() => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "struct S", "struct")); } [Fact] public void Method_AsyncModifier_Remove() { var src1 = @" class Test { public async Task<int> WaitAsync() { return 1; } }"; var src2 = @" class Test { public Task<int> WaitAsync() { return Task.FromResult(1); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingFromAsynchronousToSynchronous, "public Task<int> WaitAsync()", FeaturesResources.method)); } [Fact] public void Method_AsyncModifier_Add() { var src1 = @" class Test { public Task<int> WaitAsync() { return 1; } }"; var src2 = @" class Test { public async Task<int> WaitAsync() { await Task.Delay(1000); return 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: false); } [Fact] public void Method_AsyncModifier_Add_NotSupported() { var src1 = @" class Test { public Task<int> WaitAsync() { return 1; } }"; var src2 = @" class Test { public async Task<int> WaitAsync() { await Task.Delay(1000); return 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.MakeMethodAsync, "public async Task<int> WaitAsync()")); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Method_ReturnType_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C { " + oldType + " M() => default; }"; var src2 = "class C { " + newType + " M() => default; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Method_ReturnType_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C { " + oldType + " M() => default; }"; var src2 = "class C { " + newType + " M() => default; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, newType + " M()", FeaturesResources.method)); } [Fact] public void Method_Update() { var src1 = @" class C { static void Main(string[] args) { int a = 1; int b = 2; System.Console.WriteLine(a + b); } } "; var src2 = @" class C { static void Main(string[] args) { int b = 2; int a = 1; System.Console.WriteLine(a + b); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Update [static void Main(string[] args) { int a = 1; int b = 2; System.Console.WriteLine(a + b); }]@18 -> [static void Main(string[] args) { int b = 2; int a = 1; System.Console.WriteLine(a + b); }]@18"); edits.VerifyRudeDiagnostics(); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Main"), preserveLocalVariables: false) }); } [Fact] public void MethodWithExpressionBody_Update() { var src1 = @" class C { static int Main(string[] args) => F(1); static int F(int a) => 1; } "; var src2 = @" class C { static int Main(string[] args) => F(2); static int F(int a) => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Update [static int Main(string[] args) => F(1);]@18 -> [static int Main(string[] args) => F(2);]@18"); edits.VerifyRudeDiagnostics(); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Main"), preserveLocalVariables: false) }); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void MethodWithExpressionBody_Update_LiftedParameter() { var src1 = @" using System; class C { int M(int a) => new Func<int>(() => a + 1)(); } "; var src2 = @" using System; class C { int M(int a) => new Func<int>(() => 2)(); // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int M(int a) => new Func<int>(() => a + 1)();]@35 -> [int M(int a) => new Func<int>(() => 2)();]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact] public void MethodWithExpressionBody_ToBlockBody() { var src1 = "class C { static int F(int a) => 1; }"; var src2 = "class C { static int F(int a) { return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [static int F(int a) => 1;]@10 -> [static int F(int a) { return 2; }]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: false) }); } [Fact] public void MethodWithBlockBody_ToExpressionBody() { var src1 = "class C { static int F(int a) { return 2; } }"; var src2 = "class C { static int F(int a) => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [static int F(int a) { return 2; }]@10 -> [static int F(int a) => 1;]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: false) }); } [Fact] public void MethodWithLambda_Update() { var src1 = @" using System; class C { static void F() { Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; } } "; var src2 = @" using System; class C { static void F() { Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(1); } }"; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), syntaxMap[0]) }); } [Fact] public void MethodUpdate_LocalVariableDeclaration() { var src1 = @" class C { static void Main(string[] args) { int x = 1; Console.WriteLine(x); } } "; var src2 = @" class C { static void Main(string[] args) { int x = 2; Console.WriteLine(x); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Update [static void Main(string[] args) { int x = 1; Console.WriteLine(x); }]@18 -> [static void Main(string[] args) { int x = 2; Console.WriteLine(x); }]@18"); } [Fact] public void Method_Delete() { var src1 = @" class C { void goo() { } } "; var src2 = @" class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [void goo() { }]@18", "Delete [()]@26"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.method, "goo()"))); } [Fact] public void MethodWithExpressionBody_Delete() { var src1 = @" class C { int goo() => 1; } "; var src2 = @" class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [int goo() => 1;]@18", "Delete [()]@25"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.method, "goo()"))); } [WorkItem(754853, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754853")] [Fact] public void MethodDelete_WithParameterAndAttribute() { var src1 = @" class C { [Obsolete] void goo(int a) { } } "; var src2 = @" class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Delete [[Obsolete] void goo(int a) { }]@18", "Delete [(int a)]@42", "Delete [int a]@43"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.method, "goo(int a)"))); } [WorkItem(754853, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754853")] [Fact] public void MethodDelete_PInvoke() { var src1 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] public static extern int puts(string c); } "; var src2 = @" using System; using System.Runtime.InteropServices; class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Delete [[DllImport(""msvcrt.dll"")] public static extern int puts(string c);]@74", "Delete [(string c)]@134", "Delete [string c]@135"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.method, "puts(string c)"))); } [Fact] public void MethodInsert_NotSupportedByRuntime() { var src1 = "class C { }"; var src2 = "class C { void goo() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "void goo()", FeaturesResources.method)); } [Fact] public void PrivateMethodInsert() { var src1 = @" class C { static void Main(string[] args) { Console.ReadLine(); } }"; var src2 = @" class C { void goo() { } static void Main(string[] args) { Console.ReadLine(); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [void goo() { }]@18", "Insert [()]@26"); edits.VerifyRudeDiagnostics(); } [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784")] [Fact] public void PrivateMethodInsert_WithParameters() { var src1 = @" using System; class C { static void Main(string[] args) { Console.ReadLine(); } }"; var src2 = @" using System; class C { void goo(int a) { } static void Main(string[] args) { Console.ReadLine(); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [void goo(int a) { }]@35", "Insert [(int a)]@43", "Insert [int a]@44"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.goo")) }); } [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784")] [Fact] public void PrivateMethodInsert_WithAttribute() { var src1 = @" class C { static void Main(string[] args) { Console.ReadLine(); } }"; var src2 = @" class C { [System.Obsolete] void goo(int a) { } static void Main(string[] args) { Console.ReadLine(); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Insert [[System.Obsolete] void goo(int a) { }]@18", "Insert [(int a)]@49", "Insert [int a]@50"); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodInsert_Virtual() { var src1 = @" class C { }"; var src2 = @" class C { public virtual void F() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertVirtual, "public virtual void F()", FeaturesResources.method)); } [Fact] public void MethodInsert_Abstract() { var src1 = @" abstract class C { }"; var src2 = @" abstract class C { public abstract void F(); } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertVirtual, "public abstract void F()", FeaturesResources.method)); } [Fact] public void MethodInsert_Override() { var src1 = @" class C { }"; var src2 = @" class C { public override void F() { } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertVirtual, "public override void F()", FeaturesResources.method)); } [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784"), WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] [Fact] public void ExternMethodInsert() { var src1 = @" using System; using System.Runtime.InteropServices; class C { }"; var src2 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] private static extern int puts(string c); } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Insert [[DllImport(""msvcrt.dll"")] private static extern int puts(string c);]@74", "Insert [(string c)]@135", "Insert [string c]@136"); // CLR doesn't support methods without a body edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertExtern, "private static extern int puts(string c)", FeaturesResources.method)); } [Fact] [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784"), WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] public void ExternMethodDeleteInsert() { var srcA1 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] private static extern int puts(string c); }"; var srcA2 = @" using System; using System.Runtime.InteropServices; "; var srcB1 = @" using System; using System.Runtime.InteropServices; "; var srcB2 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] private static extern int puts(string c); } "; // TODO: The method does not need to be updated since there are no sequence points generated for it. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.puts")), }) }); } [Fact] [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784"), WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] public void ExternMethod_Attribute_DeleteInsert() { var srcA1 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] private static extern int puts(string c); }"; var srcA2 = @" using System; using System.Runtime.InteropServices; "; var srcB1 = @" using System; using System.Runtime.InteropServices; "; var srcB2 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] [Obsolete] private static extern int puts(string c); } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.puts")), }) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void MethodReorder1() { var src1 = "class C { void f(int a, int b) { a = b; } void g() { } }"; var src2 = "class C { void g() { } void f(int a, int b) { a = b; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Reorder [void g() { }]@42 -> @10"); } [Fact] public void MethodInsertDelete1() { var src1 = "class C { class D { } void f(int a, int b) { a = b; } }"; var src2 = "class C { class D { void f(int a, int b) { a = b; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [void f(int a, int b) { a = b; }]@20", "Insert [(int a, int b)]@26", "Insert [int a]@27", "Insert [int b]@34", "Delete [void f(int a, int b) { a = b; }]@22", "Delete [(int a, int b)]@28", "Delete [int a]@29", "Delete [int b]@36"); } [Fact] public void MethodUpdate_AddParameter() { var src1 = @" class C { static void Main() { } }"; var src2 = @" class C { static void Main(string[] args) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [string[] args]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "string[] args", FeaturesResources.parameter)); } [Fact] public void MethodUpdate_UpdateParameter() { var src1 = @" class C { static void Main(string[] args) { } }"; var src2 = @" class C { static void Main(string[] b) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [string[] args]@35 -> [string[] b]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.RenamingNotSupportedByRuntime, "string[] b", FeaturesResources.parameter)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Main")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void MethodUpdate_UpdateParameterAndBody() { var src1 = @" class C { static void Main(string[] args) { } }"; var src2 = @" class C { static void Main(string[] b) { System.Console.Write(1); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.RenamingNotSupportedByRuntime, "string[] b", FeaturesResources.parameter)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Main")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Method_Name_Update() { var src1 = @" class C { static void Main(string[] args) { } }"; var src2 = @" class C { static void EntryPoint(string[] args) { } }"; var edits = GetTopEdits(src1, src2); var expectedEdit = @"Update [static void Main(string[] args) { }]@18 -> [static void EntryPoint(string[] args) { }]@18"; edits.VerifyEdits(expectedEdit); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "static void EntryPoint(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AsyncMethod0() { var src1 = @" class Test { public async Task<int> WaitAsync() { await Task.Delay(1000); return 1; } }"; var src2 = @" class Test { public async Task<int> WaitAsync() { await Task.Delay(500); return 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: true); } [Fact] public void MethodUpdate_AsyncMethod1() { var src1 = @" class Test { static void Main(string[] args) { Test f = new Test(); string result = f.WaitAsync().Result; } public async Task<string> WaitAsync() { await Task.Delay(1000); return ""Done""; } }"; var src2 = @" class Test { static void Main(string[] args) { Test f = new Test(); string result = f.WaitAsync().Result; } public async Task<string> WaitAsync() { await Task.Delay(1000); return ""Not Done""; } }"; var edits = GetTopEdits(src1, src2); var expectedEdit = @"Update [public async Task<string> WaitAsync() { await Task.Delay(1000); return ""Done""; }]@151 -> [public async Task<string> WaitAsync() { await Task.Delay(1000); return ""Not Done""; }]@151"; edits.VerifyEdits(expectedEdit); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_AddReturnTypeAttribute() { var src1 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [return: Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [static void Main(string[] args) { System.Console.Write(5); }]@38 -> [[return: Obsolete] static void Main(string[] args) { System.Console.Write(5); }]@38"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AddAttribute() { var src1 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [static void Main(string[] args) { System.Console.Write(5); }]@38 -> [[Obsolete] static void Main(string[] args) { System.Console.Write(5); }]@38"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AddAttribute_SupportedByRuntime() { var src1 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [static void Main(string[] args) { System.Console.Write(5); }]@38 -> [[Obsolete] static void Main(string[] args) { System.Console.Write(5); }]@38"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Test.Main")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void MethodUpdate_Attribute_ArrayParameter() { var src1 = @" class AAttribute : System.Attribute { public AAttribute(int[] nums) { } } class C { [A(new int[] { 1, 2, 3})] void M() { } }"; var src2 = @" class AAttribute : System.Attribute { public AAttribute(int[] nums) { } } class C { [A(new int[] { 4, 5, 6})] void M() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void MethodUpdate_Attribute_ArrayParameter_NoChange() { var src1 = @" class AAttribute : System.Attribute { public AAttribute(int[] nums) { } } class C { [A(new int[] { 1, 2, 3})] void M() { var x = 1; } }"; var src2 = @" class AAttribute : System.Attribute { public AAttribute(int[] nums) { } } class C { [A(new int[] { 1, 2, 3})] void M() { var x = 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M")) }); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_AddAttribute2() { var src1 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete, STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AddAttribute3() { var src1 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] [STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AddAttribute4() { var src1 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete, STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_UpdateAttribute() { var src1 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete("""")] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [WorkItem(754853, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754853")] [Fact] public void MethodUpdate_DeleteAttribute() { var src1 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_DeleteAttribute2() { var src1 = @" using System; class Test { [Obsolete, STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_DeleteAttribute3() { var src1 = @" using System; class Test { [Obsolete] [STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_ExplicitlyImplemented1() { var src1 = @" class C : I, J { void I.Goo() { Console.WriteLine(2); } void J.Goo() { Console.WriteLine(1); } }"; var src2 = @" class C : I, J { void I.Goo() { Console.WriteLine(1); } void J.Goo() { Console.WriteLine(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [void I.Goo() { Console.WriteLine(2); }]@25 -> [void I.Goo() { Console.WriteLine(1); }]@25", "Update [void J.Goo() { Console.WriteLine(1); }]@69 -> [void J.Goo() { Console.WriteLine(2); }]@69"); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_ExplicitlyImplemented2() { var src1 = @" class C : I, J { void I.Goo() { Console.WriteLine(1); } void J.Goo() { Console.WriteLine(2); } }"; var src2 = @" class C : I, J { void Goo() { Console.WriteLine(1); } void J.Goo() { Console.WriteLine(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [void I.Goo() { Console.WriteLine(1); }]@25 -> [void Goo() { Console.WriteLine(1); }]@25"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "void Goo()", FeaturesResources.method)); } [WorkItem(754255, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754255")] [Fact] public void MethodUpdate_UpdateStackAlloc() { var src1 = @" class C { static void Main(string[] args) { int i = 10; unsafe { int* px2 = &i; } } }"; var src2 = @" class C { static void Main(string[] args) { int i = 10; unsafe { char* buffer = stackalloc char[16]; int* px2 = &i; } } }"; var expectedEdit = @"Update [static void Main(string[] args) { int i = 10; unsafe { int* px2 = &i; } }]@18 -> [static void Main(string[] args) { int i = 10; unsafe { char* buffer = stackalloc char[16]; int* px2 = &i; } }]@18"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(expectedEdit); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.method)); } [Theory] [InlineData("stackalloc int[3]")] [InlineData("stackalloc int[3] { 1, 2, 3 }")] [InlineData("stackalloc int[] { 1, 2, 3 }")] [InlineData("stackalloc[] { 1, 2, 3 }")] public void MethodUpdate_UpdateStackAlloc2(string stackallocDecl) { var src1 = @"unsafe class C { static int F() { var x = " + stackallocDecl + "; return 1; } }"; var src2 = @"unsafe class C { static int F() { var x = " + stackallocDecl + "; return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.method)); } [Fact] public void MethodUpdate_UpdateStackAllocInLambda1() { var src1 = "unsafe class C { void M() { F(1, () => { int* a = stackalloc int[10]; }); } }"; var src2 = "unsafe class C { void M() { F(2, () => { int* a = stackalloc int[10]; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_UpdateStackAllocInLambda2() { var src1 = "unsafe class C { void M() { F(1, x => { int* a = stackalloc int[10]; }); } }"; var src2 = "unsafe class C { void M() { F(2, x => { int* a = stackalloc int[10]; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_UpdateStackAllocInAnonymousMethod() { var src1 = "unsafe class C { void M() { F(1, delegate(int x) { int* a = stackalloc int[10]; }); } }"; var src2 = "unsafe class C { void M() { F(2, delegate(int x) { int* a = stackalloc int[10]; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_UpdateStackAllocInLocalFunction() { var src1 = "class C { void M() { unsafe void f(int x) { int* a = stackalloc int[10]; } f(1); } }"; var src2 = "class C { void M() { unsafe void f(int x) { int* a = stackalloc int[10]; } f(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInLambda1() { var src1 = "class C { void M() { F(1, a => a switch { 0 => 0, _ => 2 }); } }"; var src2 = "class C { void M() { F(2, a => a switch { 0 => 0, _ => 2 }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInLambda2() { var src1 = "class C { void M() { F(1, a => a switch { 0 => 0, _ => 2 }); } }"; var src2 = "class C { void M() { F(2, a => a switch { 0 => 0, _ => 2 }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInAnonymousMethod() { var src1 = "class C { void M() { F(1, delegate(int a) { return a switch { 0 => 0, _ => 2 }; }); } }"; var src2 = "class C { void M() { F(2, delegate(int a) { return a switch { 0 => 0, _ => 2 }; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInLocalFunction() { var src1 = "class C { void M() { int f(int a) => a switch { 0 => 0, _ => 2 }; f(1); } }"; var src2 = "class C { void M() { int f(int a) => a switch { 0 => 0, _ => 2 }; f(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInQuery() { var src1 = "class C { void M() { var x = from z in new[] { 1, 2, 3 } where z switch { 0 => true, _ => false } select z + 1; } }"; var src2 = "class C { void M() { var x = from z in new[] { 1, 2, 3 } where z switch { 0 => true, _ => false } select z + 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_UpdateAnonymousMethod() { var src1 = "class C { void M() { F(1, delegate(int a) { return a; }); } }"; var src2 = "class C { void M() { F(2, delegate(int a) { return a; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodWithExpressionBody_Update_UpdateAnonymousMethod() { var src1 = "class C { void M() => F(1, delegate(int a) { return a; }); }"; var src2 = "class C { void M() => F(2, delegate(int a) { return a; }); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_Query() { var src1 = "class C { void M() { F(1, from goo in bar select baz); } }"; var src2 = "class C { void M() { F(2, from goo in bar select baz); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodWithExpressionBody_Update_Query() { var src1 = "class C { void M() => F(1, from goo in bar select baz); }"; var src2 = "class C { void M() => F(2, from goo in bar select baz); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_AnonymousType() { var src1 = "class C { void M() { F(1, new { A = 1, B = 2 }); } }"; var src2 = "class C { void M() { F(2, new { A = 1, B = 2 }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodWithExpressionBody_Update_AnonymousType() { var src1 = "class C { void M() => F(new { A = 1, B = 2 }); }"; var src2 = "class C { void M() => F(new { A = 10, B = 20 }); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_Iterator_YieldReturn() { var src1 = "class C { IEnumerable<int> M() { yield return 1; } }"; var src2 = "class C { IEnumerable<int> M() { yield return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: true); } [Fact] public void MethodUpdate_AddYieldReturn() { var src1 = "class C { IEnumerable<int> M() { return new[] { 1, 2, 3}; } }"; var src2 = "class C { IEnumerable<int> M() { yield return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: false); } [Fact] public void MethodUpdate_AddYieldReturn_NotSupported() { var src1 = "class C { IEnumerable<int> M() { return new[] { 1, 2, 3}; } }"; var src2 = "class C { IEnumerable<int> M() { yield return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.MakeMethodIterator, "IEnumerable<int> M()")); } [Fact] public void MethodUpdate_Iterator_YieldBreak() { var src1 = "class C { IEnumerable<int> M() { F(); yield break; } }"; var src2 = "class C { IEnumerable<int> M() { G(); yield break; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: true); } [WorkItem(1087305, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1087305")] [Fact] public void MethodUpdate_LabeledStatement() { var src1 = @" class C { static void Main(string[] args) { goto Label1; Label1: { Console.WriteLine(1); } } }"; var src2 = @" class C { static void Main(string[] args) { goto Label1; Label1: { Console.WriteLine(2); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_LocalFunctionsParameterRefnessInBody() { var src1 = @"class C { public void M(int a) { void f(ref int b) => b = 1; } }"; var src2 = @"class C { public void M(int a) { void f(out int b) => b = 1; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public void M(int a) { void f(ref int b) => b = 1; }]@10 -> [public void M(int a) { void f(out int b) => b = 1; }]@10"); } [Fact] public void MethodUpdate_LambdaParameterRefnessInBody() { var src1 = @"class C { public void M(int a) { f((ref int b) => b = 1); } }"; var src2 = @"class C { public void M(int a) { f((out int b) => b = 1); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public void M(int a) { f((ref int b) => b = 1); }]@10 -> [public void M(int a) { f((out int b) => b = 1); }]@10"); } [Fact] public void Method_ReadOnlyRef_Parameter_InsertWhole() { var src1 = "class Test { }"; var src2 = "class Test { int M(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int M(in int b) => throw null;]@13", "Insert [(in int b)]@18", "Insert [in int b]@19"); edits.VerifyRudeDiagnostics(); } [Fact] public void Method_ReadOnlyRef_Parameter_InsertParameter() { var src1 = "class Test { int M() => throw null; }"; var src2 = "class Test { int M(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [in int b]@19"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "in int b", FeaturesResources.parameter)); } [Fact] public void Method_ReadOnlyRef_Parameter_Update() { var src1 = "class Test { int M(int b) => throw null; }"; var src2 = "class Test { int M(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int b]@19 -> [in int b]@19"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in int b", FeaturesResources.parameter)); } [Fact] public void Method_ReadOnlyRef_ReturnType_Insert() { var src1 = "class Test { }"; var src2 = "class Test { ref readonly int M() => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [ref readonly int M() => throw null;]@13", "Insert [()]@31"); edits.VerifyRudeDiagnostics(); } [Fact] public void Method_ReadOnlyRef_ReturnType_Update() { var src1 = "class Test { int M() => throw null; }"; var src2 = "class Test { ref readonly int M() => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int M() => throw null;]@13 -> [ref readonly int M() => throw null;]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "ref readonly int M()", FeaturesResources.method)); } [Fact] public void Method_ImplementingInterface_Add() { var src1 = @" using System; public interface ISample { string Get(); } public interface IConflict { string Get(); } public class BaseClass : ISample { public virtual string Get() => string.Empty; } public class SubClass : BaseClass, IConflict { public override string Get() => string.Empty; } "; var src2 = @" using System; public interface ISample { string Get(); } public interface IConflict { string Get(); } public class BaseClass : ISample { public virtual string Get() => string.Empty; } public class SubClass : BaseClass, IConflict { public override string Get() => string.Empty; string IConflict.Get() => String.Empty; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [string IConflict.Get() => String.Empty;]@325", "Insert [()]@345"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertMethodWithExplicitInterfaceSpecifier, "string IConflict.Get()", FeaturesResources.method)); } [Fact] public void Method_Partial_DeleteInsert_DefinitionPart() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcC1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { partial void F() { } }"; var srcC2 = "partial class C { partial void F(); }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults(), DocumentResults(), }); } [Fact] public void Method_Partial_DeleteInsert_ImplementationPart() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcC1 = "partial class C { }"; var srcA2 = "partial class C { partial void F(); }"; var srcB2 = "partial class C { }"; var srcC2 = "partial class C { partial void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F").PartialImplementationPart) }), }); } [Fact, WorkItem(51011, "https://github.com/dotnet/roslyn/issues/51011")] public void Method_Partial_Swap_ImplementationAndDefinitionParts() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcA2 = "partial class C { partial void F() { } }"; var srcB2 = "partial class C { partial void F(); }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F").PartialImplementationPart) }), DocumentResults(), }); } [Fact] public void Method_Partial_DeleteImplementation() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcA2 = "partial class C { partial void F(); }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial class C", DeletedSymbolDisplay(FeaturesResources.method, "F()")) }) }); } [Fact] public void Method_Partial_DeleteBoth() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial class C", DeletedSymbolDisplay(FeaturesResources.method, "F()")) }) }); } [Fact] public void Method_Partial_DeleteInsertBoth() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcC1 = "partial class C { }"; var srcD1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { }"; var srcC2 = "partial class C { partial void F(); }"; var srcD2 = "partial class C { partial void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2), GetTopEdits(srcD1, srcD2) }, new[] { DocumentResults(), DocumentResults(), DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F").PartialImplementationPart) }) }); } [Fact] public void Method_Partial_Insert() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { partial void F(); }"; var srcB2 = "partial class C { partial void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F").PartialImplementationPart) }), }); } [Fact] public void Method_Partial_Insert_Reloadable() { var srcA1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { }"; var srcB1 = "partial class C { }"; var srcA2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { partial void F(); }"; var srcB2 = "partial class C { partial void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), }); } #endregion #region Operators [Theory] [InlineData("implicit", "explicit")] [InlineData("explicit", "implicit")] public void Operator_Modifiers_Update(string oldModifiers, string newModifiers) { var src1 = "class C { public static " + oldModifiers + " operator int (C c) => 0; }"; var src2 = "class C { public static " + newModifiers + " operator int (C c) => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public static " + oldModifiers + " operator int (C c) => 0;]@10 -> [public static " + newModifiers + " operator int (C c) => 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public static " + newModifiers + " operator int (C c)", CSharpFeaturesResources.conversion_operator)); } [Fact] public void Operator_Modifiers_Update_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { public static implicit operator int (C c) => 0; }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { public static explicit operator int (C c) => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Operator_Conversion_ExternModifiers_Add() { var src1 = "class C { public static implicit operator bool (C c) => default; }"; var src2 = "class C { extern public static implicit operator bool (C c); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "extern public static implicit operator bool (C c)", CSharpFeaturesResources.conversion_operator)); } [Fact] public void Operator_Conversion_ExternModifiers_Remove() { var src1 = "class C { extern public static implicit operator bool (C c); }"; var src2 = "class C { public static implicit operator bool (C c) => default; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public static implicit operator bool (C c)", CSharpFeaturesResources.conversion_operator)); } [Fact] public void OperatorInsert() { var src1 = @" class C { } "; var src2 = @" class C { public static implicit operator bool (C c) { return false; } public static C operator +(C c, C d) { return c; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertOperator, "public static implicit operator bool (C c)", CSharpFeaturesResources.conversion_operator), Diagnostic(RudeEditKind.InsertOperator, "public static C operator +(C c, C d)", FeaturesResources.operator_)); } [Fact] public void OperatorDelete() { var src1 = @" class C { public static implicit operator bool (C c) { return false; } public static C operator +(C c, C d) { return c; } } "; var src2 = @" class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(CSharpFeaturesResources.conversion_operator, "implicit operator bool(C c)")), Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.operator_, "operator +(C c, C d)"))); } [Fact] public void OperatorInsertDelete() { var srcA1 = @" partial class C { public static implicit operator bool (C c) => false; } "; var srcB1 = @" partial class C { public static C operator +(C c, C d) => c; } "; var srcA2 = srcB1; var srcB2 = srcA1; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("op_Addition")) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("op_Implicit")) }), }); } [Fact] public void OperatorUpdate() { var src1 = @" class C { public static implicit operator bool (C c) { return false; } public static C operator +(C c, C d) { return c; } } "; var src2 = @" class C { public static implicit operator bool (C c) { return true; } public static C operator +(C c, C d) { return d; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Implicit")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Addition")), }); } [Fact] public void OperatorWithExpressionBody_Update() { var src1 = @" class C { public static implicit operator bool (C c) => false; public static C operator +(C c, C d) => c; } "; var src2 = @" class C { public static implicit operator bool (C c) => true; public static C operator +(C c, C d) => d; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Implicit")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Addition")), }); } [Fact] public void OperatorWithExpressionBody_ToBlockBody() { var src1 = "class C { public static C operator +(C c, C d) => d; }"; var src2 = "class C { public static C operator +(C c, C d) { return c; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public static C operator +(C c, C d) => d;]@10 -> [public static C operator +(C c, C d) { return c; }]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Addition")) }); } [Fact] public void OperatorWithBlockBody_ToExpressionBody() { var src1 = "class C { public static C operator +(C c, C d) { return c; } }"; var src2 = "class C { public static C operator +(C c, C d) => d; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public static C operator +(C c, C d) { return c; }]@10 -> [public static C operator +(C c, C d) => d;]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Addition")) }); } [Fact] public void OperatorReorder1() { var src1 = @" class C { public static implicit operator bool (C c) { return false; } public static implicit operator int (C c) { return 1; } } "; var src2 = @" class C { public static implicit operator int (C c) { return 1; } public static implicit operator bool (C c) { return false; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [public static implicit operator int (C c) { return 1; }]@84 -> @18"); edits.VerifyRudeDiagnostics(); } [Fact] public void OperatorReorder2() { var src1 = @" class C { public static C operator +(C c, C d) { return c; } public static C operator -(C c, C d) { return d; } } "; var src2 = @" class C { public static C operator -(C c, C d) { return d; } public static C operator +(C c, C d) { return c; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [public static C operator -(C c, C d) { return d; }]@74 -> @18"); edits.VerifyRudeDiagnostics(); } [Fact] public void Operator_ReadOnlyRef_Parameter_InsertWhole() { var src1 = "class Test { }"; var src2 = "class Test { public static bool operator !(in Test b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public static bool operator !(in Test b) => throw null;]@13", "Insert [(in Test b)]@42", "Insert [in Test b]@43"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertOperator, "public static bool operator !(in Test b)", FeaturesResources.operator_)); } [Fact] public void Operator_ReadOnlyRef_Parameter_Update() { var src1 = "class Test { public static bool operator !(Test b) => throw null; }"; var src2 = "class Test { public static bool operator !(in Test b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Test b]@43 -> [in Test b]@43"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in Test b", FeaturesResources.parameter)); } #endregion #region Constructor, Destructor [Fact] public void Constructor_Parameter_AddAttribute() { var src1 = @" class C { private int x = 1; public C(int a) { } }"; var src2 = @" class C { private int x = 2; public C([System.Obsolete]int a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [x = 1]@30 -> [x = 2]@30", "Update [int a]@53 -> [[System.Obsolete]int a]@53"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C..ctor")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] [WorkItem(2068, "https://github.com/dotnet/roslyn/issues/2068")] public void Constructor_ExternModifier_Add() { var src1 = "class C { }"; var src2 = "class C { public extern C(); }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public extern C();]@10", "Insert [()]@25"); // This can be allowed as the compiler generates an empty constructor, but it's not worth the complexity. edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public extern C()", FeaturesResources.constructor)); } [Fact] public void ConstructorInitializer_Update1() { var src1 = @" class C { public C(int a) : base(a) { } }"; var src2 = @" class C { public C(int a) : base(a + 1) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public C(int a) : base(a) { }]@18 -> [public C(int a) : base(a + 1) { }]@18"); edits.VerifyRudeDiagnostics(); } [Fact] public void ConstructorInitializer_Update2() { var src1 = @" class C<T> { public C(int a) : base(a) { } }"; var src2 = @" class C<T> { public C(int a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public C(int a) : base(a) { }]@21 -> [public C(int a) { }]@21"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "public C(int a)")); } [Fact] public void ConstructorInitializer_Update3() { var src1 = @" class C { public C(int a) { } }"; var src2 = @" class C { public C(int a) : base(a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public C(int a) { }]@18 -> [public C(int a) : base(a) { }]@18"); edits.VerifyRudeDiagnostics(); } [Fact] public void ConstructorInitializer_Update4() { var src1 = @" class C<T> { public C(int a) : base(a) { } }"; var src2 = @" class C<T> { public C(int a) : base(a + 1) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public C(int a) : base(a) { }]@21 -> [public C(int a) : base(a + 1) { }]@21"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "public C(int a)")); } [WorkItem(743552, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/743552")] [Fact] public void ConstructorUpdate_AddParameter() { var src1 = @" class C { public C(int a) { } }"; var src2 = @" class C { public C(int a, int b) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int a)]@26 -> [(int a, int b)]@26", "Insert [int b]@34"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "int b", FeaturesResources.parameter)); } [Fact] public void DestructorDelete() { var src1 = @"class B { ~B() { } }"; var src2 = @"class B { }"; var expectedEdit1 = @"Delete [~B() { }]@10"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(expectedEdit1); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class B", DeletedSymbolDisplay(CSharpFeaturesResources.destructor, "~B()"))); } [Fact] public void DestructorDelete_InsertConstructor() { var src1 = @"class B { ~B() { } }"; var src2 = @"class B { B() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [B() { }]@10", "Insert [()]@11", "Delete [~B() { }]@10"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "B()", FeaturesResources.constructor), Diagnostic(RudeEditKind.Delete, "class B", DeletedSymbolDisplay(CSharpFeaturesResources.destructor, "~B()"))); } [Fact] [WorkItem(789577, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/789577")] public void ConstructorUpdate_AnonymousTypeInFieldInitializer() { var src1 = "class C { int a = F(new { A = 1, B = 2 }); C() { x = 1; } }"; var src2 = "class C { int a = F(new { A = 1, B = 2 }); C() { x = 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Constructor_Static_Delete() { var src1 = "class C { static C() { } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.static_constructor, "C()"))); } [Fact] public void Constructor_Static_Delete_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { static C() { } }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Constructor_Static_Insert() { var src1 = "class C { }"; var src2 = "class C { static C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single()) }); } [Fact] public void InstanceCtorDelete_Public() { var src1 = "class C { public C() { } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("")] [InlineData("private")] [InlineData("protected")] [InlineData("internal")] [InlineData("private protected")] [InlineData("protected internal")] public void InstanceCtorDelete_NonPublic(string accessibility) { var src1 = "class C { [System.Obsolete] " + accessibility + " C() { } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()")), Diagnostic(RudeEditKind.ChangingAccessibility, "class C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()"))); } [Fact] public void InstanceCtorDelete_Public_PartialWithInitializerUpdate() { var srcA1 = "partial class C { public C() { } }"; var srcB1 = "partial class C { int x = 1; }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int x = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void InstanceCtorInsert_Public_Implicit() { var src1 = "class C { }"; var src2 = "class C { public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void InstanceCtorInsert_Partial_Public_Implicit() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { public C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // no change in document A DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void InstanceCtorInsert_Public_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, expectedSemanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters.IsEmpty)) }); } [Fact] public void InstanceCtorInsert_Partial_Public_NoImplicit() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { public C(int a) { } }"; var srcA2 = "partial class C { public C() { } }"; var srcB2 = "partial class C { public C(int a) { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters.IsEmpty)) }), // no change in document B DocumentResults(), }); } [Fact] public void InstanceCtorInsert_Private_Implicit1() { var src1 = "class C { }"; var src2 = "class C { private C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "private C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorInsert_Private_Implicit2() { var src1 = "class C { }"; var src2 = "class C { C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorInsert_Protected_PublicImplicit() { var src1 = "class C { }"; var src2 = "class C { protected C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "protected C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorInsert_Internal_PublicImplicit() { var src1 = "class C { }"; var src2 = "class C { internal C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "internal C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorInsert_Internal_ProtectedImplicit() { var src1 = "abstract class C { }"; var src2 = "abstract class C { internal C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "internal C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorUpdate_ProtectedImplicit() { var src1 = "abstract class C { }"; var src2 = "abstract class C { protected C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void InstanceCtorInsert_Private_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } private C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C") .InstanceConstructors.Single(ctor => ctor.DeclaredAccessibility == Accessibility.Private)) }); } [Fact] public void InstanceCtorInsert_Internal_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } internal C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void InstanceCtorInsert_Protected_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } protected C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void InstanceCtorInsert_InternalProtected_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } internal protected C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void StaticCtor_Partial_DeleteInsert() { var srcA1 = "partial class C { static C() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { static C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void InstanceCtor_Partial_DeletePrivateInsertPrivate() { var srcA1 = "partial class C { C() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void InstanceCtor_Partial_DeletePublicInsertPublic() { var srcA1 = "partial class C { public C() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { public C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void InstanceCtor_Partial_DeletePrivateInsertPublic() { var srcA1 = "partial class C { C() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { public C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // delete of the constructor in partial part will be reported as rude edit in the other document where it was inserted back with changed accessibility DocumentResults( semanticEdits: NoSemanticEdits), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ChangingAccessibility, "public C()", FeaturesResources.constructor) }), }); } [Fact] public void StaticCtor_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { static C() { } }"; var srcA2 = "partial class C { static C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertPublicDeletePublic() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { public C() { } }"; var srcA2 = "partial class C { public C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertPrivateDeletePrivate() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { private C() { } }"; var srcA2 = "partial class C { private C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_DeleteInternalInsertInternal() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { internal C() { } }"; var srcA2 = "partial class C { internal C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertInternalDeleteInternal_WithBody() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { internal C() { } }"; var srcA2 = "partial class C { internal C() { Console.WriteLine(1); } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertPublicDeletePrivate() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { private C() { } }"; var srcA2 = "partial class C { public C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ChangingAccessibility, "public C()", FeaturesResources.constructor) }), // delete of the constructor in partial part will be reported as rude in the the other document where it was inserted with changed accessibility DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertInternalDeletePrivate() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { private C() { } }"; var srcA2 = "partial class C { internal C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ChangingAccessibility, "internal C()", FeaturesResources.constructor) }), DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_Update_LambdaInInitializer1() { var src1 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C() { F(<N:0.2>c => c + 1</N:0.2>); } } "; var src2 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C() { F(<N:0.2>c => c + 2</N:0.2>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void InstanceCtor_Partial_Update_LambdaInInitializer_Trivia1() { var src1 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C() { F(<N:0.2>c => c + 1</N:0.2>); } } "; var src2 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); /*new trivia*/public C() { F(<N:0.2>c => c + 1</N:0.2>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void InstanceCtor_Partial_Update_LambdaInInitializer_ExplicitInterfaceImpl1() { var src1 = @" using System; public interface I { int B { get; } } public interface J { int B { get; } } partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C : I, J { int I.B { get; } = F(<N:0.1>ib => ib + 1</N:0.1>); int J.B { get; } = F(<N:0.2>jb => jb + 1</N:0.2>); public C() { F(<N:0.3>c => c + 1</N:0.3>); } } "; var src2 = @" using System; public interface I { int B { get; } } public interface J { int B { get; } } partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C : I, J { int I.B { get; } = F(<N:0.1>ib => ib + 1</N:0.1>); int J.B { get; } = F(<N:0.2>jb => jb + 1</N:0.2>); public C() { F(<N:0.3>c => c + 2</N:0.3>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void InstanceCtor_Partial_Insert_Parameterless_LambdaInInitializer1() { var src1 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); } "; var src2 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C() // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas, "public C()")); // TODO: //var syntaxMap = GetSyntaxMap(src1, src2); //edits.VerifySemantics( // ActiveStatementsDescription.Empty, // new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void InstanceCtor_Partial_Insert_WithParameters_LambdaInInitializer1() { var src1 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); } "; var src2 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C(int x) // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); _ = GetSyntaxMap(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas, "public C(int x)")); // TODO: bug https://github.com/dotnet/roslyn/issues/2504 //edits.VerifySemantics( // ActiveStatementsDescription.Empty, // new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<NamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void InstanceCtor_Partial_Explicit_Update() { var srcA1 = @" using System; partial class C { C(int arg) => Console.WriteLine(0); C(bool arg) => Console.WriteLine(1); } "; var srcB1 = @" using System; partial class C { int a <N:0.0>= 1</N:0.0>; C(uint arg) => Console.WriteLine(2); } "; var srcA2 = @" using System; partial class C { C(int arg) => Console.WriteLine(0); C(bool arg) => Console.WriteLine(1); } "; var srcB2 = @" using System; partial class C { int a <N:0.0>= 2</N:0.0>; // updated field initializer C(uint arg) => Console.WriteLine(2); C(byte arg) => Console.WriteLine(3); // new ctor } "; var syntaxMapB = GetSyntaxMap(srcB1, srcB2)[0]; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // No changes in document A DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "Int32"), partialType: "C", syntaxMap: syntaxMapB), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "Boolean"), partialType: "C", syntaxMap: syntaxMapB), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "UInt32"), partialType: "C", syntaxMap: syntaxMapB), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "Byte"), syntaxMap: null), }) }); } [Fact] public void InstanceCtor_Partial_Explicit_Update_SemanticError() { var srcA1 = @" using System; partial class C { C(int arg) => Console.WriteLine(0); C(int arg) => Console.WriteLine(1); } "; var srcB1 = @" using System; partial class C { int a = 1; } "; var srcA2 = @" using System; partial class C { C(int arg) => Console.WriteLine(0); C(int arg) => Console.WriteLine(1); } "; var srcB2 = @" using System; partial class C { int a = 2; C(int arg) => Console.WriteLine(2); } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // No changes in document A DocumentResults(), // The actual edits do not matter since there are semantic errors in the compilation. // We just should not crash. DocumentResults(diagnostics: Array.Empty<RudeEditDiagnosticDescription>()) }); } [Fact] public void InstanceCtor_Partial_Implicit_Update() { var srcA1 = "partial class C { int F = 1; }"; var srcB1 = "partial class C { int G = 1; }"; var srcA2 = "partial class C { int F = 2; }"; var srcB2 = "partial class C { int G = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void ParameterlessConstructor_SemanticError_Delete1() { var src1 = @" class C { D() {} } "; var src2 = @" class C { } "; var edits = GetTopEdits(src1, src2); // The compiler interprets D() as a constructor declaration. edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "class C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()"))); } [Fact] public void Constructor_SemanticError_Partial() { var src1 = @" partial class C { partial void C(int x); } partial class C { partial void C(int x) { System.Console.WriteLine(1); } } "; var src2 = @" partial class C { partial void C(int x); } partial class C { partial void C(int x) { System.Console.WriteLine(2); } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, expectedSemanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("C").PartialImplementationPart) }); } [Fact] public void PartialDeclaration_Delete() { var srcA1 = "partial class C { public C() { } void F() { } }"; var srcB1 = "partial class C { int x = 1; }"; var srcA2 = ""; var srcB2 = "partial class C { int x = 2; void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void PartialDeclaration_Insert() { var srcA1 = ""; var srcB1 = "partial class C { int x = 1; void F() { } }"; var srcA2 = "partial class C { public C() { } void F() { } }"; var srcB2 = "partial class C { int x = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void PartialDeclaration_Insert_Reloadable() { var srcA1 = ""; var srcB1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { int x = 1; void F() { } }"; var srcA2 = "partial class C { public C() { } void F() { } }"; var srcB2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { int x = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void Constructor_DeleteParameterless(string typeKind) { var src1 = @" " + typeKind + @" C { private int a = 10; private int b; public C() { b = 3; } } "; var src2 = @" " + typeKind + @" C { private int a = 10; private int b; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [public C() { b = 3; }]@66", "Delete [()]@74"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void Constructor_InsertParameterless(string typeKind) { var src1 = @" " + typeKind + @" C { private int a = 10; private int b; } "; var src2 = @" " + typeKind + @" C { private int a = 10; private int b; public C() { b = 3; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [public C() { b = 3; }]@66", "Insert [()]@74"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Constructor_BlockBodyToExpressionBody() { var src1 = @" public class C { private int _value; public C(int value) { _value = value; } } "; var src2 = @" public class C { private int _value; public C(int value) => _value = value; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public C(int value) { _value = value; }]@52 -> [public C(int value) => _value = value;]@52"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void ConstructorWithInitializer_BlockBodyToExpressionBody() { var src1 = @" public class B { B(int value) {} } public class C : B { private int _value; public C(int value) : base(value) { _value = value; } } "; var src2 = @" public class B { B(int value) {} } public class C : B { private int _value; public C(int value) : base(value) => _value = value; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public C(int value) : base(value) { _value = value; }]@90 -> [public C(int value) : base(value) => _value = value;]@90"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Constructor_ExpressionBodyToBlockBody() { var src1 = @" public class C { private int _value; public C(int value) => _value = value; } "; var src2 = @" public class C { private int _value; public C(int value) { _value = value; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [public C(int value) => _value = value;]@52 -> [public C(int value) { _value = value; }]@52"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void ConstructorWithInitializer_ExpressionBodyToBlockBody() { var src1 = @" public class B { B(int value) {} } public class C : B { private int _value; public C(int value) : base(value) => _value = value; } "; var src2 = @" public class B { B(int value) {} } public class C : B { private int _value; public C(int value) : base(value) { _value = value; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [public C(int value) : base(value) => _value = value;]@90 -> [public C(int value) : base(value) { _value = value; }]@90"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Destructor_BlockBodyToExpressionBody() { var src1 = @" public class C { ~C() { Console.WriteLine(0); } } "; var src2 = @" public class C { ~C() => Console.WriteLine(0); } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [~C() { Console.WriteLine(0); }]@25 -> [~C() => Console.WriteLine(0);]@25"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Finalize"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Destructor_ExpressionBodyToBlockBody() { var src1 = @" public class C { ~C() => Console.WriteLine(0); } "; var src2 = @" public class C { ~C() { Console.WriteLine(0); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [~C() => Console.WriteLine(0);]@25 -> [~C() { Console.WriteLine(0); }]@25"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Finalize"), preserveLocalVariables: false) }); } [Fact] public void Constructor_ReadOnlyRef_Parameter_InsertWhole() { var src1 = "class Test { }"; var src2 = "class Test { Test(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [Test(in int b) => throw null;]@13", "Insert [(in int b)]@17", "Insert [in int b]@18"); edits.VerifyRudeDiagnostics(); } [Fact] public void Constructor_ReadOnlyRef_Parameter_InsertParameter() { var src1 = "class Test { Test() => throw null; }"; var src2 = "class Test { Test(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [in int b]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "in int b", FeaturesResources.parameter)); } [Fact] public void Constructor_ReadOnlyRef_Parameter_Update() { var src1 = "class Test { Test(int b) => throw null; }"; var src2 = "class Test { Test(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int b]@18 -> [in int b]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in int b", FeaturesResources.parameter)); } #endregion #region Fields and Properties with Initializers [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializer_Update1(string typeKind) { var src1 = typeKind + " C { int a = 0; }"; var src2 = typeKind + " C { int a = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 0]@15 -> [a = 1]@15"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializer_Update1(string typeKind) { var src1 = typeKind + " C { int a { get; } = 0; }"; var src2 = typeKind + " C { int a { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a { get; } = 0;]@11 -> [int a { get; } = 1;]@11"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializer_Update2() { var src1 = "class C { int a = 0; }"; var src2 = "class C { int a; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 0]@14 -> [a]@14"); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializer_Update2() { var src1 = "class C { int a { get; } = 0; }"; var src2 = "class C { int a { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a { get; } = 0;]@10 -> [int a { get { return 1; } }]@10", "Update [get;]@18 -> [get { return 1; }]@18"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.a").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true)); } [Fact] public void PropertyInitializer_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int a { get; } = 0; }"; var srcA2 = "partial class C { int a { get { return 1; } } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.a").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults() }); } [Fact] public void FieldInitializer_Update3() { var src1 = "class C { int a; }"; var src2 = "class C { int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@14 -> [a = 0]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializer_Update3() { var src1 = "class C { int a { get { return 1; } } }"; var src2 = "class C { int a { get; } = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a { get { return 1; } }]@10 -> [int a { get; } = 0;]@10", "Update [get { return 1; }]@18 -> [get;]@18"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.a").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_StaticCtorUpdate1() { var src1 = "class C { static int a; static C() { } }"; var src2 = "class C { static int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@21 -> [a = 0]@21", "Delete [static C() { }]@24", "Delete [()]@32"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_StaticCtorUpdate1() { var src1 = "class C { static int a { get; } = 1; static C() { } }"; var src2 = "class C { static int a { get; } = 2;}"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializerUpdate_InstanceCtorUpdate_Private(string typeKind) { var src1 = typeKind + " C { int a; [System.Obsolete]C() { } }"; var src2 = typeKind + " C { int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, $"{typeKind} C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()")), Diagnostic(RudeEditKind.ChangingAccessibility, $"{typeKind} C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()"))); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializerUpdate_InstanceCtorUpdate_Private(string typeKind) { var src1 = typeKind + " C { int a { get; } = 1; C() { } }"; var src2 = typeKind + " C { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, $"{typeKind} C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()"))); } [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializerUpdate_InstanceCtorUpdate_Public(string typeKind) { var src1 = typeKind + " C { int a; public C() { } }"; var src2 = typeKind + " C { int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializerUpdate_InstanceCtorUpdate_Public(string typeKind) { var src1 = typeKind + " C { int a { get; } = 1; public C() { } }"; var src2 = typeKind + " C { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_StaticCtorUpdate2() { var src1 = "class C { static int a; static C() { } }"; var src2 = "class C { static int a = 0; static C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@21 -> [a = 0]@21"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_StaticCtorUpdate2() { var src1 = "class C { static int a { get; } = 1; static C() { } }"; var src2 = "class C { static int a { get; } = 2; static C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializerUpdate_InstanceCtorUpdate2(string typeKind) { var src1 = typeKind + " C { int a; public C() { } }"; var src2 = typeKind + " C { int a = 0; public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@15 -> [a = 0]@15"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializerUpdate_InstanceCtorUpdate2(string typeKind) { var src1 = typeKind + " C { int a { get; } = 1; public C() { } }"; var src2 = typeKind + " C { int a { get; } = 2; public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_InstanceCtorUpdate3() { var src1 = "class C { int a; }"; var src2 = "class C { int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@14 -> [a = 0]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_InstanceCtorUpdate3() { var src1 = "class C { int a { get; } = 1; }"; var src2 = "class C { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_InstanceCtorUpdate4() { var src1 = "class C { int a = 0; }"; var src2 = "class C { int a; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 0]@14 -> [a]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_InstanceCtorUpdate5() { var src1 = "class C { int a; private C(int a) { } private C(bool a) { } }"; var src2 = "class C { int a = 0; private C(int a) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@14 -> [a = 0]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), }); } [Fact] public void FieldInitializerUpdate_Struct_InstanceCtorUpdate5() { var src1 = "struct C { int a; private C(int a) { } private C(bool a) { } }"; var src2 = "struct C { int a = 0; private C(int a) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@15 -> [a = 0]@15"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C()"), preserveLocalVariables: true), }); } [Fact] public void PropertyInitializerUpdate_InstanceCtorUpdate5() { var src1 = "class C { int a { get; } = 1; private C(int a) { } private C(bool a) { } }"; var src2 = "class C { int a { get; } = 10000; private C(int a) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), }); } [Fact] public void PropertyInitializerUpdate_Struct_InstanceCtorUpdate5() { var src1 = "struct C { int a { get; } = 1; private C(int a) { } private C(bool a) { } }"; var src2 = "struct C { int a { get; } = 10000; private C(int a) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C()"), preserveLocalVariables: true), }); } [Fact] public void FieldInitializerUpdate_InstanceCtorUpdate6() { var src1 = "class C { int a; private C(int a) : this(true) { } private C(bool a) { } }"; var src2 = "class C { int a = 0; private C(int a) : this(true) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@14 -> [a = 0]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_StaticCtorInsertImplicit() { var src1 = "class C { static int a; }"; var src2 = "class C { static int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@21 -> [a = 0]@21"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single()) }); } [Fact] public void FieldInitializerUpdate_StaticCtorInsertExplicit() { var src1 = "class C { static int a; }"; var src2 = "class C { static int a = 0; static C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [static C() { }]@28", "Insert [()]@36", "Update [a]@21 -> [a = 0]@21"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single()) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializerUpdate_InstanceCtorInsertExplicit(string typeKind) { var src1 = typeKind + " C { int a; }"; var src2 = typeKind + " C { int a = 0; public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializerUpdate_InstanceCtorInsertExplicit(string typeKind) { var src1 = typeKind + " C { int a { get; } = 1; }"; var src2 = typeKind + " C { int a { get; } = 2; public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_GenericType() { var src1 = "class C<T> { int a = 1; }"; var src2 = "class C<T> { int a = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@17 -> [a = 2]@17"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "a = 2"), Diagnostic(RudeEditKind.GenericTypeUpdate, "class C<T>")); } [Fact] public void PropertyInitializerUpdate_GenericType() { var src1 = "class C<T> { int a { get; } = 1; }"; var src2 = "class C<T> { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "int a"), Diagnostic(RudeEditKind.GenericTypeUpdate, "class C<T>")); } [Fact] public void FieldInitializerUpdate_StackAllocInConstructor() { var src1 = "unsafe class C { int a = 1; public C() { int* a = stackalloc int[10]; } }"; var src2 = "unsafe class C { int a = 2; public C() { int* a = stackalloc int[10]; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@21 -> [a = 2]@21"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.constructor)); } [Fact] [WorkItem(37172, "https://github.com/dotnet/roslyn/issues/37172")] [WorkItem(43099, "https://github.com/dotnet/roslyn/issues/43099")] public void FieldInitializerUpdate_SwitchExpressionInConstructor() { var src1 = "class C { int a = 1; public C() { var b = a switch { 0 => 0, _ => 1 }; } }"; var src2 = "class C { int a = 2; public C() { var b = a switch { 0 => 0, _ => 1 }; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_StackAllocInConstructor1() { var src1 = "unsafe class C { int a { get; } = 1; public C() { int* a = stackalloc int[10]; } }"; var src2 = "unsafe class C { int a { get; } = 2; public C() { int* a = stackalloc int[10]; } }"; var edits = GetTopEdits(src1, src2); // TODO (tomat): diagnostic should point to the property initializer edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.constructor)); } [Fact] public void PropertyInitializerUpdate_StackAllocInConstructor2() { var src1 = "unsafe class C { int a { get; } = 1; public C() : this(1) { int* a = stackalloc int[10]; } public C(int a) { } }"; var src2 = "unsafe class C { int a { get; } = 2; public C() : this(1) { int* a = stackalloc int[10]; } public C(int a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_StackAllocInConstructor3() { var src1 = "unsafe class C { int a { get; } = 1; public C() { } public C(int b) { int* a = stackalloc int[10]; } }"; var src2 = "unsafe class C { int a { get; } = 2; public C() { } public C(int b) { int* a = stackalloc int[10]; } }"; var edits = GetTopEdits(src1, src2); // TODO (tomat): diagnostic should point to the property initializer edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.constructor)); } [Fact] [WorkItem(37172, "https://github.com/dotnet/roslyn/issues/37172")] [WorkItem(43099, "https://github.com/dotnet/roslyn/issues/43099")] public void PropertyInitializerUpdate_SwitchExpressionInConstructor1() { var src1 = "class C { int a { get; } = 1; public C() { var b = a switch { 0 => 0, _ => 1 }; } }"; var src2 = "class C { int a { get; } = 2; public C() { var b = a switch { 0 => 0, _ => 1 }; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] [WorkItem(37172, "https://github.com/dotnet/roslyn/issues/37172")] [WorkItem(43099, "https://github.com/dotnet/roslyn/issues/43099")] public void PropertyInitializerUpdate_SwitchExpressionInConstructor2() { var src1 = "class C { int a { get; } = 1; public C() : this(1) { var b = a switch { 0 => 0, _ => 1 }; } public C(int a) { } }"; var src2 = "class C { int a { get; } = 2; public C() : this(1) { var b = a switch { 0 => 0, _ => 1 }; } public C(int a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] [WorkItem(37172, "https://github.com/dotnet/roslyn/issues/37172")] [WorkItem(43099, "https://github.com/dotnet/roslyn/issues/43099")] public void PropertyInitializerUpdate_SwitchExpressionInConstructor3() { var src1 = "class C { int a { get; } = 1; public C() { } public C(int b) { var b = a switch { 0 => 0, _ => 1 }; } }"; var src2 = "class C { int a { get; } = 2; public C() { } public C(int b) { var b = a switch { 0 => 0, _ => 1 }; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void FieldInitializerUpdate_LambdaInConstructor() { var src1 = "class C { int a = 1; public C() { F(() => {}); } static void F(System.Action a) {} }"; var src2 = "class C { int a = 2; public C() { F(() => {}); } static void F(System.Action a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@14 -> [a = 2]@14"); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_LambdaInConstructor() { var src1 = "class C { int a { get; } = 1; public C() { F(() => {}); } static void F(System.Action a) {} }"; var src2 = "class C { int a { get; } = 2; public C() { F(() => {}); } static void F(System.Action a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void FieldInitializerUpdate_QueryInConstructor() { var src1 = "using System.Linq; class C { int a = 1; public C() { F(from a in new[] {1,2,3} select a + 1); } static void F(System.Collections.Generic.IEnumerable<int> x) {} }"; var src2 = "using System.Linq; class C { int a = 2; public C() { F(from a in new[] {1,2,3} select a + 1); } static void F(System.Collections.Generic.IEnumerable<int> x) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@33 -> [a = 2]@33"); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_QueryInConstructor() { var src1 = "using System.Linq; class C { int a { get; } = 1; public C() { F(from a in new[] {1,2,3} select a + 1); } static void F(System.Collections.Generic.IEnumerable<int> x) {} }"; var src2 = "using System.Linq; class C { int a { get; } = 2; public C() { F(from a in new[] {1,2,3} select a + 1); } static void F(System.Collections.Generic.IEnumerable<int> x) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void FieldInitializerUpdate_AnonymousTypeInConstructor() { var src1 = "class C { int a = 1; C() { F(new { A = 1, B = 2 }); } static void F(object x) {} }"; var src2 = "class C { int a = 2; C() { F(new { A = 1, B = 2 }); } static void F(object x) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_AnonymousTypeInConstructor() { var src1 = "class C { int a { get; } = 1; C() { F(new { A = 1, B = 2 }); } static void F(object x) {} }"; var src2 = "class C { int a { get; } = 2; C() { F(new { A = 1, B = 2 }); } static void F(object x) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void FieldInitializerUpdate_PartialTypeWithSingleDeclaration() { var src1 = "partial class C { int a = 1; }"; var src2 = "partial class C { int a = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@22 -> [a = 2]@22"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_PartialTypeWithSingleDeclaration() { var src1 = "partial class C { int a { get; } = 1; }"; var src2 = "partial class C { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_PartialTypeWithMultipleDeclarations() { var src1 = "partial class C { int a = 1; } partial class C { }"; var src2 = "partial class C { int a = 2; } partial class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@22 -> [a = 2]@22"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_PartialTypeWithMultipleDeclarations() { var src1 = "partial class C { int a { get; } = 1; } partial class C { }"; var src2 = "partial class C { int a { get; } = 2; } partial class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_ParenthesizedLambda() { var src1 = "class C { int a = F(1, (x, y) => x + y); }"; var src2 = "class C { int a = F(2, (x, y) => x + y); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializerUpdate_ParenthesizedLambda() { var src1 = "class C { int a { get; } = F(1, (x, y) => x + y); }"; var src2 = "class C { int a { get; } = F(2, (x, y) => x + y); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void FieldInitializerUpdate_SimpleLambda() { var src1 = "class C { int a = F(1, x => x); }"; var src2 = "class C { int a = F(2, x => x); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializerUpdate_SimpleLambda() { var src1 = "class C { int a { get; } = F(1, x => x); }"; var src2 = "class C { int a { get; } = F(2, x => x); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void FieldInitializerUpdate_Query() { var src1 = "class C { int a = F(1, from goo in bar select baz); }"; var src2 = "class C { int a = F(2, from goo in bar select baz); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializerUpdate_Query() { var src1 = "class C { int a { get; } = F(1, from goo in bar select baz); }"; var src2 = "class C { int a { get; } = F(2, from goo in bar select baz); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void FieldInitializerUpdate_AnonymousType() { var src1 = "class C { int a = F(1, new { A = 1, B = 2 }); }"; var src2 = "class C { int a = F(2, new { A = 1, B = 2 }); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializerUpdate_AnonymousType() { var src1 = "class C { int a { get; } = F(1, new { A = 1, B = 2 }); }"; var src2 = "class C { int a { get; } = F(2, new { A = 1, B = 2 }); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void FieldInitializerUpdate_Lambdas_ImplicitCtor_EditInitializerWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 2</N:0.1>); } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_ImplicitCtor_EditInitializerWithoutLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = 1; int B = F(<N:0.0>b => b + 1</N:0.0>); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = 2; int B = F(<N:0.0>b => b + 1</N:0.0>); } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_CtorIncludingInitializers_EditInitializerWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C() {} } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 2</N:0.1>); public C() {} } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_CtorIncludingInitializers_EditInitializerWithoutLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = 1; int B = F(<N:0.0>b => b + 1</N:0.0>); public C() {} } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = 2; int B = F(<N:0.0>b => b + 1</N:0.0>); public C() {} } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializers_EditInitializerWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) {} public C(bool b) {} } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 2</N:0.1>); public C(int a) {} public C(bool b) {} } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditInitializerWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 2</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditInitializerWithLambda_Trivia1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditConstructorWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(d => d + 1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 2</N:0.2>); } public C(bool b) { F(d => d + 1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Int32 a)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditConstructorWithLambda_Trivia1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(d => d + 1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(d => d + 1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Int32 a)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditConstructorWithoutLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(c => c + 1); } public C(bool b) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(c => c + 1); } public C(bool b) { Console.WriteLine(2); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_EditConstructorNotIncludingInitializers() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(a => a + 1); int B = F(b => b + 1); public C(int a) { F(c => c + 1); } public C(bool b) : this(1) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(a => a + 1); int B = F(b => b + 1); public C(int a) { F(c => c + 1); } public C(bool b) : this(1) { Console.WriteLine(2); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)")) }); } [Fact] public void FieldInitializerUpdate_Lambdas_RemoveCtorInitializer1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); unsafe public C(int a) { char* buffer = stackalloc char[16]; F(c => c + 1); } public C(bool b) : this(1) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); unsafe public C(int a) { char* buffer = stackalloc char[16]; F(c => c + 1); } public C(bool b) { Console.WriteLine(1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_AddCtorInitializer1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(a => a + 1); int B = F(b => b + 1); public C(int a) { F(c => c + 1); } public C(bool b) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(a => a + 1); int B = F(b => b + 1); public C(int a) { F(c => c + 1); } public C(bool b) : this(1) { Console.WriteLine(1); } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)")) }); } [Fact] public void FieldInitializerUpdate_Lambdas_UpdateBaseCtorInitializerWithLambdas1() { var src1 = @" using System; class B { public B(int a) { } } class C : B { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(bool b) : base(F(<N:0.2>c => c + 1</N:0.2>)) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var src2 = @" using System; class B { public B(int a) { } } class C : B { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(bool b) : base(F(<N:0.2>c => c + 2</N:0.2>)) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_PartialDeclarationDelete_SingleDocument() { var src1 = @" partial class C { int x = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int y = F(<N:0.1>a => a + 10</N:0.1>); } partial class C { public C() { } static int F(Func<int, int> x) => 1; } "; var src2 = @" partial class C { int x = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int y = F(<N:0.1>a => a + 10</N:0.1>); static int F(Func<int, int> x) => 1; } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), syntaxMap[0]), }); } [Fact] public void FieldInitializerUpdate_ActiveStatements1() { var src1 = @" using System; class C { <AS:0>int A = <N:0.0>1</N:0.0>;</AS:0> int B = 1; public C(int a) { Console.WriteLine(1); } public C(bool b) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { <AS:0>int A = <N:0.0>1</N:0.0>;</AS:0> int B = 2; public C(int a) { Console.WriteLine(1); } public C(bool b) { Console.WriteLine(1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); var activeStatements = GetActiveStatements(src1, src2); edits.VerifySemantics( activeStatements, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]), }); } [Fact] public void PropertyWithInitializer_SemanticError_Partial() { var src1 = @" partial class C { partial int P => 1; } partial class C { partial int P => 1; } "; var src2 = @" partial class C { partial int P => 1; } partial class C { partial int P => 2; public C() { } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, expectedSemanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => ((IPropertySymbol)c.GetMember<INamedTypeSymbol>("C").GetMembers("P").First()).GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void Field_Partial_DeleteInsert_InitializerRemoval() { var srcA1 = "partial class C { int F = 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int F; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void Field_Partial_DeleteInsert_InitializerUpdate() { var srcA1 = "partial class C { int F = 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int F = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } #endregion #region Fields [Fact] public void Field_Rename() { var src1 = "class C { int a = 0; }"; var src2 = "class C { int b = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 0]@14 -> [b = 0]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "b = 0", FeaturesResources.field)); } [Fact] public void Field_Kind_Update() { var src1 = "class C { Action a; }"; var src2 = "class C { event Action a; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Action a;]@10 -> [event Action a;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.FieldKindUpdate, "event Action a", FeaturesResources.event_)); } [Theory] [InlineData("static")] [InlineData("volatile")] [InlineData("const")] public void Field_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "int F = 0; }"; var src2 = "class C { " + newModifiers + "int F = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "int F = 0;]@10 -> [" + newModifiers + "int F = 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "int F = 0", FeaturesResources.field)); } [Fact] public void Field_Modifier_Add_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int F; }"; var srcA2 = "partial class C { static int F; }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ModifiersUpdate, "F", FeaturesResources.field) }), DocumentResults(), }); } [Fact] public void Field_Attribute_Add_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int F; }"; var srcA2 = "partial class C { [System.Obsolete]int F; }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")) }), DocumentResults(), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_FixedSize_Update() { var src1 = "struct S { public unsafe fixed byte a[1], b[2]; }"; var src2 = "struct S { public unsafe fixed byte a[2], b[3]; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a[1]]@36 -> [a[2]]@36", "Update [b[2]]@42 -> [b[3]]@42"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.FixedSizeFieldUpdate, "a[2]", FeaturesResources.field), Diagnostic(RudeEditKind.FixedSizeFieldUpdate, "b[3]", FeaturesResources.field)); } [WorkItem(1120407, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1120407")] [Fact] public void Field_Const_Update() { var src1 = "class C { const int x = 0; }"; var src2 = "class C { const int x = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [x = 0]@20 -> [x = 1]@20"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "x = 1", FeaturesResources.const_field)); } [Fact] public void Field_Event_VariableDeclarator_Update() { var src1 = "class C { event Action a; }"; var src2 = "class C { event Action a = () => { }; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@23 -> [a = () => { }]@23"); edits.VerifyRudeDiagnostics(); } [Fact] public void Field_Reorder() { var src1 = "class C { int a = 0; int b = 1; int c = 2; }"; var src2 = "class C { int c = 2; int a = 0; int b = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int c = 2;]@32 -> @10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "int c = 2", FeaturesResources.field)); } [Fact] public void Field_Insert() { var src1 = "class C { }"; var src2 = "class C { int a = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int a = 1;]@10", "Insert [int a = 1]@10", "Insert [a = 1]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.a")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void Field_Insert_IntoStruct() { var src1 = @" struct S { public int a; public S(int z) { this = default(S); a = z; } } "; var src2 = @" struct S { public int a; private int b; private static int c; private static int f = 1; private event System.Action d; public S(int z) { this = default(S); a = z; } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoStruct, "b", FeaturesResources.field, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "c", FeaturesResources.field, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "f = 1", FeaturesResources.field, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "d", CSharpFeaturesResources.event_field, CSharpFeaturesResources.struct_)); } [Fact] public void Field_Insert_IntoLayoutClass_Auto() { var src1 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Auto)] class C { private int a; } "; var src2 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Auto)] class C { private int a; private int b; private int c; private static int d; } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.b")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.c")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.d")), }); } [Fact] public void Field_Insert_IntoLayoutClass_Explicit() { var src1 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Explicit)] class C { [FieldOffset(0)] private int a; } "; var src2 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Explicit)] class C { [FieldOffset(0)] private int a; [FieldOffset(0)] private int b; [FieldOffset(4)] private int c; private static int d; } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "b", FeaturesResources.field, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "c", FeaturesResources.field, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "d", FeaturesResources.field, FeaturesResources.class_)); } [Fact] public void Field_Insert_IntoLayoutClass_Sequential() { var src1 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private int a; } "; var src2 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private int a; private int b; private int c; private static int d; } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "b", FeaturesResources.field, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "c", FeaturesResources.field, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "d", FeaturesResources.field, FeaturesResources.class_)); } [Fact] public void Field_Insert_WithInitializersAndLambdas1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); public C() { F(<N:0.1>c => c + 1</N:0.1>); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(b => b + 1); // new field public C() { F(<N:0.1>c => c + 1</N:0.1>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.B")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void Field_Insert_ConstructorReplacingImplicitConstructor_WithInitializersAndLambdas() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(b => b + 1); // new field public C() // new ctor replacing existing implicit constructor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.B")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void Field_Insert_ParameterlessConstructorInsert_WithInitializersAndLambdas() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); public C(int x) {} } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); public C(int x) {} public C() // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas, "public C()")); // TODO (bug https://github.com/dotnet/roslyn/issues/2504): //edits.VerifySemantics( // ActiveStatementsDescription.Empty, // new[] // { // SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<NamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) // }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void Field_Insert_ConstructorInsert_WithInitializersAndLambdas1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(b => b + 1); // new field public C(int x) // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); _ = GetSyntaxMap(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas, "public C(int x)")); // TODO (bug https://github.com/dotnet/roslyn/issues/2504): //edits.VerifySemantics( // ActiveStatementsDescription.Empty, // new[] // { // SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.B")), // SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<NamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) // }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void Field_Insert_ConstructorInsert_WithInitializersButNoExistingLambdas1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(null); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(null); int B = F(b => b + 1); // new field public C(int x) // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.B")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single()) }); } [Fact] public void Field_Insert_NotSupportedByRuntime() { var src1 = "class C { }"; var src2 = "class C { public int a = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities | EditAndContinueCapabilities.AddStaticFieldToExistingType, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "a = 1", FeaturesResources.field)); } [Fact] public void Field_Insert_Static_NotSupportedByRuntime() { var src1 = "class C { }"; var src2 = "class C { public static int a = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities | EditAndContinueCapabilities.AddInstanceFieldToExistingType, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "a = 1", FeaturesResources.field)); } [Fact] public void Field_Attribute_Add_NotSupportedByRuntime() { var src1 = @" class C { public int a = 1, x = 1; }"; var src2 = @" class C { [System.Obsolete]public int a = 1, x = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public int a = 1, x = 1;]@18 -> [[System.Obsolete]public int a = 1, x = 1;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "public int a = 1, x = 1", FeaturesResources.field), Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "public int a = 1, x = 1", FeaturesResources.field)); } [Fact] public void Field_Attribute_Add() { var src1 = @" class C { public int a, b; }"; var src2 = @" class C { [System.Obsolete]public int a, b; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.a")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.b")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_Attribute_Add_WithInitializer() { var src1 = @" class C { int a; }"; var src2 = @" class C { [System.Obsolete]int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.a")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_Attribute_DeleteInsertUpdate_WithInitializer() { var srcA1 = "partial class C { int a = 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { [System.Obsolete]int a = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.a"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_Delete1() { var src1 = "class C { int a = 1; }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [int a = 1;]@10", "Delete [int a = 1]@10", "Delete [a = 1]@14"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.field, "a"))); } [Fact] public void Field_UnsafeModifier_Update() { var src1 = "struct Node { unsafe Node* left; }"; var src2 = "struct Node { Node* left; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [unsafe Node* left;]@14 -> [Node* left;]@14"); edits.VerifyRudeDiagnostics(); } [Fact] public void Field_ModifierAndType_Update() { var src1 = "struct Node { unsafe Node* left; }"; var src2 = "struct Node { Node left; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [unsafe Node* left;]@14 -> [Node left;]@14", "Update [Node* left]@21 -> [Node left]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "Node left", FeaturesResources.field)); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Field_Type_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C { " + oldType + " F, G; }"; var src2 = "class C { " + newType + " F, G; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.G"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Field_Type_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C { " + oldType + " F, G; }"; var src2 = "class C { " + newType + " F, G; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, newType + " F, G", FeaturesResources.field), Diagnostic(RudeEditKind.TypeUpdate, newType + " F, G", FeaturesResources.field)); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Field_Event_Type_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C { event System.Action<" + oldType + "> F, G; }"; var src2 = "class C { event System.Action<" + newType + "> F, G; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.G"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Field_Event_Type_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C { event System.Action<" + oldType + "> F, G; }"; var src2 = "class C { event System.Action<" + newType + "> F, G; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "event System.Action<" + newType + "> F, G", FeaturesResources.event_), Diagnostic(RudeEditKind.TypeUpdate, "event System.Action<" + newType + "> F, G", FeaturesResources.event_)); } [Fact] public void Field_Type_Update_ReorderRemoveAdd() { var src1 = "class C { int F, G, H; bool U; }"; var src2 = "class C { string G, F; double V, U; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int F, G, H]@10 -> [string G, F]@10", "Reorder [G]@17 -> @17", "Update [bool U]@23 -> [double V, U]@23", "Insert [V]@30", "Delete [H]@20"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "G", FeaturesResources.field), Diagnostic(RudeEditKind.TypeUpdate, "string G, F", FeaturesResources.field), Diagnostic(RudeEditKind.TypeUpdate, "string G, F", FeaturesResources.field), Diagnostic(RudeEditKind.TypeUpdate, "double V, U", FeaturesResources.field), Diagnostic(RudeEditKind.Delete, "string G, F", DeletedSymbolDisplay(FeaturesResources.field, "H"))); } [Fact] public void Field_Event_Reorder() { var src1 = "class C { int a = 0; int b = 1; event int c = 2; }"; var src2 = "class C { event int c = 2; int a = 0; int b = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [event int c = 2;]@32 -> @10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "event int c = 2", CSharpFeaturesResources.event_field)); } [Fact] public void Field_Event_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { event int E = 2; }"; var srcA2 = "partial class C { event int E = 2; }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults(), }); } #endregion #region Properties [Theory] [InlineData("static")] [InlineData("virtual")] [InlineData("abstract")] [InlineData("override")] [InlineData("sealed override", "override")] public void Property_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "int F => 0; }"; var src2 = "class C { " + newModifiers + "int F => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "int F => 0;]@10 -> [" + newModifiers + "int F => 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "int F", FeaturesResources.property_)); } [Fact] public void Property_ExpressionBody_Rename() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int Q => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int Q", FeaturesResources.property_)); } [Fact] public void Property_ExpressionBody_Update() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int P => 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [int P => 1;]@10 -> [int P => 2;]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false) }); } [Fact, WorkItem(48628, "https://github.com/dotnet/roslyn/issues/48628")] public void Property_ExpressionBody_ModifierUpdate() { var src1 = "class C { int P => 1; }"; var src2 = "class C { unsafe int P => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [int P => 1;]@10 -> [unsafe int P => 1;]@10"); edits.VerifyRudeDiagnostics(); } [Fact] public void Property_ExpressionBodyToBlockBody1() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int P { get { return 2; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P => 1;]@10 -> [int P { get { return 2; } }]@10", "Insert [{ get { return 2; } }]@16", "Insert [get { return 2; }]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false) }); } [Fact] public void Property_ExpressionBodyToBlockBody2() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int P { get { return 2; } set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P => 1;]@10 -> [int P { get { return 2; } set { } }]@10", "Insert [{ get { return 2; } set { } }]@16", "Insert [get { return 2; }]@18", "Insert [set { }]@36"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.set_P"), preserveLocalVariables: false) }); } [Fact] public void Property_BlockBodyToExpressionBody1() { var src1 = "class C { int P { get { return 2; } } }"; var src2 = "class C { int P => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get { return 2; } }]@10 -> [int P => 1;]@10", "Delete [{ get { return 2; } }]@16", "Delete [get { return 2; }]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false) }); } [Fact] public void Property_BlockBodyToExpressionBody2() { var src1 = "class C { int P { get { return 2; } set { } } }"; var src2 = "class C { int P => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get { return 2; } set { } }]@10 -> [int P => 1;]@10", "Delete [{ get { return 2; } set { } }]@16", "Delete [get { return 2; }]@18", "Delete [set { }]@36"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_setter, "P.set"))); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_ExpressionBodyToGetterExpressionBody() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int P { get => 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P => 1;]@10 -> [int P { get => 2; }]@10", "Insert [{ get => 2; }]@16", "Insert [get => 2;]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterExpressionBodyToExpressionBody() { var src1 = "class C { int P { get => 2; } }"; var src2 = "class C { int P => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get => 2; }]@10 -> [int P => 1;]@10", "Delete [{ get => 2; }]@16", "Delete [get => 2;]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterBlockBodyToGetterExpressionBody() { var src1 = "class C { int P { get { return 2; } } }"; var src2 = "class C { int P { get => 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get { return 2; }]@18 -> [get => 2;]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_SetterBlockBodyToSetterExpressionBody() { var src1 = "class C { int P { set { } } }"; var src2 = "class C { int P { set => F(); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [set { }]@18 -> [set => F();]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_InitBlockBodyToInitExpressionBody() { var src1 = "class C { int P { init { } } }"; var src2 = "class C { int P { init => F(); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [init { }]@18 -> [init => F();]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod, preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterExpressionBodyToGetterBlockBody() { var src1 = "class C { int P { get => 2; } }"; var src2 = "class C { int P { get { return 2; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get => 2;]@18 -> [get { return 2; }]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterBlockBodyWithSetterToGetterExpressionBodyWithSetter() { var src1 = "class C { int P { get => 2; set { Console.WriteLine(0); } } }"; var src2 = "class C { int P { get { return 2; } set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get => 2;]@18 -> [get { return 2; }]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterExpressionBodyWithSetterToGetterBlockBodyWithSetter() { var src1 = "class C { int P { get { return 2; } set { Console.WriteLine(0); } } }"; var src2 = "class C { int P { get => 2; set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get { return 2; }]@18 -> [get => 2;]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_P"), preserveLocalVariables: false) }); } [Fact] public void Property_Rename1() { var src1 = "class C { int P { get { return 1; } } }"; var src2 = "class C { int Q { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int Q", FeaturesResources.property_)); } [Fact] public void Property_Rename2() { var src1 = "class C { int I.P { get { return 1; } } }"; var src2 = "class C { int J.P { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int J.P", FeaturesResources.property_)); } [Fact] public void Property_RenameAndUpdate() { var src1 = "class C { int P { get { return 1; } } }"; var src2 = "class C { int Q { get { return 2; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int Q", FeaturesResources.property_)); } [Fact] public void PropertyDelete() { var src1 = "class C { int P { get { return 1; } } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.property_, "P"))); } [Fact] public void PropertyReorder1() { var src1 = "class C { int P { get { return 1; } } int Q { get { return 1; } } }"; var src2 = "class C { int Q { get { return 1; } } int P { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int Q { get { return 1; } }]@38 -> @10"); // TODO: we can allow the move since the property doesn't have a backing field edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "int Q", FeaturesResources.property_)); } [Fact] public void PropertyReorder2() { var src1 = "class C { int P { get; set; } int Q { get; set; } }"; var src2 = "class C { int Q { get; set; } int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int Q { get; set; }]@30 -> @10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "int Q", FeaturesResources.auto_property)); } [Fact] public void PropertyAccessorReorder_GetSet() { var src1 = "class C { int P { get { return 1; } set { } } }"; var src2 = "class C { int P { set { } get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [set { }]@36 -> @18"); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyAccessorReorder_GetInit() { var src1 = "class C { int P { get { return 1; } init { } } }"; var src2 = "class C { int P { init { } get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [init { }]@36 -> @18"); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyTypeUpdate() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { char P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get; set; }]@10 -> [char P { get; set; }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "char P", FeaturesResources.property_)); } [Fact] public void PropertyUpdate_AddAttribute() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { [System.Obsolete]int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int P", FeaturesResources.property_)); } [Fact] public void PropertyUpdate_AddAttribute_SupportedByRuntime() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { [System.Obsolete]int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.P")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void PropertyAccessorUpdate_AddAttribute() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { [System.Obsolete]get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "get", CSharpFeaturesResources.property_getter)); } [Fact] public void PropertyAccessorUpdate_AddAttribute2() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { get; [System.Obsolete]set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "set", CSharpFeaturesResources.property_setter)); } [Fact] public void PropertyAccessorUpdate_AddAttribute_SupportedByRuntime() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { [System.Obsolete]get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void PropertyAccessorUpdate_AddAttribute_SupportedByRuntime2() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { get; [System.Obsolete]set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void PropertyInsert() { var src1 = "class C { }"; var src2 = "class C { int P { get => 1; set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("P"))); } [Fact] public void PropertyInsert_NotSupportedByRuntime() { var src1 = "class C { }"; var src2 = "class C { int P { get => 1; set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "int P", FeaturesResources.auto_property)); } [WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] [Fact] public void PropertyInsert_PInvoke() { var src1 = @" using System; using System.Runtime.InteropServices; class C { }"; var src2 = @" using System; using System.Runtime.InteropServices; class C { private static extern int P1 { [DllImport(""x.dll"")]get; } private static extern int P2 { [DllImport(""x.dll"")]set; } private static extern int P3 { [DllImport(""x.dll"")]get; [DllImport(""x.dll"")]set; } } "; var edits = GetTopEdits(src1, src2); // CLR doesn't support methods without a body edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertExtern, "private static extern int P1", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertExtern, "private static extern int P2", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertExtern, "private static extern int P3", FeaturesResources.property_)); } [Fact] public void PropertyInsert_IntoStruct() { var src1 = @" struct S { public int a; public S(int z) { a = z; } } "; var src2 = @" struct S { public int a; private static int c { get; set; } private static int e { get { return 0; } set { } } private static int g { get; } = 1; private static int i { get; set; } = 1; private static int k => 1; public S(int z) { a = z; } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoStruct, "private static int c { get; set; }", FeaturesResources.auto_property, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "private static int g { get; } = 1;", FeaturesResources.auto_property, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "private static int i { get; set; } = 1;", FeaturesResources.auto_property, CSharpFeaturesResources.struct_)); } [Fact] public void PropertyInsert_IntoLayoutClass_Sequential() { var src1 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private int a; } "; var src2 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private int a; private int b { get; set; } private static int c { get; set; } private int d { get { return 0; } set { } } private static int e { get { return 0; } set { } } private int f { get; } = 1; private static int g { get; } = 1; private int h { get; set; } = 1; private static int i { get; set; } = 1; private int j => 1; private static int k => 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private int b { get; set; }", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private static int c { get; set; }", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private int f { get; } = 1;", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private static int g { get; } = 1;", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private int h { get; set; } = 1;", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private static int i { get; set; } = 1;", FeaturesResources.auto_property, FeaturesResources.class_)); } // Design: Adding private accessors should also be allowed since we now allow adding private methods // and adding public properties and/or public accessors are not allowed. [Fact] public void PrivateProperty_AccessorAdd() { var src1 = "class C { int _p; int P { get { return 1; } } }"; var src2 = "class C { int _p; int P { get { return 1; } set { _p = value; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set { _p = value; }]@44"); edits.VerifyRudeDiagnostics(); } [WorkItem(755975, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755975")] [Fact] public void PrivatePropertyAccessorDelete() { var src1 = "class C { int _p; int P { get { return 1; } set { _p = value; } } }"; var src2 = "class C { int _p; int P { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [set { _p = value; }]@44"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_setter, "P.set"))); } [Fact] public void PrivateAutoPropertyAccessorAdd1() { var src1 = "class C { int P { get; } }"; var src2 = "class C { int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set;]@23"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd2() { var src1 = "class C { public int P { get; } }"; var src2 = "class C { public int P { get; private set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [private set;]@30"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd4() { var src1 = "class C { public int P { get; } }"; var src2 = "class C { public int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set;]@30"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd5() { var src1 = "class C { public int P { get; } }"; var src2 = "class C { public int P { get; internal set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [internal set;]@30"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd6() { var src1 = "class C { int P { get; } = 1; }"; var src2 = "class C { int P { get; set; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set;]@23"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd_Init() { var src1 = "class C { int P { get; } = 1; }"; var src2 = "class C { int P { get; init; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [init;]@23"); edits.VerifyRudeDiagnostics(); } [WorkItem(755975, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755975")] [Fact] public void PrivateAutoPropertyAccessorDelete_Get() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [get;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_getter, "P.get"))); } [Fact] public void AutoPropertyAccessor_SetToInit() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { get; init; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [set;]@23 -> [init;]@23"); // not allowed since it changes the backing field readonly-ness and the signature of the setter (modreq) edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.AccessorKindUpdate, "init", CSharpFeaturesResources.property_setter)); } [Fact] public void AutoPropertyAccessor_InitToSet() { var src1 = "class C { int P { get; init; } }"; var src2 = "class C { int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [init;]@23 -> [set;]@23"); // not allowed since it changes the backing field readonly-ness and the signature of the setter (modreq) edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.AccessorKindUpdate, "set", CSharpFeaturesResources.property_setter)); } [Fact] public void PrivateAutoPropertyAccessorDelete_Set() { var src1 = "class C { int P { get; set; } = 1; }"; var src2 = "class C { int P { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [set;]@23"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_setter, "P.set"))); } [Fact] public void PrivateAutoPropertyAccessorDelete_Init() { var src1 = "class C { int P { get; init; } = 1; }"; var src2 = "class C { int P { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [init;]@23"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_setter, "P.init"))); } [Fact] public void AutoPropertyAccessorUpdate() { var src1 = "class C { int P { get; } }"; var src2 = "class C { int P { set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get;]@18 -> [set;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.AccessorKindUpdate, "set", CSharpFeaturesResources.property_setter)); } [WorkItem(992578, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/992578")] [Fact] public void InsertIncompleteProperty() { var src1 = "class C { }"; var src2 = "class C { public int P { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [public int P { }]@10", "Insert [{ }]@23"); edits.VerifyRudeDiagnostics(); } [Fact] public void Property_ReadOnlyRef_Insert() { var src1 = "class Test { }"; var src2 = "class Test { ref readonly int P { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [ref readonly int P { get; }]@13", "Insert [{ get; }]@32", "Insert [get;]@34"); edits.VerifyRudeDiagnostics(); } [Fact] public void Property_ReadOnlyRef_Update() { var src1 = "class Test { int P { get; } }"; var src2 = "class Test { ref readonly int P { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get; }]@13 -> [ref readonly int P { get; }]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "ref readonly int P", FeaturesResources.property_)); } [Fact] public void Property_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int P { get => 1; set { } } }"; var srcA2 = "partial class C { int P { get => 1; set { } } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) }), DocumentResults(), }); } [Fact] public void PropertyInit_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int Q { get => 1; init { } }}"; var srcA2 = "partial class C { int Q { get => 1; init { } }}"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod) }), DocumentResults(), }); } [Fact] public void AutoProperty_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int P { get; set; } int Q { get; init; } }"; var srcA2 = "partial class C { int P { get; set; } int Q { get; init; } }"; var srcB2 = "partial class C { }"; // Accessors need to be updated even though they do not have an explicit body. // There is still a sequence point generated for them whose location needs to be updated. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod), }), DocumentResults(), }); } [Fact] public void AutoPropertyWithInitializer_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int P { get; set; } = 1; }"; var srcA2 = "partial class C { int P { get; set; } = 1; }"; var srcB2 = "partial class C { }"; // Accessors need to be updated even though they do not have an explicit body. // There is still a sequence point generated for them whose location needs to be updated. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults(), }); } [Fact] public void PropertyWithExpressionBody_Partial_InsertDeleteUpdate() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int P => 1; }"; var srcA2 = "partial class C { int P => 2; }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod) }), DocumentResults(), }); } [Fact] public void AutoProperty_ReadOnly_Add() { var src1 = @" struct S { int P { get; } }"; var src2 = @" struct S { readonly int P { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void Property_InMutableStruct_ReadOnly_Add() { var src1 = @" struct S { int P1 { get => 1; } int P2 { get => 1; set {}} int P3 { get => 1; set {}} int P4 { get => 1; set {}} }"; var src2 = @" struct S { readonly int P1 { get => 1; } int P2 { readonly get => 1; set {}} int P3 { get => 1; readonly set {}} readonly int P4 { get => 1; set {}} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int P1", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int P4", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int P4", CSharpFeaturesResources.property_setter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly get", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly set", CSharpFeaturesResources.property_setter)); } [Fact] public void Property_InReadOnlyStruct_ReadOnly_Add() { // indent to align accessor bodies and avoid updates caused by sequence point location changes var src1 = @" readonly struct S { int P1 { get => 1; } int P2 { get => 1; set {}} int P3 { get => 1; set {}} int P4 { get => 1; set {}} }"; var src2 = @" readonly struct S { readonly int P1 { get => 1; } int P2 { readonly get => 1; set {}} int P3 { get => 1; readonly set {}} readonly int P4 { get => 1; set {}} }"; var edits = GetTopEdits(src1, src2); // updates only for accessors whose modifiers were explicitly updated edits.VerifySemantics(new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IPropertySymbol>("P2").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IPropertySymbol>("P3").SetMethod, preserveLocalVariables: false) }); } #endregion #region Indexers [Theory] [InlineData("virtual")] [InlineData("abstract")] [InlineData("override")] [InlineData("sealed override", "override")] public void Indexer_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "int this[int a] => 0; }"; var src2 = "class C { " + newModifiers + "int this[int a] => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "int this[int a] => 0;]@10 -> [" + newModifiers + "int this[int a] => 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "int this[int a]", FeaturesResources.indexer_)); } [Fact] public void Indexer_GetterUpdate() { var src1 = "class C { int this[int a] { get { return 1; } } }"; var src2 = "class C { int this[int a] { get { return 2; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [get { return 1; }]@28 -> [get { return 2; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact] public void Indexer_SetterUpdate() { var src1 = "class C { int this[int a] { get { return 1; } set { System.Console.WriteLine(value); } } }"; var src2 = "class C { int this[int a] { get { return 1; } set { System.Console.WriteLine(value + 1); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [set { System.Console.WriteLine(value); }]@46 -> [set { System.Console.WriteLine(value + 1); }]@46"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: false) }); } [Fact] public void Indexer_InitUpdate() { var src1 = "class C { int this[int a] { get { return 1; } init { System.Console.WriteLine(value); } } }"; var src2 = "class C { int this[int a] { get { return 1; } init { System.Console.WriteLine(value + 1); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [init { System.Console.WriteLine(value); }]@46 -> [init { System.Console.WriteLine(value + 1); }]@46"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: false) }); } [Fact] public void IndexerWithExpressionBody_Update() { var src1 = "class C { int this[int a] => 1; }"; var src2 = "class C { int this[int a] => 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => 1;]@10 -> [int this[int a] => 2;]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Update_LiftedParameter() { var src1 = @" using System; class C { int this[int a] => new Func<int>(() => a + 1)() + 10; } "; var src2 = @" using System; class C { int this[int a] => new Func<int>(() => 2)() + 11; // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => new Func<int>(() => a + 1)() + 10;]@35 -> [int this[int a] => new Func<int>(() => 2)() + 11;]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Update_LiftedParameter_2() { var src1 = @" using System; class C { int this[int a] => new Func<int>(() => a + 1)(); } "; var src2 = @" using System; class C { int this[int a] => new Func<int>(() => 2)(); // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => new Func<int>(() => a + 1)();]@35 -> [int this[int a] => new Func<int>(() => 2)();]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Update_LiftedParameter_3() { var src1 = @" using System; class C { int this[int a] => new Func<int>(() => { return a + 1; })(); } "; var src2 = @" using System; class C { int this[int a] => new Func<int>(() => { return 2; })(); // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => new Func<int>(() => { return a + 1; })();]@35 -> [int this[int a] => new Func<int>(() => { return 2; })();]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Update_LiftedParameter_4() { var src1 = @" using System; class C { int this[int a] => new Func<int>(delegate { return a + 1; })(); } "; var src2 = @" using System; class C { int this[int a] => new Func<int>(delegate { return 2; })(); // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => new Func<int>(delegate { return a + 1; })();]@35 -> [int this[int a] => new Func<int>(delegate { return 2; })();]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_ExpressionBodyToBlockBody() { var src1 = "class C { int this[int a] => 1; }"; var src2 = "class C { int this[int a] { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => 1;]@10 -> [int this[int a] { get { return 1; } }]@10", "Insert [{ get { return 1; } }]@26", "Insert [get { return 1; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_BlockBodyToExpressionBody() { var src1 = "class C { int this[int a] { get { return 1; } } }"; var src2 = "class C { int this[int a] => 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] { get { return 1; } }]@10 -> [int this[int a] => 1;]@10", "Delete [{ get { return 1; } }]@26", "Delete [get { return 1; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterExpressionBodyToBlockBody() { var src1 = "class C { int this[int a] { get => 1; } }"; var src2 = "class C { int this[int a] { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get => 1;]@28 -> [get { return 1; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_BlockBodyToGetterExpressionBody() { var src1 = "class C { int this[int a] { get { return 1; } } }"; var src2 = "class C { int this[int a] { get => 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get { return 1; }]@28 -> [get => 1;]@28"); edits.VerifyRudeDiagnostics(); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterExpressionBodyToExpressionBody() { var src1 = "class C { int this[int a] { get => 1; } }"; var src2 = "class C { int this[int a] => 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] { get => 1; }]@10 -> [int this[int a] => 1;]@10", "Delete [{ get => 1; }]@26", "Delete [get => 1;]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_ExpressionBodyToGetterExpressionBody() { var src1 = "class C { int this[int a] => 1; }"; var src2 = "class C { int this[int a] { get => 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => 1;]@10 -> [int this[int a] { get => 1; }]@10", "Insert [{ get => 1; }]@26", "Insert [get => 1;]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterBlockBodyToGetterExpressionBody() { var src1 = "class C { int this[int a] { get { return 1; } set { Console.WriteLine(0); } } }"; var src2 = "class C { int this[int a] { get => 1; set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get { return 1; }]@28 -> [get => 1;]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_SetterBlockBodyToSetterExpressionBody() { var src1 = "class C { int this[int a] { set { } } void F() { } }"; var src2 = "class C { int this[int a] { set => F(); } void F() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [set { }]@28 -> [set => F();]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_InitBlockBodyToInitExpressionBody() { var src1 = "class C { int this[int a] { init { } } void F() { } }"; var src2 = "class C { int this[int a] { init => F(); } void F() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [init { }]@28 -> [init => F();]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterExpressionBodyToGetterBlockBody() { var src1 = "class C { int this[int a] { get => 1; set { Console.WriteLine(0); } } }"; var src2 = "class C { int this[int a] { get { return 1; } set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get => 1;]@28 -> [get { return 1; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterAndSetterBlockBodiesToExpressionBody() { var src1 = "class C { int this[int a] { get { return 1; } set { Console.WriteLine(0); } } }"; var src2 = "class C { int this[int a] => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] { get { return 1; } set { Console.WriteLine(0); } }]@10 -> [int this[int a] => 1;]@10", "Delete [{ get { return 1; } set { Console.WriteLine(0); } }]@26", "Delete [get { return 1; }]@28", "Delete [set { Console.WriteLine(0); }]@46"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int this[int a]", DeletedSymbolDisplay(CSharpFeaturesResources.indexer_setter, "this[int a].set"))); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_ExpressionBodyToGetterAndSetterBlockBodies() { var src1 = "class C { int this[int a] => 1; }"; var src2 = "class C { int this[int a] { get { return 1; } set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => 1;]@10 -> [int this[int a] { get { return 1; } set { Console.WriteLine(0); } }]@10", "Insert [{ get { return 1; } set { Console.WriteLine(0); } }]@26", "Insert [get { return 1; }]@28", "Insert [set { Console.WriteLine(0); }]@46"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.set_Item"), preserveLocalVariables: false) }); } [Fact] public void Indexer_Rename() { var src1 = "class C { int I.this[int a] { get { return 1; } } }"; var src2 = "class C { int J.this[int a] { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int J.this[int a]", CSharpFeaturesResources.indexer)); } [Fact] public void Indexer_Reorder1() { var src1 = "class C { int this[int a] { get { return 1; } } int this[string a] { get { return 1; } } }"; var src2 = "class C { int this[string a] { get { return 1; } } int this[int a] { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int this[string a] { get { return 1; } }]@48 -> @10"); edits.VerifyRudeDiagnostics(); } [Fact] public void Indexer_AccessorReorder() { var src1 = "class C { int this[int a] { get { return 1; } set { } } }"; var src2 = "class C { int this[int a] { set { } get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [set { }]@46 -> @28"); edits.VerifyRudeDiagnostics(); } [Fact] public void Indexer_TypeUpdate() { var src1 = "class C { int this[int a] { get; set; } }"; var src2 = "class C { string this[int a] { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] { get; set; }]@10 -> [string this[int a] { get; set; }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "string this[int a]", CSharpFeaturesResources.indexer)); } [Fact] public void Tuple_TypeUpdate() { var src1 = "class C { (int, int) M() { throw new System.Exception(); } }"; var src2 = "class C { (string, int) M() { throw new System.Exception(); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int, int) M() { throw new System.Exception(); }]@10 -> [(string, int) M() { throw new System.Exception(); }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "(string, int) M()", FeaturesResources.method)); } [Fact] public void TupleElementDelete() { var src1 = "class C { (int, int, int a) M() { return (1, 2, 3); } }"; var src2 = "class C { (int, int) M() { return (1, 2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int, int, int a) M() { return (1, 2, 3); }]@10 -> [(int, int) M() { return (1, 2); }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "(int, int) M()", FeaturesResources.method)); } [Fact] public void TupleElementAdd() { var src1 = "class C { (int, int) M() { return (1, 2); } }"; var src2 = "class C { (int, int, int a) M() { return (1, 2, 3); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int, int) M() { return (1, 2); }]@10 -> [(int, int, int a) M() { return (1, 2, 3); }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "(int, int, int a) M()", FeaturesResources.method)); } [Fact] public void Indexer_ParameterUpdate() { var src1 = "class C { int this[int a] { get; set; } }"; var src2 = "class C { int this[string a] { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "string a", FeaturesResources.parameter)); } [Fact] public void Indexer_AddGetAccessor() { var src1 = @" class Test { static void Main(string[] args) { SampleCollection<string> stringCollection = new SampleCollection<string>(); stringCollection[0] = ""hello""; } } class SampleCollection<T> { private T[] arr = new T[100]; public T this[int i] { set { arr[i] = value; } } }"; var src2 = @" class Test { static void Main(string[] args) { SampleCollection<string> stringCollection = new SampleCollection<string>(); stringCollection[0] = ""hello""; } } class SampleCollection<T> { private T[] arr = new T[100]; public T this[int i] { get { return arr[i]; } set { arr[i] = value; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [get { return arr[i]; }]@304"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InsertIntoGenericType, "get", CSharpFeaturesResources.indexer_getter)); } [Fact] public void Indexer_AddSetAccessor() { var src1 = @" class C { public int this[int i] { get { return default; } } }"; var src2 = @" class C { public int this[int i] { get { return default; } set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set { }]@67"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod)); } [Fact] public void Indexer_AddSetAccessor_GenericType() { var src1 = @" class C<T> { public T this[int i] { get { return default; } } }"; var src2 = @" class C<T> { public T this[int i] { get { return default; } set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set { }]@68"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoGenericType, "set", CSharpFeaturesResources.indexer_setter)); } [WorkItem(750109, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/750109")] [Fact] public void Indexer_DeleteGetAccessor() { var src1 = @" class C<T> { public T this[int i] { get { return arr[i]; } set { arr[i] = value; } } }"; var src2 = @" class C<T> { public T this[int i] { set { arr[i] = value; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [get { return arr[i]; }]@58"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "public T this[int i]", DeletedSymbolDisplay(CSharpFeaturesResources.indexer_getter, "this[int i].get"))); } [Fact] public void Indexer_DeleteSetAccessor() { var src1 = @" class C { public int this[int i] { get { return 0; } set { } } }"; var src2 = @" class C { public int this[int i] { get { return 0; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [set { }]@61"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "public int this[int i]", DeletedSymbolDisplay(CSharpFeaturesResources.indexer_setter, "this[int i].set"))); } [Fact, WorkItem(1174850, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1174850")] public void Indexer_Insert() { var src1 = "struct C { }"; var src2 = "struct C { public int this[int x, int y] { get { return x + y; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void Indexer_ReadOnlyRef_Parameter_InsertWhole() { var src1 = "class Test { }"; var src2 = "class Test { int this[in int i] => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int this[in int i] => throw null;]@13", "Insert [[in int i]]@21", "Insert [in int i]@22"); edits.VerifyRudeDiagnostics(); } [Fact] public void Indexer_ReadOnlyRef_Parameter_Update() { var src1 = "class Test { int this[int i] => throw null; }"; var src2 = "class Test { int this[in int i] => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int i]@22 -> [in int i]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in int i", FeaturesResources.parameter)); } [Fact] public void Indexer_ReadOnlyRef_ReturnType_Insert() { var src1 = "class Test { }"; var src2 = "class Test { ref readonly int this[int i] => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [ref readonly int this[int i] => throw null;]@13", "Insert [[int i]]@34", "Insert [int i]@35"); edits.VerifyRudeDiagnostics(); } [Fact] public void Indexer_ReadOnlyRef_ReturnType_Update() { var src1 = "class Test { int this[int i] => throw null; }"; var src2 = "class Test { ref readonly int this[int i] => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int i] => throw null;]@13 -> [ref readonly int this[int i] => throw null;]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "ref readonly int this[int i]", FeaturesResources.indexer_)); } [Fact] public void Indexer_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int this[int x] { get => 1; set { } } }"; var srcA2 = "partial class C { int this[int x] { get => 1; set { } } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod) }), DocumentResults(), }); } [Fact] public void IndexerInit_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int this[int x] { get => 1; init { } }}"; var srcA2 = "partial class C { int this[int x] { get => 1; init { } }}"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod) }), DocumentResults(), }); } [Fact] public void AutoIndexer_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int this[int x] { get; set; } }"; var srcA2 = "partial class C { int this[int x] { get; set; } }"; var srcB2 = "partial class C { }"; // Accessors need to be updated even though they do not have an explicit body. // There is still a sequence point generated for them whose location needs to be updated. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod), }), DocumentResults(), }); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Partial_InsertDeleteUpdate_LiftedParameter() { var srcA1 = @" partial class C { }"; var srcB1 = @" partial class C { int this[int a] => new System.Func<int>(() => a + 1); }"; var srcA2 = @" partial class C { int this[int a] => new System.Func<int>(() => 2); // no capture }"; var srcB2 = @" partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a") }), DocumentResults(), }); } [Fact] public void AutoIndexer_ReadOnly_Add() { var src1 = @" struct S { int this[int x] { get; } }"; var src2 = @" struct S { readonly int this[int x] { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int this[int x]", CSharpFeaturesResources.indexer_getter)); } [Fact] public void Indexer_InMutableStruct_ReadOnly_Add() { var src1 = @" struct S { int this[int x] { get => 1; } int this[uint x] { get => 1; set {}} int this[byte x] { get => 1; set {}} int this[sbyte x] { get => 1; set {}} }"; var src2 = @" struct S { readonly int this[int x] { get => 1; } int this[uint x] { readonly get => 1; set {}} int this[byte x] { get => 1; readonly set {}} readonly int this[sbyte x] { get => 1; set {}} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int this[int x]", CSharpFeaturesResources.indexer_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int this[sbyte x]", CSharpFeaturesResources.indexer_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int this[sbyte x]", CSharpFeaturesResources.indexer_setter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly get", CSharpFeaturesResources.indexer_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly set", CSharpFeaturesResources.indexer_setter)); } [Fact] public void Indexer_InReadOnlyStruct_ReadOnly_Add() { // indent to align accessor bodies and avoid updates caused by sequence point location changes var src1 = @" readonly struct S { int this[int x] { get => 1; } int this[uint x] { get => 1; set {}} int this[byte x] { get => 1; set {}} int this[sbyte x] { get => 1; set {}} }"; var src2 = @" readonly struct S { readonly int this[int x] { get => 1; } int this[uint x] { readonly get => 1; set {}} int this[byte x] { get => 1; readonly set {}} readonly int this[sbyte x] { get => 1; set {}} }"; var edits = GetTopEdits(src1, src2); // updates only for accessors whose modifiers were explicitly updated edits.VerifySemantics(new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.Parameters.Single().Type.Name == "UInt32").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.Parameters.Single().Type.Name == "Byte").SetMethod, preserveLocalVariables: false) }); } #endregion #region Events [Theory] [InlineData("static")] [InlineData("virtual")] [InlineData("abstract")] [InlineData("override")] [InlineData("sealed override", "override")] public void Event_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "event Action F { add {} remove {} } }"; var src2 = "class C { " + newModifiers + "event Action F { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "event Action F { add {} remove {} }]@10 -> [" + newModifiers + "event Action F { add {} remove {} }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "event Action F", FeaturesResources.event_)); } [Fact] public void Event_Accessor_Reorder1() { var src1 = "class C { event int E { add { } remove { } } }"; var src2 = "class C { event int E { remove { } add { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [remove { }]@32 -> @24"); edits.VerifyRudeDiagnostics(); } [Fact] public void Event_Accessor_Reorder2() { var src1 = "class C { event int E1 { add { } remove { } } event int E1 { add { } remove { } } }"; var src2 = "class C { event int E2 { remove { } add { } } event int E2 { remove { } add { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [event int E1 { add { } remove { } }]@10 -> [event int E2 { remove { } add { } }]@10", "Update [event int E1 { add { } remove { } }]@49 -> [event int E2 { remove { } add { } }]@49", "Reorder [remove { }]@33 -> @25", "Reorder [remove { }]@72 -> @64"); } [Fact] public void Event_Accessor_Reorder3() { var src1 = "class C { event int E1 { add { } remove { } } event int E2 { add { } remove { } } }"; var src2 = "class C { event int E2 { remove { } add { } } event int E1 { remove { } add { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [event int E2 { add { } remove { } }]@49 -> @10", "Reorder [remove { }]@72 -> @25", "Reorder [remove { }]@33 -> @64"); } [Fact] public void Event_Insert() { var src1 = "class C { }"; var src2 = "class C { event int E { remove { } add { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("E"))); } [Fact] public void Event_Delete() { var src1 = "class C { event int E { remove { } add { } } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.event_, "E"))); } [Fact] public void Event_Insert_IntoLayoutClass_Sequential() { var src1 = @" using System; using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { } "; var src2 = @" using System; using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private event Action c { add { } remove { } } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Event_ExpressionBodyToBlockBody() { var src1 = @" using System; public class C { event Action E { add => F(); remove => F(); } } "; var src2 = @" using System; public class C { event Action E { add { F(); } remove { } } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [add => F();]@57 -> [add { F(); }]@56", "Update [remove => F();]@69 -> [remove { }]@69" ); edits.VerifySemanticDiagnostics(); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Event_BlockBodyToExpressionBody() { var src1 = @" using System; public class C { event Action E { add { F(); } remove { } } } "; var src2 = @" using System; public class C { event Action E { add => F(); remove => F(); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [add { F(); }]@56 -> [add => F();]@57", "Update [remove { }]@69 -> [remove => F();]@69" ); edits.VerifySemanticDiagnostics(); } [Fact] public void Event_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { event int E { add { } remove { } } }"; var srcA2 = "partial class C { event int E { add { } remove { } } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").AddMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").RemoveMethod) }), DocumentResults(), }); } [Fact] public void Event_InMutableStruct_ReadOnly_Add() { var src1 = @" struct S { public event Action E { add {} remove {} } }"; var src2 = @" struct S { public readonly event Action E { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public readonly event Action E", FeaturesResources.event_)); } [Fact] public void Event_InReadOnlyStruct_ReadOnly_Add1() { var src1 = @" readonly struct S { public event Action E { add {} remove {} } }"; var src2 = @" readonly struct S { public readonly event Action E { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); // Currently, an edit is produced eventhough bodies nor IsReadOnly attribute have changed. Consider improving. edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IEventSymbol>("E").AddMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IEventSymbol>("E").RemoveMethod)); } [Fact] public void Field_Event_Attribute_Add() { var src1 = @" class C { event Action F; }"; var src2 = @" class C { [System.Obsolete]event Action F; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [event Action F;]@18 -> [[System.Obsolete]event Action F;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "event Action F", FeaturesResources.event_)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Event_Attribute_Add() { var src1 = @" class C { event Action F { add {} remove {} } }"; var src2 = @" class C { [System.Obsolete]event Action F { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [event Action F { add {} remove {} }]@18 -> [[System.Obsolete]event Action F { add {} remove {} }]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "event Action F", FeaturesResources.event_)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").AddMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").RemoveMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Event_Accessor_Attribute_Add() { var src1 = @" class C { event Action F { add {} remove {} } }"; var src2 = @" class C { event Action F { add {} [System.Obsolete]remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [remove {}]@42 -> [[System.Obsolete]remove {}]@42"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "remove", FeaturesResources.event_accessor)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").RemoveMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_Event_Attribute_Delete() { var src1 = @" class C { [System.Obsolete]event Action F; }"; var src2 = @" class C { event Action F; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete]event Action F;]@18 -> [event Action F;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "event Action F", FeaturesResources.event_)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Event_Attribute_Delete() { var src1 = @" class C { [System.Obsolete]event Action F { add {} remove {} } }"; var src2 = @" class C { event Action F { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete]event Action F { add {} remove {} }]@18 -> [event Action F { add {} remove {} }]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "event Action F", FeaturesResources.event_)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").AddMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").RemoveMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Event_Accessor_Attribute_Delete() { var src1 = @" class C { event Action F { add {} [System.Obsolete]remove {} } }"; var src2 = @" class C { event Action F { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete]remove {}]@42 -> [remove {}]@42"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "remove", FeaturesResources.event_accessor)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").RemoveMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } #endregion #region Parameter [Fact] public void ParameterRename_Method1() { var src1 = @"class C { public void M(int a) {} }"; var src2 = @"class C { public void M(int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@24 -> [int b]@24"); } [Fact] public void ParameterRename_Ctor1() { var src1 = @"class C { public C(int a) {} }"; var src2 = @"class C { public C(int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@19 -> [int b]@19"); } [Fact] public void ParameterRename_Operator1() { var src1 = @"class C { public static implicit operator int(C a) {} }"; var src2 = @"class C { public static implicit operator int(C b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [C a]@46 -> [C b]@46"); } [Fact] public void ParameterRename_Operator2() { var src1 = @"class C { public static int operator +(C a, C b) { return 0; } }"; var src2 = @"class C { public static int operator +(C a, C x) { return 0; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [C b]@44 -> [C x]@44"); } [Fact] public void ParameterRename_Indexer2() { var src1 = @"class C { public int this[int a, int b] { get { return 0; } } }"; var src2 = @"class C { public int this[int a, int x] { get { return 0; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int b]@33 -> [int x]@33"); } [Fact] public void ParameterInsert1() { var src1 = @"class C { public void M() {} }"; var src2 = @"class C { public void M(int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int a]@24"); } [Fact] public void ParameterInsert2() { var src1 = @"class C { public void M(int a) {} }"; var src2 = @"class C { public void M(int a, ref int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int a)]@23 -> [(int a, ref int b)]@23", "Insert [ref int b]@31"); } [Fact] public void ParameterDelete1() { var src1 = @"class C { public void M(int a) {} }"; var src2 = @"class C { public void M() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [int a]@24"); } [Fact] public void ParameterDelete2() { var src1 = @"class C { public void M(int a, int b) {} }"; var src2 = @"class C { public void M(int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int a, int b)]@23 -> [(int b)]@23", "Delete [int a]@24"); } [Fact] public void ParameterUpdate() { var src1 = @"class C { public void M(int a) {} }"; var src2 = @"class C { public void M(int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@24 -> [int b]@24"); } [Fact] public void ParameterReorder() { var src1 = @"class C { public void M(int a, int b) {} }"; var src2 = @"class C { public void M(int b, int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int b]@31 -> @24"); } [Fact] public void ParameterReorderAndUpdate() { var src1 = @"class C { public void M(int a, int b) {} }"; var src2 = @"class C { public void M(int b, int c) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int b]@31 -> @24", "Update [int a]@24 -> [int c]@31"); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Parameter_Type_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C { static void M(" + oldType + " a) {} }"; var src2 = "class C { static void M(" + newType + " a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Parameter_Type_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C { static void M(" + oldType + " a) {} }"; var src2 = "class C { static void M(" + newType + " a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, newType + " a", FeaturesResources.parameter)); } [Fact] public void Parameter_Type_Nullable() { var src1 = @" #nullable enable class C { static void M(string a) { } } "; var src2 = @" #nullable disable class C { static void M(string a) { } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Theory] [InlineData("this")] [InlineData("ref")] [InlineData("out")] [InlineData("params")] public void Parameter_Modifier_Remove(string modifier) { var src1 = @"static class C { static void F(" + modifier + " int[] a) { } }"; var src2 = @"static class C { static void F(int[] a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "int[] a", FeaturesResources.parameter)); } [Theory] [InlineData("int a = 1", "int a = 2")] [InlineData("int a = 1", "int a")] [InlineData("int a", "int a = 2")] [InlineData("object a = null", "object a")] [InlineData("object a", "object a = null")] [InlineData("double a = double.NaN", "double a = 1.2")] public void Parameter_Initializer_Update(string oldParameter, string newParameter) { var src1 = @"static class C { static void F(" + oldParameter + ") { } }"; var src2 = @"static class C { static void F(" + newParameter + ") { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, newParameter, FeaturesResources.parameter)); } [Fact] public void Parameter_Initializer_NaN() { var src1 = @"static class C { static void F(double a = System.Double.NaN) { } }"; var src2 = @"static class C { static void F(double a = double.NaN) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Parameter_Initializer_InsertDeleteUpdate() { var srcA1 = @"partial class C { }"; var srcB1 = @"partial class C { public static void F(int x = 1) {} }"; var srcA2 = @"partial class C { public static void F(int x = 2) {} }"; var srcB2 = @"partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "int x = 2", FeaturesResources.parameter) }), DocumentResults(), }); } [Fact] public void Parameter_Attribute_Insert() { var attribute = "public class A : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M(int a) {} }"; var src2 = attribute + @"class C { public void M([A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@63 -> [[A]int a]@63"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Parameter_Attribute_Insert_SupportedByRuntime_SecurityAttribute1() { var attribute = "public class AAttribute : System.Security.Permissions.SecurityAttribute { }\n\n"; var src1 = attribute + @"class C { public void M(int a) {} }"; var src2 = attribute + @"class C { public void M([A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@101 -> [[A]int a]@101"); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.ChangingNonCustomAttribute, "int a", "AAttribute", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Insert_SupportedByRuntime_SecurityAttribute2() { var attribute = "public class BAttribute : System.Security.Permissions.SecurityAttribute { }\n\n" + "public class AAttribute : BAttribute { }\n\n"; var src1 = attribute + @"class C { public void M(int a) {} }"; var src2 = attribute + @"class C { public void M([A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@143 -> [[A]int a]@143"); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.ChangingNonCustomAttribute, "int a", "AAttribute", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Insert_NotSupportedByRuntime1() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M(int a) {} }"; var src2 = attribute + @"class C { public void M([A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@72 -> [[A]int a]@72"); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Insert_NotSupportedByRuntime2() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M([A]int a) {} }"; var src2 = attribute + @"class C { public void M([A, B]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]int a]@120 -> [[A, B]int a]@120"); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Delete_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M([A]int a) {} }"; var src2 = attribute + @"class C { public void M(int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]int a]@72 -> [int a]@72"); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Update_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M([System.Obsolete(""1""), B]int a) {} }"; var src2 = attribute + @"class C { public void M([System.Obsolete(""2""), A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\"), B]int a]@120 -> [[System.Obsolete(\"2\"), A]int a]@120"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Update() { var attribute = "class A : System.Attribute { public A(int x) {} } "; var src1 = attribute + "class C { void F([A(0)]int a) {} }"; var src2 = attribute + "class C { void F([A(1)]int a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A(0)]int a]@67 -> [[A(1)]int a]@67"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Parameter_Attribute_Update_WithBodyUpdate() { var attribute = "class A : System.Attribute { public A(int x) {} } "; var src1 = attribute + "class C { void F([A(0)]int a) { F(0); } }"; var src2 = attribute + "class C { void F([A(1)]int a) { F(1); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [void F([A(0)]int a) { F(0); }]@60 -> [void F([A(1)]int a) { F(1); }]@60", "Update [[A(0)]int a]@67 -> [[A(1)]int a]@67"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } #endregion #region Method Type Parameter [Fact] public void MethodTypeParameterInsert1() { var src1 = @"class C { public void M() {} }"; var src2 = @"class C { public void M<A>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [<A>]@23", "Insert [A]@24"); } [Fact] public void MethodTypeParameterInsert2() { var src1 = @"class C { public void M<A>() {} }"; var src2 = @"class C { public void M<A,B>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [<A>]@23 -> [<A,B>]@23", "Insert [B]@26"); } [Fact] public void MethodTypeParameterDelete1() { var src1 = @"class C { public void M<A>() {} }"; var src2 = @"class C { public void M() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [<A>]@23", "Delete [A]@24"); } [Fact] public void MethodTypeParameterDelete2() { var src1 = @"class C { public void M<A,B>() {} }"; var src2 = @"class C { public void M<B>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [<A,B>]@23 -> [<B>]@23", "Delete [A]@24"); } [Fact] public void MethodTypeParameterUpdate() { var src1 = @"class C { public void M<A>() {} }"; var src2 = @"class C { public void M<B>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [A]@24 -> [B]@24"); } [Fact] public void MethodTypeParameterReorder() { var src1 = @"class C { public void M<A,B>() {} }"; var src2 = @"class C { public void M<B,A>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [B]@26 -> @24"); } [Fact] public void MethodTypeParameterReorderAndUpdate() { var src1 = @"class C { public void M<A,B>() {} }"; var src2 = @"class C { public void M<B,C>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [B]@26 -> @24", "Update [A]@24 -> [C]@26"); } [Fact] public void MethodTypeParameter_Attribute_Insert1() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M<T>() {} }"; var src2 = attribute + @"class C { public void M<[A]T>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@72 -> [[A]T]@72"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodUpdate, "T"), Diagnostic(RudeEditKind.GenericMethodTriviaUpdate, "", FeaturesResources.method)); } [Fact] public void MethodTypeParameter_Attribute_Insert2() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M<[A]T>() {} }"; var src2 = attribute + @"class C { public void M<[A, B]T>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]T]@120 -> [[A, B]T]@120"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodUpdate, "T"), Diagnostic(RudeEditKind.GenericMethodTriviaUpdate, "", FeaturesResources.method)); } [Fact] public void MethodTypeParameter_Attribute_Delete() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M<[A]T>() {} }"; var src2 = attribute + @"class C { public void M<T>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]T]@72 -> [T]@72"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodTriviaUpdate, "", FeaturesResources.method), Diagnostic(RudeEditKind.GenericMethodUpdate, "T")); } [Fact] public void MethodTypeParameter_Attribute_Update_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M<[System.Obsolete(""1""), B]T>() {} }"; var src2 = attribute + @"class C { public void M<[System.Obsolete(""2""), A]T>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\"), B]T]@120 -> [[System.Obsolete(\"2\"), A]T]@120"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodUpdate, "T")); } [Fact] public void MethodTypeParameter_Attribute_Update() { var attribute = "class A : System.Attribute { public A(int x) {} } "; var src1 = attribute + "class C { void F<[A(0)]T>(T a) {} }"; var src2 = attribute + "class C { void F<[A(1)]T>(T a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A(0)]T]@67 -> [[A(1)]T]@67"); edits.VerifyRudeDiagnostics( EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.GenericMethodUpdate, "T")); } [Fact] public void MethodTypeParameter_Attribute_Update_WithBodyUpdate() { var attribute = "class A : System.Attribute { public A(int x) {} } "; var src1 = attribute + "class C { void F<[A(0)]T>(T a) { F(0); } }"; var src2 = attribute + "class C { void F<[A(1)]T>(T a) { F(1); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [void F<[A(0)]T>(T a) { F(0); }]@60 -> [void F<[A(1)]T>(T a) { F(1); }]@60", "Update [[A(0)]T]@67 -> [[A(1)]T]@67"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericMethodUpdate, "void F<[A(1)]T>(T a)"), Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodUpdate, "T")); } #endregion #region Type Type Parameter [Fact] public void TypeTypeParameterInsert1() { var src1 = @"class C {}"; var src2 = @"class C<A> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [<A>]@7", "Insert [A]@8"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "A", FeaturesResources.type_parameter)); } [Fact] public void TypeTypeParameterInsert2() { var src1 = @"class C<A> {}"; var src2 = @"class C<A,B> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [<A>]@7 -> [<A,B>]@7", "Insert [B]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "B", FeaturesResources.type_parameter)); } [Fact] public void TypeTypeParameterDelete1() { var src1 = @"class C<A> { }"; var src2 = @"class C { } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [<A>]@7", "Delete [A]@8"); } [Fact] public void TypeTypeParameterDelete2() { var src1 = @"class C<A,B> {}"; var src2 = @"class C<B> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [<A,B>]@7 -> [<B>]@7", "Delete [A]@8"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "class C<B>", DeletedSymbolDisplay(FeaturesResources.type_parameter, "A"))); } [Fact] public void TypeTypeParameterUpdate() { var src1 = @"class C<A> {}"; var src2 = @"class C<B> {} "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [A]@8 -> [B]@8"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "B", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "B")); } [Fact] public void TypeTypeParameterReorder() { var src1 = @"class C<A,B> { }"; var src2 = @"class C<B,A> { } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [B]@10 -> @8"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "B", FeaturesResources.type_parameter)); } [Fact] public void TypeTypeParameterReorderAndUpdate() { var src1 = @"class C<A,B> {}"; var src2 = @"class C<B,C> {} "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [B]@10 -> @8", "Update [A]@8 -> [C]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "B", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.Renamed, "C", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "C")); } [Fact] public void TypeTypeParameterAttributeInsert1() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<T> {}"; var src2 = attribute + @"class C<[A]T> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@56 -> [[A]T]@56"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameterAttributeInsert2() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<[A]T> {}"; var src2 = attribute + @"class C<[A, B]T> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]T]@104 -> [[A, B]T]@104"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameterAttributeInsert_SupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<T> {}"; var src2 = attribute + @"class C<[A]T> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@56 -> [[A]T]@56"); edits.VerifyRudeDiagnostics( EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameterAttributeDelete() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<[A]T> {}"; var src2 = attribute + @"class C<T> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]T]@56 -> [T]@56"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameterAttributeUpdate() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<[System.Obsolete(""1""), B]T> {}"; var src2 = attribute + @"class C<[System.Obsolete(""2""), A]T> {} "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\"), B]T]@104 -> [[System.Obsolete(\"2\"), A]T]@104"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameter_Partial_Attribute_AddMultiple() { var attributes = @" class A : System.Attribute {} class B : System.Attribute {} "; var srcA1 = "partial class C<T> { }" + attributes; var srcB1 = "partial class C<T> { }"; var srcA2 = "partial class C<[A]T> { }" + attributes; var srcB2 = "partial class C<[B]T> { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), }), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void TypeTypeParameter_Partial_Attribute_AddMultiple_Reloadable() { var attributes = @" class A : System.Attribute {} class B : System.Attribute {} "; var srcA1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C<T> { }" + attributes; var srcB1 = "partial class C<T> { }"; var srcA2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C<[A]T> { }" + attributes; var srcB2 = "partial class C<[B]T> { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } #endregion #region Type Parameter Constraints [Theory] [InlineData("nonnull")] [InlineData("struct")] [InlineData("class")] [InlineData("new()")] [InlineData("unmanaged")] [InlineData("System.IDisposable")] [InlineData("System.Delegate")] public void TypeConstraint_Insert(string newConstraint) { var src1 = "class C<S,T> { }"; var src2 = "class C<S,T> where T : " + newConstraint + " { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [where T : " + newConstraint + "]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "where T : " + newConstraint, FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : " + newConstraint)); } [Theory] [InlineData("nonnull")] [InlineData("struct")] [InlineData("class")] [InlineData("new()")] [InlineData("unmanaged")] [InlineData("System.IDisposable")] [InlineData("System.Delegate")] public void TypeConstraint_Delete(string oldConstraint) { var src1 = "class C<S,T> where T : " + oldConstraint + " { }"; var src2 = "class C<S,T> { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [where T : " + oldConstraint + "]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Theory] [InlineData("string", "string?")] [InlineData("(int a, int b)", "(int a, int c)")] public void TypeConstraint_Update_RuntimeTypeUnchanged(string oldType, string newType) { // note: dynamic is not allowed in constraints var src1 = "class C<T> where T : System.Collections.Generic.List<" + oldType + "> {}"; var src2 = "class C<T> where T : System.Collections.Generic.List<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : System.Collections.Generic.List<" + newType + ">")); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void TypeConstraint_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C<T> where T : System.Collections.Generic.List<" + oldType + "> {}"; var src2 = "class C<T> where T : System.Collections.Generic.List<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "where T : System.Collections.Generic.List<" + newType + ">", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : System.Collections.Generic.List<" + newType + ">")); } [Fact] public void TypeConstraint_Delete_WithParameter() { var src1 = "class C<S,T> where S : new() where T : class { }"; var src2 = "class C<S> where S : new() { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "class C<S>", DeletedSymbolDisplay(FeaturesResources.type_parameter, "T"))); } [Fact] public void TypeConstraint_MultipleClauses_Insert() { var src1 = "class C<S,T> where T : class { }"; var src2 = "class C<S,T> where S : unmanaged where T : class { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [where S : unmanaged]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "where S : unmanaged", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where S : unmanaged")); } [Fact] public void TypeConstraint_MultipleClauses_Delete() { var src1 = "class C<S,T> where S : new() where T : class { }"; var src2 = "class C<S,T> where T : class { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [where S : new()]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "S", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "S")); } [Fact] public void TypeConstraint_MultipleClauses_Reorder() { var src1 = "class C<S,T> where S : struct where T : class { }"; var src2 = "class C<S,T> where T : class where S : struct { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [where T : class]@30 -> @13"); edits.VerifyRudeDiagnostics(); } [Fact] public void TypeConstraint_MultipleClauses_UpdateAndReorder() { var src1 = "class C<S,T> where S : new() where T : class { }"; var src2 = "class C<T,S> where T : class, I where S : class, new() { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [where T : class]@29 -> @13", "Reorder [T]@10 -> @8", "Update [where T : class]@29 -> [where T : class, I]@13", "Update [where S : new()]@13 -> [where S : class, new()]@32"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.ChangingConstraints, "where T : class, I", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : class, I"), Diagnostic(RudeEditKind.ChangingConstraints, "where S : class, new()", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where S : class, new()")); } #endregion #region Top Level Statements [Fact] public void TopLevelStatements_Update() { var src1 = @" using System; Console.WriteLine(""Hello""); "; var src2 = @" using System; Console.WriteLine(""Hello World""); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [Console.WriteLine(\"Hello\");]@19 -> [Console.WriteLine(\"Hello World\");]@19"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_InsertAndUpdate() { var src1 = @" using System; Console.WriteLine(""Hello""); "; var src2 = @" using System; Console.WriteLine(""Hello World""); Console.WriteLine(""What is your name?""); var name = Console.ReadLine(); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Console.WriteLine(\"Hello\");]@19 -> [Console.WriteLine(\"Hello World\");]@19", "Insert [Console.WriteLine(\"What is your name?\");]@54", "Insert [var name = Console.ReadLine();]@96"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_Insert_NoImplicitMain() { var src1 = @" using System; "; var src2 = @" using System; Console.WriteLine(""Hello World""); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [Console.WriteLine(\"Hello World\");]@19"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_Insert_ImplicitMain() { var src1 = @" using System; Console.WriteLine(""Hello""); "; var src2 = @" using System; Console.WriteLine(""Hello""); Console.WriteLine(""World""); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [Console.WriteLine(\"World\");]@48"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_Delete_NoImplicitMain() { var src1 = @" using System; Console.WriteLine(""Hello World""); "; var src2 = @" using System; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [Console.WriteLine(\"Hello World\");]@19"); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.global_statement)); } [Fact] public void TopLevelStatements_Delete_ImplicitMain() { var src1 = @" using System; Console.WriteLine(""Hello""); Console.WriteLine(""World""); "; var src2 = @" using System; Console.WriteLine(""Hello""); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [Console.WriteLine(\"World\");]@48"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_StackAlloc() { var src1 = @"unsafe { var x = stackalloc int[3]; System.Console.Write(1); }"; var src2 = @"unsafe { var x = stackalloc int[3]; System.Console.Write(2); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", CSharpFeaturesResources.global_statement)); } [Fact] public void TopLevelStatements_VoidToInt1() { var src1 = @" using System; Console.Write(1); "; var src2 = @" using System; Console.Write(1); return 1; "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return 1;")); } [Fact] public void TopLevelStatements_VoidToInt2() { var src1 = @" using System; Console.Write(1); return; "; var src2 = @" using System; Console.Write(1); return 1; "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return 1;")); } [Fact] public void TopLevelStatements_VoidToInt3() { var src1 = @" using System; Console.Write(1); int Goo() { return 1; } "; var src2 = @" using System; Console.Write(1); return 1; int Goo() { return 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return 1;")); } [Fact] public void TopLevelStatements_AddAwait() { var src1 = @" using System.Threading.Tasks; await Task.Delay(100); "; var src2 = @" using System.Threading.Tasks; await Task.Delay(100); await Task.Delay(200); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "await", CSharpFeaturesResources.await_expression)); } [Fact] public void TopLevelStatements_DeleteAwait() { var src1 = @" using System.Threading.Tasks; await Task.Delay(100); await Task.Delay(200); "; var src2 = @" using System.Threading.Tasks; await Task.Delay(100); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.await_expression)); } [Fact] public void TopLevelStatements_VoidToTask() { var src1 = @" using System; using System.Threading.Tasks; Console.Write(1); "; var src2 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "await Task.Delay(100);")); } [Fact] public void TopLevelStatements_TaskToTaskInt() { var src1 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); "; var src2 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); return 1; "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return 1;")); } [Fact] public void TopLevelStatements_VoidToTaskInt() { var src1 = @" using System; using System.Threading.Tasks; Console.Write(1); "; var src2 = @" using System; using System.Threading.Tasks; Console.Write(1); return await GetInt(); Task<int> GetInt() { return Task.FromResult(1); } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return await GetInt();")); } [Fact] public void TopLevelStatements_IntToVoid1() { var src1 = @" using System; Console.Write(1); return 1; "; var src2 = @" using System; Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);")); } [Fact] public void TopLevelStatements_IntToVoid2() { var src1 = @" using System; Console.Write(1); return 1; "; var src2 = @" using System; Console.Write(1); return; "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return;")); } [Fact] public void TopLevelStatements_IntToVoid3() { var src1 = @" using System; Console.Write(1); return 1; int Goo() { return 1; } "; var src2 = @" using System; Console.Write(1); int Goo() { return 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "int Goo()\r\n{\r\n return 1;\r\n}")); } [Fact] public void TopLevelStatements_IntToVoid4() { var src1 = @" using System; Console.Write(1); return 1; public class C { public int Goo() { return 1; } } "; var src2 = @" using System; Console.Write(1); public class C { public int Goo() { return 1; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);")); } [Fact] public void TopLevelStatements_TaskToVoid() { var src1 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); "; var src2 = @" using System; using System.Threading.Tasks; Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);"), Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.await_expression)); } [Fact] public void TopLevelStatements_TaskIntToTask() { var src1 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); return 1; "; var src2 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);")); } [Fact] public void TopLevelStatements_TaskIntToVoid() { var src1 = @" using System; using System.Threading.Tasks; Console.Write(1); return await GetInt(); Task<int> GetInt() { return Task.FromResult(1); } "; var src2 = @" using System; using System.Threading.Tasks; Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);"), Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.await_expression)); } [Fact] public void TopLevelStatements_WithLambda_Insert() { var src1 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; "; var src2 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(1); "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"), syntaxMap[0]) }); } [Fact] public void TopLevelStatements_WithLambda_Update() { var src1 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(1); public class C { } "; var src2 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(2); public class C { } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"), syntaxMap[0]) }); } [Fact] public void TopLevelStatements_WithLambda_Delete() { var src1 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(1); public class C { } "; var src2 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; public class C { } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"), syntaxMap[0]) }); } [Fact] public void TopLevelStatements_UpdateMultiple() { var src1 = @" using System; Console.WriteLine(1); Console.WriteLine(2); public class C { } "; var src2 = @" using System; Console.WriteLine(3); Console.WriteLine(4); public class C { } "; var edits = GetTopEdits(src1, src2); // Since each individual statement is a separate update to a separate node, this just validates we correctly // only analyze the things once edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_MoveToOtherFile() { var srcA1 = @" using System; Console.WriteLine(1); public class A { }"; var srcB1 = @" using System; public class B { }"; var srcA2 = @" using System; public class A { }"; var srcB2 = @" using System; Console.WriteLine(2); public class B { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new [] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$")) }), }); } #endregion } }
// 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. #nullable disable using System; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.UnitTests; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; using Microsoft.CodeAnalysis.Emit; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests { [UseExportProvider] public class TopLevelEditingTests : EditingTestBase { #region Usings [Fact] public void Using_Global_Insert() { var src1 = @" using System.Collections.Generic; "; var src2 = @" global using D = System.Diagnostics; global using System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [global using D = System.Diagnostics;]@2", "Insert [global using System.Collections;]@40"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Delete1() { var src1 = @" using System.Diagnostics; "; var src2 = @""; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [using System.Diagnostics;]@2"); Assert.IsType<UsingDirectiveSyntax>(edits.Edits.First().OldNode); Assert.Null(edits.Edits.First().NewNode); } [Fact] public void Using_Delete2() { var src1 = @" using D = System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var src2 = @" using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [using D = System.Diagnostics;]@2", "Delete [using System.Collections;]@33"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Insert() { var src1 = @" using System.Collections.Generic; "; var src2 = @" using D = System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [using D = System.Diagnostics;]@2", "Insert [using System.Collections;]@33"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Update1() { var src1 = @" using System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var src2 = @" using System.Diagnostics; using X = System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [using System.Collections;]@29 -> [using X = System.Collections;]@29"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Update2() { var src1 = @" using System.Diagnostics; using X1 = System.Collections; using System.Collections.Generic; "; var src2 = @" using System.Diagnostics; using X2 = System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [using X1 = System.Collections;]@29 -> [using X2 = System.Collections;]@29"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Update3() { var src1 = @" using System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var src2 = @" using System; using System.Collections; using System.Collections.Generic; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [using System.Diagnostics;]@2 -> [using System;]@2"); edits.VerifyRudeDiagnostics(); } [Fact] public void Using_Reorder1() { var src1 = @" using System.Diagnostics; using System.Collections; using System.Collections.Generic; "; var src2 = @" using System.Collections; using System.Collections.Generic; using System.Diagnostics; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [using System.Diagnostics;]@2 -> @64"); } [Fact] public void Using_InsertDelete1() { var src1 = @" namespace N { using System.Collections; } namespace M { } "; var src2 = @" namespace N { } namespace M { using System.Collections; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [using System.Collections;]@43", "Delete [using System.Collections;]@22"); } [Fact] public void Using_InsertDelete2() { var src1 = @" namespace N { using System.Collections; } "; var src2 = @" using System.Collections; namespace N { } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [using System.Collections;]@2", "Delete [using System.Collections;]@22"); } [Fact] public void Using_Delete_ChangesCodeMeaning() { // This test specifically validates the scenario we _don't_ support, namely when inserting or deleting // a using directive, if existing code changes in meaning as a result, we don't issue edits for that code. // If this ever regresses then please buy a lottery ticket because the feature has magically fixed itself. var src1 = @" using System.IO; using DirectoryInfo = N.C; namespace N { public class C { public C(string a) { } public FileAttributes Attributes { get; set; } } public class D { public void M() { var d = new DirectoryInfo(""aa""); var x = directoryInfo.Attributes; } } }"; var src2 = @" using System.IO; namespace N { public class C { public C(string a) { } public FileAttributes Attributes { get; set; } } public class D { public void M() { var d = new DirectoryInfo(""aa""); var x = directoryInfo.Attributes; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [using DirectoryInfo = N.C;]@20"); edits.VerifySemantics(); } [Fact] public void Using_Insert_ForNewCode() { // As distinct from the above, this test validates a real world scenario of inserting a using directive // and changing code that utilizes the new directive to some effect. var src1 = @" namespace N { class Program { static void Main(string[] args) { } } }"; var src2 = @" using System; namespace N { class Program { static void Main(string[] args) { Console.WriteLine(""Hello World!""); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("N.Program.Main"))); } [Fact] public void Using_Delete_ForOldCode() { var src1 = @" using System; namespace N { class Program { static void Main(string[] args) { Console.WriteLine(""Hello World!""); } } }"; var src2 = @" namespace N { class Program { static void Main(string[] args) { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("N.Program.Main"))); } [Fact] public void Using_Insert_CreatesAmbiguousCode() { // This test validates that we still issue edits for changed valid code, even when unchanged // code has ambiguities after adding a using. var src1 = @" using System.Threading; namespace N { class C { void M() { // Timer exists in System.Threading and System.Timers var t = new Timer(s => System.Console.WriteLine(s)); } } }"; var src2 = @" using System.Threading; using System.Timers; namespace N { class C { void M() { // Timer exists in System.Threading and System.Timers var t = new Timer(s => System.Console.WriteLine(s)); } void M2() { // TimersDescriptionAttribute only exists in System.Timers System.Console.WriteLine(new TimersDescriptionAttribute("""")); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("N.C.M2"))); } #endregion #region Extern Alias [Fact] public void ExternAliasUpdate() { var src1 = "extern alias X;"; var src2 = "extern alias Y;"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [extern alias X;]@0 -> [extern alias Y;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Update, "extern alias Y;", CSharpFeaturesResources.extern_alias)); } [Fact] public void ExternAliasInsert() { var src1 = ""; var src2 = "extern alias Y;"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [extern alias Y;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "extern alias Y;", CSharpFeaturesResources.extern_alias)); } [Fact] public void ExternAliasDelete() { var src1 = "extern alias Y;"; var src2 = ""; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [extern alias Y;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.extern_alias)); } #endregion #region Assembly/Module Attributes [Fact] public void Insert_TopLevelAttribute() { var src1 = ""; var src2 = "[assembly: System.Obsolete(\"2\")]"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [[assembly: System.Obsolete(\"2\")]]@0", "Insert [System.Obsolete(\"2\")]@11"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "[assembly: System.Obsolete(\"2\")]", FeaturesResources.attribute)); } [Fact] public void Delete_TopLevelAttribute() { var src1 = "[assembly: System.Obsolete(\"2\")]"; var src2 = ""; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [[assembly: System.Obsolete(\"2\")]]@0", "Delete [System.Obsolete(\"2\")]@11"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, null, FeaturesResources.attribute)); } [Fact] public void Update_TopLevelAttribute() { var src1 = "[assembly: System.Obsolete(\"1\")]"; var src2 = "[assembly: System.Obsolete(\"2\")]"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[assembly: System.Obsolete(\"1\")]]@0 -> [[assembly: System.Obsolete(\"2\")]]@0", "Update [System.Obsolete(\"1\")]@11 -> [System.Obsolete(\"2\")]@11"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Update, "System.Obsolete(\"2\")", FeaturesResources.attribute)); } [Fact] public void Reorder_TopLevelAttribute() { var src1 = "[assembly: System.Obsolete(\"1\")][assembly: System.Obsolete(\"2\")]"; var src2 = "[assembly: System.Obsolete(\"2\")][assembly: System.Obsolete(\"1\")]"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [[assembly: System.Obsolete(\"2\")]]@32 -> @0"); edits.VerifyRudeDiagnostics(); } #endregion #region Types [Theory] [InlineData("class", "struct")] [InlineData("class", "record")] // TODO: Allow this conversion: https://github.com/dotnet/roslyn/issues/51874 [InlineData("class", "record struct")] [InlineData("class", "interface")] [InlineData("struct", "record struct")] // TODO: Allow this conversion: https://github.com/dotnet/roslyn/issues/51874 public void Type_Kind_Update(string oldKeyword, string newKeyword) { var src1 = oldKeyword + " C { }"; var src2 = newKeyword + " C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [" + oldKeyword + " C { }]@0 -> [" + newKeyword + " C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeKindUpdate, newKeyword + " C")); } [Theory] [InlineData("class", "struct")] [InlineData("class", "record")] [InlineData("class", "record struct")] [InlineData("class", "interface")] [InlineData("struct", "record struct")] public void Type_Kind_Update_Reloadable(string oldKeyword, string newKeyword) { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]" + oldKeyword + " C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]" + newKeyword + " C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate]" + oldKeyword + " C { }]@145 -> [[CreateNewOnMetadataUpdate]" + newKeyword + " C { }]@145"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Modifiers_Static_Remove() { var src1 = "public static class C { }"; var src2 = "public class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public static class C { }]@0 -> [public class C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public class C", FeaturesResources.class_)); } [Theory] [InlineData("public")] [InlineData("protected")] [InlineData("private")] [InlineData("private protected")] [InlineData("internal protected")] public void Type_Modifiers_Accessibility_Change(string accessibility) { var src1 = accessibility + " class C { }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [" + accessibility + " class C { }]@0 -> [class C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "class C", FeaturesResources.class_)); } [Theory] [InlineData("public", "public")] [InlineData("internal", "internal")] [InlineData("", "internal")] [InlineData("internal", "")] [InlineData("protected", "protected")] [InlineData("private", "private")] [InlineData("private protected", "private protected")] [InlineData("internal protected", "internal protected")] public void Type_Modifiers_Accessibility_Partial(string accessibilityA, string accessibilityB) { var srcA1 = accessibilityA + " partial class C { }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = accessibilityB + " partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(), }); } [Fact] public void Type_Modifiers_Internal_Remove() { var src1 = "internal interface C { }"; var src2 = "interface C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void Type_Modifiers_Internal_Add() { var src1 = "struct C { }"; var src2 = "internal struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void Type_Modifiers_Accessibility_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]public class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]internal class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate]public class C { }]@145 -> [[CreateNewOnMetadataUpdate]internal class C { }]@145"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Theory] [InlineData("class")] [InlineData("struct")] [InlineData("interface")] [InlineData("record")] [InlineData("record struct")] public void Type_Modifiers_NestedPrivateInInterface_Remove(string keyword) { var src1 = "interface C { private " + keyword + " S { } }"; var src2 = "interface C { " + keyword + " S { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, keyword + " S", GetResource(keyword))); } [Theory] [InlineData("class")] [InlineData("struct")] [InlineData("interface")] [InlineData("record")] [InlineData("record struct")] public void Type_Modifiers_NestedPrivateInClass_Add(string keyword) { var src1 = "class C { " + keyword + " S { } }"; var src2 = "class C { private " + keyword + " S { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Theory] [InlineData("class")] [InlineData("struct")] [InlineData("interface")] [InlineData("record")] [InlineData("record struct")] public void Type_Modifiers_NestedPublicInInterface_Add(string keyword) { var src1 = "interface C { " + keyword + " S { } }"; var src2 = "interface C { public " + keyword + " S { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact, WorkItem(48628, "https://github.com/dotnet/roslyn/issues/48628")] public void Type_Modifiers_Unsafe_Add() { var src1 = "public class C { }"; var src2 = "public unsafe class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public class C { }]@0 -> [public unsafe class C { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact, WorkItem(48628, "https://github.com/dotnet/roslyn/issues/48628")] public void Type_Modifiers_Unsafe_Remove() { var src1 = @" using System; unsafe delegate void D(); class C { unsafe class N { } public unsafe event Action<int> A { add { } remove { } } unsafe int F() => 0; unsafe int X; unsafe int Y { get; } unsafe C() {} unsafe ~C() {} } "; var src2 = @" using System; delegate void D(); class C { class N { } public event Action<int> A { add { } remove { } } int F() => 0; int X; int Y { get; } C() {} ~C() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [unsafe delegate void D();]@17 -> [delegate void D();]@17", "Update [unsafe class N { }]@60 -> [class N { }]@53", "Update [public unsafe event Action<int> A { add { } remove { } }]@84 -> [public event Action<int> A { add { } remove { } }]@70", "Update [unsafe int F() => 0;]@146 -> [int F() => 0;]@125", "Update [unsafe int X;]@172 -> [int X;]@144", "Update [unsafe int Y { get; }]@191 -> [int Y { get; }]@156", "Update [unsafe C() {}]@218 -> [C() {}]@176", "Update [unsafe ~C() {}]@237 -> [~C() {}]@188"); edits.VerifyRudeDiagnostics(); } [Fact, WorkItem(48628, "https://github.com/dotnet/roslyn/issues/48628")] public void Type_Modifiers_Unsafe_DeleteInsert() { var srcA1 = "partial class C { unsafe void F() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")) }), }); } [Fact] public void Type_Modifiers_Ref_Add() { var src1 = "public struct C { }"; var src2 = "public ref struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public struct C { }]@0 -> [public ref struct C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public ref struct C", CSharpFeaturesResources.struct_)); } [Fact] public void Type_Modifiers_Ref_Remove() { var src1 = "public ref struct C { }"; var src2 = "public struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public ref struct C { }]@0 -> [public struct C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public struct C", CSharpFeaturesResources.struct_)); } [Fact] public void Type_Modifiers_ReadOnly_Add() { var src1 = "public struct C { }"; var src2 = "public readonly struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public struct C { }]@0 -> [public readonly struct C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public readonly struct C", CSharpFeaturesResources.struct_)); } [Fact] public void Type_Modifiers_ReadOnly_Remove() { var src1 = "public readonly struct C { }"; var src2 = "public struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public readonly struct C { }]@0 -> [public struct C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public struct C", CSharpFeaturesResources.struct_)); } [Theory] [InlineData("[System.CLSCompliantAttribute]", "CLSCompliantAttribute")] [InlineData("[System.Diagnostics.CodeAnalysis.AllowNullAttribute]", "AllowNullAttribute")] [InlineData("[System.Diagnostics.CodeAnalysis.DisallowNullAttribute]", "DisallowNullAttribute")] [InlineData("[System.Diagnostics.CodeAnalysis.MaybeNullAttribute]", "MaybeNullAttribute")] [InlineData("[System.Diagnostics.CodeAnalysis.NotNullAttribute]", "NotNullAttribute")] [InlineData("[System.NonSerializedAttribute]", "NonSerializedAttribute")] [InlineData("[System.Reflection.AssemblyAlgorithmIdAttribute]", "AssemblyAlgorithmIdAttribute")] [InlineData("[System.Reflection.AssemblyCultureAttribute]", "AssemblyCultureAttribute")] [InlineData("[System.Reflection.AssemblyFlagsAttribute]", "AssemblyFlagsAttribute")] [InlineData("[System.Reflection.AssemblyVersionAttribute]", "AssemblyVersionAttribute")] [InlineData("[System.Runtime.CompilerServices.DllImportAttribute]", "DllImportAttribute")] [InlineData("[System.Runtime.CompilerServices.IndexerNameAttribute]", "IndexerNameAttribute")] [InlineData("[System.Runtime.CompilerServices.MethodImplAttribute]", "MethodImplAttribute")] [InlineData("[System.Runtime.CompilerServices.SpecialNameAttribute]", "SpecialNameAttribute")] [InlineData("[System.Runtime.CompilerServices.TypeForwardedToAttribute]", "TypeForwardedToAttribute")] [InlineData("[System.Runtime.InteropServices.ComImportAttribute]", "ComImportAttribute")] [InlineData("[System.Runtime.InteropServices.DefaultParameterValueAttribute]", "DefaultParameterValueAttribute")] [InlineData("[System.Runtime.InteropServices.FieldOffsetAttribute]", "FieldOffsetAttribute")] [InlineData("[System.Runtime.InteropServices.InAttribute]", "InAttribute")] [InlineData("[System.Runtime.InteropServices.MarshalAsAttribute]", "MarshalAsAttribute")] [InlineData("[System.Runtime.InteropServices.OptionalAttribute]", "OptionalAttribute")] [InlineData("[System.Runtime.InteropServices.OutAttribute]", "OutAttribute")] [InlineData("[System.Runtime.InteropServices.PreserveSigAttribute]", "PreserveSigAttribute")] [InlineData("[System.Runtime.InteropServices.StructLayoutAttribute]", "StructLayoutAttribute")] [InlineData("[System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeImportAttribute]", "WindowsRuntimeImportAttribute")] [InlineData("[System.Security.DynamicSecurityMethodAttribute]", "DynamicSecurityMethodAttribute")] [InlineData("[System.SerializableAttribute]", "SerializableAttribute")] [InlineData("[System.Runtime.CompilerServices.AsyncMethodBuilderAttribute]", "AsyncMethodBuilderAttribute")] public void Type_Attribute_Insert_SupportedByRuntime_NonCustomAttribute(string attributeType, string attributeName) { var src1 = @"class C { public void M(int a) {} }"; var src2 = attributeType + @"class C { public void M(int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { public void M(int a) {} }]@0 -> [" + attributeType + "class C { public void M(int a) {} }]@0"); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.ChangingNonCustomAttribute, "class C", attributeName, FeaturesResources.class_)); } [Fact] public void Type_Attribute_Update_NotSupportedByRuntime1() { var attribute = "public class A1Attribute : System.Attribute { }\n\n" + "public class A2Attribute : System.Attribute { }\n\n"; var src1 = attribute + "[A1]class C { }"; var src2 = attribute + "[A2]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A1]class C { }]@98 -> [[A2]class C { }]@98"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Update_NotSupportedByRuntime2() { var src1 = "[System.Obsolete(\"1\")]class C { }"; var src2 = "[System.Obsolete(\"2\")]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\")]class C { }]@0 -> [[System.Obsolete(\"2\")]class C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Delete_NotSupportedByRuntime1() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[A, B]class C { }"; var src2 = attribute + "[A]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A, B]class C { }]@96 -> [[A]class C { }]@96"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Delete_NotSupportedByRuntime2() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[B, A]class C { }"; var src2 = attribute + "[A]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[B, A]class C { }]@96 -> [[A]class C { }]@96"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Change_Reloadable() { var attributeSrc = @" public class A1 : System.Attribute { } public class A2 : System.Attribute { } public class A3 : System.Attribute { } "; var src1 = ReloadableAttributeSrc + attributeSrc + "[CreateNewOnMetadataUpdate, A1, A2]class C { }"; var src2 = ReloadableAttributeSrc + attributeSrc + "[CreateNewOnMetadataUpdate, A2, A3]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate, A1, A2]class C { }]@267 -> [[CreateNewOnMetadataUpdate, A2, A3]class C { }]@267"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Attribute_ReloadableRemove() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Attribute_ReloadableAdd() { var src1 = ReloadableAttributeSrc + "class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Attribute_ReloadableBase() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class B { } class C : B { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class B { } class C : B { void F() {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Attribute_Add() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[A]class C { }"; var src2 = attribute + "[A, B]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]class C { }]@96 -> [[A, B]class C { }]@96"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Attribute_Add_NotSupportedByRuntime1() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[A]class C { }"; var src2 = attribute + "[A, B]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]class C { }]@96 -> [[A, B]class C { }]@96"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Add_NotSupportedByRuntime2() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "class C { }"; var src2 = attribute + "[A]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { }]@48 -> [[A]class C { }]@48"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Fact] public void Type_Attribute_Reorder1() { var src1 = "[A(1), B(2), C(3)]class C { }"; var src2 = "[C(3), A(1), B(2)]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A(1), B(2), C(3)]class C { }]@0 -> [[C(3), A(1), B(2)]class C { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact] public void Type_Attribute_Reorder2() { var src1 = "[A, B, C]class C { }"; var src2 = "[B, C, A]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A, B, C]class C { }]@0 -> [[B, C, A]class C { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact] public void Type_Attribute_ReorderAndUpdate_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + "[System.Obsolete(\"1\"), A, B]class C { }"; var src2 = attribute + "[A, B, System.Obsolete(\"2\")]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\"), A, B]class C { }]@96 -> [[A, B, System.Obsolete(\"2\")]class C { }]@96"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", FeaturesResources.class_)); } [Theory] [InlineData("class")] [InlineData("struct")] [InlineData("interface")] [InlineData("record")] [InlineData("record struct")] public void Type_Rename(string keyword) { var src1 = keyword + " C { }"; var src2 = keyword + " D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [" + keyword + " C { }]@0 -> [" + keyword + " D { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, keyword + " D", GetResource(keyword))); } [Fact] public void Type_Rename_AddAndDeleteMember() { var src1 = "class C { int x = 1; }"; var src2 = "class D { void F() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { int x = 1; }]@0 -> [class D { void F() { } }]@0", "Insert [void F() { }]@10", "Insert [()]@16", "Delete [int x = 1;]@10", "Delete [int x = 1]@10", "Delete [x = 1]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "class D", FeaturesResources.class_)); } [Fact] [WorkItem(54886, "https://github.com/dotnet/roslyn/issues/54886")] public void Type_Rename_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate]class C { }]@145 -> [[CreateNewOnMetadataUpdate]class D { }]@145"); // TODO: expected: Replace edit of D edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Renamed, "class D", FeaturesResources.class_)); } [Fact] [WorkItem(54886, "https://github.com/dotnet/roslyn/issues/54886")] public void Type_Rename_Reloadable_AddAndDeleteMember() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { int x = 1; }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class D { void F() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[CreateNewOnMetadataUpdate]class C { int x = 1; }]@145 -> [[CreateNewOnMetadataUpdate]class D { void F() { } }]@145", "Insert [void F() { }]@182", "Insert [()]@188", "Delete [int x = 1;]@182", "Delete [int x = 1]@182", "Delete [x = 1]@186"); // TODO: expected: Replace edit of D edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Renamed, "class D", FeaturesResources.class_)); } [Fact] public void Interface_NoModifiers_Insert() { var src1 = ""; var src2 = "interface C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Interface_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { } "; var src2 = "namespace N { interface C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Interface_NoModifiers_IntoType_Insert() { var src1 = "interface N { }"; var src2 = "interface N { interface C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Class_NoModifiers_Insert() { var src1 = ""; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Class_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { class C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Class_NoModifiers_IntoType_Insert() { var src1 = "struct N { }"; var src2 = "struct N { class C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_NoModifiers_Insert() { var src1 = ""; var src2 = "struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { struct C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_NoModifiers_IntoType_Insert() { var src1 = "struct N { }"; var src2 = "struct N { struct C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Type_BaseType_Add_Unchanged() { var src1 = "class C { }"; var src2 = "class C : object { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { }]@0 -> [class C : object { }]@0"); edits.VerifySemantics(); } [Fact] public void Type_BaseType_Add_Changed() { var src1 = "class C { }"; var src2 = "class C : D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { }]@0 -> [class C : D { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Theory] [InlineData("string", "string?")] [InlineData("string[]", "string[]?")] [InlineData("object", "dynamic")] [InlineData("dynamic?", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Type_BaseType_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C : System.Collections.Generic.List<" + oldType + "> {}"; var src2 = "class C : System.Collections.Generic.List<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Type_BaseType_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C : System.Collections.Generic.List<" + oldType + "> {}"; var src2 = "class C : System.Collections.Generic.List<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Fact] public void Type_BaseType_Update_CompileTimeTypeUnchanged() { var src1 = "using A = System.Int32; using B = System.Int32; class C : System.Collections.Generic.List<A> {}"; var src2 = "using A = System.Int32; using B = System.Int32; class C : System.Collections.Generic.List<B> {}"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void Type_BaseInterface_Add() { var src1 = "class C { }"; var src2 = "class C : IDisposable { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C { }]@0 -> [class C : IDisposable { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Fact] public void Type_BaseInterface_Delete_Inherited() { var src1 = @" interface B {} interface A : B {} class C : A, B {} "; var src2 = @" interface B {} interface A : B {} class C : A {} "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void Type_BaseInterface_Reorder() { var src1 = "class C : IGoo, IBar { }"; var src2 = "class C : IBar, IGoo { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [class C : IGoo, IBar { }]@0 -> [class C : IBar, IGoo { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Type_BaseInterface_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C : System.Collections.Generic.IEnumerable<" + oldType + "> {}"; var src2 = "class C : System.Collections.Generic.IEnumerable<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Type_BaseInterface_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C : System.Collections.Generic.IEnumerable<" + oldType + "> {}"; var src2 = "class C : System.Collections.Generic.IEnumerable<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class C", FeaturesResources.class_)); } [Fact] public void Type_Base_Partial() { var srcA1 = "partial class C : B, I { }"; var srcB1 = "partial class C : J { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C : B, I, J { }"; var srcC = @" class B {} interface I {} interface J {}"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC, srcC) }, new[] { DocumentResults(), DocumentResults(), DocumentResults() }); } [Fact] public void Type_Base_Partial_InsertDeleteAndUpdate() { var srcA1 = "partial class C { }"; var srcB1 = ""; var srcC1 = "partial class C { }"; var srcA2 = ""; var srcB2 = "partial class C : D { }"; var srcC2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "partial class C", FeaturesResources.class_) }), DocumentResults(), }); } [Fact] public void Type_Base_InsertDelete() { var srcA1 = ""; var srcB1 = "class C : B, I { }"; var srcA2 = "class C : B, I { }"; var srcB2 = ""; var srcC = @" class B {} interface I {} interface J {}"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC, srcC) }, new[] { DocumentResults(), DocumentResults(), DocumentResults() }); } [Fact] public void Type_Reloadable_NotSupportedByRuntime() { var src1 = ReloadableAttributeSrc + @" [CreateNewOnMetadataUpdate] public class C { void F() { System.Console.WriteLine(1); } }"; var src2 = ReloadableAttributeSrc + @" [CreateNewOnMetadataUpdate] public class C { void F() { System.Console.WriteLine(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.ChangingReloadableTypeNotSupportedByRuntime, "void F()", "CreateNewOnMetadataUpdateAttribute")); } [Fact] public void Type_Insert_AbstractVirtualOverride() { var src1 = ""; var src2 = @" public abstract class C<T> { public abstract void F(); public virtual void G() {} public override string ToString() => null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Type_Insert_NotSupportedByRuntime() { var src1 = @" public class C { void F() { } }"; var src2 = @" public class C { void F() { } } public class D { void M() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "public class D", FeaturesResources.class_)); } [Fact] public void Type_Insert_Reloadable() { var src1 = ReloadableAttributeSrc + ""; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { void F() {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C"))); } [Fact] public void InterfaceInsert() { var src1 = ""; var src2 = @" public interface I { void F(); static void G() {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void RefStructInsert() { var src1 = ""; var src2 = "ref struct X { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [ref struct X { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_ReadOnly_Insert() { var src1 = ""; var src2 = "readonly struct X { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [readonly struct X { }]@0"); edits.VerifyRudeDiagnostics(); } [Fact] public void Struct_RefModifier_Add() { var src1 = "struct X { }"; var src2 = "ref struct X { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [struct X { }]@0 -> [ref struct X { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "ref struct X", CSharpFeaturesResources.struct_)); } [Fact] public void Struct_ReadonlyModifier_Add() { var src1 = "struct X { }"; var src2 = "readonly struct X { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [struct X { }]@0 -> [readonly struct X { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "readonly struct X", SyntaxFacts.GetText(SyntaxKind.StructKeyword))); } [Theory] [InlineData("ref")] [InlineData("readonly")] public void Struct_Modifiers_Partial_InsertDelete(string modifier) { var srcA1 = modifier + " partial struct S { }"; var srcB1 = "partial struct S { }"; var srcA2 = "partial struct S { }"; var srcB2 = modifier + " partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults() }); } [Fact] public void Class_ImplementingInterface_Add() { var src1 = @" using System; public interface ISample { string Get(); } public interface IConflict { string Get(); } public class BaseClass : ISample { public virtual string Get() => string.Empty; } "; var src2 = @" using System; public interface ISample { string Get(); } public interface IConflict { string Get(); } public class BaseClass : ISample { public virtual string Get() => string.Empty; } public class SubClass : BaseClass, IConflict { public override string Get() => string.Empty; string IConflict.Get() => String.Empty; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Insert [public class SubClass : BaseClass, IConflict { public override string Get() => string.Empty; string IConflict.Get() => String.Empty; }]@219", "Insert [public override string Get() => string.Empty;]@272", "Insert [string IConflict.Get() => String.Empty;]@325", "Insert [()]@298", "Insert [()]@345"); // Here we add a class implementing an interface and a method inside it with explicit interface specifier. // We want to be sure that adding the method will not tirgger a rude edit as it happens if adding a single method with explicit interface specifier. edits.VerifyRudeDiagnostics(); } [WorkItem(37128, "https://github.com/dotnet/roslyn/issues/37128")] [Fact] public void Interface_InsertMembers() { var src1 = @" using System; interface I { } "; var src2 = @" using System; interface I { static int StaticField = 10; static void StaticMethod() { } void VirtualMethod1() { } virtual void VirtualMethod2() { } abstract void AbstractMethod(); sealed void NonVirtualMethod() { } public static int operator +(I a, I b) => 1; static int StaticProperty1 { get => 1; set { } } static int StaticProperty2 => 1; virtual int VirtualProperty1 { get => 1; set { } } virtual int VirtualProperty2 { get => 1; } int VirtualProperty3 { get => 1; set { } } int VirtualProperty4 { get => 1; } abstract int AbstractProperty1 { get; set; } abstract int AbstractProperty2 { get; } sealed int NonVirtualProperty => 1; int this[byte virtualIndexer] => 1; int this[sbyte virtualIndexer] { get => 1; } virtual int this[ushort virtualIndexer] { get => 1; set {} } virtual int this[short virtualIndexer] { get => 1; set {} } abstract int this[uint abstractIndexer] { get; set; } abstract int this[int abstractIndexer] { get; } sealed int this[ulong nonVirtualIndexer] { get => 1; set {} } sealed int this[long nonVirtualIndexer] { get => 1; set {} } static event Action StaticEvent; static event Action StaticEvent2 { add { } remove { } } event Action VirtualEvent { add { } remove { } } abstract event Action AbstractEvent; sealed event Action NonVirtualEvent { add { } remove { } } abstract class C { } interface J { } enum E { } delegate void D(); } "; var edits = GetTopEdits(src1, src2); // TODO: InsertIntoInterface errors are reported due to https://github.com/dotnet/roslyn/issues/37128. edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoInterface, "static void StaticMethod()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertVirtual, "void VirtualMethod1()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertVirtual, "virtual void VirtualMethod2()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertVirtual, "abstract void AbstractMethod()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed void NonVirtualMethod()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertOperator, "public static int operator +(I a, I b)", FeaturesResources.operator_), Diagnostic(RudeEditKind.InsertIntoInterface, "static int StaticProperty1", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertIntoInterface, "static int StaticProperty2", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertIntoInterface, "static int StaticProperty2", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.InsertVirtual, "virtual int VirtualProperty1", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertVirtual, "virtual int VirtualProperty2", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertVirtual, "int VirtualProperty3", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertVirtual, "int VirtualProperty4", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertVirtual, "abstract int AbstractProperty1", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertVirtual, "abstract int AbstractProperty2", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed int NonVirtualProperty", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed int NonVirtualProperty", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.InsertVirtual, "int this[byte virtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "int this[byte virtualIndexer]", CSharpFeaturesResources.indexer_getter), Diagnostic(RudeEditKind.InsertVirtual, "int this[sbyte virtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "virtual int this[ushort virtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "virtual int this[short virtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "abstract int this[uint abstractIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertVirtual, "abstract int this[int abstractIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed int this[ulong nonVirtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed int this[long nonVirtualIndexer]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertIntoInterface, "static event Action StaticEvent2", FeaturesResources.event_), Diagnostic(RudeEditKind.InsertVirtual, "event Action VirtualEvent", FeaturesResources.event_), Diagnostic(RudeEditKind.InsertIntoInterface, "sealed event Action NonVirtualEvent", FeaturesResources.event_), Diagnostic(RudeEditKind.InsertIntoInterface, "StaticField = 10", FeaturesResources.field), Diagnostic(RudeEditKind.InsertIntoInterface, "StaticEvent", CSharpFeaturesResources.event_field), Diagnostic(RudeEditKind.InsertVirtual, "AbstractEvent", CSharpFeaturesResources.event_field)); } [Fact] public void Interface_InsertDelete() { var srcA1 = @" interface I { static void M() { } } "; var srcB1 = @" "; var srcA2 = @" "; var srcB2 = @" interface I { static void M() { } } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("M")) }), }); } [Fact] public void Type_Generic_InsertMembers() { var src1 = @" using System; class C<T> { } "; var src2 = @" using System; class C<T> { void M() {} int P1 { get; set; } int P2 { get => 1; set {} } int this[int i] { get => 1; set {} } event Action E { add {} remove {} } event Action EF; int F1, F2; enum E {} interface I {} class D {} } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoGenericType, "void M()", FeaturesResources.method), Diagnostic(RudeEditKind.InsertIntoGenericType, "int P1", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertIntoGenericType, "int P2", FeaturesResources.auto_property), Diagnostic(RudeEditKind.InsertIntoGenericType, "int this[int i]", FeaturesResources.indexer_), Diagnostic(RudeEditKind.InsertIntoGenericType, "event Action E", FeaturesResources.event_), Diagnostic(RudeEditKind.InsertIntoGenericType, "EF", CSharpFeaturesResources.event_field), Diagnostic(RudeEditKind.InsertIntoGenericType, "F1", FeaturesResources.field), Diagnostic(RudeEditKind.InsertIntoGenericType, "F2", FeaturesResources.field)); } [Fact] public void Type_Generic_InsertMembers_Reloadable() { var src1 = ReloadableAttributeSrc + @" [CreateNewOnMetadataUpdate] class C<T> { } "; var src2 = ReloadableAttributeSrc + @" [CreateNewOnMetadataUpdate] class C<T> { void M() {} int P1 { get; set; } int P2 { get => 1; set {} } int this[int i] { get => 1; set {} } event System.Action E { add {} remove {} } event System.Action EF; int F1, F2; enum E {} interface I {} class D {} } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Generic_DeleteInsert() { var srcA1 = @" class C<T> { void F() {} } struct S<T> { void F() {} } interface I<T> { void F() {} } "; var srcB1 = ""; var srcA2 = srcB1; var srcB2 = srcA1; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "class C<T>"), Diagnostic(RudeEditKind.GenericTypeUpdate, "struct S<T>"), Diagnostic(RudeEditKind.GenericTypeUpdate, "interface I<T>"), Diagnostic(RudeEditKind.GenericTypeUpdate, "void F()"), Diagnostic(RudeEditKind.GenericTypeUpdate, "void F()"), Diagnostic(RudeEditKind.GenericTypeUpdate, "void F()"), Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), }) }); } [Fact(Skip = "https://github.com/dotnet/roslyn/issues/54881")] [WorkItem(54881, "https://github.com/dotnet/roslyn/issues/54881")] public void Type_TypeParameter_Insert_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]public class C<T> { void F() { } }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]internal class C<T, S> { int x = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Type_Delete() { var src1 = @" class C { void F() {} } struct S { void F() {} } interface I { void F() {} } "; var src2 = ""; GetTopEdits(src1, src2).VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(FeaturesResources.class_, "C")), Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(CSharpFeaturesResources.struct_, "S")), Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(FeaturesResources.interface_, "I"))); } [Fact] public void Type_Delete_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { void F() {} }"; var src2 = ReloadableAttributeSrc; GetTopEdits(src1, src2).VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(FeaturesResources.class_, "C"))); } [Fact] public void Type_Partial_DeleteDeclaration() { var srcA1 = "partial class C { void F() {} void M() { } }"; var srcB1 = "partial class C { void G() {} }"; var srcA2 = ""; var srcB2 = "partial class C { void G() {} void M() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, null, DeletedSymbolDisplay(FeaturesResources.method, "C.F()")) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("M")), }) }); } [Fact] public void Type_Partial_InsertFirstDeclaration() { var src1 = ""; var src2 = "partial class C { void F() {} }"; GetTopEdits(src1, src2).VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C"), preserveLocalVariables: false) }); } [Fact] public void Type_Partial_InsertSecondDeclaration() { var srcA1 = "partial class C { void F() {} }"; var srcB1 = ""; var srcA2 = "partial class C { void F() {} }"; var srcB2 = "partial class C { void G() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("G"), preserveLocalVariables: false) }), }); } [Fact] public void Type_Partial_Reloadable() { var srcA1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { void F() {} }"; var srcB1 = ""; var srcA2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { void F() {} }"; var srcB2 = "partial class C { void G() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), }); } [Fact] public void Type_DeleteInsert() { var srcA1 = @" class C { void F() {} } struct S { void F() {} } interface I { void F() {} } "; var srcB1 = ""; var srcA2 = srcB1; var srcB2 = srcA1; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("F")), }) }); } [Fact] public void Type_DeleteInsert_Reloadable() { var srcA1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { void F() {} }"; var srcB1 = ""; var srcA2 = ReloadableAttributeSrc; var srcB2 = "[CreateNewOnMetadataUpdate]class C { void F() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C")), }) }); } [Fact] public void Type_NonInsertableMembers_DeleteInsert() { var srcA1 = @" abstract class C { public abstract void AbstractMethod(); public virtual void VirtualMethod() {} public override string ToString() => null; public void I.G() {} } interface I { void G(); void F() {} } "; var srcB1 = ""; var srcA2 = srcB1; var srcB2 = srcA1; // TODO: The methods without bodies do not need to be updated. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("AbstractMethod")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("VirtualMethod")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("ToString")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("I.G")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("G")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("F")), }) }); } [Fact] public void Type_Attribute_NonInsertableMembers_DeleteInsert() { var srcA1 = @" abstract class C { public abstract void AbstractMethod(); public virtual void VirtualMethod() {} public override string ToString() => null; public void I.G() {} } interface I { void G(); void F() {} } "; var srcB1 = ""; var srcA2 = ""; var srcB2 = @" abstract class C { [System.Obsolete]public abstract void AbstractMethod(); public virtual void VirtualMethod() {} public override string ToString() => null; public void I.G() {} } interface I { [System.Obsolete]void G(); void F() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("AbstractMethod")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("VirtualMethod")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("ToString")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("I.G")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("G")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember("F")), }) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_DeleteInsert_DataMembers() { var srcA1 = @" class C { public int x = 1; public int y = 2; public int P { get; set; } = 3; public event System.Action E = new System.Action(null); } "; var srcB1 = ""; var srcA2 = ""; var srcB2 = @" class C { public int x = 1; public int y = 2; public int P { get; set; } = 3; public event System.Action E = new System.Action(null); } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true), }) }); } [Fact] public void Type_DeleteInsert_DataMembers_PartialSplit() { var srcA1 = @" class C { public int x = 1; public int y = 2; public int P { get; set; } = 3; } "; var srcB1 = ""; var srcA2 = @" partial class C { public int x = 1; public int y = 2; } "; var srcB2 = @" partial class C { public int P { get; set; } = 3; } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true), }) }); } [Fact] public void Type_DeleteInsert_DataMembers_PartialMerge() { var srcA1 = @" partial class C { public int x = 1; public int y = 2; } "; var srcB1 = @" partial class C { public int P { get; set; } = 3; }"; var srcA2 = @" class C { public int x = 1; public int y = 2; public int P { get; set; } = 3; } "; var srcB2 = @" "; // note that accessors are not updated since they do not have bodies EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true), }), DocumentResults() }); } #endregion #region Records [Fact] public void Record_Partial_MovePrimaryConstructor() { var src1 = @" partial record C { } partial record C(int X);"; var src2 = @" partial record C(int X); partial record C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_Name_Update() { var src1 = "record C { }"; var src2 = "record D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C { }]@0 -> [record D { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "record D", CSharpFeaturesResources.record_)); } [Fact] public void RecordStruct_NoModifiers_Insert() { var src1 = ""; var src2 = "record struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void RecordStruct_AddField() { var src1 = @" record struct C(int X) { }"; var src2 = @" record struct C(int X) { private int _y = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoStruct, "_y = 0", FeaturesResources.field, CSharpFeaturesResources.record_struct)); } [Fact] public void RecordStruct_AddProperty() { var src1 = @" record struct C(int X) { }"; var src2 = @" record struct C(int X) { public int Y { get; set; } = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoStruct, "public int Y { get; set; } = 0;", FeaturesResources.auto_property, CSharpFeaturesResources.record_struct)); } [Fact] public void Record_NoModifiers_Insert() { var src1 = ""; var src2 = "record C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { record C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_NoModifiers_IntoType_Insert() { var src1 = "struct N { }"; var src2 = "struct N { record C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_BaseTypeUpdate1() { var src1 = "record C { }"; var src2 = "record C : D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C { }]@0 -> [record C : D { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void Record_BaseTypeUpdate2() { var src1 = "record C : D1 { }"; var src2 = "record C : D2 { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C : D1 { }]@0 -> [record C : D2 { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void Record_BaseInterfaceUpdate1() { var src1 = "record C { }"; var src2 = "record C : IDisposable { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C { }]@0 -> [record C : IDisposable { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void Record_BaseInterfaceUpdate2() { var src1 = "record C : IGoo, IBar { }"; var src2 = "record C : IGoo { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C : IGoo, IBar { }]@0 -> [record C : IGoo { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void Record_BaseInterfaceUpdate3() { var src1 = "record C : IGoo, IBar { }"; var src2 = "record C : IBar, IGoo { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [record C : IGoo, IBar { }]@0 -> [record C : IBar, IGoo { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "record C", CSharpFeaturesResources.record_)); } [Fact] public void RecordInsert_AbstractVirtualOverride() { var src1 = ""; var src2 = @" public abstract record C<T> { public abstract void F(); public virtual void G() {} public override void H() {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_ParameterlessConstructor() { var src1 = "record C { }"; var src2 = @" record C { public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.First(c => c.ToString() == "C.C()"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void RecordStruct_ImplementSynthesized_ParameterlessConstructor() { var src1 = "record struct C { }"; var src2 = @" record struct C { public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.First(c => c.ToString() == "C.C()"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_PrintMembers() { var src1 = "record C { }"; var src2 = @" record C { protected virtual bool PrintMembers(System.Text.StringBuilder builder) { return true; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers"))); edits.VerifyRudeDiagnostics(); } [Fact] public void RecordStruct_ImplementSynthesized_PrintMembers() { var src1 = "record struct C { }"; var src2 = @" record struct C { private readonly bool PrintMembers(System.Text.StringBuilder builder) { return true; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_WrongParameterName() { var src1 = "record C { }"; var src2 = @" record C { protected virtual bool PrintMembers(System.Text.StringBuilder sb) { return false; } public virtual bool Equals(C rhs) { return false; } protected C(C other) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ExplicitRecordMethodParameterNamesMustMatch, "protected virtual bool PrintMembers(System.Text.StringBuilder sb)", "PrintMembers(System.Text.StringBuilder builder)"), Diagnostic(RudeEditKind.ExplicitRecordMethodParameterNamesMustMatch, "public virtual bool Equals(C rhs)", "Equals(C other)"), Diagnostic(RudeEditKind.ExplicitRecordMethodParameterNamesMustMatch, "protected C(C other)", "C(C original)")); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.FirstOrDefault()?.Type.ToDisplayString() == "C"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Length == 0), preserveLocalVariables: true), }, EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Record_ImplementSynthesized_ToString() { var src1 = "record C { }"; var src2 = @" record C { public override string ToString() { return ""R""; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.ToString"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_UnImplementSynthesized_ToString() { var src1 = @" record C { public override string ToString() { return ""R""; } }"; var src2 = "record C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.ToString"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_Primary() { var src1 = "record C(int X);"; var src2 = "record C(int X, int Y);"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "int Y", FeaturesResources.parameter)); } [Fact] public void Record_UnimplementSynthesized_ParameterlessConstructor() { var src1 = @" record C { public C() { } }"; var src2 = "record C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.First(c => c.ToString() == "C.C()"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void RecordStruct_UnimplementSynthesized_ParameterlessConstructor() { var src1 = @" record struct C { public C() { } }"; var src2 = "record struct C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.First(c => c.ToString() == "C.C()"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_NotPrimary() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int Y { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.Y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_NotPrimary_WithConstructor() { var src1 = @" record C(int X) { public C(string fromAString) { } }"; var src2 = @" record C(int X) { public int Y { get; set; } public C(string fromAString) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.Y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_NotPrimary_WithExplicitMembers() { var src1 = @" record C(int X) { protected virtual bool PrintMembers(System.Text.StringBuilder builder) { return false; } public override int GetHashCode() { return 0; } public virtual bool Equals(C other) { return false; } public C(C original) { } }"; var src2 = @" record C(int X) { public int Y { get; set; } protected virtual bool PrintMembers(System.Text.StringBuilder builder) { return false; } public override int GetHashCode() { return 0; } public virtual bool Equals(C other) { return false; } public C(C original) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.Y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddProperty_NotPrimary_WithInitializer() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int Y { get; set; } = 1; }"; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.Y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField() { var src1 = "record C(int X) { }"; var src2 = "record C(int X) { private int _y; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField_WithExplicitMembers() { var src1 = @" record C(int X) { public C(C other) { } }"; var src2 = @" record C(int X) { private int _y; public C(C other) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField_WithInitializer() { var src1 = "record C(int X) { }"; var src2 = "record C(int X) { private int _y = 1; }"; var syntaxMap = GetSyntaxMap(src1, src2); var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._y")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField_WithExistingInitializer() { var src1 = "record C(int X) { private int _y = <N:0.0>1</N:0.0>; }"; var src2 = "record C(int X) { private int _y = <N:0.0>1</N:0.0>; private int _z; }"; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._z")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_AddField_WithInitializerAndExistingInitializer() { var src1 = "record C(int X) { private int _y = <N:0.0>1</N:0.0>; }"; var src2 = "record C(int X) { private int _y = <N:0.0>1</N:0.0>; private int _z = 1; }"; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C._z")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_DeleteField() { var src1 = "record C(int X) { private int _y; }"; var src2 = "record C(int X) { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Delete, "record C", DeletedSymbolDisplay(FeaturesResources.field, "_y"))); } [Fact] public void Record_DeleteProperty_Primary() { var src1 = "record C(int X, int Y) { }"; var src2 = "record C(int X) { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Delete, "record C", DeletedSymbolDisplay(FeaturesResources.parameter, "int Y"))); } [Fact] public void Record_DeleteProperty_NotPrimary() { var src1 = "record C(int X) { public int P { get; set; } }"; var src2 = "record C(int X) { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "record C", DeletedSymbolDisplay(FeaturesResources.auto_property, "P"))); } [Fact] public void Record_ImplementSynthesized_Property() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get; init; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_Property_WithBody() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get { return 4; } init { throw null; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_Property_WithExpressionBody() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get => 4; init => throw null; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_Property_InitToSet() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ImplementRecordParameterWithSet, "public int X", "X")); } [Fact] public void Record_ImplementSynthesized_Property_MakeReadOnly() { var src1 = "record C(int X);"; var src2 = @" record C(int X) { public int X { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ImplementRecordParameterAsReadOnly, "public int X", "X")); } [Fact] public void Record_UnImplementSynthesized_Property() { var src1 = @" record C(int X) { public int X { get; init; } }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_UnImplementSynthesized_Property_WithExpressionBody() { var src1 = @" record C(int X) { public int X { get => 4; init => throw null; } }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_UnImplementSynthesized_Property_WithBody() { var src1 = @" record C(int X) { public int X { get { return 4; } init { } } }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C"))); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_ImplementSynthesized_Property_Partial() { var srcA1 = @"partial record C(int X);"; var srcB1 = @"partial record C;"; var srcA2 = @"partial record C(int X);"; var srcB2 = @" partial record C { public int X { get; init; } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void Record_UnImplementSynthesized_Property_Partial() { var srcA1 = @"partial record C(int X);"; var srcB1 = @" partial record C { public int X { get; init; } }"; var srcA2 = @"partial record C(int X);"; var srcB2 = @"partial record C;"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void Record_ImplementSynthesized_Property_Partial_WithBody() { var srcA1 = @"partial record C(int X);"; var srcB1 = @"partial record C;"; var srcA2 = @"partial record C(int X);"; var srcB2 = @" partial record C { public int X { get { return 4; } init { throw null; } } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), partialType : "C", preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C")) }) }); } [Fact] public void Record_UnImplementSynthesized_Property_Partial_WithBody() { var srcA1 = @"partial record C(int X);"; var srcB1 = @" partial record C { public int X { get { return 4; } init { throw null; } } }"; var srcA2 = @"partial record C(int X);"; var srcB2 = @"partial record C;"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.PrintMembers")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("Equals").OfType<IMethodSymbol>().First(m => SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, m.ContainingType))), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.GetHashCode")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.X").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), partialType : "C", preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "C")) }) }); } [Fact] public void Record_MoveProperty_Partial() { var srcA1 = @" partial record C(int X) { public int Y { get; init; } }"; var srcB1 = @" partial record C; "; var srcA2 = @" partial record C(int X); "; var srcB2 = @" partial record C { public int Y { get; init; } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.Y").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.Y").SetMethod) }), }); } [Fact] public void Record_UnImplementSynthesized_Property_WithInitializer() { var src1 = @" record C(int X) { public int X { get; init; } = 1; }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_UnImplementSynthesized_Property_WithInitializerMatchingCompilerGenerated() { var src1 = @" record C(int X) { public int X { get; init; } = X; }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); edits.VerifyRudeDiagnostics(); } [Fact] public void Record_Property_Delete_NotPrimary() { var src1 = @" record C(int X) { public int Y { get; init; } }"; var src2 = "record C(int X);"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "record C", DeletedSymbolDisplay(FeaturesResources.auto_property, "Y"))); } [Fact] public void Record_PropertyInitializer_Update_NotPrimary() { var src1 = "record C { int X { get; } = 0; }"; var src2 = "record C { int X { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Length == 0), preserveLocalVariables: true)); } [Fact] public void Record_PropertyInitializer_Update_Primary() { var src1 = "record C(int X) { int X { get; } = 0; }"; var src2 = "record C(int X) { int X { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters[0].Type.ToDisplayString() == "int"), preserveLocalVariables: true)); } #endregion #region Enums [Fact] public void Enum_NoModifiers_Insert() { var src1 = ""; var src2 = "enum C { A }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Enum_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { enum C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Enum_NoModifiers_IntoType_Insert() { var src1 = "struct N { }"; var src2 = "struct N { enum C { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Enum_Attribute_Insert() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "enum E { }"; var src2 = attribute + "[A]enum E { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum E { }]@48 -> [[A]enum E { }]@48"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "enum E", FeaturesResources.enum_)); } [Fact] public void Enum_Member_Attribute_Delete() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "enum E { [A]X }"; var src2 = attribute + "enum E { X }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]X]@57 -> [X]@57"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "X", FeaturesResources.enum_value)); } [Fact] public void Enum_Member_Attribute_Insert() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "enum E { X }"; var src2 = attribute + "enum E { [A]X }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [X]@57 -> [[A]X]@57"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "[A]X", FeaturesResources.enum_value)); } [Fact] public void Enum_Member_Attribute_Update() { var attribute = "public class A1Attribute : System.Attribute { }\n\n" + "public class A2Attribute : System.Attribute { }\n\n"; var src1 = attribute + "enum E { [A1]X }"; var src2 = attribute + "enum E { [A2]X }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A1]X]@107 -> [[A2]X]@107"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "[A2]X", FeaturesResources.enum_value)); } [Fact] public void Enum_Member_Attribute_InsertDeleteAndUpdate() { var srcA1 = ""; var srcB1 = "enum N { A = 1 }"; var srcA2 = "enum N { [System.Obsolete]A = 1 }"; var srcB2 = ""; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("N.A")) }), DocumentResults() }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Enum_Rename() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Colors { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red = 1, Blue = 2, }]@0 -> [enum Colors { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "enum Colors", FeaturesResources.enum_)); } [Fact] public void Enum_BaseType_Add() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color : ushort { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red = 1, Blue = 2, }]@0 -> [enum Color : ushort { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.EnumUnderlyingTypeUpdate, "enum Color", FeaturesResources.enum_)); } [Fact] public void Enum_BaseType_Add_Unchanged() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color : int { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red = 1, Blue = 2, }]@0 -> [enum Color : int { Red = 1, Blue = 2, }]@0"); edits.VerifySemantics(); } [Fact] public void Enum_BaseType_Update() { var src1 = "enum Color : ushort { Red = 1, Blue = 2, }"; var src2 = "enum Color : long { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color : ushort { Red = 1, Blue = 2, }]@0 -> [enum Color : long { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.EnumUnderlyingTypeUpdate, "enum Color", FeaturesResources.enum_)); } [Fact] public void Enum_BaseType_Delete_Unchanged() { var src1 = "enum Color : int { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color : int { Red = 1, Blue = 2, }]@0 -> [enum Color { Red = 1, Blue = 2, }]@0"); edits.VerifySemantics(); } [Fact] public void Enum_BaseType_Delete_Changed() { var src1 = "enum Color : ushort { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color : ushort { Red = 1, Blue = 2, }]@0 -> [enum Color { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.EnumUnderlyingTypeUpdate, "enum Color", FeaturesResources.enum_)); } [Fact] public void EnumAccessibilityChange() { var src1 = "public enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public enum Color { Red = 1, Blue = 2, }]@0 -> [enum Color { Red = 1, Blue = 2, }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "enum Color", FeaturesResources.enum_)); } [Fact] public void EnumAccessibilityNoChange() { var src1 = "internal enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 2, }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Fact] public void EnumInitializerUpdate() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1, Blue = 3, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Blue = 2]@22 -> [Blue = 3]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Blue = 3", FeaturesResources.enum_value)); } [Fact] public void EnumInitializerUpdate2() { var src1 = "enum Color { Red = 1, Blue = 2, }"; var src2 = "enum Color { Red = 1 << 0, Blue = 2 << 1, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [Red = 1]@13 -> [Red = 1 << 0]@13", "Update [Blue = 2]@22 -> [Blue = 2 << 1]@27"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Blue = 2 << 1", FeaturesResources.enum_value)); } [Fact] public void EnumInitializerUpdate3() { var src1 = "enum Color { Red = int.MinValue }"; var src2 = "enum Color { Red = int.MaxValue }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [Red = int.MinValue]@13 -> [Red = int.MaxValue]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Red = int.MaxValue", FeaturesResources.enum_value)); } [Fact] public void EnumInitializerUpdate_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]enum Color { Red = 1 }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]enum Color { Red = 2 }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [Red = 1]@185 -> [Red = 2]@185"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("Color"))); } [Fact] public void EnumInitializerAdd() { var src1 = "enum Color { Red, }"; var src2 = "enum Color { Red = 1, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Red]@13 -> [Red = 1]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Red = 1", FeaturesResources.enum_value)); } [Fact] public void EnumInitializerDelete() { var src1 = "enum Color { Red = 1, }"; var src2 = "enum Color { Red, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Red = 1]@13 -> [Red]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "Red", FeaturesResources.enum_value)); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916")] [Fact] public void EnumMemberAdd() { var src1 = "enum Color { Red }"; var src2 = "enum Color { Red, Blue}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red }]@0 -> [enum Color { Red, Blue}]@0", "Insert [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "Blue", FeaturesResources.enum_value)); } [Fact] public void EnumMemberAdd2() { var src1 = "enum Color { Red, }"; var src2 = "enum Color { Red, Blue}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "Blue", FeaturesResources.enum_value)); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916")] [Fact] public void EnumMemberAdd3() { var src1 = "enum Color { Red, }"; var src2 = "enum Color { Red, Blue,}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red, }]@0 -> [enum Color { Red, Blue,}]@0", "Insert [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "Blue", FeaturesResources.enum_value)); } [Fact] public void EnumMemberUpdate() { var src1 = "enum Color { Red }"; var src2 = "enum Color { Orange }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Red]@13 -> [Orange]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "Orange", FeaturesResources.enum_value)); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916")] [Fact] public void EnumMemberDelete() { var src1 = "enum Color { Red, Blue}"; var src2 = "enum Color { Red }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red, Blue}]@0 -> [enum Color { Red }]@0", "Delete [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "enum Color", DeletedSymbolDisplay(FeaturesResources.enum_value, "Blue"))); } [Fact] public void EnumMemberDelete2() { var src1 = "enum Color { Red, Blue}"; var src2 = "enum Color { Red, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [Blue]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "enum Color", DeletedSymbolDisplay(FeaturesResources.enum_value, "Blue"))); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916"), WorkItem(793197, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/793197")] [Fact] public void EnumTrailingCommaAdd() { var src1 = "enum Color { Red }"; var src2 = "enum Color { Red, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red }]@0 -> [enum Color { Red, }]@0"); edits.VerifySemantics(ActiveStatementsDescription.Empty, NoSemanticEdits); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916"), WorkItem(793197, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/793197")] [Fact] public void EnumTrailingCommaAdd_WithInitializer() { var src1 = "enum Color { Red = 1 }"; var src2 = "enum Color { Red = 1, }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum Color { Red = 1 }]@0 -> [enum Color { Red = 1, }]@0"); edits.VerifySemantics(ActiveStatementsDescription.Empty, NoSemanticEdits); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916"), WorkItem(793197, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/793197")] [Fact] public void EnumTrailingCommaDelete() { var src1 = "enum Color { Red, }"; var src2 = "enum Color { Red }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red, }]@0 -> [enum Color { Red }]@0"); edits.VerifySemantics(ActiveStatementsDescription.Empty, NoSemanticEdits); } [WorkItem(754916, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754916"), WorkItem(793197, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/793197")] [Fact] public void EnumTrailingCommaDelete_WithInitializer() { var src1 = "enum Color { Red = 1, }"; var src2 = "enum Color { Red = 1 }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [enum Color { Red = 1, }]@0 -> [enum Color { Red = 1 }]@0"); edits.VerifySemantics(ActiveStatementsDescription.Empty, NoSemanticEdits); } #endregion #region Delegates [Fact] public void Delegates_NoModifiers_Insert() { var src1 = ""; var src2 = "delegate void D();"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_NoModifiers_IntoNamespace_Insert() { var src1 = "namespace N { }"; var src2 = "namespace N { delegate void D(); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_NoModifiers_IntoType_Insert() { var src1 = "class C { }"; var src2 = "class C { delegate void D(); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_Public_IntoType_Insert() { var src1 = "class C { }"; var src2 = "class C { public delegate void D(); }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public delegate void D();]@10", "Insert [()]@32"); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_Generic_Insert() { var src1 = "class C { }"; var src2 = "class C { private delegate void D<T>(T a); }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [private delegate void D<T>(T a);]@10", "Insert [<T>]@33", "Insert [(T a)]@36", "Insert [T]@34", "Insert [T a]@37"); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_Delete() { var src1 = "class C { private delegate void D(); }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [private delegate void D();]@10", "Delete [()]@33"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.delegate_, "D"))); } [Fact] public void Delegates_Rename() { var src1 = "public delegate void D();"; var src2 = "public delegate void Z();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate void D();]@0 -> [public delegate void Z();]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "public delegate void Z()", FeaturesResources.delegate_)); } [Fact] public void Delegates_Accessibility_Update() { var src1 = "public delegate void D();"; var src2 = "private delegate void D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate void D();]@0 -> [private delegate void D();]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "private delegate void D()", FeaturesResources.delegate_)); } [Fact] public void Delegates_ReturnType_Update() { var src1 = "public delegate int D();"; var src2 = "public delegate void D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D();]@0 -> [public delegate void D();]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "public delegate void D()", FeaturesResources.delegate_)); } [Fact] public void Delegates_ReturnType_AddAttribute() { var attribute = "public class A : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "[return: A]public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D(int a);]@39 -> [[return: A]public delegate int D(int a);]@39"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.Invoke")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.BeginInvoke")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_Parameter_Insert() { var src1 = "public delegate int D();"; var src2 = "public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int a]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "int a", FeaturesResources.parameter)); } [Fact] public void Delegates_Parameter_Insert_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]public delegate int D();"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]internal delegate bool D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("D"))); } [Fact] public void Delegates_Parameter_Delete() { var src1 = "public delegate int D(int a);"; var src2 = "public delegate int D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [int a]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "public delegate int D()", DeletedSymbolDisplay(FeaturesResources.parameter, "int a"))); } [Fact] public void Delegates_Parameter_Rename() { var src1 = "public delegate int D(int a);"; var src2 = "public delegate int D(int b);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@22 -> [int b]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.RenamingNotSupportedByRuntime, "int b", FeaturesResources.parameter)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.Invoke")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.BeginInvoke")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_Parameter_Update() { var src1 = "public delegate int D(int a);"; var src2 = "public delegate int D(byte a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@22 -> [byte a]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "byte a", FeaturesResources.parameter)); } [Fact] public void Delegates_Parameter_AddAttribute_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "public delegate int D([A]int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@70 -> [[A]int a]@70"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Delegates_Parameter_AddAttribute() { var attribute = "public class A : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "public delegate int D([A]int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@61 -> [[A]int a]@61"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.Invoke")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.BeginInvoke")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_TypeParameter_Insert() { var src1 = "public delegate int D();"; var src2 = "public delegate int D<T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [<T>]@21", "Insert [T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "T", FeaturesResources.type_parameter)); } [Fact(Skip = "https://github.com/dotnet/roslyn/issues/54881")] [WorkItem(54881, "https://github.com/dotnet/roslyn/issues/54881")] public void Delegates_TypeParameter_Insert_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]public delegate int D<out T>();"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]internal delegate bool D<in T, out S>(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("D"))); } [Fact] public void Delegates_TypeParameter_Delete() { var src1 = "public delegate int D<T>();"; var src2 = "public delegate int D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [<T>]@21", "Delete [T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "public delegate int D()", DeletedSymbolDisplay(FeaturesResources.type_parameter, "T"))); } [Fact] public void Delegates_TypeParameter_Rename() { var src1 = "public delegate int D<T>();"; var src2 = "public delegate int D<S>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@22 -> [S]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "S", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "S")); } [Fact] public void Delegates_TypeParameter_Variance1() { var src1 = "public delegate int D<T>();"; var src2 = "public delegate int D<in T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@22 -> [in T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.VarianceUpdate, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void Delegates_TypeParameter_Variance2() { var src1 = "public delegate int D<out T>();"; var src2 = "public delegate int D<T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [out T]@22 -> [T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.VarianceUpdate, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void Delegates_TypeParameter_Variance3() { var src1 = "public delegate int D<out T>();"; var src2 = "public delegate int D<in T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [out T]@22 -> [in T]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.VarianceUpdate, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void Delegates_TypeParameter_AddAttribute() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D<T>();"; var src2 = attribute + "public delegate int D<[A]T>();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@70 -> [[A]T]@70"); edits.VerifyRudeDiagnostics( EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void Delegates_Attribute_Add_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "[A]public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D(int a);]@48 -> [[A]public delegate int D(int a);]@48"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "public delegate int D(int a)", FeaturesResources.delegate_)); } [Fact] public void Delegates_Attribute_Add() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "[A]public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D(int a);]@48 -> [[A]public delegate int D(int a);]@48"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_Attribute_Add_WithReturnTypeAttribute() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + "public delegate int D(int a);"; var src2 = attribute + "[return: A][A]public delegate int D(int a);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D(int a);]@48 -> [[return: A][A]public delegate int D(int a);]@48"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.Invoke")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("D.BeginInvoke")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Delegates_ReadOnlyRef_Parameter_InsertWhole() { var src1 = ""; var src2 = "public delegate int D(in int b);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public delegate int D(in int b);]@0", "Insert [(in int b)]@21", "Insert [in int b]@22"); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_ReadOnlyRef_Parameter_InsertParameter() { var src1 = "public delegate int D();"; var src2 = "public delegate int D(in int b);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [in int b]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "in int b", FeaturesResources.parameter)); } [Fact] public void Delegates_ReadOnlyRef_Parameter_Update() { var src1 = "public delegate int D(int b);"; var src2 = "public delegate int D(in int b);"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int b]@22 -> [in int b]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in int b", FeaturesResources.parameter)); } [Fact] public void Delegates_ReadOnlyRef_ReturnType_Insert() { var src1 = ""; var src2 = "public delegate ref readonly int D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public delegate ref readonly int D();]@0", "Insert [()]@34"); edits.VerifyRudeDiagnostics(); } [Fact] public void Delegates_ReadOnlyRef_ReturnType_Update() { var src1 = "public delegate int D();"; var src2 = "public delegate ref readonly int D();"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public delegate int D();]@0 -> [public delegate ref readonly int D();]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "public delegate ref readonly int D()", FeaturesResources.delegate_)); } #endregion #region Nested Types [Fact] public void NestedClass_ClassMove1() { var src1 = @"class C { class D { } }"; var src2 = @"class C { } class D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Move [class D { }]@10 -> @12"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "class D", FeaturesResources.class_)); } [Fact] public void NestedClass_ClassMove2() { var src1 = @"class C { class D { } class E { } class F { } }"; var src2 = @"class C { class D { } class F { } } class E { } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Move [class E { }]@23 -> @37"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "class E", FeaturesResources.class_)); } [Fact] public void NestedClass_ClassInsertMove1() { var src1 = @"class C { class D { } }"; var src2 = @"class C { class E { class D { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [class E { class D { } }]@10", "Move [class D { }]@10 -> @20"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "class D", FeaturesResources.class_)); } [Fact] public void NestedClass_Insert1() { var src1 = @"class C { }"; var src2 = @"class C { class D { class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [class D { class E { } }]@10", "Insert [class E { }]@20"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_Insert2() { var src1 = @"class C { }"; var src2 = @"class C { protected class D { public class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [protected class D { public class E { } }]@10", "Insert [public class E { }]@30"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_Insert3() { var src1 = @"class C { }"; var src2 = @"class C { private class D { public class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [private class D { public class E { } }]@10", "Insert [public class E { }]@28"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_Insert4() { var src1 = @"class C { }"; var src2 = @"class C { private class D { public D(int a, int b) { } public int P { get; set; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [private class D { public D(int a, int b) { } public int P { get; set; } }]@10", "Insert [public D(int a, int b) { }]@28", "Insert [public int P { get; set; }]@55", "Insert [(int a, int b)]@36", "Insert [{ get; set; }]@68", "Insert [int a]@37", "Insert [int b]@44", "Insert [get;]@70", "Insert [set;]@75"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_Insert_ReloadableIntoReloadable1() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { [CreateNewOnMetadataUpdate]class D { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void NestedClass_Insert_ReloadableIntoReloadable2() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { [CreateNewOnMetadataUpdate]class D { [CreateNewOnMetadataUpdate]class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void NestedClass_Insert_ReloadableIntoReloadable3() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { class D { [CreateNewOnMetadataUpdate]class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void NestedClass_Insert_ReloadableIntoReloadable4() { var src1 = ReloadableAttributeSrc + "class C { }"; var src2 = ReloadableAttributeSrc + "class C { [CreateNewOnMetadataUpdate]class D { [CreateNewOnMetadataUpdate]class E { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.D"))); } [Fact] public void NestedClass_Insert_Member_Reloadable() { var src1 = ReloadableAttributeSrc + "class C { [CreateNewOnMetadataUpdate]class D { } }"; var src2 = ReloadableAttributeSrc + "class C { [CreateNewOnMetadataUpdate]class D { int x; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C.D"))); } [Fact] public void NestedClass_InsertMemberWithInitializer1() { var src1 = @" class C { }"; var src2 = @" class C { private class D { public int P = 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.D"), preserveLocalVariables: false) }); } [WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] [Fact] public void NestedClass_Insert_PInvoke() { var src1 = @" using System; using System.Runtime.InteropServices; class C { }"; var src2 = @" using System; using System.Runtime.InteropServices; class C { abstract class D { public extern D(); public static extern int P { [DllImport(""msvcrt.dll"")]get; [DllImport(""msvcrt.dll"")]set; } [DllImport(""msvcrt.dll"")] public static extern int puts(string c); [DllImport(""msvcrt.dll"")] public static extern int operator +(D d, D g); [DllImport(""msvcrt.dll"")] public static extern explicit operator int (D d); } } "; var edits = GetTopEdits(src1, src2); // Adding P/Invoke is not supported by the CLR. edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertExtern, "public extern D()", FeaturesResources.constructor), Diagnostic(RudeEditKind.InsertExtern, "public static extern int P", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertExtern, "public static extern int puts(string c)", FeaturesResources.method), Diagnostic(RudeEditKind.InsertExtern, "public static extern int operator +(D d, D g)", FeaturesResources.operator_), Diagnostic(RudeEditKind.InsertExtern, "public static extern explicit operator int (D d)", CSharpFeaturesResources.conversion_operator)); } [WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] [Fact] public void NestedClass_Insert_VirtualAbstract() { var src1 = @" using System; using System.Runtime.InteropServices; class C { }"; var src2 = @" using System; using System.Runtime.InteropServices; class C { abstract class D { public abstract int P { get; } public abstract int this[int i] { get; } public abstract int puts(string c); public virtual event Action E { add { } remove { } } public virtual int Q { get { return 1; } } public virtual int this[string i] { get { return 1; } } public virtual int M(string c) { return 1; } } } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_TypeReorder1() { var src1 = @"class C { struct E { } class F { } delegate void D(); interface I {} }"; var src2 = @"class C { class F { } interface I {} delegate void D(); struct E { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [struct E { }]@10 -> @56", "Reorder [interface I {}]@54 -> @22"); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedClass_MethodDeleteInsert() { var src1 = @"public class C { public void goo() {} }"; var src2 = @"public class C { private class D { public void goo() {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [private class D { public void goo() {} }]@17", "Insert [public void goo() {}]@35", "Insert [()]@50", "Delete [public void goo() {}]@17", "Delete [()]@32"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "public class C", DeletedSymbolDisplay(FeaturesResources.method, "goo()"))); } [Fact] public void NestedClass_ClassDeleteInsert() { var src1 = @"public class C { public class X {} }"; var src2 = @"public class C { public class D { public class X {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public class D { public class X {} }]@17", "Move [public class X {}]@17 -> @34"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "public class X", FeaturesResources.class_)); } /// <summary> /// A new generic type can be added whether it's nested and inherits generic parameters from the containing type, or top-level. /// </summary> [Fact] public void NestedClassGeneric_Insert() { var src1 = @" using System; class C<T> { } "; var src2 = @" using System; class C<T> { class D {} struct S {} enum N {} interface I {} delegate void D(); } class D<T> { } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void NestedEnum_InsertMember() { var src1 = "struct S { enum N { A = 1 } }"; var src2 = "struct S { enum N { A = 1, B = 2 } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [enum N { A = 1 }]@11 -> [enum N { A = 1, B = 2 }]@11", "Insert [B = 2]@27"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "B = 2", FeaturesResources.enum_value)); } [Fact, WorkItem(50876, "https://github.com/dotnet/roslyn/issues/50876")] public void NestedEnumInPartialType_InsertDelete() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { enum N { A = 1 } }"; var srcA2 = "partial struct S { enum N { A = 1 } }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults() }); } [Fact, WorkItem(50876, "https://github.com/dotnet/roslyn/issues/50876")] public void NestedEnumInPartialType_InsertDeleteAndUpdateMember() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { enum N { A = 1 } }"; var srcA2 = "partial struct S { enum N { A = 2 } }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "A = 2", FeaturesResources.enum_value), }), DocumentResults() }); } [Fact, WorkItem(50876, "https://github.com/dotnet/roslyn/issues/50876")] public void NestedEnumInPartialType_InsertDeleteAndUpdateBase() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { enum N : uint { A = 1 } }"; var srcA2 = "partial struct S { enum N : int { A = 1 } }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.EnumUnderlyingTypeUpdate, "enum N", FeaturesResources.enum_), }), DocumentResults() }); } [Fact, WorkItem(50876, "https://github.com/dotnet/roslyn/issues/50876")] public void NestedEnumInPartialType_InsertDeleteAndInsertMember() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { enum N { A = 1 } }"; var srcA2 = "partial struct S { enum N { A = 1, B = 2 } }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Insert, "B = 2", FeaturesResources.enum_value) }), DocumentResults() }); } [Fact] public void NestedDelegateInPartialType_InsertDelete() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { delegate void D(); }"; var srcA2 = "partial struct S { delegate void D(); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( // delegate does not have any user-defined method body and this does not need a PDB update semanticEdits: NoSemanticEdits), DocumentResults() }); } [Fact] public void NestedDelegateInPartialType_InsertDeleteAndChangeParameters() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { delegate void D(); }"; var srcA2 = "partial struct S { delegate void D(int x); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ChangingParameterTypes, "delegate void D(int x)", FeaturesResources.delegate_) }), DocumentResults() }); } [Fact] public void NestedDelegateInPartialType_InsertDeleteAndChangeReturnType() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { delegate ref int D(); }"; var srcA2 = "partial struct S { delegate ref readonly int D(); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.TypeUpdate, "delegate ref readonly int D()", FeaturesResources.delegate_) }), DocumentResults() }); } [Fact] public void NestedDelegateInPartialType_InsertDeleteAndChangeOptionalParameterValue() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { delegate void D(int x = 1); }"; var srcA2 = "partial struct S { delegate void D(int x = 2); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "int x = 2", FeaturesResources.parameter) }), DocumentResults() }); } [Fact] public void NestedPartialTypeInPartialType_InsertDeleteAndChange() { var srcA1 = "partial struct S { partial class C { void F1() {} } }"; var srcB1 = "partial struct S { partial class C { void F2(byte x) {} } }"; var srcC1 = "partial struct S { }"; var srcA2 = "partial struct S { partial class C { void F1() {} } }"; var srcB2 = "partial struct S { }"; var srcC2 = "partial struct S { partial class C { void F2(int x) {} } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial struct S", DeletedSymbolDisplay(FeaturesResources.method, "F2(byte x)")) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("S").GetMember<INamedTypeSymbol>("C").GetMember("F2")) }) }); } [Fact] public void Type_Partial_AddMultiple() { var srcA1 = ""; var srcB1 = ""; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C"), partialType: "C") }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C"), partialType: "C") }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Partial_InsertDeleteAndChange_Attribute() { var srcA1 = "partial class C { }"; var srcB1 = ""; var srcC1 = "partial class C { }"; var srcA2 = ""; var srcB2 = "[A]partial class C { }"; var srcC2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"), partialType: "C") }), DocumentResults(), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Partial_InsertDeleteAndChange_TypeParameterAttribute_NotSupportedByRuntime() { var srcA1 = "partial class C<T> { }"; var srcB1 = ""; var srcC1 = "partial class C<T> { }"; var srcA2 = ""; var srcB2 = "partial class C<[A]T> { }"; var srcC2 = "partial class C<T> { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "partial class C<[A]T>"), Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T") }), DocumentResults(), }); } [Fact] public void Type_Partial_InsertDeleteAndChange_Constraint() { var srcA1 = "partial class C<T> { }"; var srcB1 = ""; var srcC1 = "partial class C<T> { }"; var srcA2 = ""; var srcB2 = "partial class C<T> where T : new() { }"; var srcC2 = "partial class C<T> { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "partial class C<T>"), Diagnostic(RudeEditKind.ChangingConstraints, "where T : new()", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : new()") }), DocumentResults(), }); } [Fact] public void Type_Partial_InsertDeleteRefactor() { var srcA1 = "partial class C : I { void F() { } }"; var srcB1 = "[A][B]partial class C : J { void G() { } }"; var srcC1 = ""; var srcD1 = ""; var srcA2 = ""; var srcB2 = ""; var srcC2 = "[A]partial class C : I, J { void F() { } }"; var srcD2 = "[B]partial class C { void G() { } }"; var srcE = "interface I {} interface J {}"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2), GetTopEdits(srcD1, srcD2), GetTopEdits(srcE, srcE) }, new[] { DocumentResults(), DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("G")) }), DocumentResults(), }); } [Fact] public void Type_Partial_Attribute_AddMultiple() { var attributes = @" class A : System.Attribute {} class B : System.Attribute {} "; var srcA1 = "partial class C { }" + attributes; var srcB1 = "partial class C { }"; var srcA2 = "[A]partial class C { }" + attributes; var srcB2 = "[B]partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"), partialType: "C") }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C"), partialType: "C") }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Type_Partial_InsertDeleteRefactor_AttributeListSplitting() { var srcA1 = "partial class C { void F() { } }"; var srcB1 = "[A,B]partial class C { void G() { } }"; var srcC1 = ""; var srcD1 = ""; var srcA2 = ""; var srcB2 = ""; var srcC2 = "[A]partial class C { void F() { } }"; var srcD2 = "[B]partial class C { void G() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2), GetTopEdits(srcD1, srcD2) }, new[] { DocumentResults(), DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")) }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.G")) }), }); } [Fact] public void Type_Partial_InsertDeleteChangeMember() { var srcA1 = "partial class C { void F(int y = 1) { } }"; var srcB1 = "partial class C { void G(int x = 1) { } }"; var srcC1 = ""; var srcA2 = ""; var srcB2 = "partial class C { void G(int x = 2) { } }"; var srcC2 = "partial class C { void F(int y = 2) { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "int x = 2", FeaturesResources.parameter) }), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "int y = 2", FeaturesResources.parameter) }), }); } [Fact] public void NestedPartialTypeInPartialType_InsertDeleteAndInsertVirtual() { var srcA1 = "partial interface I { partial class C { virtual void F1() {} } }"; var srcB1 = "partial interface I { partial class C { virtual void F2() {} } }"; var srcC1 = "partial interface I { partial class C { } }"; var srcD1 = "partial interface I { partial class C { } }"; var srcE1 = "partial interface I { }"; var srcF1 = "partial interface I { }"; var srcA2 = "partial interface I { partial class C { } }"; var srcB2 = ""; var srcC2 = "partial interface I { partial class C { virtual void F1() {} } }"; // move existing virtual into existing partial decl var srcD2 = "partial interface I { partial class C { virtual void N1() {} } }"; // insert new virtual into existing partial decl var srcE2 = "partial interface I { partial class C { virtual void F2() {} } }"; // move existing virtual into a new partial decl var srcF2 = "partial interface I { partial class C { virtual void N2() {} } }"; // insert new virtual into new partial decl EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2), GetTopEdits(srcD1, srcD2), GetTopEdits(srcE1, srcE2), GetTopEdits(srcF1, srcF2) }, new[] { // A DocumentResults(), // B DocumentResults(), // C DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember<INamedTypeSymbol>("C").GetMember("F1")) }), // D DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InsertVirtual, "virtual void N1()", FeaturesResources.method) }), // E DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("I").GetMember<INamedTypeSymbol>("C").GetMember("F2")) }), // F DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InsertVirtual, "virtual void N2()", FeaturesResources.method) }), }); } #endregion #region Namespaces [Fact] public void Namespace_Insert() { var src1 = @""; var src2 = @"namespace C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [namespace C { }]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "namespace C", FeaturesResources.namespace_)); } [Fact] public void Namespace_InsertNested() { var src1 = @"namespace C { }"; var src2 = @"namespace C { namespace D { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [namespace D { }]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "namespace D", FeaturesResources.namespace_)); } [Fact] public void Namespace_DeleteNested() { var src1 = @"namespace C { namespace D { } }"; var src2 = @"namespace C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [namespace D { }]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "namespace C", FeaturesResources.namespace_)); } [Fact] public void Namespace_Move() { var src1 = @"namespace C { namespace D { } }"; var src2 = @"namespace C { } namespace D { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Move [namespace D { }]@14 -> @16"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "namespace D", FeaturesResources.namespace_)); } [Fact] public void Namespace_Reorder1() { var src1 = @"namespace C { namespace D { } class T { } namespace E { } }"; var src2 = @"namespace C { namespace E { } class T { } namespace D { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [class T { }]@30 -> @30", "Reorder [namespace E { }]@42 -> @14"); edits.VerifyRudeDiagnostics(); } [Fact] public void Namespace_Reorder2() { var src1 = @"namespace C { namespace D1 { } namespace D2 { } namespace D3 { } class T { } namespace E { } }"; var src2 = @"namespace C { namespace E { } class T { } namespace D1 { } namespace D2 { } namespace D3 { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [class T { }]@65 -> @65", "Reorder [namespace E { }]@77 -> @14"); edits.VerifyRudeDiagnostics(); } [Fact] public void Namespace_FileScoped_Insert() { var src1 = @""; var src2 = @"namespace C;"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [namespace C;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "namespace C", FeaturesResources.namespace_)); } [Fact] public void Namespace_FileScoped_Delete() { var src1 = @"namespace C;"; var src2 = @""; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [namespace C;]@0"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, null, FeaturesResources.namespace_)); } #endregion #region Members [Fact] public void PartialMember_DeleteInsert_SingleDocument() { var src1 = @" using System; partial class C { void M() {} int P1 { get; set; } int P2 { get => 1; set {} } int this[int i] { get => 1; set {} } int this[byte i] { get => 1; set {} } event Action E { add {} remove {} } event Action EF; int F1; int F2; } partial class C { } "; var src2 = @" using System; partial class C { } partial class C { void M() {} int P1 { get; set; } int P2 { get => 1; set {} } int this[int i] { get => 1; set {} } int this[byte i] { get => 1; set {} } event Action E { add {} remove {} } event Action EF; int F1, F2; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [void M() {}]@68", "Insert [int P1 { get; set; }]@85", "Insert [int P2 { get => 1; set {} }]@111", "Insert [int this[int i] { get => 1; set {} }]@144", "Insert [int this[byte i] { get => 1; set {} }]@186", "Insert [event Action E { add {} remove {} }]@229", "Insert [event Action EF;]@270", "Insert [int F1, F2;]@292", "Insert [()]@74", "Insert [{ get; set; }]@92", "Insert [{ get => 1; set {} }]@118", "Insert [[int i]]@152", "Insert [{ get => 1; set {} }]@160", "Insert [[byte i]]@194", "Insert [{ get => 1; set {} }]@203", "Insert [{ add {} remove {} }]@244", "Insert [Action EF]@276", "Insert [int F1, F2]@292", "Insert [get;]@94", "Insert [set;]@99", "Insert [get => 1;]@120", "Insert [set {}]@130", "Insert [int i]@153", "Insert [get => 1;]@162", "Insert [set {}]@172", "Insert [byte i]@195", "Insert [get => 1;]@205", "Insert [set {}]@215", "Insert [add {}]@246", "Insert [remove {}]@253", "Insert [EF]@283", "Insert [F1]@296", "Insert [F2]@300", "Delete [void M() {}]@43", "Delete [()]@49", "Delete [int P1 { get; set; }]@60", "Delete [{ get; set; }]@67", "Delete [get;]@69", "Delete [set;]@74", "Delete [int P2 { get => 1; set {} }]@86", "Delete [{ get => 1; set {} }]@93", "Delete [get => 1;]@95", "Delete [set {}]@105", "Delete [int this[int i] { get => 1; set {} }]@119", "Delete [[int i]]@127", "Delete [int i]@128", "Delete [{ get => 1; set {} }]@135", "Delete [get => 1;]@137", "Delete [set {}]@147", "Delete [int this[byte i] { get => 1; set {} }]@161", "Delete [[byte i]]@169", "Delete [byte i]@170", "Delete [{ get => 1; set {} }]@178", "Delete [get => 1;]@180", "Delete [set {}]@190", "Delete [event Action E { add {} remove {} }]@204", "Delete [{ add {} remove {} }]@219", "Delete [add {}]@221", "Delete [remove {}]@228", "Delete [event Action EF;]@245", "Delete [Action EF]@251", "Delete [EF]@258", "Delete [int F1;]@267", "Delete [int F1]@267", "Delete [F1]@271", "Delete [int F2;]@280", "Delete [int F2]@280", "Delete [F2]@284"); EditAndContinueValidation.VerifySemantics( new[] { edits }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("M"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P1").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P1").SetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P2").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P2").SetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Int32").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Int32").SetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Byte").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.GetParameters().Single().Type.Name == "Byte").SetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").AddMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").RemoveMethod, preserveLocalVariables: false), }) }); } [Fact] public void PartialMember_InsertDelete_MultipleDocuments() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { void F() {} }"; var srcA2 = "partial class C { void F() {} }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F"), preserveLocalVariables: false) }), DocumentResults() }); } [Fact] public void PartialMember_DeleteInsert_MultipleDocuments() { var srcA1 = "partial class C { void F() {} }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { void F() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"), preserveLocalVariables: false) }) }); } [Fact] public void PartialMember_DeleteInsert_GenericMethod() { var srcA1 = "partial class C { void F<T>() {} }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { void F<T>() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.GenericMethodUpdate, "void F<T>()"), Diagnostic(RudeEditKind.GenericMethodUpdate, "T") }) }); } [Fact] public void PartialMember_DeleteInsert_GenericType() { var srcA1 = "partial class C<T> { void F() {} }"; var srcB1 = "partial class C<T> { }"; var srcA2 = "partial class C<T> { }"; var srcB2 = "partial class C<T> { void F() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "void F()") }) }); } [Fact] public void PartialMember_DeleteInsert_Destructor() { var srcA1 = "partial class C { ~C() {} }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { ~C() {} }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("Finalize"), preserveLocalVariables: false), }) }); } [Fact] public void PartialNestedType_InsertDeleteAndChange() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { class D { void M() {} } interface I { } }"; var srcA2 = "partial class C { class D : I { void M() {} } interface I { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.BaseTypeOrInterfaceUpdate, "class D", FeaturesResources.class_), }), DocumentResults() }); } [Fact, WorkItem(51011, "https://github.com/dotnet/roslyn/issues/51011")] public void PartialMember_RenameInsertDelete() { // The syntactic analysis for A and B produce rename edits since it doesn't see that the member was in fact moved. // TODO: Currently, we don't even pass rename edits to semantic analysis where we could handle them as updates. var srcA1 = "partial class C { void F1() {} }"; var srcB1 = "partial class C { void F2() {} }"; var srcA2 = "partial class C { void F2() {} }"; var srcB2 = "partial class C { void F1() {} }"; // current outcome: GetTopEdits(srcA1, srcA2).VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Renamed, "void F2()", FeaturesResources.method)); GetTopEdits(srcB1, srcB2).VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Renamed, "void F1()", FeaturesResources.method)); // correct outcome: //EditAndContinueValidation.VerifySemantics( // new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, // new[] // { // DocumentResults(semanticEdits: new[] // { // SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F2")), // }), // DocumentResults( // semanticEdits: new[] // { // SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F1")), // }) // }); } [Fact] public void PartialMember_DeleteInsert_UpdateMethodBodyError() { var srcA1 = @" using System.Collections.Generic; partial class C { IEnumerable<int> F() { yield return 1; } } "; var srcB1 = @" using System.Collections.Generic; partial class C { } "; var srcA2 = @" using System.Collections.Generic; partial class C { } "; var srcB2 = @" using System.Collections.Generic; partial class C { IEnumerable<int> F() { yield return 1; yield return 2; } } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.Insert, "yield return 2;", CSharpFeaturesResources.yield_return_statement) }) }); } [Fact] public void PartialMember_DeleteInsert_UpdatePropertyAccessors() { var srcA1 = "partial class C { int P { get => 1; set { Console.WriteLine(1); } } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int P { get => 2; set { Console.WriteLine(2); } } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) }) }); } [Fact] public void PartialMember_DeleteInsert_UpdateAutoProperty() { var srcA1 = "partial class C { int P => 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int P => 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod) }) }); } [Fact] public void PartialMember_DeleteInsert_AddFieldInitializer() { var srcA1 = "partial class C { int f; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int f = 1; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void PartialMember_DeleteInsert_RemoveFieldInitializer() { var srcA1 = "partial class C { int f = 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int f; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void PartialMember_DeleteInsert_ConstructorWithInitializers() { var srcA1 = "partial class C { int f = 1; C(int x) { f = x; } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { int f = 1; }"; var srcB2 = "partial class C { C(int x) { f = x + 1; } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void PartialMember_DeleteInsert_MethodAddParameter() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { void F() {} }"; var srcA2 = "partial struct S { void F(int x) {} }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.F")) }), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial struct S", DeletedSymbolDisplay(FeaturesResources.method, "F()")) }) }); } [Fact] public void PartialMember_DeleteInsert_UpdateMethodParameterType() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { void F(int x); }"; var srcA2 = "partial struct S { void F(byte x); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("S.F")) }), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial struct S", DeletedSymbolDisplay(FeaturesResources.method, "F(int x)")) }) }); } [Fact] public void PartialMember_DeleteInsert_MethodAddTypeParameter() { var srcA1 = "partial struct S { }"; var srcB1 = "partial struct S { void F(); }"; var srcA2 = "partial struct S { void F<T>(); }"; var srcB2 = "partial struct S { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InsertGenericMethod, "void F<T>()", FeaturesResources.method) }), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial struct S", DeletedSymbolDisplay(FeaturesResources.method, "F()")) }) }); } #endregion #region Methods [Theory] [InlineData("static")] [InlineData("virtual")] [InlineData("abstract")] [InlineData("override")] [InlineData("sealed override", "override")] public void Method_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "int F() => 0; }"; var src2 = "class C { " + newModifiers + "int F() => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "int F() => 0;]@10 -> [" + newModifiers + "int F() => 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "int F()", FeaturesResources.method)); } [Fact] public void Method_NewModifier_Add() { var src1 = "class C { int F() => 0; }"; var src2 = "class C { new int F() => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [int F() => 0;]@10 -> [new int F() => 0;]@10"); // Currently, an edit is produced eventhough there is no metadata/IL change. Consider improving. edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"))); } [Fact] public void Method_NewModifier_Remove() { var src1 = "class C { new int F() => 0; }"; var src2 = "class C { int F() => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [new int F() => 0;]@10 -> [int F() => 0;]@10"); // Currently, an edit is produced eventhough there is no metadata/IL change. Consider improving. edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F"))); } [Fact] public void Method_ReadOnlyModifier_Add_InMutableStruct() { var src1 = @" struct S { public int M() => 1; }"; var src2 = @" struct S { public readonly int M() => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public readonly int M()", FeaturesResources.method)); } [Fact] public void Method_ReadOnlyModifier_Add_InReadOnlyStruct1() { var src1 = @" readonly struct S { public int M() => 1; }"; var src2 = @" readonly struct S { public readonly int M() => 1; }"; var edits = GetTopEdits(src1, src2); // Currently, an edit is produced eventhough the body nor IsReadOnly attribute have changed. Consider improving. edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IMethodSymbol>("M"))); } [Fact] public void Method_ReadOnlyModifier_Add_InReadOnlyStruct2() { var src1 = @" readonly struct S { public int M() => 1; }"; var src2 = @" struct S { public readonly int M() => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "struct S", "struct")); } [Fact] public void Method_AsyncModifier_Remove() { var src1 = @" class Test { public async Task<int> WaitAsync() { return 1; } }"; var src2 = @" class Test { public Task<int> WaitAsync() { return Task.FromResult(1); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingFromAsynchronousToSynchronous, "public Task<int> WaitAsync()", FeaturesResources.method)); } [Fact] public void Method_AsyncModifier_Add() { var src1 = @" class Test { public Task<int> WaitAsync() { return 1; } }"; var src2 = @" class Test { public async Task<int> WaitAsync() { await Task.Delay(1000); return 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: false); } [Fact] public void Method_AsyncModifier_Add_NotSupported() { var src1 = @" class Test { public Task<int> WaitAsync() { return 1; } }"; var src2 = @" class Test { public async Task<int> WaitAsync() { await Task.Delay(1000); return 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.MakeMethodAsync, "public async Task<int> WaitAsync()")); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Method_ReturnType_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C { " + oldType + " M() => default; }"; var src2 = "class C { " + newType + " M() => default; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Method_ReturnType_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C { " + oldType + " M() => default; }"; var src2 = "class C { " + newType + " M() => default; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, newType + " M()", FeaturesResources.method)); } [Fact] public void Method_Update() { var src1 = @" class C { static void Main(string[] args) { int a = 1; int b = 2; System.Console.WriteLine(a + b); } } "; var src2 = @" class C { static void Main(string[] args) { int b = 2; int a = 1; System.Console.WriteLine(a + b); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Update [static void Main(string[] args) { int a = 1; int b = 2; System.Console.WriteLine(a + b); }]@18 -> [static void Main(string[] args) { int b = 2; int a = 1; System.Console.WriteLine(a + b); }]@18"); edits.VerifyRudeDiagnostics(); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Main"), preserveLocalVariables: false) }); } [Fact] public void MethodWithExpressionBody_Update() { var src1 = @" class C { static int Main(string[] args) => F(1); static int F(int a) => 1; } "; var src2 = @" class C { static int Main(string[] args) => F(2); static int F(int a) => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Update [static int Main(string[] args) => F(1);]@18 -> [static int Main(string[] args) => F(2);]@18"); edits.VerifyRudeDiagnostics(); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Main"), preserveLocalVariables: false) }); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void MethodWithExpressionBody_Update_LiftedParameter() { var src1 = @" using System; class C { int M(int a) => new Func<int>(() => a + 1)(); } "; var src2 = @" using System; class C { int M(int a) => new Func<int>(() => 2)(); // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int M(int a) => new Func<int>(() => a + 1)();]@35 -> [int M(int a) => new Func<int>(() => 2)();]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact] public void MethodWithExpressionBody_ToBlockBody() { var src1 = "class C { static int F(int a) => 1; }"; var src2 = "class C { static int F(int a) { return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [static int F(int a) => 1;]@10 -> [static int F(int a) { return 2; }]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: false) }); } [Fact] public void MethodWithBlockBody_ToExpressionBody() { var src1 = "class C { static int F(int a) { return 2; } }"; var src2 = "class C { static int F(int a) => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [static int F(int a) { return 2; }]@10 -> [static int F(int a) => 1;]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: false) }); } [Fact] public void MethodWithLambda_Update() { var src1 = @" using System; class C { static void F() { Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; } } "; var src2 = @" using System; class C { static void F() { Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(1); } }"; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F"), syntaxMap[0]) }); } [Fact] public void MethodUpdate_LocalVariableDeclaration() { var src1 = @" class C { static void Main(string[] args) { int x = 1; Console.WriteLine(x); } } "; var src2 = @" class C { static void Main(string[] args) { int x = 2; Console.WriteLine(x); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Update [static void Main(string[] args) { int x = 1; Console.WriteLine(x); }]@18 -> [static void Main(string[] args) { int x = 2; Console.WriteLine(x); }]@18"); } [Fact] public void Method_Delete() { var src1 = @" class C { void goo() { } } "; var src2 = @" class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [void goo() { }]@18", "Delete [()]@26"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.method, "goo()"))); } [Fact] public void MethodWithExpressionBody_Delete() { var src1 = @" class C { int goo() => 1; } "; var src2 = @" class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [int goo() => 1;]@18", "Delete [()]@25"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.method, "goo()"))); } [WorkItem(754853, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754853")] [Fact] public void MethodDelete_WithParameterAndAttribute() { var src1 = @" class C { [Obsolete] void goo(int a) { } } "; var src2 = @" class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Delete [[Obsolete] void goo(int a) { }]@18", "Delete [(int a)]@42", "Delete [int a]@43"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.method, "goo(int a)"))); } [WorkItem(754853, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754853")] [Fact] public void MethodDelete_PInvoke() { var src1 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] public static extern int puts(string c); } "; var src2 = @" using System; using System.Runtime.InteropServices; class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Delete [[DllImport(""msvcrt.dll"")] public static extern int puts(string c);]@74", "Delete [(string c)]@134", "Delete [string c]@135"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.method, "puts(string c)"))); } [Fact] public void MethodInsert_NotSupportedByRuntime() { var src1 = "class C { }"; var src2 = "class C { void goo() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "void goo()", FeaturesResources.method)); } [Fact] public void PrivateMethodInsert() { var src1 = @" class C { static void Main(string[] args) { Console.ReadLine(); } }"; var src2 = @" class C { void goo() { } static void Main(string[] args) { Console.ReadLine(); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [void goo() { }]@18", "Insert [()]@26"); edits.VerifyRudeDiagnostics(); } [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784")] [Fact] public void PrivateMethodInsert_WithParameters() { var src1 = @" using System; class C { static void Main(string[] args) { Console.ReadLine(); } }"; var src2 = @" using System; class C { void goo(int a) { } static void Main(string[] args) { Console.ReadLine(); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [void goo(int a) { }]@35", "Insert [(int a)]@43", "Insert [int a]@44"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.goo")) }); } [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784")] [Fact] public void PrivateMethodInsert_WithAttribute() { var src1 = @" class C { static void Main(string[] args) { Console.ReadLine(); } }"; var src2 = @" class C { [System.Obsolete] void goo(int a) { } static void Main(string[] args) { Console.ReadLine(); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Insert [[System.Obsolete] void goo(int a) { }]@18", "Insert [(int a)]@49", "Insert [int a]@50"); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodInsert_Virtual() { var src1 = @" class C { }"; var src2 = @" class C { public virtual void F() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertVirtual, "public virtual void F()", FeaturesResources.method)); } [Fact] public void MethodInsert_Abstract() { var src1 = @" abstract class C { }"; var src2 = @" abstract class C { public abstract void F(); } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertVirtual, "public abstract void F()", FeaturesResources.method)); } [Fact] public void MethodInsert_Override() { var src1 = @" class C { }"; var src2 = @" class C { public override void F() { } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertVirtual, "public override void F()", FeaturesResources.method)); } [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784"), WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] [Fact] public void ExternMethodInsert() { var src1 = @" using System; using System.Runtime.InteropServices; class C { }"; var src2 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] private static extern int puts(string c); } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( @"Insert [[DllImport(""msvcrt.dll"")] private static extern int puts(string c);]@74", "Insert [(string c)]@135", "Insert [string c]@136"); // CLR doesn't support methods without a body edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertExtern, "private static extern int puts(string c)", FeaturesResources.method)); } [Fact] [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784"), WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] public void ExternMethodDeleteInsert() { var srcA1 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] private static extern int puts(string c); }"; var srcA2 = @" using System; using System.Runtime.InteropServices; "; var srcB1 = @" using System; using System.Runtime.InteropServices; "; var srcB2 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] private static extern int puts(string c); } "; // TODO: The method does not need to be updated since there are no sequence points generated for it. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.puts")), }) }); } [Fact] [WorkItem(755784, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755784"), WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] public void ExternMethod_Attribute_DeleteInsert() { var srcA1 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] private static extern int puts(string c); }"; var srcA2 = @" using System; using System.Runtime.InteropServices; "; var srcB1 = @" using System; using System.Runtime.InteropServices; "; var srcB2 = @" using System; using System.Runtime.InteropServices; class C { [DllImport(""msvcrt.dll"")] [Obsolete] private static extern int puts(string c); } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.puts")), }) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void MethodReorder1() { var src1 = "class C { void f(int a, int b) { a = b; } void g() { } }"; var src2 = "class C { void g() { } void f(int a, int b) { a = b; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Reorder [void g() { }]@42 -> @10"); } [Fact] public void MethodInsertDelete1() { var src1 = "class C { class D { } void f(int a, int b) { a = b; } }"; var src2 = "class C { class D { void f(int a, int b) { a = b; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [void f(int a, int b) { a = b; }]@20", "Insert [(int a, int b)]@26", "Insert [int a]@27", "Insert [int b]@34", "Delete [void f(int a, int b) { a = b; }]@22", "Delete [(int a, int b)]@28", "Delete [int a]@29", "Delete [int b]@36"); } [Fact] public void MethodUpdate_AddParameter() { var src1 = @" class C { static void Main() { } }"; var src2 = @" class C { static void Main(string[] args) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [string[] args]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "string[] args", FeaturesResources.parameter)); } [Fact] public void MethodUpdate_UpdateParameter() { var src1 = @" class C { static void Main(string[] args) { } }"; var src2 = @" class C { static void Main(string[] b) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [string[] args]@35 -> [string[] b]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.RenamingNotSupportedByRuntime, "string[] b", FeaturesResources.parameter)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Main")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void MethodUpdate_UpdateParameterAndBody() { var src1 = @" class C { static void Main(string[] args) { } }"; var src2 = @" class C { static void Main(string[] b) { System.Console.Write(1); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.RenamingNotSupportedByRuntime, "string[] b", FeaturesResources.parameter)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Main")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Method_Name_Update() { var src1 = @" class C { static void Main(string[] args) { } }"; var src2 = @" class C { static void EntryPoint(string[] args) { } }"; var edits = GetTopEdits(src1, src2); var expectedEdit = @"Update [static void Main(string[] args) { }]@18 -> [static void EntryPoint(string[] args) { }]@18"; edits.VerifyEdits(expectedEdit); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "static void EntryPoint(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AsyncMethod0() { var src1 = @" class Test { public async Task<int> WaitAsync() { await Task.Delay(1000); return 1; } }"; var src2 = @" class Test { public async Task<int> WaitAsync() { await Task.Delay(500); return 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: true); } [Fact] public void MethodUpdate_AsyncMethod1() { var src1 = @" class Test { static void Main(string[] args) { Test f = new Test(); string result = f.WaitAsync().Result; } public async Task<string> WaitAsync() { await Task.Delay(1000); return ""Done""; } }"; var src2 = @" class Test { static void Main(string[] args) { Test f = new Test(); string result = f.WaitAsync().Result; } public async Task<string> WaitAsync() { await Task.Delay(1000); return ""Not Done""; } }"; var edits = GetTopEdits(src1, src2); var expectedEdit = @"Update [public async Task<string> WaitAsync() { await Task.Delay(1000); return ""Done""; }]@151 -> [public async Task<string> WaitAsync() { await Task.Delay(1000); return ""Not Done""; }]@151"; edits.VerifyEdits(expectedEdit); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_AddReturnTypeAttribute() { var src1 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [return: Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [static void Main(string[] args) { System.Console.Write(5); }]@38 -> [[return: Obsolete] static void Main(string[] args) { System.Console.Write(5); }]@38"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AddAttribute() { var src1 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [static void Main(string[] args) { System.Console.Write(5); }]@38 -> [[Obsolete] static void Main(string[] args) { System.Console.Write(5); }]@38"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AddAttribute_SupportedByRuntime() { var src1 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [static void Main(string[] args) { System.Console.Write(5); }]@38 -> [[Obsolete] static void Main(string[] args) { System.Console.Write(5); }]@38"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Test.Main")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void MethodUpdate_Attribute_ArrayParameter() { var src1 = @" class AAttribute : System.Attribute { public AAttribute(int[] nums) { } } class C { [A(new int[] { 1, 2, 3})] void M() { } }"; var src2 = @" class AAttribute : System.Attribute { public AAttribute(int[] nums) { } } class C { [A(new int[] { 4, 5, 6})] void M() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void MethodUpdate_Attribute_ArrayParameter_NoChange() { var src1 = @" class AAttribute : System.Attribute { public AAttribute(int[] nums) { } } class C { [A(new int[] { 1, 2, 3})] void M() { var x = 1; } }"; var src2 = @" class AAttribute : System.Attribute { public AAttribute(int[] nums) { } } class C { [A(new int[] { 1, 2, 3})] void M() { var x = 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M")) }); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_AddAttribute2() { var src1 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete, STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AddAttribute3() { var src1 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] [STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_AddAttribute4() { var src1 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete, STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_UpdateAttribute() { var src1 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete("""")] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [WorkItem(754853, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754853")] [Fact] public void MethodUpdate_DeleteAttribute() { var src1 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_DeleteAttribute2() { var src1 = @" using System; class Test { [Obsolete, STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_DeleteAttribute3() { var src1 = @" using System; class Test { [Obsolete] [STAThread] static void Main(string[] args) { System.Console.Write(5); } }"; var src2 = @" using System; class Test { [Obsolete] static void Main(string[] args) { System.Console.Write(5); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "static void Main(string[] args)", FeaturesResources.method)); } [Fact] public void MethodUpdate_ExplicitlyImplemented1() { var src1 = @" class C : I, J { void I.Goo() { Console.WriteLine(2); } void J.Goo() { Console.WriteLine(1); } }"; var src2 = @" class C : I, J { void I.Goo() { Console.WriteLine(1); } void J.Goo() { Console.WriteLine(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [void I.Goo() { Console.WriteLine(2); }]@25 -> [void I.Goo() { Console.WriteLine(1); }]@25", "Update [void J.Goo() { Console.WriteLine(1); }]@69 -> [void J.Goo() { Console.WriteLine(2); }]@69"); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_ExplicitlyImplemented2() { var src1 = @" class C : I, J { void I.Goo() { Console.WriteLine(1); } void J.Goo() { Console.WriteLine(2); } }"; var src2 = @" class C : I, J { void Goo() { Console.WriteLine(1); } void J.Goo() { Console.WriteLine(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [void I.Goo() { Console.WriteLine(1); }]@25 -> [void Goo() { Console.WriteLine(1); }]@25"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "void Goo()", FeaturesResources.method)); } [WorkItem(754255, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/754255")] [Fact] public void MethodUpdate_UpdateStackAlloc() { var src1 = @" class C { static void Main(string[] args) { int i = 10; unsafe { int* px2 = &i; } } }"; var src2 = @" class C { static void Main(string[] args) { int i = 10; unsafe { char* buffer = stackalloc char[16]; int* px2 = &i; } } }"; var expectedEdit = @"Update [static void Main(string[] args) { int i = 10; unsafe { int* px2 = &i; } }]@18 -> [static void Main(string[] args) { int i = 10; unsafe { char* buffer = stackalloc char[16]; int* px2 = &i; } }]@18"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(expectedEdit); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.method)); } [Theory] [InlineData("stackalloc int[3]")] [InlineData("stackalloc int[3] { 1, 2, 3 }")] [InlineData("stackalloc int[] { 1, 2, 3 }")] [InlineData("stackalloc[] { 1, 2, 3 }")] public void MethodUpdate_UpdateStackAlloc2(string stackallocDecl) { var src1 = @"unsafe class C { static int F() { var x = " + stackallocDecl + "; return 1; } }"; var src2 = @"unsafe class C { static int F() { var x = " + stackallocDecl + "; return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.method)); } [Fact] public void MethodUpdate_UpdateStackAllocInLambda1() { var src1 = "unsafe class C { void M() { F(1, () => { int* a = stackalloc int[10]; }); } }"; var src2 = "unsafe class C { void M() { F(2, () => { int* a = stackalloc int[10]; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_UpdateStackAllocInLambda2() { var src1 = "unsafe class C { void M() { F(1, x => { int* a = stackalloc int[10]; }); } }"; var src2 = "unsafe class C { void M() { F(2, x => { int* a = stackalloc int[10]; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_UpdateStackAllocInAnonymousMethod() { var src1 = "unsafe class C { void M() { F(1, delegate(int x) { int* a = stackalloc int[10]; }); } }"; var src2 = "unsafe class C { void M() { F(2, delegate(int x) { int* a = stackalloc int[10]; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_UpdateStackAllocInLocalFunction() { var src1 = "class C { void M() { unsafe void f(int x) { int* a = stackalloc int[10]; } f(1); } }"; var src2 = "class C { void M() { unsafe void f(int x) { int* a = stackalloc int[10]; } f(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInLambda1() { var src1 = "class C { void M() { F(1, a => a switch { 0 => 0, _ => 2 }); } }"; var src2 = "class C { void M() { F(2, a => a switch { 0 => 0, _ => 2 }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInLambda2() { var src1 = "class C { void M() { F(1, a => a switch { 0 => 0, _ => 2 }); } }"; var src2 = "class C { void M() { F(2, a => a switch { 0 => 0, _ => 2 }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInAnonymousMethod() { var src1 = "class C { void M() { F(1, delegate(int a) { return a switch { 0 => 0, _ => 2 }; }); } }"; var src2 = "class C { void M() { F(2, delegate(int a) { return a switch { 0 => 0, _ => 2 }; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInLocalFunction() { var src1 = "class C { void M() { int f(int a) => a switch { 0 => 0, _ => 2 }; f(1); } }"; var src2 = "class C { void M() { int f(int a) => a switch { 0 => 0, _ => 2 }; f(2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_SwitchExpressionInQuery() { var src1 = "class C { void M() { var x = from z in new[] { 1, 2, 3 } where z switch { 0 => true, _ => false } select z + 1; } }"; var src2 = "class C { void M() { var x = from z in new[] { 1, 2, 3 } where z switch { 0 => true, _ => false } select z + 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_UpdateAnonymousMethod() { var src1 = "class C { void M() { F(1, delegate(int a) { return a; }); } }"; var src2 = "class C { void M() { F(2, delegate(int a) { return a; }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodWithExpressionBody_Update_UpdateAnonymousMethod() { var src1 = "class C { void M() => F(1, delegate(int a) { return a; }); }"; var src2 = "class C { void M() => F(2, delegate(int a) { return a; }); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_Query() { var src1 = "class C { void M() { F(1, from goo in bar select baz); } }"; var src2 = "class C { void M() { F(2, from goo in bar select baz); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodWithExpressionBody_Update_Query() { var src1 = "class C { void M() => F(1, from goo in bar select baz); }"; var src2 = "class C { void M() => F(2, from goo in bar select baz); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_AnonymousType() { var src1 = "class C { void M() { F(1, new { A = 1, B = 2 }); } }"; var src2 = "class C { void M() { F(2, new { A = 1, B = 2 }); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodWithExpressionBody_Update_AnonymousType() { var src1 = "class C { void M() => F(new { A = 1, B = 2 }); }"; var src2 = "class C { void M() => F(new { A = 10, B = 20 }); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_Iterator_YieldReturn() { var src1 = "class C { IEnumerable<int> M() { yield return 1; } }"; var src2 = "class C { IEnumerable<int> M() { yield return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: true); } [Fact] public void MethodUpdate_AddYieldReturn() { var src1 = "class C { IEnumerable<int> M() { return new[] { 1, 2, 3}; } }"; var src2 = "class C { IEnumerable<int> M() { yield return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: false); } [Fact] public void MethodUpdate_AddYieldReturn_NotSupported() { var src1 = "class C { IEnumerable<int> M() { return new[] { 1, 2, 3}; } }"; var src2 = "class C { IEnumerable<int> M() { yield return 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.MakeMethodIterator, "IEnumerable<int> M()")); } [Fact] public void MethodUpdate_Iterator_YieldBreak() { var src1 = "class C { IEnumerable<int> M() { F(); yield break; } }"; var src2 = "class C { IEnumerable<int> M() { G(); yield break; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); VerifyPreserveLocalVariables(edits, preserveLocalVariables: true); } [WorkItem(1087305, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1087305")] [Fact] public void MethodUpdate_LabeledStatement() { var src1 = @" class C { static void Main(string[] args) { goto Label1; Label1: { Console.WriteLine(1); } } }"; var src2 = @" class C { static void Main(string[] args) { goto Label1; Label1: { Console.WriteLine(2); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void MethodUpdate_LocalFunctionsParameterRefnessInBody() { var src1 = @"class C { public void M(int a) { void f(ref int b) => b = 1; } }"; var src2 = @"class C { public void M(int a) { void f(out int b) => b = 1; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public void M(int a) { void f(ref int b) => b = 1; }]@10 -> [public void M(int a) { void f(out int b) => b = 1; }]@10"); } [Fact] public void MethodUpdate_LambdaParameterRefnessInBody() { var src1 = @"class C { public void M(int a) { f((ref int b) => b = 1); } }"; var src2 = @"class C { public void M(int a) { f((out int b) => b = 1); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public void M(int a) { f((ref int b) => b = 1); }]@10 -> [public void M(int a) { f((out int b) => b = 1); }]@10"); } [Fact] public void Method_ReadOnlyRef_Parameter_InsertWhole() { var src1 = "class Test { }"; var src2 = "class Test { int M(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int M(in int b) => throw null;]@13", "Insert [(in int b)]@18", "Insert [in int b]@19"); edits.VerifyRudeDiagnostics(); } [Fact] public void Method_ReadOnlyRef_Parameter_InsertParameter() { var src1 = "class Test { int M() => throw null; }"; var src2 = "class Test { int M(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [in int b]@19"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "in int b", FeaturesResources.parameter)); } [Fact] public void Method_ReadOnlyRef_Parameter_Update() { var src1 = "class Test { int M(int b) => throw null; }"; var src2 = "class Test { int M(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int b]@19 -> [in int b]@19"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in int b", FeaturesResources.parameter)); } [Fact] public void Method_ReadOnlyRef_ReturnType_Insert() { var src1 = "class Test { }"; var src2 = "class Test { ref readonly int M() => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [ref readonly int M() => throw null;]@13", "Insert [()]@31"); edits.VerifyRudeDiagnostics(); } [Fact] public void Method_ReadOnlyRef_ReturnType_Update() { var src1 = "class Test { int M() => throw null; }"; var src2 = "class Test { ref readonly int M() => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int M() => throw null;]@13 -> [ref readonly int M() => throw null;]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "ref readonly int M()", FeaturesResources.method)); } [Fact] public void Method_ImplementingInterface_Add() { var src1 = @" using System; public interface ISample { string Get(); } public interface IConflict { string Get(); } public class BaseClass : ISample { public virtual string Get() => string.Empty; } public class SubClass : BaseClass, IConflict { public override string Get() => string.Empty; } "; var src2 = @" using System; public interface ISample { string Get(); } public interface IConflict { string Get(); } public class BaseClass : ISample { public virtual string Get() => string.Empty; } public class SubClass : BaseClass, IConflict { public override string Get() => string.Empty; string IConflict.Get() => String.Empty; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [string IConflict.Get() => String.Empty;]@325", "Insert [()]@345"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertMethodWithExplicitInterfaceSpecifier, "string IConflict.Get()", FeaturesResources.method)); } [Fact] public void Method_Partial_DeleteInsert_DefinitionPart() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcC1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { partial void F() { } }"; var srcC2 = "partial class C { partial void F(); }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults(), DocumentResults(), }); } [Fact] public void Method_Partial_DeleteInsert_ImplementationPart() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcC1 = "partial class C { }"; var srcA2 = "partial class C { partial void F(); }"; var srcB2 = "partial class C { }"; var srcC2 = "partial class C { partial void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2) }, new[] { DocumentResults(), DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F").PartialImplementationPart) }), }); } [Fact, WorkItem(51011, "https://github.com/dotnet/roslyn/issues/51011")] public void Method_Partial_Swap_ImplementationAndDefinitionParts() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcA2 = "partial class C { partial void F() { } }"; var srcB2 = "partial class C { partial void F(); }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F").PartialImplementationPart) }), DocumentResults(), }); } [Fact] public void Method_Partial_DeleteImplementation() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcA2 = "partial class C { partial void F(); }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial class C", DeletedSymbolDisplay(FeaturesResources.method, "F()")) }) }); } [Fact] public void Method_Partial_DeleteBoth() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.Delete, "partial class C", DeletedSymbolDisplay(FeaturesResources.method, "F()")) }) }); } [Fact] public void Method_Partial_DeleteInsertBoth() { var srcA1 = "partial class C { partial void F(); }"; var srcB1 = "partial class C { partial void F() { } }"; var srcC1 = "partial class C { }"; var srcD1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { }"; var srcC2 = "partial class C { partial void F(); }"; var srcD2 = "partial class C { partial void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2), GetTopEdits(srcC1, srcC2), GetTopEdits(srcD1, srcD2) }, new[] { DocumentResults(), DocumentResults(), DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F").PartialImplementationPart) }) }); } [Fact] public void Method_Partial_Insert() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { partial void F(); }"; var srcB2 = "partial class C { partial void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F").PartialImplementationPart) }), }); } [Fact] public void Method_Partial_Insert_Reloadable() { var srcA1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { }"; var srcB1 = "partial class C { }"; var srcA2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { partial void F(); }"; var srcB2 = "partial class C { partial void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), }); } #endregion #region Operators [Theory] [InlineData("implicit", "explicit")] [InlineData("explicit", "implicit")] public void Operator_Modifiers_Update(string oldModifiers, string newModifiers) { var src1 = "class C { public static " + oldModifiers + " operator int (C c) => 0; }"; var src2 = "class C { public static " + newModifiers + " operator int (C c) => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public static " + oldModifiers + " operator int (C c) => 0;]@10 -> [public static " + newModifiers + " operator int (C c) => 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public static " + newModifiers + " operator int (C c)", CSharpFeaturesResources.conversion_operator)); } [Fact] public void Operator_Modifiers_Update_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { public static implicit operator int (C c) => 0; }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { public static explicit operator int (C c) => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Operator_Conversion_ExternModifiers_Add() { var src1 = "class C { public static implicit operator bool (C c) => default; }"; var src2 = "class C { extern public static implicit operator bool (C c); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "extern public static implicit operator bool (C c)", CSharpFeaturesResources.conversion_operator)); } [Fact] public void Operator_Conversion_ExternModifiers_Remove() { var src1 = "class C { extern public static implicit operator bool (C c); }"; var src2 = "class C { public static implicit operator bool (C c) => default; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public static implicit operator bool (C c)", CSharpFeaturesResources.conversion_operator)); } [Fact] public void OperatorInsert() { var src1 = @" class C { } "; var src2 = @" class C { public static implicit operator bool (C c) { return false; } public static C operator +(C c, C d) { return c; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertOperator, "public static implicit operator bool (C c)", CSharpFeaturesResources.conversion_operator), Diagnostic(RudeEditKind.InsertOperator, "public static C operator +(C c, C d)", FeaturesResources.operator_)); } [Fact] public void OperatorDelete() { var src1 = @" class C { public static implicit operator bool (C c) { return false; } public static C operator +(C c, C d) { return c; } } "; var src2 = @" class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(CSharpFeaturesResources.conversion_operator, "implicit operator bool(C c)")), Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.operator_, "operator +(C c, C d)"))); } [Fact] public void OperatorInsertDelete() { var srcA1 = @" partial class C { public static implicit operator bool (C c) => false; } "; var srcB1 = @" partial class C { public static C operator +(C c, C d) => c; } "; var srcA2 = srcB1; var srcB2 = srcA1; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("op_Addition")) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("op_Implicit")) }), }); } [Fact] public void OperatorUpdate() { var src1 = @" class C { public static implicit operator bool (C c) { return false; } public static C operator +(C c, C d) { return c; } } "; var src2 = @" class C { public static implicit operator bool (C c) { return true; } public static C operator +(C c, C d) { return d; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Implicit")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Addition")), }); } [Fact] public void OperatorWithExpressionBody_Update() { var src1 = @" class C { public static implicit operator bool (C c) => false; public static C operator +(C c, C d) => c; } "; var src2 = @" class C { public static implicit operator bool (C c) => true; public static C operator +(C c, C d) => d; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Implicit")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Addition")), }); } [Fact] public void OperatorWithExpressionBody_ToBlockBody() { var src1 = "class C { public static C operator +(C c, C d) => d; }"; var src2 = "class C { public static C operator +(C c, C d) { return c; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public static C operator +(C c, C d) => d;]@10 -> [public static C operator +(C c, C d) { return c; }]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Addition")) }); } [Fact] public void OperatorWithBlockBody_ToExpressionBody() { var src1 = "class C { public static C operator +(C c, C d) { return c; } }"; var src2 = "class C { public static C operator +(C c, C d) => d; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public static C operator +(C c, C d) { return c; }]@10 -> [public static C operator +(C c, C d) => d;]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.op_Addition")) }); } [Fact] public void OperatorReorder1() { var src1 = @" class C { public static implicit operator bool (C c) { return false; } public static implicit operator int (C c) { return 1; } } "; var src2 = @" class C { public static implicit operator int (C c) { return 1; } public static implicit operator bool (C c) { return false; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [public static implicit operator int (C c) { return 1; }]@84 -> @18"); edits.VerifyRudeDiagnostics(); } [Fact] public void OperatorReorder2() { var src1 = @" class C { public static C operator +(C c, C d) { return c; } public static C operator -(C c, C d) { return d; } } "; var src2 = @" class C { public static C operator -(C c, C d) { return d; } public static C operator +(C c, C d) { return c; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [public static C operator -(C c, C d) { return d; }]@74 -> @18"); edits.VerifyRudeDiagnostics(); } [Fact] public void Operator_ReadOnlyRef_Parameter_InsertWhole() { var src1 = "class Test { }"; var src2 = "class Test { public static bool operator !(in Test b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public static bool operator !(in Test b) => throw null;]@13", "Insert [(in Test b)]@42", "Insert [in Test b]@43"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertOperator, "public static bool operator !(in Test b)", FeaturesResources.operator_)); } [Fact] public void Operator_ReadOnlyRef_Parameter_Update() { var src1 = "class Test { public static bool operator !(Test b) => throw null; }"; var src2 = "class Test { public static bool operator !(in Test b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Test b]@43 -> [in Test b]@43"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in Test b", FeaturesResources.parameter)); } #endregion #region Constructor, Destructor [Fact] public void Constructor_Parameter_AddAttribute() { var src1 = @" class C { private int x = 1; public C(int a) { } }"; var src2 = @" class C { private int x = 2; public C([System.Obsolete]int a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [x = 1]@30 -> [x = 2]@30", "Update [int a]@53 -> [[System.Obsolete]int a]@53"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C..ctor")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] [WorkItem(2068, "https://github.com/dotnet/roslyn/issues/2068")] public void Constructor_ExternModifier_Add() { var src1 = "class C { }"; var src2 = "class C { public extern C(); }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [public extern C();]@10", "Insert [()]@25"); // This can be allowed as the compiler generates an empty constructor, but it's not worth the complexity. edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public extern C()", FeaturesResources.constructor)); } [Fact] public void ConstructorInitializer_Update1() { var src1 = @" class C { public C(int a) : base(a) { } }"; var src2 = @" class C { public C(int a) : base(a + 1) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public C(int a) : base(a) { }]@18 -> [public C(int a) : base(a + 1) { }]@18"); edits.VerifyRudeDiagnostics(); } [Fact] public void ConstructorInitializer_Update2() { var src1 = @" class C<T> { public C(int a) : base(a) { } }"; var src2 = @" class C<T> { public C(int a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public C(int a) : base(a) { }]@21 -> [public C(int a) { }]@21"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "public C(int a)")); } [Fact] public void ConstructorInitializer_Update3() { var src1 = @" class C { public C(int a) { } }"; var src2 = @" class C { public C(int a) : base(a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public C(int a) { }]@18 -> [public C(int a) : base(a) { }]@18"); edits.VerifyRudeDiagnostics(); } [Fact] public void ConstructorInitializer_Update4() { var src1 = @" class C<T> { public C(int a) : base(a) { } }"; var src2 = @" class C<T> { public C(int a) : base(a + 1) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public C(int a) : base(a) { }]@21 -> [public C(int a) : base(a + 1) { }]@21"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "public C(int a)")); } [WorkItem(743552, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/743552")] [Fact] public void ConstructorUpdate_AddParameter() { var src1 = @" class C { public C(int a) { } }"; var src2 = @" class C { public C(int a, int b) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int a)]@26 -> [(int a, int b)]@26", "Insert [int b]@34"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "int b", FeaturesResources.parameter)); } [Fact] public void DestructorDelete() { var src1 = @"class B { ~B() { } }"; var src2 = @"class B { }"; var expectedEdit1 = @"Delete [~B() { }]@10"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(expectedEdit1); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class B", DeletedSymbolDisplay(CSharpFeaturesResources.destructor, "~B()"))); } [Fact] public void DestructorDelete_InsertConstructor() { var src1 = @"class B { ~B() { } }"; var src2 = @"class B { B() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [B() { }]@10", "Insert [()]@11", "Delete [~B() { }]@10"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "B()", FeaturesResources.constructor), Diagnostic(RudeEditKind.Delete, "class B", DeletedSymbolDisplay(CSharpFeaturesResources.destructor, "~B()"))); } [Fact] [WorkItem(789577, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/789577")] public void ConstructorUpdate_AnonymousTypeInFieldInitializer() { var src1 = "class C { int a = F(new { A = 1, B = 2 }); C() { x = 1; } }"; var src2 = "class C { int a = F(new { A = 1, B = 2 }); C() { x = 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Constructor_Static_Delete() { var src1 = "class C { static C() { } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.static_constructor, "C()"))); } [Fact] public void Constructor_Static_Delete_Reloadable() { var src1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { static C() { } }"; var src2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"))); } [Fact] public void Constructor_Static_Insert() { var src1 = "class C { }"; var src2 = "class C { static C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single()) }); } [Fact] public void InstanceCtorDelete_Public() { var src1 = "class C { public C() { } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("")] [InlineData("private")] [InlineData("protected")] [InlineData("internal")] [InlineData("private protected")] [InlineData("protected internal")] public void InstanceCtorDelete_NonPublic(string accessibility) { var src1 = "class C { [System.Obsolete] " + accessibility + " C() { } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "class C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()")), Diagnostic(RudeEditKind.ChangingAccessibility, "class C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()"))); } [Fact] public void InstanceCtorDelete_Public_PartialWithInitializerUpdate() { var srcA1 = "partial class C { public C() { } }"; var srcB1 = "partial class C { int x = 1; }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int x = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }) }); } [Fact] public void InstanceCtorInsert_Public_Implicit() { var src1 = "class C { }"; var src2 = "class C { public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void InstanceCtorInsert_Partial_Public_Implicit() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { public C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // no change in document A DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void InstanceCtorInsert_Public_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, expectedSemanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters.IsEmpty)) }); } [Fact] public void InstanceCtorInsert_Partial_Public_NoImplicit() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { public C(int a) { } }"; var srcA2 = "partial class C { public C() { } }"; var srcB2 = "partial class C { public C(int a) { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(c => c.Parameters.IsEmpty)) }), // no change in document B DocumentResults(), }); } [Fact] public void InstanceCtorInsert_Private_Implicit1() { var src1 = "class C { }"; var src2 = "class C { private C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "private C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorInsert_Private_Implicit2() { var src1 = "class C { }"; var src2 = "class C { C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorInsert_Protected_PublicImplicit() { var src1 = "class C { }"; var src2 = "class C { protected C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "protected C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorInsert_Internal_PublicImplicit() { var src1 = "class C { }"; var src2 = "class C { internal C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "internal C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorInsert_Internal_ProtectedImplicit() { var src1 = "abstract class C { }"; var src2 = "abstract class C { internal C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "internal C()", FeaturesResources.constructor)); } [Fact] public void InstanceCtorUpdate_ProtectedImplicit() { var src1 = "abstract class C { }"; var src2 = "abstract class C { protected C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void InstanceCtorInsert_Private_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } private C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C") .InstanceConstructors.Single(ctor => ctor.DeclaredAccessibility == Accessibility.Private)) }); } [Fact] public void InstanceCtorInsert_Internal_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } internal C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void InstanceCtorInsert_Protected_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } protected C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void InstanceCtorInsert_InternalProtected_NoImplicit() { var src1 = "class C { public C(int a) { } }"; var src2 = "class C { public C(int a) { } internal protected C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void StaticCtor_Partial_DeleteInsert() { var srcA1 = "partial class C { static C() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { static C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void InstanceCtor_Partial_DeletePrivateInsertPrivate() { var srcA1 = "partial class C { C() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void InstanceCtor_Partial_DeletePublicInsertPublic() { var srcA1 = "partial class C { public C() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { public C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void InstanceCtor_Partial_DeletePrivateInsertPublic() { var srcA1 = "partial class C { C() { } }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { public C() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // delete of the constructor in partial part will be reported as rude edit in the other document where it was inserted back with changed accessibility DocumentResults( semanticEdits: NoSemanticEdits), DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ChangingAccessibility, "public C()", FeaturesResources.constructor) }), }); } [Fact] public void StaticCtor_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { static C() { } }"; var srcA2 = "partial class C { static C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertPublicDeletePublic() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { public C() { } }"; var srcA2 = "partial class C { public C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertPrivateDeletePrivate() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { private C() { } }"; var srcA2 = "partial class C { private C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_DeleteInternalInsertInternal() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { internal C() { } }"; var srcA2 = "partial class C { internal C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertInternalDeleteInternal_WithBody() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { internal C() { } }"; var srcA2 = "partial class C { internal C() { Console.WriteLine(1); } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), // delete of the constructor in partial part will be represented as a semantic update in the other document where it was inserted back DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertPublicDeletePrivate() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { private C() { } }"; var srcA2 = "partial class C { public C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ChangingAccessibility, "public C()", FeaturesResources.constructor) }), // delete of the constructor in partial part will be reported as rude in the the other document where it was inserted with changed accessibility DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_InsertInternalDeletePrivate() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { private C() { } }"; var srcA2 = "partial class C { internal C() { } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ChangingAccessibility, "internal C()", FeaturesResources.constructor) }), DocumentResults(), }); } [Fact] public void InstanceCtor_Partial_Update_LambdaInInitializer1() { var src1 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C() { F(<N:0.2>c => c + 1</N:0.2>); } } "; var src2 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C() { F(<N:0.2>c => c + 2</N:0.2>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void InstanceCtor_Partial_Update_LambdaInInitializer_Trivia1() { var src1 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C() { F(<N:0.2>c => c + 1</N:0.2>); } } "; var src2 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); /*new trivia*/public C() { F(<N:0.2>c => c + 1</N:0.2>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void InstanceCtor_Partial_Update_LambdaInInitializer_ExplicitInterfaceImpl1() { var src1 = @" using System; public interface I { int B { get; } } public interface J { int B { get; } } partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C : I, J { int I.B { get; } = F(<N:0.1>ib => ib + 1</N:0.1>); int J.B { get; } = F(<N:0.2>jb => jb + 1</N:0.2>); public C() { F(<N:0.3>c => c + 1</N:0.3>); } } "; var src2 = @" using System; public interface I { int B { get; } } public interface J { int B { get; } } partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C : I, J { int I.B { get; } = F(<N:0.1>ib => ib + 1</N:0.1>); int J.B { get; } = F(<N:0.2>jb => jb + 1</N:0.2>); public C() { F(<N:0.3>c => c + 2</N:0.3>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void InstanceCtor_Partial_Insert_Parameterless_LambdaInInitializer1() { var src1 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); } "; var src2 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C() // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas, "public C()")); // TODO: //var syntaxMap = GetSyntaxMap(src1, src2); //edits.VerifySemantics( // ActiveStatementsDescription.Empty, // new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void InstanceCtor_Partial_Insert_WithParameters_LambdaInInitializer1() { var src1 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); } "; var src2 = @" using System; partial class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int B { get; } = F(<N:0.1>b => b + 1</N:0.1>); public C(int x) // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); _ = GetSyntaxMap(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas, "public C(int x)")); // TODO: bug https://github.com/dotnet/roslyn/issues/2504 //edits.VerifySemantics( // ActiveStatementsDescription.Empty, // new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<NamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void InstanceCtor_Partial_Explicit_Update() { var srcA1 = @" using System; partial class C { C(int arg) => Console.WriteLine(0); C(bool arg) => Console.WriteLine(1); } "; var srcB1 = @" using System; partial class C { int a <N:0.0>= 1</N:0.0>; C(uint arg) => Console.WriteLine(2); } "; var srcA2 = @" using System; partial class C { C(int arg) => Console.WriteLine(0); C(bool arg) => Console.WriteLine(1); } "; var srcB2 = @" using System; partial class C { int a <N:0.0>= 2</N:0.0>; // updated field initializer C(uint arg) => Console.WriteLine(2); C(byte arg) => Console.WriteLine(3); // new ctor } "; var syntaxMapB = GetSyntaxMap(srcB1, srcB2)[0]; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // No changes in document A DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "Int32"), partialType: "C", syntaxMap: syntaxMapB), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "Boolean"), partialType: "C", syntaxMap: syntaxMapB), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "UInt32"), partialType: "C", syntaxMap: syntaxMapB), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(c => c.Parameters.Single().Type.Name == "Byte"), syntaxMap: null), }) }); } [Fact] public void InstanceCtor_Partial_Explicit_Update_SemanticError() { var srcA1 = @" using System; partial class C { C(int arg) => Console.WriteLine(0); C(int arg) => Console.WriteLine(1); } "; var srcB1 = @" using System; partial class C { int a = 1; } "; var srcA2 = @" using System; partial class C { C(int arg) => Console.WriteLine(0); C(int arg) => Console.WriteLine(1); } "; var srcB2 = @" using System; partial class C { int a = 2; C(int arg) => Console.WriteLine(2); } "; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { // No changes in document A DocumentResults(), // The actual edits do not matter since there are semantic errors in the compilation. // We just should not crash. DocumentResults(diagnostics: Array.Empty<RudeEditDiagnosticDescription>()) }); } [Fact] public void InstanceCtor_Partial_Implicit_Update() { var srcA1 = "partial class C { int F = 1; }"; var srcB1 = "partial class C { int G = 1; }"; var srcA2 = "partial class C { int F = 2; }"; var srcB2 = "partial class C { int G = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void ParameterlessConstructor_SemanticError_Delete1() { var src1 = @" class C { D() {} } "; var src2 = @" class C { } "; var edits = GetTopEdits(src1, src2); // The compiler interprets D() as a constructor declaration. edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, "class C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()"))); } [Fact] public void Constructor_SemanticError_Partial() { var src1 = @" partial class C { partial void C(int x); } partial class C { partial void C(int x) { System.Console.WriteLine(1); } } "; var src2 = @" partial class C { partial void C(int x); } partial class C { partial void C(int x) { System.Console.WriteLine(2); } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, expectedSemanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("C").PartialImplementationPart) }); } [Fact] public void PartialDeclaration_Delete() { var srcA1 = "partial class C { public C() { } void F() { } }"; var srcB1 = "partial class C { int x = 1; }"; var srcA2 = ""; var srcB2 = "partial class C { int x = 2; void F() { } }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void PartialDeclaration_Insert() { var srcA1 = ""; var srcB1 = "partial class C { int x = 1; void F() { } }"; var srcA2 = "partial class C { public C() { } void F() { } }"; var srcB2 = "partial class C { int x = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IMethodSymbol>("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void PartialDeclaration_Insert_Reloadable() { var srcA1 = ""; var srcB1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { int x = 1; void F() { } }"; var srcA2 = "partial class C { public C() { } void F() { } }"; var srcB2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C { int x = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void Constructor_DeleteParameterless(string typeKind) { var src1 = @" " + typeKind + @" C { private int a = 10; private int b; public C() { b = 3; } } "; var src2 = @" " + typeKind + @" C { private int a = 10; private int b; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [public C() { b = 3; }]@66", "Delete [()]@74"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void Constructor_InsertParameterless(string typeKind) { var src1 = @" " + typeKind + @" C { private int a = 10; private int b; } "; var src2 = @" " + typeKind + @" C { private int a = 10; private int b; public C() { b = 3; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [public C() { b = 3; }]@66", "Insert [()]@74"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Constructor_BlockBodyToExpressionBody() { var src1 = @" public class C { private int _value; public C(int value) { _value = value; } } "; var src2 = @" public class C { private int _value; public C(int value) => _value = value; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public C(int value) { _value = value; }]@52 -> [public C(int value) => _value = value;]@52"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void ConstructorWithInitializer_BlockBodyToExpressionBody() { var src1 = @" public class B { B(int value) {} } public class C : B { private int _value; public C(int value) : base(value) { _value = value; } } "; var src2 = @" public class B { B(int value) {} } public class C : B { private int _value; public C(int value) : base(value) => _value = value; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [public C(int value) : base(value) { _value = value; }]@90 -> [public C(int value) : base(value) => _value = value;]@90"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Constructor_ExpressionBodyToBlockBody() { var src1 = @" public class C { private int _value; public C(int value) => _value = value; } "; var src2 = @" public class C { private int _value; public C(int value) { _value = value; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [public C(int value) => _value = value;]@52 -> [public C(int value) { _value = value; }]@52"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void ConstructorWithInitializer_ExpressionBodyToBlockBody() { var src1 = @" public class B { B(int value) {} } public class C : B { private int _value; public C(int value) : base(value) => _value = value; } "; var src2 = @" public class B { B(int value) {} } public class C : B { private int _value; public C(int value) : base(value) { _value = value; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits(@"Update [public C(int value) : base(value) => _value = value;]@90 -> [public C(int value) : base(value) { _value = value; }]@90"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Destructor_BlockBodyToExpressionBody() { var src1 = @" public class C { ~C() { Console.WriteLine(0); } } "; var src2 = @" public class C { ~C() => Console.WriteLine(0); } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [~C() { Console.WriteLine(0); }]@25 -> [~C() => Console.WriteLine(0);]@25"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Finalize"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Destructor_ExpressionBodyToBlockBody() { var src1 = @" public class C { ~C() => Console.WriteLine(0); } "; var src2 = @" public class C { ~C() { Console.WriteLine(0); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [~C() => Console.WriteLine(0);]@25 -> [~C() { Console.WriteLine(0); }]@25"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.Finalize"), preserveLocalVariables: false) }); } [Fact] public void Constructor_ReadOnlyRef_Parameter_InsertWhole() { var src1 = "class Test { }"; var src2 = "class Test { Test(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [Test(in int b) => throw null;]@13", "Insert [(in int b)]@17", "Insert [in int b]@18"); edits.VerifyRudeDiagnostics(); } [Fact] public void Constructor_ReadOnlyRef_Parameter_InsertParameter() { var src1 = "class Test { Test() => throw null; }"; var src2 = "class Test { Test(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [in int b]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "in int b", FeaturesResources.parameter)); } [Fact] public void Constructor_ReadOnlyRef_Parameter_Update() { var src1 = "class Test { Test(int b) => throw null; }"; var src2 = "class Test { Test(in int b) => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int b]@18 -> [in int b]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in int b", FeaturesResources.parameter)); } #endregion #region Fields and Properties with Initializers [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializer_Update1(string typeKind) { var src1 = typeKind + " C { int a = 0; }"; var src2 = typeKind + " C { int a = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 0]@15 -> [a = 1]@15"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializer_Update1(string typeKind) { var src1 = typeKind + " C { int a { get; } = 0; }"; var src2 = typeKind + " C { int a { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a { get; } = 0;]@11 -> [int a { get; } = 1;]@11"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializer_Update2() { var src1 = "class C { int a = 0; }"; var src2 = "class C { int a; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 0]@14 -> [a]@14"); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializer_Update2() { var src1 = "class C { int a { get; } = 0; }"; var src2 = "class C { int a { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a { get; } = 0;]@10 -> [int a { get { return 1; } }]@10", "Update [get;]@18 -> [get { return 1; }]@18"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.a").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true)); } [Fact] public void PropertyInitializer_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int a { get; } = 0; }"; var srcA2 = "partial class C { int a { get { return 1; } } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.a").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults() }); } [Fact] public void FieldInitializer_Update3() { var src1 = "class C { int a; }"; var src2 = "class C { int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@14 -> [a = 0]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializer_Update3() { var src1 = "class C { int a { get { return 1; } } }"; var src2 = "class C { int a { get; } = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a { get { return 1; } }]@10 -> [int a { get; } = 0;]@10", "Update [get { return 1; }]@18 -> [get;]@18"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IPropertySymbol>("C.a").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_StaticCtorUpdate1() { var src1 = "class C { static int a; static C() { } }"; var src2 = "class C { static int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@21 -> [a = 0]@21", "Delete [static C() { }]@24", "Delete [()]@32"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_StaticCtorUpdate1() { var src1 = "class C { static int a { get; } = 1; static C() { } }"; var src2 = "class C { static int a { get; } = 2;}"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializerUpdate_InstanceCtorUpdate_Private(string typeKind) { var src1 = typeKind + " C { int a; [System.Obsolete]C() { } }"; var src2 = typeKind + " C { int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, $"{typeKind} C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()")), Diagnostic(RudeEditKind.ChangingAccessibility, $"{typeKind} C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()"))); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializerUpdate_InstanceCtorUpdate_Private(string typeKind) { var src1 = typeKind + " C { int a { get; } = 1; C() { } }"; var src2 = typeKind + " C { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ChangingAccessibility, $"{typeKind} C", DeletedSymbolDisplay(FeaturesResources.constructor, "C()"))); } [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializerUpdate_InstanceCtorUpdate_Public(string typeKind) { var src1 = typeKind + " C { int a; public C() { } }"; var src2 = typeKind + " C { int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializerUpdate_InstanceCtorUpdate_Public(string typeKind) { var src1 = typeKind + " C { int a { get; } = 1; public C() { } }"; var src2 = typeKind + " C { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_StaticCtorUpdate2() { var src1 = "class C { static int a; static C() { } }"; var src2 = "class C { static int a = 0; static C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@21 -> [a = 0]@21"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_StaticCtorUpdate2() { var src1 = "class C { static int a { get; } = 1; static C() { } }"; var src2 = "class C { static int a { get; } = 2; static C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializerUpdate_InstanceCtorUpdate2(string typeKind) { var src1 = typeKind + " C { int a; public C() { } }"; var src2 = typeKind + " C { int a = 0; public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@15 -> [a = 0]@15"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializerUpdate_InstanceCtorUpdate2(string typeKind) { var src1 = typeKind + " C { int a { get; } = 1; public C() { } }"; var src2 = typeKind + " C { int a { get; } = 2; public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_InstanceCtorUpdate3() { var src1 = "class C { int a; }"; var src2 = "class C { int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@14 -> [a = 0]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_InstanceCtorUpdate3() { var src1 = "class C { int a { get; } = 1; }"; var src2 = "class C { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_InstanceCtorUpdate4() { var src1 = "class C { int a = 0; }"; var src2 = "class C { int a; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 0]@14 -> [a]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_InstanceCtorUpdate5() { var src1 = "class C { int a; private C(int a) { } private C(bool a) { } }"; var src2 = "class C { int a = 0; private C(int a) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@14 -> [a = 0]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), }); } [Fact] public void FieldInitializerUpdate_Struct_InstanceCtorUpdate5() { var src1 = "struct C { int a; private C(int a) { } private C(bool a) { } }"; var src2 = "struct C { int a = 0; private C(int a) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@15 -> [a = 0]@15"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C()"), preserveLocalVariables: true), }); } [Fact] public void PropertyInitializerUpdate_InstanceCtorUpdate5() { var src1 = "class C { int a { get; } = 1; private C(int a) { } private C(bool a) { } }"; var src2 = "class C { int a { get; } = 10000; private C(int a) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), }); } [Fact] public void PropertyInitializerUpdate_Struct_InstanceCtorUpdate5() { var src1 = "struct C { int a { get; } = 1; private C(int a) { } private C(bool a) { } }"; var src2 = "struct C { int a { get; } = 10000; private C(int a) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(int)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C()"), preserveLocalVariables: true), }); } [Fact] public void FieldInitializerUpdate_InstanceCtorUpdate6() { var src1 = "class C { int a; private C(int a) : this(true) { } private C(bool a) { } }"; var src2 = "class C { int a = 0; private C(int a) : this(true) { } private C(bool a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@14 -> [a = 0]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(m => m.ToString() == "C.C(bool)"), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_StaticCtorInsertImplicit() { var src1 = "class C { static int a; }"; var src2 = "class C { static int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@21 -> [a = 0]@21"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single()) }); } [Fact] public void FieldInitializerUpdate_StaticCtorInsertExplicit() { var src1 = "class C { static int a; }"; var src2 = "class C { static int a = 0; static C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [static C() { }]@28", "Insert [()]@36", "Update [a]@21 -> [a = 0]@21"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").StaticConstructors.Single()) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void FieldInitializerUpdate_InstanceCtorInsertExplicit(string typeKind) { var src1 = typeKind + " C { int a; }"; var src2 = typeKind + " C { int a = 0; public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Theory] [InlineData("class ")] [InlineData("struct")] public void PropertyInitializerUpdate_InstanceCtorInsertExplicit(string typeKind) { var src1 = typeKind + " C { int a { get; } = 1; }"; var src2 = typeKind + " C { int a { get; } = 2; public C() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_GenericType() { var src1 = "class C<T> { int a = 1; }"; var src2 = "class C<T> { int a = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@17 -> [a = 2]@17"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "a = 2"), Diagnostic(RudeEditKind.GenericTypeUpdate, "class C<T>")); } [Fact] public void PropertyInitializerUpdate_GenericType() { var src1 = "class C<T> { int a { get; } = 1; }"; var src2 = "class C<T> { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "int a"), Diagnostic(RudeEditKind.GenericTypeUpdate, "class C<T>")); } [Fact] public void FieldInitializerUpdate_StackAllocInConstructor() { var src1 = "unsafe class C { int a = 1; public C() { int* a = stackalloc int[10]; } }"; var src2 = "unsafe class C { int a = 2; public C() { int* a = stackalloc int[10]; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@21 -> [a = 2]@21"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.constructor)); } [Fact] [WorkItem(37172, "https://github.com/dotnet/roslyn/issues/37172")] [WorkItem(43099, "https://github.com/dotnet/roslyn/issues/43099")] public void FieldInitializerUpdate_SwitchExpressionInConstructor() { var src1 = "class C { int a = 1; public C() { var b = a switch { 0 => 0, _ => 1 }; } }"; var src2 = "class C { int a = 2; public C() { var b = a switch { 0 => 0, _ => 1 }; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_StackAllocInConstructor1() { var src1 = "unsafe class C { int a { get; } = 1; public C() { int* a = stackalloc int[10]; } }"; var src2 = "unsafe class C { int a { get; } = 2; public C() { int* a = stackalloc int[10]; } }"; var edits = GetTopEdits(src1, src2); // TODO (tomat): diagnostic should point to the property initializer edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.constructor)); } [Fact] public void PropertyInitializerUpdate_StackAllocInConstructor2() { var src1 = "unsafe class C { int a { get; } = 1; public C() : this(1) { int* a = stackalloc int[10]; } public C(int a) { } }"; var src2 = "unsafe class C { int a { get; } = 2; public C() : this(1) { int* a = stackalloc int[10]; } public C(int a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_StackAllocInConstructor3() { var src1 = "unsafe class C { int a { get; } = 1; public C() { } public C(int b) { int* a = stackalloc int[10]; } }"; var src2 = "unsafe class C { int a { get; } = 2; public C() { } public C(int b) { int* a = stackalloc int[10]; } }"; var edits = GetTopEdits(src1, src2); // TODO (tomat): diagnostic should point to the property initializer edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", FeaturesResources.constructor)); } [Fact] [WorkItem(37172, "https://github.com/dotnet/roslyn/issues/37172")] [WorkItem(43099, "https://github.com/dotnet/roslyn/issues/43099")] public void PropertyInitializerUpdate_SwitchExpressionInConstructor1() { var src1 = "class C { int a { get; } = 1; public C() { var b = a switch { 0 => 0, _ => 1 }; } }"; var src2 = "class C { int a { get; } = 2; public C() { var b = a switch { 0 => 0, _ => 1 }; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] [WorkItem(37172, "https://github.com/dotnet/roslyn/issues/37172")] [WorkItem(43099, "https://github.com/dotnet/roslyn/issues/43099")] public void PropertyInitializerUpdate_SwitchExpressionInConstructor2() { var src1 = "class C { int a { get; } = 1; public C() : this(1) { var b = a switch { 0 => 0, _ => 1 }; } public C(int a) { } }"; var src2 = "class C { int a { get; } = 2; public C() : this(1) { var b = a switch { 0 => 0, _ => 1 }; } public C(int a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] [WorkItem(37172, "https://github.com/dotnet/roslyn/issues/37172")] [WorkItem(43099, "https://github.com/dotnet/roslyn/issues/43099")] public void PropertyInitializerUpdate_SwitchExpressionInConstructor3() { var src1 = "class C { int a { get; } = 1; public C() { } public C(int b) { var b = a switch { 0 => 0, _ => 1 }; } }"; var src2 = "class C { int a { get; } = 2; public C() { } public C(int b) { var b = a switch { 0 => 0, _ => 1 }; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void FieldInitializerUpdate_LambdaInConstructor() { var src1 = "class C { int a = 1; public C() { F(() => {}); } static void F(System.Action a) {} }"; var src2 = "class C { int a = 2; public C() { F(() => {}); } static void F(System.Action a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@14 -> [a = 2]@14"); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_LambdaInConstructor() { var src1 = "class C { int a { get; } = 1; public C() { F(() => {}); } static void F(System.Action a) {} }"; var src2 = "class C { int a { get; } = 2; public C() { F(() => {}); } static void F(System.Action a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void FieldInitializerUpdate_QueryInConstructor() { var src1 = "using System.Linq; class C { int a = 1; public C() { F(from a in new[] {1,2,3} select a + 1); } static void F(System.Collections.Generic.IEnumerable<int> x) {} }"; var src2 = "using System.Linq; class C { int a = 2; public C() { F(from a in new[] {1,2,3} select a + 1); } static void F(System.Collections.Generic.IEnumerable<int> x) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@33 -> [a = 2]@33"); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_QueryInConstructor() { var src1 = "using System.Linq; class C { int a { get; } = 1; public C() { F(from a in new[] {1,2,3} select a + 1); } static void F(System.Collections.Generic.IEnumerable<int> x) {} }"; var src2 = "using System.Linq; class C { int a { get; } = 2; public C() { F(from a in new[] {1,2,3} select a + 1); } static void F(System.Collections.Generic.IEnumerable<int> x) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void FieldInitializerUpdate_AnonymousTypeInConstructor() { var src1 = "class C { int a = 1; C() { F(new { A = 1, B = 2 }); } static void F(object x) {} }"; var src2 = "class C { int a = 2; C() { F(new { A = 1, B = 2 }); } static void F(object x) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void PropertyInitializerUpdate_AnonymousTypeInConstructor() { var src1 = "class C { int a { get; } = 1; C() { F(new { A = 1, B = 2 }); } static void F(object x) {} }"; var src2 = "class C { int a { get; } = 2; C() { F(new { A = 1, B = 2 }); } static void F(object x) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void FieldInitializerUpdate_PartialTypeWithSingleDeclaration() { var src1 = "partial class C { int a = 1; }"; var src2 = "partial class C { int a = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@22 -> [a = 2]@22"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_PartialTypeWithSingleDeclaration() { var src1 = "partial class C { int a { get; } = 1; }"; var src2 = "partial class C { int a { get; } = 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_PartialTypeWithMultipleDeclarations() { var src1 = "partial class C { int a = 1; } partial class C { }"; var src2 = "partial class C { int a = 2; } partial class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 1]@22 -> [a = 2]@22"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) }); } [Fact] public void PropertyInitializerUpdate_PartialTypeWithMultipleDeclarations() { var src1 = "partial class C { int a { get; } = 1; } partial class C { }"; var src2 = "partial class C { int a { get; } = 2; } partial class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), preserveLocalVariables: true) }); } [Fact] public void FieldInitializerUpdate_ParenthesizedLambda() { var src1 = "class C { int a = F(1, (x, y) => x + y); }"; var src2 = "class C { int a = F(2, (x, y) => x + y); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializerUpdate_ParenthesizedLambda() { var src1 = "class C { int a { get; } = F(1, (x, y) => x + y); }"; var src2 = "class C { int a { get; } = F(2, (x, y) => x + y); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void FieldInitializerUpdate_SimpleLambda() { var src1 = "class C { int a = F(1, x => x); }"; var src2 = "class C { int a = F(2, x => x); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializerUpdate_SimpleLambda() { var src1 = "class C { int a { get; } = F(1, x => x); }"; var src2 = "class C { int a { get; } = F(2, x => x); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void FieldInitializerUpdate_Query() { var src1 = "class C { int a = F(1, from goo in bar select baz); }"; var src2 = "class C { int a = F(2, from goo in bar select baz); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializerUpdate_Query() { var src1 = "class C { int a { get; } = F(1, from goo in bar select baz); }"; var src2 = "class C { int a { get; } = F(2, from goo in bar select baz); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void FieldInitializerUpdate_AnonymousType() { var src1 = "class C { int a = F(1, new { A = 1, B = 2 }); }"; var src2 = "class C { int a = F(2, new { A = 1, B = 2 }); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyInitializerUpdate_AnonymousType() { var src1 = "class C { int a { get; } = F(1, new { A = 1, B = 2 }); }"; var src2 = "class C { int a { get; } = F(2, new { A = 1, B = 2 }); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void FieldInitializerUpdate_Lambdas_ImplicitCtor_EditInitializerWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 2</N:0.1>); } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_ImplicitCtor_EditInitializerWithoutLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = 1; int B = F(<N:0.0>b => b + 1</N:0.0>); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = 2; int B = F(<N:0.0>b => b + 1</N:0.0>); } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_CtorIncludingInitializers_EditInitializerWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C() {} } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 2</N:0.1>); public C() {} } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_CtorIncludingInitializers_EditInitializerWithoutLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = 1; int B = F(<N:0.0>b => b + 1</N:0.0>); public C() {} } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = 2; int B = F(<N:0.0>b => b + 1</N:0.0>); public C() {} } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializers_EditInitializerWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) {} public C(bool b) {} } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 2</N:0.1>); public C(int a) {} public C(bool b) {} } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditInitializerWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 2</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditInitializerWithLambda_Trivia1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditConstructorWithLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(d => d + 1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 2</N:0.2>); } public C(bool b) { F(d => d + 1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Int32 a)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditConstructorWithLambda_Trivia1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(d => d + 1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(<N:0.2>c => c + 1</N:0.2>); } public C(bool b) { F(d => d + 1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Int32 a)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_MultipleCtorsIncludingInitializersContainingLambdas_EditConstructorWithoutLambda1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(c => c + 1); } public C(bool b) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(int a) { F(c => c + 1); } public C(bool b) { Console.WriteLine(2); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_EditConstructorNotIncludingInitializers() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(a => a + 1); int B = F(b => b + 1); public C(int a) { F(c => c + 1); } public C(bool b) : this(1) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(a => a + 1); int B = F(b => b + 1); public C(int a) { F(c => c + 1); } public C(bool b) : this(1) { Console.WriteLine(2); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)")) }); } [Fact] public void FieldInitializerUpdate_Lambdas_RemoveCtorInitializer1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); unsafe public C(int a) { char* buffer = stackalloc char[16]; F(c => c + 1); } public C(bool b) : this(1) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); unsafe public C(int a) { char* buffer = stackalloc char[16]; F(c => c + 1); } public C(bool b) { Console.WriteLine(1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_AddCtorInitializer1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(a => a + 1); int B = F(b => b + 1); public C(int a) { F(c => c + 1); } public C(bool b) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(a => a + 1); int B = F(b => b + 1); public C(int a) { F(c => c + 1); } public C(bool b) : this(1) { Console.WriteLine(1); } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)")) }); } [Fact] public void FieldInitializerUpdate_Lambdas_UpdateBaseCtorInitializerWithLambdas1() { var src1 = @" using System; class B { public B(int a) { } } class C : B { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(bool b) : base(F(<N:0.2>c => c + 1</N:0.2>)) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var src2 = @" using System; class B { public B(int a) { } } class C : B { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(<N:0.1>b => b + 1</N:0.1>); public C(bool b) : base(F(<N:0.2>c => c + 2</N:0.2>)) { F(<N:0.3>d => d + 1</N:0.3>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(ctor => ctor.ToTestDisplayString() == "C..ctor(System.Boolean b)"), syntaxMap[0]) }); } [Fact] public void FieldInitializerUpdate_Lambdas_PartialDeclarationDelete_SingleDocument() { var src1 = @" partial class C { int x = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int y = F(<N:0.1>a => a + 10</N:0.1>); } partial class C { public C() { } static int F(Func<int, int> x) => 1; } "; var src2 = @" partial class C { int x = F(<N:0.0>a => a + 1</N:0.0>); } partial class C { int y = F(<N:0.1>a => a + 10</N:0.1>); static int F(Func<int, int> x) => 1; } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember("F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), syntaxMap[0]), }); } [Fact] public void FieldInitializerUpdate_ActiveStatements1() { var src1 = @" using System; class C { <AS:0>int A = <N:0.0>1</N:0.0>;</AS:0> int B = 1; public C(int a) { Console.WriteLine(1); } public C(bool b) { Console.WriteLine(1); } } "; var src2 = @" using System; class C { <AS:0>int A = <N:0.0>1</N:0.0>;</AS:0> int B = 2; public C(int a) { Console.WriteLine(1); } public C(bool b) { Console.WriteLine(1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); var activeStatements = GetActiveStatements(src1, src2); edits.VerifySemantics( activeStatements, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[0], syntaxMap[0]), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors[1], syntaxMap[0]), }); } [Fact] public void PropertyWithInitializer_SemanticError_Partial() { var src1 = @" partial class C { partial int P => 1; } partial class C { partial int P => 1; } "; var src2 = @" partial class C { partial int P => 1; } partial class C { partial int P => 2; public C() { } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(ActiveStatementsDescription.Empty, expectedSemanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => ((IPropertySymbol)c.GetMember<INamedTypeSymbol>("C").GetMembers("P").First()).GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void Field_Partial_DeleteInsert_InitializerRemoval() { var srcA1 = "partial class C { int F = 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int F; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } [Fact] public void Field_Partial_DeleteInsert_InitializerUpdate() { var srcA1 = "partial class C { int F = 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { int F = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }); } #endregion #region Fields [Fact] public void Field_Rename() { var src1 = "class C { int a = 0; }"; var src2 = "class C { int b = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a = 0]@14 -> [b = 0]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "b = 0", FeaturesResources.field)); } [Fact] public void Field_Kind_Update() { var src1 = "class C { Action a; }"; var src2 = "class C { event Action a; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Action a;]@10 -> [event Action a;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.FieldKindUpdate, "event Action a", FeaturesResources.event_)); } [Theory] [InlineData("static")] [InlineData("volatile")] [InlineData("const")] public void Field_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "int F = 0; }"; var src2 = "class C { " + newModifiers + "int F = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "int F = 0;]@10 -> [" + newModifiers + "int F = 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "int F = 0", FeaturesResources.field)); } [Fact] public void Field_Modifier_Add_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int F; }"; var srcA2 = "partial class C { static int F; }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.ModifiersUpdate, "F", FeaturesResources.field) }), DocumentResults(), }); } [Fact] public void Field_Attribute_Add_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int F; }"; var srcA2 = "partial class C { [System.Obsolete]int F; }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")) }), DocumentResults(), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_FixedSize_Update() { var src1 = "struct S { public unsafe fixed byte a[1], b[2]; }"; var src2 = "struct S { public unsafe fixed byte a[2], b[3]; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a[1]]@36 -> [a[2]]@36", "Update [b[2]]@42 -> [b[3]]@42"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.FixedSizeFieldUpdate, "a[2]", FeaturesResources.field), Diagnostic(RudeEditKind.FixedSizeFieldUpdate, "b[3]", FeaturesResources.field)); } [WorkItem(1120407, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1120407")] [Fact] public void Field_Const_Update() { var src1 = "class C { const int x = 0; }"; var src2 = "class C { const int x = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [x = 0]@20 -> [x = 1]@20"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, "x = 1", FeaturesResources.const_field)); } [Fact] public void Field_Event_VariableDeclarator_Update() { var src1 = "class C { event Action a; }"; var src2 = "class C { event Action a = () => { }; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [a]@23 -> [a = () => { }]@23"); edits.VerifyRudeDiagnostics(); } [Fact] public void Field_Reorder() { var src1 = "class C { int a = 0; int b = 1; int c = 2; }"; var src2 = "class C { int c = 2; int a = 0; int b = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int c = 2;]@32 -> @10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "int c = 2", FeaturesResources.field)); } [Fact] public void Field_Insert() { var src1 = "class C { }"; var src2 = "class C { int a = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int a = 1;]@10", "Insert [int a = 1]@10", "Insert [a = 1]@14"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.a")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true) }); } [Fact] public void Field_Insert_IntoStruct() { var src1 = @" struct S { public int a; public S(int z) { this = default(S); a = z; } } "; var src2 = @" struct S { public int a; private int b; private static int c; private static int f = 1; private event System.Action d; public S(int z) { this = default(S); a = z; } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoStruct, "b", FeaturesResources.field, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "c", FeaturesResources.field, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "f = 1", FeaturesResources.field, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "d", CSharpFeaturesResources.event_field, CSharpFeaturesResources.struct_)); } [Fact] public void Field_Insert_IntoLayoutClass_Auto() { var src1 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Auto)] class C { private int a; } "; var src2 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Auto)] class C { private int a; private int b; private int c; private static int d; } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.b")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.c")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.d")), }); } [Fact] public void Field_Insert_IntoLayoutClass_Explicit() { var src1 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Explicit)] class C { [FieldOffset(0)] private int a; } "; var src2 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Explicit)] class C { [FieldOffset(0)] private int a; [FieldOffset(0)] private int b; [FieldOffset(4)] private int c; private static int d; } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "b", FeaturesResources.field, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "c", FeaturesResources.field, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "d", FeaturesResources.field, FeaturesResources.class_)); } [Fact] public void Field_Insert_IntoLayoutClass_Sequential() { var src1 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private int a; } "; var src2 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private int a; private int b; private int c; private static int d; } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "b", FeaturesResources.field, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "c", FeaturesResources.field, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "d", FeaturesResources.field, FeaturesResources.class_)); } [Fact] public void Field_Insert_WithInitializersAndLambdas1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); public C() { F(<N:0.1>c => c + 1</N:0.1>); } } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(b => b + 1); // new field public C() { F(<N:0.1>c => c + 1</N:0.1>); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.B")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact] public void Field_Insert_ConstructorReplacingImplicitConstructor_WithInitializersAndLambdas() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(b => b + 1); // new field public C() // new ctor replacing existing implicit constructor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.B")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void Field_Insert_ParameterlessConstructorInsert_WithInitializersAndLambdas() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); public C(int x) {} } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); public C(int x) {} public C() // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas, "public C()")); // TODO (bug https://github.com/dotnet/roslyn/issues/2504): //edits.VerifySemantics( // ActiveStatementsDescription.Empty, // new[] // { // SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<NamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) // }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void Field_Insert_ConstructorInsert_WithInitializersAndLambdas1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(<N:0.0>a => a + 1</N:0.0>); int B = F(b => b + 1); // new field public C(int x) // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); _ = GetSyntaxMap(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertConstructorToTypeWithInitializersWithLambdas, "public C(int x)")); // TODO (bug https://github.com/dotnet/roslyn/issues/2504): //edits.VerifySemantics( // ActiveStatementsDescription.Empty, // new[] // { // SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.B")), // SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<NamedTypeSymbol>("C").Constructors.Single(), syntaxMap[0]) // }); } [Fact, WorkItem(2504, "https://github.com/dotnet/roslyn/issues/2504")] public void Field_Insert_ConstructorInsert_WithInitializersButNoExistingLambdas1() { var src1 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(null); } "; var src2 = @" using System; class C { static int F(Func<int, int> x) => 1; int A = F(null); int B = F(b => b + 1); // new field public C(int x) // new ctor { F(c => c + 1); } } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.B")), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").Constructors.Single()) }); } [Fact] public void Field_Insert_NotSupportedByRuntime() { var src1 = "class C { }"; var src2 = "class C { public int a = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities | EditAndContinueCapabilities.AddStaticFieldToExistingType, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "a = 1", FeaturesResources.field)); } [Fact] public void Field_Insert_Static_NotSupportedByRuntime() { var src1 = "class C { }"; var src2 = "class C { public static int a = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities | EditAndContinueCapabilities.AddInstanceFieldToExistingType, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "a = 1", FeaturesResources.field)); } [Fact] public void Field_Attribute_Add_NotSupportedByRuntime() { var src1 = @" class C { public int a = 1, x = 1; }"; var src2 = @" class C { [System.Obsolete]public int a = 1, x = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [public int a = 1, x = 1;]@18 -> [[System.Obsolete]public int a = 1, x = 1;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "public int a = 1, x = 1", FeaturesResources.field), Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "public int a = 1, x = 1", FeaturesResources.field)); } [Fact] public void Field_Attribute_Add() { var src1 = @" class C { public int a, b; }"; var src2 = @" class C { [System.Obsolete]public int a, b; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.a")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.b")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_Attribute_Add_WithInitializer() { var src1 = @" class C { int a; }"; var src2 = @" class C { [System.Obsolete]int a = 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.a")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), preserveLocalVariables: true), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_Attribute_DeleteInsertUpdate_WithInitializer() { var srcA1 = "partial class C { int a = 1; }"; var srcB1 = "partial class C { }"; var srcA2 = "partial class C { }"; var srcB2 = "partial class C { [System.Obsolete]int a = 2; }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.a"), preserveLocalVariables: true), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_Delete1() { var src1 = "class C { int a = 1; }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [int a = 1;]@10", "Delete [int a = 1]@10", "Delete [a = 1]@14"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.field, "a"))); } [Fact] public void Field_UnsafeModifier_Update() { var src1 = "struct Node { unsafe Node* left; }"; var src2 = "struct Node { Node* left; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [unsafe Node* left;]@14 -> [Node* left;]@14"); edits.VerifyRudeDiagnostics(); } [Fact] public void Field_ModifierAndType_Update() { var src1 = "struct Node { unsafe Node* left; }"; var src2 = "struct Node { Node left; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [unsafe Node* left;]@14 -> [Node left;]@14", "Update [Node* left]@21 -> [Node left]@14"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "Node left", FeaturesResources.field)); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Field_Type_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C { " + oldType + " F, G; }"; var src2 = "class C { " + newType + " F, G; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.G"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Field_Type_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C { " + oldType + " F, G; }"; var src2 = "class C { " + newType + " F, G; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, newType + " F, G", FeaturesResources.field), Diagnostic(RudeEditKind.TypeUpdate, newType + " F, G", FeaturesResources.field)); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Field_Event_Type_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C { event System.Action<" + oldType + "> F, G; }"; var src2 = "class C { event System.Action<" + newType + "> F, G; }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.G"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Field_Event_Type_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C { event System.Action<" + oldType + "> F, G; }"; var src2 = "class C { event System.Action<" + newType + "> F, G; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "event System.Action<" + newType + "> F, G", FeaturesResources.event_), Diagnostic(RudeEditKind.TypeUpdate, "event System.Action<" + newType + "> F, G", FeaturesResources.event_)); } [Fact] public void Field_Type_Update_ReorderRemoveAdd() { var src1 = "class C { int F, G, H; bool U; }"; var src2 = "class C { string G, F; double V, U; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int F, G, H]@10 -> [string G, F]@10", "Reorder [G]@17 -> @17", "Update [bool U]@23 -> [double V, U]@23", "Insert [V]@30", "Delete [H]@20"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "G", FeaturesResources.field), Diagnostic(RudeEditKind.TypeUpdate, "string G, F", FeaturesResources.field), Diagnostic(RudeEditKind.TypeUpdate, "string G, F", FeaturesResources.field), Diagnostic(RudeEditKind.TypeUpdate, "double V, U", FeaturesResources.field), Diagnostic(RudeEditKind.Delete, "string G, F", DeletedSymbolDisplay(FeaturesResources.field, "H"))); } [Fact] public void Field_Event_Reorder() { var src1 = "class C { int a = 0; int b = 1; event int c = 2; }"; var src2 = "class C { event int c = 2; int a = 0; int b = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [event int c = 2;]@32 -> @10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "event int c = 2", CSharpFeaturesResources.event_field)); } [Fact] public void Field_Event_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { event int E = 2; }"; var srcA2 = "partial class C { event int E = 2; }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults(), }); } #endregion #region Properties [Theory] [InlineData("static")] [InlineData("virtual")] [InlineData("abstract")] [InlineData("override")] [InlineData("sealed override", "override")] public void Property_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "int F => 0; }"; var src2 = "class C { " + newModifiers + "int F => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "int F => 0;]@10 -> [" + newModifiers + "int F => 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "int F", FeaturesResources.property_)); } [Fact] public void Property_ExpressionBody_Rename() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int Q => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int Q", FeaturesResources.property_)); } [Fact] public void Property_ExpressionBody_Update() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int P => 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [int P => 1;]@10 -> [int P => 2;]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false) }); } [Fact, WorkItem(48628, "https://github.com/dotnet/roslyn/issues/48628")] public void Property_ExpressionBody_ModifierUpdate() { var src1 = "class C { int P => 1; }"; var src2 = "class C { unsafe int P => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [int P => 1;]@10 -> [unsafe int P => 1;]@10"); edits.VerifyRudeDiagnostics(); } [Fact] public void Property_ExpressionBodyToBlockBody1() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int P { get { return 2; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P => 1;]@10 -> [int P { get { return 2; } }]@10", "Insert [{ get { return 2; } }]@16", "Insert [get { return 2; }]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false) }); } [Fact] public void Property_ExpressionBodyToBlockBody2() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int P { get { return 2; } set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P => 1;]@10 -> [int P { get { return 2; } set { } }]@10", "Insert [{ get { return 2; } set { } }]@16", "Insert [get { return 2; }]@18", "Insert [set { }]@36"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.set_P"), preserveLocalVariables: false) }); } [Fact] public void Property_BlockBodyToExpressionBody1() { var src1 = "class C { int P { get { return 2; } } }"; var src2 = "class C { int P => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get { return 2; } }]@10 -> [int P => 1;]@10", "Delete [{ get { return 2; } }]@16", "Delete [get { return 2; }]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false) }); } [Fact] public void Property_BlockBodyToExpressionBody2() { var src1 = "class C { int P { get { return 2; } set { } } }"; var src2 = "class C { int P => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get { return 2; } set { } }]@10 -> [int P => 1;]@10", "Delete [{ get { return 2; } set { } }]@16", "Delete [get { return 2; }]@18", "Delete [set { }]@36"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_setter, "P.set"))); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_ExpressionBodyToGetterExpressionBody() { var src1 = "class C { int P => 1; }"; var src2 = "class C { int P { get => 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P => 1;]@10 -> [int P { get => 2; }]@10", "Insert [{ get => 2; }]@16", "Insert [get => 2;]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterExpressionBodyToExpressionBody() { var src1 = "class C { int P { get => 2; } }"; var src2 = "class C { int P => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get => 2; }]@10 -> [int P => 1;]@10", "Delete [{ get => 2; }]@16", "Delete [get => 2;]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterBlockBodyToGetterExpressionBody() { var src1 = "class C { int P { get { return 2; } } }"; var src2 = "class C { int P { get => 2; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get { return 2; }]@18 -> [get => 2;]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_SetterBlockBodyToSetterExpressionBody() { var src1 = "class C { int P { set { } } }"; var src2 = "class C { int P { set => F(); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [set { }]@18 -> [set => F();]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_InitBlockBodyToInitExpressionBody() { var src1 = "class C { int P { init { } } }"; var src2 = "class C { int P { init => F(); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [init { }]@18 -> [init => F();]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod, preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterExpressionBodyToGetterBlockBody() { var src1 = "class C { int P { get => 2; } }"; var src2 = "class C { int P { get { return 2; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get => 2;]@18 -> [get { return 2; }]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterBlockBodyWithSetterToGetterExpressionBodyWithSetter() { var src1 = "class C { int P { get => 2; set { Console.WriteLine(0); } } }"; var src2 = "class C { int P { get { return 2; } set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get => 2;]@18 -> [get { return 2; }]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Property_GetterExpressionBodyWithSetterToGetterBlockBodyWithSetter() { var src1 = "class C { int P { get { return 2; } set { Console.WriteLine(0); } } }"; var src2 = "class C { int P { get => 2; set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get { return 2; }]@18 -> [get => 2;]@18"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_P"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_P"), preserveLocalVariables: false) }); } [Fact] public void Property_Rename1() { var src1 = "class C { int P { get { return 1; } } }"; var src2 = "class C { int Q { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int Q", FeaturesResources.property_)); } [Fact] public void Property_Rename2() { var src1 = "class C { int I.P { get { return 1; } } }"; var src2 = "class C { int J.P { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int J.P", FeaturesResources.property_)); } [Fact] public void Property_RenameAndUpdate() { var src1 = "class C { int P { get { return 1; } } }"; var src2 = "class C { int Q { get { return 2; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int Q", FeaturesResources.property_)); } [Fact] public void PropertyDelete() { var src1 = "class C { int P { get { return 1; } } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.property_, "P"))); } [Fact] public void PropertyReorder1() { var src1 = "class C { int P { get { return 1; } } int Q { get { return 1; } } }"; var src2 = "class C { int Q { get { return 1; } } int P { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int Q { get { return 1; } }]@38 -> @10"); // TODO: we can allow the move since the property doesn't have a backing field edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "int Q", FeaturesResources.property_)); } [Fact] public void PropertyReorder2() { var src1 = "class C { int P { get; set; } int Q { get; set; } }"; var src2 = "class C { int Q { get; set; } int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int Q { get; set; }]@30 -> @10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "int Q", FeaturesResources.auto_property)); } [Fact] public void PropertyAccessorReorder_GetSet() { var src1 = "class C { int P { get { return 1; } set { } } }"; var src2 = "class C { int P { set { } get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [set { }]@36 -> @18"); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyAccessorReorder_GetInit() { var src1 = "class C { int P { get { return 1; } init { } } }"; var src2 = "class C { int P { init { } get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [init { }]@36 -> @18"); edits.VerifyRudeDiagnostics(); } [Fact] public void PropertyTypeUpdate() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { char P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get; set; }]@10 -> [char P { get; set; }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "char P", FeaturesResources.property_)); } [Fact] public void PropertyUpdate_AddAttribute() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { [System.Obsolete]int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int P", FeaturesResources.property_)); } [Fact] public void PropertyUpdate_AddAttribute_SupportedByRuntime() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { [System.Obsolete]int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.P")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void PropertyAccessorUpdate_AddAttribute() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { [System.Obsolete]get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "get", CSharpFeaturesResources.property_getter)); } [Fact] public void PropertyAccessorUpdate_AddAttribute2() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { get; [System.Obsolete]set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "set", CSharpFeaturesResources.property_setter)); } [Fact] public void PropertyAccessorUpdate_AddAttribute_SupportedByRuntime() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { [System.Obsolete]get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void PropertyAccessorUpdate_AddAttribute_SupportedByRuntime2() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { get; [System.Obsolete]set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void PropertyInsert() { var src1 = "class C { }"; var src2 = "class C { int P { get => 1; set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("P"))); } [Fact] public void PropertyInsert_NotSupportedByRuntime() { var src1 = "class C { }"; var src2 = "class C { int P { get => 1; set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.BaselineCapabilities, Diagnostic(RudeEditKind.InsertNotSupportedByRuntime, "int P", FeaturesResources.auto_property)); } [WorkItem(835827, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/835827")] [Fact] public void PropertyInsert_PInvoke() { var src1 = @" using System; using System.Runtime.InteropServices; class C { }"; var src2 = @" using System; using System.Runtime.InteropServices; class C { private static extern int P1 { [DllImport(""x.dll"")]get; } private static extern int P2 { [DllImport(""x.dll"")]set; } private static extern int P3 { [DllImport(""x.dll"")]get; [DllImport(""x.dll"")]set; } } "; var edits = GetTopEdits(src1, src2); // CLR doesn't support methods without a body edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertExtern, "private static extern int P1", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertExtern, "private static extern int P2", FeaturesResources.property_), Diagnostic(RudeEditKind.InsertExtern, "private static extern int P3", FeaturesResources.property_)); } [Fact] public void PropertyInsert_IntoStruct() { var src1 = @" struct S { public int a; public S(int z) { a = z; } } "; var src2 = @" struct S { public int a; private static int c { get; set; } private static int e { get { return 0; } set { } } private static int g { get; } = 1; private static int i { get; set; } = 1; private static int k => 1; public S(int z) { a = z; } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoStruct, "private static int c { get; set; }", FeaturesResources.auto_property, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "private static int g { get; } = 1;", FeaturesResources.auto_property, CSharpFeaturesResources.struct_), Diagnostic(RudeEditKind.InsertIntoStruct, "private static int i { get; set; } = 1;", FeaturesResources.auto_property, CSharpFeaturesResources.struct_)); } [Fact] public void PropertyInsert_IntoLayoutClass_Sequential() { var src1 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private int a; } "; var src2 = @" using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private int a; private int b { get; set; } private static int c { get; set; } private int d { get { return 0; } set { } } private static int e { get { return 0; } set { } } private int f { get; } = 1; private static int g { get; } = 1; private int h { get; set; } = 1; private static int i { get; set; } = 1; private int j => 1; private static int k => 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private int b { get; set; }", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private static int c { get; set; }", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private int f { get; } = 1;", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private static int g { get; } = 1;", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private int h { get; set; } = 1;", FeaturesResources.auto_property, FeaturesResources.class_), Diagnostic(RudeEditKind.InsertIntoClassWithLayout, "private static int i { get; set; } = 1;", FeaturesResources.auto_property, FeaturesResources.class_)); } // Design: Adding private accessors should also be allowed since we now allow adding private methods // and adding public properties and/or public accessors are not allowed. [Fact] public void PrivateProperty_AccessorAdd() { var src1 = "class C { int _p; int P { get { return 1; } } }"; var src2 = "class C { int _p; int P { get { return 1; } set { _p = value; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set { _p = value; }]@44"); edits.VerifyRudeDiagnostics(); } [WorkItem(755975, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755975")] [Fact] public void PrivatePropertyAccessorDelete() { var src1 = "class C { int _p; int P { get { return 1; } set { _p = value; } } }"; var src2 = "class C { int _p; int P { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [set { _p = value; }]@44"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_setter, "P.set"))); } [Fact] public void PrivateAutoPropertyAccessorAdd1() { var src1 = "class C { int P { get; } }"; var src2 = "class C { int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set;]@23"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd2() { var src1 = "class C { public int P { get; } }"; var src2 = "class C { public int P { get; private set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [private set;]@30"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd4() { var src1 = "class C { public int P { get; } }"; var src2 = "class C { public int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set;]@30"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd5() { var src1 = "class C { public int P { get; } }"; var src2 = "class C { public int P { get; internal set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [internal set;]@30"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd6() { var src1 = "class C { int P { get; } = 1; }"; var src2 = "class C { int P { get; set; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set;]@23"); edits.VerifyRudeDiagnostics(); } [Fact] public void PrivateAutoPropertyAccessorAdd_Init() { var src1 = "class C { int P { get; } = 1; }"; var src2 = "class C { int P { get; init; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [init;]@23"); edits.VerifyRudeDiagnostics(); } [WorkItem(755975, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/755975")] [Fact] public void PrivateAutoPropertyAccessorDelete_Get() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [get;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_getter, "P.get"))); } [Fact] public void AutoPropertyAccessor_SetToInit() { var src1 = "class C { int P { get; set; } }"; var src2 = "class C { int P { get; init; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [set;]@23 -> [init;]@23"); // not allowed since it changes the backing field readonly-ness and the signature of the setter (modreq) edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.AccessorKindUpdate, "init", CSharpFeaturesResources.property_setter)); } [Fact] public void AutoPropertyAccessor_InitToSet() { var src1 = "class C { int P { get; init; } }"; var src2 = "class C { int P { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [init;]@23 -> [set;]@23"); // not allowed since it changes the backing field readonly-ness and the signature of the setter (modreq) edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.AccessorKindUpdate, "set", CSharpFeaturesResources.property_setter)); } [Fact] public void PrivateAutoPropertyAccessorDelete_Set() { var src1 = "class C { int P { get; set; } = 1; }"; var src2 = "class C { int P { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [set;]@23"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_setter, "P.set"))); } [Fact] public void PrivateAutoPropertyAccessorDelete_Init() { var src1 = "class C { int P { get; init; } = 1; }"; var src2 = "class C { int P { get; } = 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [init;]@23"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int P", DeletedSymbolDisplay(CSharpFeaturesResources.property_setter, "P.init"))); } [Fact] public void AutoPropertyAccessorUpdate() { var src1 = "class C { int P { get; } }"; var src2 = "class C { int P { set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get;]@18 -> [set;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.AccessorKindUpdate, "set", CSharpFeaturesResources.property_setter)); } [WorkItem(992578, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/992578")] [Fact] public void InsertIncompleteProperty() { var src1 = "class C { }"; var src2 = "class C { public int P { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [public int P { }]@10", "Insert [{ }]@23"); edits.VerifyRudeDiagnostics(); } [Fact] public void Property_ReadOnlyRef_Insert() { var src1 = "class Test { }"; var src2 = "class Test { ref readonly int P { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [ref readonly int P { get; }]@13", "Insert [{ get; }]@32", "Insert [get;]@34"); edits.VerifyRudeDiagnostics(); } [Fact] public void Property_ReadOnlyRef_Update() { var src1 = "class Test { int P { get; } }"; var src2 = "class Test { ref readonly int P { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int P { get; }]@13 -> [ref readonly int P { get; }]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "ref readonly int P", FeaturesResources.property_)); } [Fact] public void Property_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int P { get => 1; set { } } }"; var srcA2 = "partial class C { int P { get => 1; set { } } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod) }), DocumentResults(), }); } [Fact] public void PropertyInit_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int Q { get => 1; init { } }}"; var srcA2 = "partial class C { int Q { get => 1; init { } }}"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod) }), DocumentResults(), }); } [Fact] public void AutoProperty_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int P { get; set; } int Q { get; init; } }"; var srcA2 = "partial class C { int P { get; set; } int Q { get; init; } }"; var srcB2 = "partial class C { }"; // Accessors need to be updated even though they do not have an explicit body. // There is still a sequence point generated for them whose location needs to be updated. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("Q").SetMethod), }), DocumentResults(), }); } [Fact] public void AutoPropertyWithInitializer_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int P { get; set; } = 1; }"; var srcA2 = "partial class C { int P { get; set; } = 1; }"; var srcB2 = "partial class C { }"; // Accessors need to be updated even though they do not have an explicit body. // There is still a sequence point generated for them whose location needs to be updated. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").SetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").InstanceConstructors.Single(), partialType: "C", preserveLocalVariables: true) }), DocumentResults(), }); } [Fact] public void PropertyWithExpressionBody_Partial_InsertDeleteUpdate() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int P => 1; }"; var srcA2 = "partial class C { int P => 2; }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("P").GetMethod) }), DocumentResults(), }); } [Fact] public void AutoProperty_ReadOnly_Add() { var src1 = @" struct S { int P { get; } }"; var src2 = @" struct S { readonly int P { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void Property_InMutableStruct_ReadOnly_Add() { var src1 = @" struct S { int P1 { get => 1; } int P2 { get => 1; set {}} int P3 { get => 1; set {}} int P4 { get => 1; set {}} }"; var src2 = @" struct S { readonly int P1 { get => 1; } int P2 { readonly get => 1; set {}} int P3 { get => 1; readonly set {}} readonly int P4 { get => 1; set {}} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int P1", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int P4", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int P4", CSharpFeaturesResources.property_setter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly get", CSharpFeaturesResources.property_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly set", CSharpFeaturesResources.property_setter)); } [Fact] public void Property_InReadOnlyStruct_ReadOnly_Add() { // indent to align accessor bodies and avoid updates caused by sequence point location changes var src1 = @" readonly struct S { int P1 { get => 1; } int P2 { get => 1; set {}} int P3 { get => 1; set {}} int P4 { get => 1; set {}} }"; var src2 = @" readonly struct S { readonly int P1 { get => 1; } int P2 { readonly get => 1; set {}} int P3 { get => 1; readonly set {}} readonly int P4 { get => 1; set {}} }"; var edits = GetTopEdits(src1, src2); // updates only for accessors whose modifiers were explicitly updated edits.VerifySemantics(new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IPropertySymbol>("P2").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IPropertySymbol>("P3").SetMethod, preserveLocalVariables: false) }); } #endregion #region Indexers [Theory] [InlineData("virtual")] [InlineData("abstract")] [InlineData("override")] [InlineData("sealed override", "override")] public void Indexer_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "int this[int a] => 0; }"; var src2 = "class C { " + newModifiers + "int this[int a] => 0; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "int this[int a] => 0;]@10 -> [" + newModifiers + "int this[int a] => 0;]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "int this[int a]", FeaturesResources.indexer_)); } [Fact] public void Indexer_GetterUpdate() { var src1 = "class C { int this[int a] { get { return 1; } } }"; var src2 = "class C { int this[int a] { get { return 2; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [get { return 1; }]@28 -> [get { return 2; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact] public void Indexer_SetterUpdate() { var src1 = "class C { int this[int a] { get { return 1; } set { System.Console.WriteLine(value); } } }"; var src2 = "class C { int this[int a] { get { return 1; } set { System.Console.WriteLine(value + 1); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [set { System.Console.WriteLine(value); }]@46 -> [set { System.Console.WriteLine(value + 1); }]@46"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: false) }); } [Fact] public void Indexer_InitUpdate() { var src1 = "class C { int this[int a] { get { return 1; } init { System.Console.WriteLine(value); } } }"; var src2 = "class C { int this[int a] { get { return 1; } init { System.Console.WriteLine(value + 1); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [init { System.Console.WriteLine(value); }]@46 -> [init { System.Console.WriteLine(value + 1); }]@46"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: false) }); } [Fact] public void IndexerWithExpressionBody_Update() { var src1 = "class C { int this[int a] => 1; }"; var src2 = "class C { int this[int a] => 2; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => 1;]@10 -> [int this[int a] => 2;]@10"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Update_LiftedParameter() { var src1 = @" using System; class C { int this[int a] => new Func<int>(() => a + 1)() + 10; } "; var src2 = @" using System; class C { int this[int a] => new Func<int>(() => 2)() + 11; // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => new Func<int>(() => a + 1)() + 10;]@35 -> [int this[int a] => new Func<int>(() => 2)() + 11;]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Update_LiftedParameter_2() { var src1 = @" using System; class C { int this[int a] => new Func<int>(() => a + 1)(); } "; var src2 = @" using System; class C { int this[int a] => new Func<int>(() => 2)(); // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => new Func<int>(() => a + 1)();]@35 -> [int this[int a] => new Func<int>(() => 2)();]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Update_LiftedParameter_3() { var src1 = @" using System; class C { int this[int a] => new Func<int>(() => { return a + 1; })(); } "; var src2 = @" using System; class C { int this[int a] => new Func<int>(() => { return 2; })(); // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => new Func<int>(() => { return a + 1; })();]@35 -> [int this[int a] => new Func<int>(() => { return 2; })();]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Update_LiftedParameter_4() { var src1 = @" using System; class C { int this[int a] => new Func<int>(delegate { return a + 1; })(); } "; var src2 = @" using System; class C { int this[int a] => new Func<int>(delegate { return 2; })(); // not capturing a anymore }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => new Func<int>(delegate { return a + 1; })();]@35 -> [int this[int a] => new Func<int>(delegate { return 2; })();]@35"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a")); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_ExpressionBodyToBlockBody() { var src1 = "class C { int this[int a] => 1; }"; var src2 = "class C { int this[int a] { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => 1;]@10 -> [int this[int a] { get { return 1; } }]@10", "Insert [{ get { return 1; } }]@26", "Insert [get { return 1; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_BlockBodyToExpressionBody() { var src1 = "class C { int this[int a] { get { return 1; } } }"; var src2 = "class C { int this[int a] => 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] { get { return 1; } }]@10 -> [int this[int a] => 1;]@10", "Delete [{ get { return 1; } }]@26", "Delete [get { return 1; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterExpressionBodyToBlockBody() { var src1 = "class C { int this[int a] { get => 1; } }"; var src2 = "class C { int this[int a] { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get => 1;]@28 -> [get { return 1; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_BlockBodyToGetterExpressionBody() { var src1 = "class C { int this[int a] { get { return 1; } } }"; var src2 = "class C { int this[int a] { get => 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get { return 1; }]@28 -> [get => 1;]@28"); edits.VerifyRudeDiagnostics(); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterExpressionBodyToExpressionBody() { var src1 = "class C { int this[int a] { get => 1; } }"; var src2 = "class C { int this[int a] => 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] { get => 1; }]@10 -> [int this[int a] => 1;]@10", "Delete [{ get => 1; }]@26", "Delete [get => 1;]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_ExpressionBodyToGetterExpressionBody() { var src1 = "class C { int this[int a] => 1; }"; var src2 = "class C { int this[int a] { get => 1; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => 1;]@10 -> [int this[int a] { get => 1; }]@10", "Insert [{ get => 1; }]@26", "Insert [get => 1;]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterBlockBodyToGetterExpressionBody() { var src1 = "class C { int this[int a] { get { return 1; } set { Console.WriteLine(0); } } }"; var src2 = "class C { int this[int a] { get => 1; set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get { return 1; }]@28 -> [get => 1;]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_SetterBlockBodyToSetterExpressionBody() { var src1 = "class C { int this[int a] { set { } } void F() { } }"; var src2 = "class C { int this[int a] { set => F(); } void F() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [set { }]@28 -> [set => F();]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_InitBlockBodyToInitExpressionBody() { var src1 = "class C { int this[int a] { init { } } void F() { } }"; var src2 = "class C { int this[int a] { init => F(); } void F() { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [init { }]@28 -> [init => F();]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")), }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterExpressionBodyToGetterBlockBody() { var src1 = "class C { int this[int a] { get => 1; set { Console.WriteLine(0); } } }"; var src2 = "class C { int this[int a] { get { return 1; } set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [get => 1;]@28 -> [get { return 1; }]@28"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.set_Item"), preserveLocalVariables: false) }); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_GetterAndSetterBlockBodiesToExpressionBody() { var src1 = "class C { int this[int a] { get { return 1; } set { Console.WriteLine(0); } } }"; var src2 = "class C { int this[int a] => 1; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] { get { return 1; } set { Console.WriteLine(0); } }]@10 -> [int this[int a] => 1;]@10", "Delete [{ get { return 1; } set { Console.WriteLine(0); } }]@26", "Delete [get { return 1; }]@28", "Delete [set { Console.WriteLine(0); }]@46"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "int this[int a]", DeletedSymbolDisplay(CSharpFeaturesResources.indexer_setter, "this[int a].set"))); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Indexer_ExpressionBodyToGetterAndSetterBlockBodies() { var src1 = "class C { int this[int a] => 1; }"; var src2 = "class C { int this[int a] { get { return 1; } set { Console.WriteLine(0); } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] => 1;]@10 -> [int this[int a] { get { return 1; } set { Console.WriteLine(0); } }]@10", "Insert [{ get { return 1; } set { Console.WriteLine(0); } }]@26", "Insert [get { return 1; }]@28", "Insert [set { Console.WriteLine(0); }]@46"); edits.VerifySemantics(ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.get_Item"), preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("C.set_Item"), preserveLocalVariables: false) }); } [Fact] public void Indexer_Rename() { var src1 = "class C { int I.this[int a] { get { return 1; } } }"; var src2 = "class C { int J.this[int a] { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "int J.this[int a]", CSharpFeaturesResources.indexer)); } [Fact] public void Indexer_Reorder1() { var src1 = "class C { int this[int a] { get { return 1; } } int this[string a] { get { return 1; } } }"; var src2 = "class C { int this[string a] { get { return 1; } } int this[int a] { get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int this[string a] { get { return 1; } }]@48 -> @10"); edits.VerifyRudeDiagnostics(); } [Fact] public void Indexer_AccessorReorder() { var src1 = "class C { int this[int a] { get { return 1; } set { } } }"; var src2 = "class C { int this[int a] { set { } get { return 1; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [set { }]@46 -> @28"); edits.VerifyRudeDiagnostics(); } [Fact] public void Indexer_TypeUpdate() { var src1 = "class C { int this[int a] { get; set; } }"; var src2 = "class C { string this[int a] { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int a] { get; set; }]@10 -> [string this[int a] { get; set; }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "string this[int a]", CSharpFeaturesResources.indexer)); } [Fact] public void Tuple_TypeUpdate() { var src1 = "class C { (int, int) M() { throw new System.Exception(); } }"; var src2 = "class C { (string, int) M() { throw new System.Exception(); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int, int) M() { throw new System.Exception(); }]@10 -> [(string, int) M() { throw new System.Exception(); }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "(string, int) M()", FeaturesResources.method)); } [Fact] public void TupleElementDelete() { var src1 = "class C { (int, int, int a) M() { return (1, 2, 3); } }"; var src2 = "class C { (int, int) M() { return (1, 2); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int, int, int a) M() { return (1, 2, 3); }]@10 -> [(int, int) M() { return (1, 2); }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "(int, int) M()", FeaturesResources.method)); } [Fact] public void TupleElementAdd() { var src1 = "class C { (int, int) M() { return (1, 2); } }"; var src2 = "class C { (int, int, int a) M() { return (1, 2, 3); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int, int) M() { return (1, 2); }]@10 -> [(int, int, int a) M() { return (1, 2, 3); }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "(int, int, int a) M()", FeaturesResources.method)); } [Fact] public void Indexer_ParameterUpdate() { var src1 = "class C { int this[int a] { get; set; } }"; var src2 = "class C { int this[string a] { get; set; } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "string a", FeaturesResources.parameter)); } [Fact] public void Indexer_AddGetAccessor() { var src1 = @" class Test { static void Main(string[] args) { SampleCollection<string> stringCollection = new SampleCollection<string>(); stringCollection[0] = ""hello""; } } class SampleCollection<T> { private T[] arr = new T[100]; public T this[int i] { set { arr[i] = value; } } }"; var src2 = @" class Test { static void Main(string[] args) { SampleCollection<string> stringCollection = new SampleCollection<string>(); stringCollection[0] = ""hello""; } } class SampleCollection<T> { private T[] arr = new T[100]; public T this[int i] { get { return arr[i]; } set { arr[i] = value; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [get { return arr[i]; }]@304"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InsertIntoGenericType, "get", CSharpFeaturesResources.indexer_getter)); } [Fact] public void Indexer_AddSetAccessor() { var src1 = @" class C { public int this[int i] { get { return default; } } }"; var src2 = @" class C { public int this[int i] { get { return default; } set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set { }]@67"); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod)); } [Fact] public void Indexer_AddSetAccessor_GenericType() { var src1 = @" class C<T> { public T this[int i] { get { return default; } } }"; var src2 = @" class C<T> { public T this[int i] { get { return default; } set { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [set { }]@68"); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.InsertIntoGenericType, "set", CSharpFeaturesResources.indexer_setter)); } [WorkItem(750109, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/750109")] [Fact] public void Indexer_DeleteGetAccessor() { var src1 = @" class C<T> { public T this[int i] { get { return arr[i]; } set { arr[i] = value; } } }"; var src2 = @" class C<T> { public T this[int i] { set { arr[i] = value; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [get { return arr[i]; }]@58"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "public T this[int i]", DeletedSymbolDisplay(CSharpFeaturesResources.indexer_getter, "this[int i].get"))); } [Fact] public void Indexer_DeleteSetAccessor() { var src1 = @" class C { public int this[int i] { get { return 0; } set { } } }"; var src2 = @" class C { public int this[int i] { get { return 0; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [set { }]@61"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "public int this[int i]", DeletedSymbolDisplay(CSharpFeaturesResources.indexer_setter, "this[int i].set"))); } [Fact, WorkItem(1174850, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1174850")] public void Indexer_Insert() { var src1 = "struct C { }"; var src2 = "struct C { public int this[int x, int y] { get { return x + y; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact] public void Indexer_ReadOnlyRef_Parameter_InsertWhole() { var src1 = "class Test { }"; var src2 = "class Test { int this[in int i] => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int this[in int i] => throw null;]@13", "Insert [[in int i]]@21", "Insert [in int i]@22"); edits.VerifyRudeDiagnostics(); } [Fact] public void Indexer_ReadOnlyRef_Parameter_Update() { var src1 = "class Test { int this[int i] => throw null; }"; var src2 = "class Test { int this[in int i] => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int i]@22 -> [in int i]@22"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "in int i", FeaturesResources.parameter)); } [Fact] public void Indexer_ReadOnlyRef_ReturnType_Insert() { var src1 = "class Test { }"; var src2 = "class Test { ref readonly int this[int i] => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [ref readonly int this[int i] => throw null;]@13", "Insert [[int i]]@34", "Insert [int i]@35"); edits.VerifyRudeDiagnostics(); } [Fact] public void Indexer_ReadOnlyRef_ReturnType_Update() { var src1 = "class Test { int this[int i] => throw null; }"; var src2 = "class Test { ref readonly int this[int i] => throw null; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int this[int i] => throw null;]@13 -> [ref readonly int this[int i] => throw null;]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, "ref readonly int this[int i]", FeaturesResources.indexer_)); } [Fact] public void Indexer_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int this[int x] { get => 1; set { } } }"; var srcA2 = "partial class C { int this[int x] { get => 1; set { } } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod) }), DocumentResults(), }); } [Fact] public void IndexerInit_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int this[int x] { get => 1; init { } }}"; var srcA2 = "partial class C { int this[int x] { get => 1; init { } }}"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod) }), DocumentResults(), }); } [Fact] public void AutoIndexer_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { int this[int x] { get; set; } }"; var srcA2 = "partial class C { int this[int x] { get; set; } }"; var srcB2 = "partial class C { }"; // Accessors need to be updated even though they do not have an explicit body. // There is still a sequence point generated for them whose location needs to be updated. EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").GetMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IPropertySymbol>("this[]").SetMethod), }), DocumentResults(), }); } [Fact, WorkItem(51297, "https://github.com/dotnet/roslyn/issues/51297")] public void IndexerWithExpressionBody_Partial_InsertDeleteUpdate_LiftedParameter() { var srcA1 = @" partial class C { }"; var srcB1 = @" partial class C { int this[int a] => new System.Func<int>(() => a + 1); }"; var srcA2 = @" partial class C { int this[int a] => new System.Func<int>(() => 2); // no capture }"; var srcB2 = @" partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.NotCapturingVariable, "a", "a") }), DocumentResults(), }); } [Fact] public void AutoIndexer_ReadOnly_Add() { var src1 = @" struct S { int this[int x] { get; } }"; var src2 = @" struct S { readonly int this[int x] { get; } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int this[int x]", CSharpFeaturesResources.indexer_getter)); } [Fact] public void Indexer_InMutableStruct_ReadOnly_Add() { var src1 = @" struct S { int this[int x] { get => 1; } int this[uint x] { get => 1; set {}} int this[byte x] { get => 1; set {}} int this[sbyte x] { get => 1; set {}} }"; var src2 = @" struct S { readonly int this[int x] { get => 1; } int this[uint x] { readonly get => 1; set {}} int this[byte x] { get => 1; readonly set {}} readonly int this[sbyte x] { get => 1; set {}} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int this[int x]", CSharpFeaturesResources.indexer_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int this[sbyte x]", CSharpFeaturesResources.indexer_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly int this[sbyte x]", CSharpFeaturesResources.indexer_setter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly get", CSharpFeaturesResources.indexer_getter), Diagnostic(RudeEditKind.ModifiersUpdate, "readonly set", CSharpFeaturesResources.indexer_setter)); } [Fact] public void Indexer_InReadOnlyStruct_ReadOnly_Add() { // indent to align accessor bodies and avoid updates caused by sequence point location changes var src1 = @" readonly struct S { int this[int x] { get => 1; } int this[uint x] { get => 1; set {}} int this[byte x] { get => 1; set {}} int this[sbyte x] { get => 1; set {}} }"; var src2 = @" readonly struct S { readonly int this[int x] { get => 1; } int this[uint x] { readonly get => 1; set {}} int this[byte x] { get => 1; readonly set {}} readonly int this[sbyte x] { get => 1; set {}} }"; var edits = GetTopEdits(src1, src2); // updates only for accessors whose modifiers were explicitly updated edits.VerifySemantics(new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.Parameters.Single().Type.Name == "UInt32").GetMethod, preserveLocalVariables: false), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMembers("this[]").Cast<IPropertySymbol>().Single(m => m.Parameters.Single().Type.Name == "Byte").SetMethod, preserveLocalVariables: false) }); } #endregion #region Events [Theory] [InlineData("static")] [InlineData("virtual")] [InlineData("abstract")] [InlineData("override")] [InlineData("sealed override", "override")] public void Event_Modifiers_Update(string oldModifiers, string newModifiers = "") { if (oldModifiers != "") { oldModifiers += " "; } if (newModifiers != "") { newModifiers += " "; } var src1 = "class C { " + oldModifiers + "event Action F { add {} remove {} } }"; var src2 = "class C { " + newModifiers + "event Action F { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [" + oldModifiers + "event Action F { add {} remove {} }]@10 -> [" + newModifiers + "event Action F { add {} remove {} }]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, newModifiers + "event Action F", FeaturesResources.event_)); } [Fact] public void Event_Accessor_Reorder1() { var src1 = "class C { event int E { add { } remove { } } }"; var src2 = "class C { event int E { remove { } add { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [remove { }]@32 -> @24"); edits.VerifyRudeDiagnostics(); } [Fact] public void Event_Accessor_Reorder2() { var src1 = "class C { event int E1 { add { } remove { } } event int E1 { add { } remove { } } }"; var src2 = "class C { event int E2 { remove { } add { } } event int E2 { remove { } add { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [event int E1 { add { } remove { } }]@10 -> [event int E2 { remove { } add { } }]@10", "Update [event int E1 { add { } remove { } }]@49 -> [event int E2 { remove { } add { } }]@49", "Reorder [remove { }]@33 -> @25", "Reorder [remove { }]@72 -> @64"); } [Fact] public void Event_Accessor_Reorder3() { var src1 = "class C { event int E1 { add { } remove { } } event int E2 { add { } remove { } } }"; var src2 = "class C { event int E2 { remove { } add { } } event int E1 { remove { } add { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [event int E2 { add { } remove { } }]@49 -> @10", "Reorder [remove { }]@72 -> @25", "Reorder [remove { }]@33 -> @64"); } [Fact] public void Event_Insert() { var src1 = "class C { }"; var src2 = "class C { event int E { remove { } add { } } }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Insert, c => c.GetMember<INamedTypeSymbol>("C").GetMember("E"))); } [Fact] public void Event_Delete() { var src1 = "class C { event int E { remove { } add { } } }"; var src2 = "class C { }"; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics( Diagnostic(RudeEditKind.Delete, "class C", DeletedSymbolDisplay(FeaturesResources.event_, "E"))); } [Fact] public void Event_Insert_IntoLayoutClass_Sequential() { var src1 = @" using System; using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { } "; var src2 = @" using System; using System.Runtime.InteropServices; [StructLayoutAttribute(LayoutKind.Sequential)] class C { private event Action c { add { } remove { } } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemanticDiagnostics(); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Event_ExpressionBodyToBlockBody() { var src1 = @" using System; public class C { event Action E { add => F(); remove => F(); } } "; var src2 = @" using System; public class C { event Action E { add { F(); } remove { } } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [add => F();]@57 -> [add { F(); }]@56", "Update [remove => F();]@69 -> [remove { }]@69" ); edits.VerifySemanticDiagnostics(); } [Fact, WorkItem(17681, "https://github.com/dotnet/roslyn/issues/17681")] public void Event_BlockBodyToExpressionBody() { var src1 = @" using System; public class C { event Action E { add { F(); } remove { } } } "; var src2 = @" using System; public class C { event Action E { add => F(); remove => F(); } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [add { F(); }]@56 -> [add => F();]@57", "Update [remove { }]@69 -> [remove => F();]@69" ); edits.VerifySemanticDiagnostics(); } [Fact] public void Event_Partial_InsertDelete() { var srcA1 = "partial class C { }"; var srcB1 = "partial class C { event int E { add { } remove { } } }"; var srcA2 = "partial class C { event int E { add { } remove { } } }"; var srcB2 = "partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( semanticEdits: new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").AddMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("C").GetMember<IEventSymbol>("E").RemoveMethod) }), DocumentResults(), }); } [Fact] public void Event_InMutableStruct_ReadOnly_Add() { var src1 = @" struct S { public event Action E { add {} remove {} } }"; var src2 = @" struct S { public readonly event Action E { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "public readonly event Action E", FeaturesResources.event_)); } [Fact] public void Event_InReadOnlyStruct_ReadOnly_Add1() { var src1 = @" readonly struct S { public event Action E { add {} remove {} } }"; var src2 = @" readonly struct S { public readonly event Action E { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); // Currently, an edit is produced eventhough bodies nor IsReadOnly attribute have changed. Consider improving. edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IEventSymbol>("E").AddMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<INamedTypeSymbol>("S").GetMember<IEventSymbol>("E").RemoveMethod)); } [Fact] public void Field_Event_Attribute_Add() { var src1 = @" class C { event Action F; }"; var src2 = @" class C { [System.Obsolete]event Action F; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [event Action F;]@18 -> [[System.Obsolete]event Action F;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "event Action F", FeaturesResources.event_)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Event_Attribute_Add() { var src1 = @" class C { event Action F { add {} remove {} } }"; var src2 = @" class C { [System.Obsolete]event Action F { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [event Action F { add {} remove {} }]@18 -> [[System.Obsolete]event Action F { add {} remove {} }]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "event Action F", FeaturesResources.event_)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").AddMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").RemoveMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Event_Accessor_Attribute_Add() { var src1 = @" class C { event Action F { add {} remove {} } }"; var src2 = @" class C { event Action F { add {} [System.Obsolete]remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [remove {}]@42 -> [[System.Obsolete]remove {}]@42"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "remove", FeaturesResources.event_accessor)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").RemoveMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Field_Event_Attribute_Delete() { var src1 = @" class C { [System.Obsolete]event Action F; }"; var src2 = @" class C { event Action F; }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete]event Action F;]@18 -> [event Action F;]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "event Action F", FeaturesResources.event_)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Event_Attribute_Delete() { var src1 = @" class C { [System.Obsolete]event Action F { add {} remove {} } }"; var src2 = @" class C { event Action F { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete]event Action F { add {} remove {} }]@18 -> [event Action F { add {} remove {} }]@18"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "event Action F", FeaturesResources.event_)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F")), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").AddMethod), SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").RemoveMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Event_Accessor_Attribute_Delete() { var src1 = @" class C { event Action F { add {} [System.Obsolete]remove {} } }"; var src2 = @" class C { event Action F { add {} remove {} } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete]remove {}]@42 -> [remove {}]@42"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "remove", FeaturesResources.event_accessor)); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember<IEventSymbol>("C.F").RemoveMethod) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } #endregion #region Parameter [Fact] public void ParameterRename_Method1() { var src1 = @"class C { public void M(int a) {} }"; var src2 = @"class C { public void M(int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@24 -> [int b]@24"); } [Fact] public void ParameterRename_Ctor1() { var src1 = @"class C { public C(int a) {} }"; var src2 = @"class C { public C(int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@19 -> [int b]@19"); } [Fact] public void ParameterRename_Operator1() { var src1 = @"class C { public static implicit operator int(C a) {} }"; var src2 = @"class C { public static implicit operator int(C b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [C a]@46 -> [C b]@46"); } [Fact] public void ParameterRename_Operator2() { var src1 = @"class C { public static int operator +(C a, C b) { return 0; } }"; var src2 = @"class C { public static int operator +(C a, C x) { return 0; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [C b]@44 -> [C x]@44"); } [Fact] public void ParameterRename_Indexer2() { var src1 = @"class C { public int this[int a, int b] { get { return 0; } } }"; var src2 = @"class C { public int this[int a, int x] { get { return 0; } } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int b]@33 -> [int x]@33"); } [Fact] public void ParameterInsert1() { var src1 = @"class C { public void M() {} }"; var src2 = @"class C { public void M(int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [int a]@24"); } [Fact] public void ParameterInsert2() { var src1 = @"class C { public void M(int a) {} }"; var src2 = @"class C { public void M(int a, ref int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int a)]@23 -> [(int a, ref int b)]@23", "Insert [ref int b]@31"); } [Fact] public void ParameterDelete1() { var src1 = @"class C { public void M(int a) {} }"; var src2 = @"class C { public void M() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [int a]@24"); } [Fact] public void ParameterDelete2() { var src1 = @"class C { public void M(int a, int b) {} }"; var src2 = @"class C { public void M(int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [(int a, int b)]@23 -> [(int b)]@23", "Delete [int a]@24"); } [Fact] public void ParameterUpdate() { var src1 = @"class C { public void M(int a) {} }"; var src2 = @"class C { public void M(int b) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@24 -> [int b]@24"); } [Fact] public void ParameterReorder() { var src1 = @"class C { public void M(int a, int b) {} }"; var src2 = @"class C { public void M(int b, int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int b]@31 -> @24"); } [Fact] public void ParameterReorderAndUpdate() { var src1 = @"class C { public void M(int a, int b) {} }"; var src2 = @"class C { public void M(int b, int c) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [int b]@31 -> @24", "Update [int a]@24 -> [int c]@31"); } [Theory] [InlineData("string", "string?")] [InlineData("object", "dynamic")] [InlineData("(int a, int b)", "(int a, int c)")] public void Parameter_Type_Update_RuntimeTypeUnchanged(string oldType, string newType) { var src1 = "class C { static void M(" + oldType + " a) {} }"; var src2 = "class C { static void M(" + newType + " a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifySemantics( SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M"))); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void Parameter_Type_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C { static void M(" + oldType + " a) {} }"; var src2 = "class C { static void M(" + newType + " a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.TypeUpdate, newType + " a", FeaturesResources.parameter)); } [Fact] public void Parameter_Type_Nullable() { var src1 = @" #nullable enable class C { static void M(string a) { } } "; var src2 = @" #nullable disable class C { static void M(string a) { } } "; var edits = GetTopEdits(src1, src2); edits.VerifySemantics(); } [Theory] [InlineData("this")] [InlineData("ref")] [InlineData("out")] [InlineData("params")] public void Parameter_Modifier_Remove(string modifier) { var src1 = @"static class C { static void F(" + modifier + " int[] a) { } }"; var src2 = @"static class C { static void F(int[] a) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ModifiersUpdate, "int[] a", FeaturesResources.parameter)); } [Theory] [InlineData("int a = 1", "int a = 2")] [InlineData("int a = 1", "int a")] [InlineData("int a", "int a = 2")] [InlineData("object a = null", "object a")] [InlineData("object a", "object a = null")] [InlineData("double a = double.NaN", "double a = 1.2")] public void Parameter_Initializer_Update(string oldParameter, string newParameter) { var src1 = @"static class C { static void F(" + oldParameter + ") { } }"; var src2 = @"static class C { static void F(" + newParameter + ") { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.InitializerUpdate, newParameter, FeaturesResources.parameter)); } [Fact] public void Parameter_Initializer_NaN() { var src1 = @"static class C { static void F(double a = System.Double.NaN) { } }"; var src2 = @"static class C { static void F(double a = double.NaN) { } }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics(); } [Fact] public void Parameter_Initializer_InsertDeleteUpdate() { var srcA1 = @"partial class C { }"; var srcB1 = @"partial class C { public static void F(int x = 1) {} }"; var srcA2 = @"partial class C { public static void F(int x = 2) {} }"; var srcB2 = @"partial class C { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults( diagnostics: new[] { Diagnostic(RudeEditKind.InitializerUpdate, "int x = 2", FeaturesResources.parameter) }), DocumentResults(), }); } [Fact] public void Parameter_Attribute_Insert() { var attribute = "public class A : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M(int a) {} }"; var src2 = attribute + @"class C { public void M([A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@63 -> [[A]int a]@63"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.M")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Parameter_Attribute_Insert_SupportedByRuntime_SecurityAttribute1() { var attribute = "public class AAttribute : System.Security.Permissions.SecurityAttribute { }\n\n"; var src1 = attribute + @"class C { public void M(int a) {} }"; var src2 = attribute + @"class C { public void M([A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@101 -> [[A]int a]@101"); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.ChangingNonCustomAttribute, "int a", "AAttribute", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Insert_SupportedByRuntime_SecurityAttribute2() { var attribute = "public class BAttribute : System.Security.Permissions.SecurityAttribute { }\n\n" + "public class AAttribute : BAttribute { }\n\n"; var src1 = attribute + @"class C { public void M(int a) {} }"; var src2 = attribute + @"class C { public void M([A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@143 -> [[A]int a]@143"); edits.VerifyRudeDiagnostics( capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.ChangingNonCustomAttribute, "int a", "AAttribute", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Insert_NotSupportedByRuntime1() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M(int a) {} }"; var src2 = attribute + @"class C { public void M([A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [int a]@72 -> [[A]int a]@72"); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Insert_NotSupportedByRuntime2() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M([A]int a) {} }"; var src2 = attribute + @"class C { public void M([A, B]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]int a]@120 -> [[A, B]int a]@120"); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Delete_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M([A]int a) {} }"; var src2 = attribute + @"class C { public void M(int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]int a]@72 -> [int a]@72"); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Update_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M([System.Obsolete(""1""), B]int a) {} }"; var src2 = attribute + @"class C { public void M([System.Obsolete(""2""), A]int a) {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\"), B]int a]@120 -> [[System.Obsolete(\"2\"), A]int a]@120"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "int a", FeaturesResources.parameter)); } [Fact] public void Parameter_Attribute_Update() { var attribute = "class A : System.Attribute { public A(int x) {} } "; var src1 = attribute + "class C { void F([A(0)]int a) {} }"; var src2 = attribute + "class C { void F([A(1)]int a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A(0)]int a]@67 -> [[A(1)]int a]@67"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void Parameter_Attribute_Update_WithBodyUpdate() { var attribute = "class A : System.Attribute { public A(int x) {} } "; var src1 = attribute + "class C { void F([A(0)]int a) { F(0); } }"; var src2 = attribute + "class C { void F([A(1)]int a) { F(1); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [void F([A(0)]int a) { F(0); }]@60 -> [void F([A(1)]int a) { F(1); }]@60", "Update [[A(0)]int a]@67 -> [[A(1)]int a]@67"); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("C.F")) }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } #endregion #region Method Type Parameter [Fact] public void MethodTypeParameterInsert1() { var src1 = @"class C { public void M() {} }"; var src2 = @"class C { public void M<A>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [<A>]@23", "Insert [A]@24"); } [Fact] public void MethodTypeParameterInsert2() { var src1 = @"class C { public void M<A>() {} }"; var src2 = @"class C { public void M<A,B>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [<A>]@23 -> [<A,B>]@23", "Insert [B]@26"); } [Fact] public void MethodTypeParameterDelete1() { var src1 = @"class C { public void M<A>() {} }"; var src2 = @"class C { public void M() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [<A>]@23", "Delete [A]@24"); } [Fact] public void MethodTypeParameterDelete2() { var src1 = @"class C { public void M<A,B>() {} }"; var src2 = @"class C { public void M<B>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [<A,B>]@23 -> [<B>]@23", "Delete [A]@24"); } [Fact] public void MethodTypeParameterUpdate() { var src1 = @"class C { public void M<A>() {} }"; var src2 = @"class C { public void M<B>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [A]@24 -> [B]@24"); } [Fact] public void MethodTypeParameterReorder() { var src1 = @"class C { public void M<A,B>() {} }"; var src2 = @"class C { public void M<B,A>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [B]@26 -> @24"); } [Fact] public void MethodTypeParameterReorderAndUpdate() { var src1 = @"class C { public void M<A,B>() {} }"; var src2 = @"class C { public void M<B,C>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [B]@26 -> @24", "Update [A]@24 -> [C]@26"); } [Fact] public void MethodTypeParameter_Attribute_Insert1() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M<T>() {} }"; var src2 = attribute + @"class C { public void M<[A]T>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@72 -> [[A]T]@72"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodUpdate, "T"), Diagnostic(RudeEditKind.GenericMethodTriviaUpdate, "", FeaturesResources.method)); } [Fact] public void MethodTypeParameter_Attribute_Insert2() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M<[A]T>() {} }"; var src2 = attribute + @"class C { public void M<[A, B]T>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]T]@120 -> [[A, B]T]@120"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodUpdate, "T"), Diagnostic(RudeEditKind.GenericMethodTriviaUpdate, "", FeaturesResources.method)); } [Fact] public void MethodTypeParameter_Attribute_Delete() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M<[A]T>() {} }"; var src2 = attribute + @"class C { public void M<T>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]T]@72 -> [T]@72"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodTriviaUpdate, "", FeaturesResources.method), Diagnostic(RudeEditKind.GenericMethodUpdate, "T")); } [Fact] public void MethodTypeParameter_Attribute_Update_NotSupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C { public void M<[System.Obsolete(""1""), B]T>() {} }"; var src2 = attribute + @"class C { public void M<[System.Obsolete(""2""), A]T>() {} } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\"), B]T]@120 -> [[System.Obsolete(\"2\"), A]T]@120"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodUpdate, "T")); } [Fact] public void MethodTypeParameter_Attribute_Update() { var attribute = "class A : System.Attribute { public A(int x) {} } "; var src1 = attribute + "class C { void F<[A(0)]T>(T a) {} }"; var src2 = attribute + "class C { void F<[A(1)]T>(T a) {} }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A(0)]T]@67 -> [[A(1)]T]@67"); edits.VerifyRudeDiagnostics( EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.GenericMethodUpdate, "T")); } [Fact] public void MethodTypeParameter_Attribute_Update_WithBodyUpdate() { var attribute = "class A : System.Attribute { public A(int x) {} } "; var src1 = attribute + "class C { void F<[A(0)]T>(T a) { F(0); } }"; var src2 = attribute + "class C { void F<[A(1)]T>(T a) { F(1); } }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [void F<[A(0)]T>(T a) { F(0); }]@60 -> [void F<[A(1)]T>(T a) { F(1); }]@60", "Update [[A(0)]T]@67 -> [[A(1)]T]@67"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericMethodUpdate, "void F<[A(1)]T>(T a)"), Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericMethodUpdate, "T")); } #endregion #region Type Type Parameter [Fact] public void TypeTypeParameterInsert1() { var src1 = @"class C {}"; var src2 = @"class C<A> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [<A>]@7", "Insert [A]@8"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "A", FeaturesResources.type_parameter)); } [Fact] public void TypeTypeParameterInsert2() { var src1 = @"class C<A> {}"; var src2 = @"class C<A,B> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [<A>]@7 -> [<A,B>]@7", "Insert [B]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "B", FeaturesResources.type_parameter)); } [Fact] public void TypeTypeParameterDelete1() { var src1 = @"class C<A> { }"; var src2 = @"class C { } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [<A>]@7", "Delete [A]@8"); } [Fact] public void TypeTypeParameterDelete2() { var src1 = @"class C<A,B> {}"; var src2 = @"class C<B> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [<A,B>]@7 -> [<B>]@7", "Delete [A]@8"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "class C<B>", DeletedSymbolDisplay(FeaturesResources.type_parameter, "A"))); } [Fact] public void TypeTypeParameterUpdate() { var src1 = @"class C<A> {}"; var src2 = @"class C<B> {} "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [A]@8 -> [B]@8"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Renamed, "B", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "B")); } [Fact] public void TypeTypeParameterReorder() { var src1 = @"class C<A,B> { }"; var src2 = @"class C<B,A> { } "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [B]@10 -> @8"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "B", FeaturesResources.type_parameter)); } [Fact] public void TypeTypeParameterReorderAndUpdate() { var src1 = @"class C<A,B> {}"; var src2 = @"class C<B,C> {} "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [B]@10 -> @8", "Update [A]@8 -> [C]@10"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "B", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.Renamed, "C", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "C")); } [Fact] public void TypeTypeParameterAttributeInsert1() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<T> {}"; var src2 = attribute + @"class C<[A]T> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@56 -> [[A]T]@56"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameterAttributeInsert2() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<[A]T> {}"; var src2 = attribute + @"class C<[A, B]T> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]T]@104 -> [[A, B]T]@104"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameterAttributeInsert_SupportedByRuntime() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<T> {}"; var src2 = attribute + @"class C<[A]T> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [T]@56 -> [[A]T]@56"); edits.VerifyRudeDiagnostics( EditAndContinueTestHelpers.Net6RuntimeCapabilities, Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameterAttributeDelete() { var attribute = "public class AAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<[A]T> {}"; var src2 = attribute + @"class C<T> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[A]T]@56 -> [T]@56"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameterAttributeUpdate() { var attribute = "public class AAttribute : System.Attribute { }\n\n" + "public class BAttribute : System.Attribute { }\n\n"; var src1 = attribute + @"class C<[System.Obsolete(""1""), B]T> {}"; var src2 = attribute + @"class C<[System.Obsolete(""2""), A]T> {} "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [[System.Obsolete(\"1\"), B]T]@104 -> [[System.Obsolete(\"2\"), A]T]@104"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingAttributesNotSupportedByRuntime, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Fact] public void TypeTypeParameter_Partial_Attribute_AddMultiple() { var attributes = @" class A : System.Attribute {} class B : System.Attribute {} "; var srcA1 = "partial class C<T> { }" + attributes; var srcB1 = "partial class C<T> { }"; var srcA2 = "partial class C<[A]T> { }" + attributes; var srcB2 = "partial class C<[B]T> { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), }), DocumentResults(diagnostics: new[] { Diagnostic(RudeEditKind.GenericTypeUpdate, "T"), }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } [Fact] public void TypeTypeParameter_Partial_Attribute_AddMultiple_Reloadable() { var attributes = @" class A : System.Attribute {} class B : System.Attribute {} "; var srcA1 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C<T> { }" + attributes; var srcB1 = "partial class C<T> { }"; var srcA2 = ReloadableAttributeSrc + "[CreateNewOnMetadataUpdate]partial class C<[A]T> { }" + attributes; var srcB2 = "partial class C<[B]T> { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), DocumentResults(semanticEdits: new[] { SemanticEdit(SemanticEditKind.Replace, c => c.GetMember("C"), partialType: "C") }), }, capabilities: EditAndContinueTestHelpers.Net6RuntimeCapabilities); } #endregion #region Type Parameter Constraints [Theory] [InlineData("nonnull")] [InlineData("struct")] [InlineData("class")] [InlineData("new()")] [InlineData("unmanaged")] [InlineData("System.IDisposable")] [InlineData("System.Delegate")] public void TypeConstraint_Insert(string newConstraint) { var src1 = "class C<S,T> { }"; var src2 = "class C<S,T> where T : " + newConstraint + " { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [where T : " + newConstraint + "]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "where T : " + newConstraint, FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : " + newConstraint)); } [Theory] [InlineData("nonnull")] [InlineData("struct")] [InlineData("class")] [InlineData("new()")] [InlineData("unmanaged")] [InlineData("System.IDisposable")] [InlineData("System.Delegate")] public void TypeConstraint_Delete(string oldConstraint) { var src1 = "class C<S,T> where T : " + oldConstraint + " { }"; var src2 = "class C<S,T> { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [where T : " + oldConstraint + "]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "T")); } [Theory] [InlineData("string", "string?")] [InlineData("(int a, int b)", "(int a, int c)")] public void TypeConstraint_Update_RuntimeTypeUnchanged(string oldType, string newType) { // note: dynamic is not allowed in constraints var src1 = "class C<T> where T : System.Collections.Generic.List<" + oldType + "> {}"; var src2 = "class C<T> where T : System.Collections.Generic.List<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : System.Collections.Generic.List<" + newType + ">")); } [Theory] [InlineData("int", "string")] [InlineData("int", "int?")] [InlineData("(int a, int b)", "(int a, double b)")] public void TypeConstraint_Update_RuntimeTypeChanged(string oldType, string newType) { var src1 = "class C<T> where T : System.Collections.Generic.List<" + oldType + "> {}"; var src2 = "class C<T> where T : System.Collections.Generic.List<" + newType + "> {}"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "where T : System.Collections.Generic.List<" + newType + ">", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : System.Collections.Generic.List<" + newType + ">")); } [Fact] public void TypeConstraint_Delete_WithParameter() { var src1 = "class C<S,T> where S : new() where T : class { }"; var src2 = "class C<S> where S : new() { }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, "class C<S>", DeletedSymbolDisplay(FeaturesResources.type_parameter, "T"))); } [Fact] public void TypeConstraint_MultipleClauses_Insert() { var src1 = "class C<S,T> where T : class { }"; var src2 = "class C<S,T> where S : unmanaged where T : class { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Insert [where S : unmanaged]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "where S : unmanaged", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where S : unmanaged")); } [Fact] public void TypeConstraint_MultipleClauses_Delete() { var src1 = "class C<S,T> where S : new() where T : class { }"; var src2 = "class C<S,T> where T : class { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Delete [where S : new()]@13"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangingConstraints, "S", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "S")); } [Fact] public void TypeConstraint_MultipleClauses_Reorder() { var src1 = "class C<S,T> where S : struct where T : class { }"; var src2 = "class C<S,T> where T : class where S : struct { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [where T : class]@30 -> @13"); edits.VerifyRudeDiagnostics(); } [Fact] public void TypeConstraint_MultipleClauses_UpdateAndReorder() { var src1 = "class C<S,T> where S : new() where T : class { }"; var src2 = "class C<T,S> where T : class, I where S : class, new() { }"; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Reorder [where T : class]@29 -> @13", "Reorder [T]@10 -> @8", "Update [where T : class]@29 -> [where T : class, I]@13", "Update [where S : new()]@13 -> [where S : class, new()]@32"); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Move, "T", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.ChangingConstraints, "where T : class, I", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where T : class, I"), Diagnostic(RudeEditKind.ChangingConstraints, "where S : class, new()", FeaturesResources.type_parameter), Diagnostic(RudeEditKind.GenericTypeUpdate, "where S : class, new()")); } #endregion #region Top Level Statements [Fact] public void TopLevelStatements_Update() { var src1 = @" using System; Console.WriteLine(""Hello""); "; var src2 = @" using System; Console.WriteLine(""Hello World""); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Update [Console.WriteLine(\"Hello\");]@19 -> [Console.WriteLine(\"Hello World\");]@19"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_InsertAndUpdate() { var src1 = @" using System; Console.WriteLine(""Hello""); "; var src2 = @" using System; Console.WriteLine(""Hello World""); Console.WriteLine(""What is your name?""); var name = Console.ReadLine(); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits( "Update [Console.WriteLine(\"Hello\");]@19 -> [Console.WriteLine(\"Hello World\");]@19", "Insert [Console.WriteLine(\"What is your name?\");]@54", "Insert [var name = Console.ReadLine();]@96"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_Insert_NoImplicitMain() { var src1 = @" using System; "; var src2 = @" using System; Console.WriteLine(""Hello World""); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [Console.WriteLine(\"Hello World\");]@19"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Insert, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_Insert_ImplicitMain() { var src1 = @" using System; Console.WriteLine(""Hello""); "; var src2 = @" using System; Console.WriteLine(""Hello""); Console.WriteLine(""World""); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Insert [Console.WriteLine(\"World\");]@48"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_Delete_NoImplicitMain() { var src1 = @" using System; Console.WriteLine(""Hello World""); "; var src2 = @" using System; "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [Console.WriteLine(\"Hello World\");]@19"); edits.VerifyRudeDiagnostics(Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.global_statement)); } [Fact] public void TopLevelStatements_Delete_ImplicitMain() { var src1 = @" using System; Console.WriteLine(""Hello""); Console.WriteLine(""World""); "; var src2 = @" using System; Console.WriteLine(""Hello""); "; var edits = GetTopEdits(src1, src2); edits.VerifyEdits("Delete [Console.WriteLine(\"World\");]@48"); edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_StackAlloc() { var src1 = @"unsafe { var x = stackalloc int[3]; System.Console.Write(1); }"; var src2 = @"unsafe { var x = stackalloc int[3]; System.Console.Write(2); }"; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.StackAllocUpdate, "stackalloc", CSharpFeaturesResources.global_statement)); } [Fact] public void TopLevelStatements_VoidToInt1() { var src1 = @" using System; Console.Write(1); "; var src2 = @" using System; Console.Write(1); return 1; "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return 1;")); } [Fact] public void TopLevelStatements_VoidToInt2() { var src1 = @" using System; Console.Write(1); return; "; var src2 = @" using System; Console.Write(1); return 1; "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return 1;")); } [Fact] public void TopLevelStatements_VoidToInt3() { var src1 = @" using System; Console.Write(1); int Goo() { return 1; } "; var src2 = @" using System; Console.Write(1); return 1; int Goo() { return 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return 1;")); } [Fact] public void TopLevelStatements_AddAwait() { var src1 = @" using System.Threading.Tasks; await Task.Delay(100); "; var src2 = @" using System.Threading.Tasks; await Task.Delay(100); await Task.Delay(200); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Insert, "await", CSharpFeaturesResources.await_expression)); } [Fact] public void TopLevelStatements_DeleteAwait() { var src1 = @" using System.Threading.Tasks; await Task.Delay(100); await Task.Delay(200); "; var src2 = @" using System.Threading.Tasks; await Task.Delay(100); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.await_expression)); } [Fact] public void TopLevelStatements_VoidToTask() { var src1 = @" using System; using System.Threading.Tasks; Console.Write(1); "; var src2 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "await Task.Delay(100);")); } [Fact] public void TopLevelStatements_TaskToTaskInt() { var src1 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); "; var src2 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); return 1; "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return 1;")); } [Fact] public void TopLevelStatements_VoidToTaskInt() { var src1 = @" using System; using System.Threading.Tasks; Console.Write(1); "; var src2 = @" using System; using System.Threading.Tasks; Console.Write(1); return await GetInt(); Task<int> GetInt() { return Task.FromResult(1); } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return await GetInt();")); } [Fact] public void TopLevelStatements_IntToVoid1() { var src1 = @" using System; Console.Write(1); return 1; "; var src2 = @" using System; Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);")); } [Fact] public void TopLevelStatements_IntToVoid2() { var src1 = @" using System; Console.Write(1); return 1; "; var src2 = @" using System; Console.Write(1); return; "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "return;")); } [Fact] public void TopLevelStatements_IntToVoid3() { var src1 = @" using System; Console.Write(1); return 1; int Goo() { return 1; } "; var src2 = @" using System; Console.Write(1); int Goo() { return 1; } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "int Goo()\r\n{\r\n return 1;\r\n}")); } [Fact] public void TopLevelStatements_IntToVoid4() { var src1 = @" using System; Console.Write(1); return 1; public class C { public int Goo() { return 1; } } "; var src2 = @" using System; Console.Write(1); public class C { public int Goo() { return 1; } } "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);")); } [Fact] public void TopLevelStatements_TaskToVoid() { var src1 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); "; var src2 = @" using System; using System.Threading.Tasks; Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);"), Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.await_expression)); } [Fact] public void TopLevelStatements_TaskIntToTask() { var src1 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); return 1; "; var src2 = @" using System; using System.Threading.Tasks; await Task.Delay(100); Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);")); } [Fact] public void TopLevelStatements_TaskIntToVoid() { var src1 = @" using System; using System.Threading.Tasks; Console.Write(1); return await GetInt(); Task<int> GetInt() { return Task.FromResult(1); } "; var src2 = @" using System; using System.Threading.Tasks; Console.Write(1); "; var edits = GetTopEdits(src1, src2); edits.VerifyRudeDiagnostics( Diagnostic(RudeEditKind.ChangeImplicitMainReturnType, "Console.Write(1);"), Diagnostic(RudeEditKind.Delete, null, CSharpFeaturesResources.await_expression)); } [Fact] public void TopLevelStatements_WithLambda_Insert() { var src1 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; "; var src2 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(1); "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"), syntaxMap[0]) }); } [Fact] public void TopLevelStatements_WithLambda_Update() { var src1 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(1); public class C { } "; var src2 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(2); public class C { } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"), syntaxMap[0]) }); } [Fact] public void TopLevelStatements_WithLambda_Delete() { var src1 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; Console.WriteLine(1); public class C { } "; var src2 = @" using System; Func<int> a = () => { <N:0.0>return 1;</N:0.0> }; Func<Func<int>> b = () => () => { <N:0.1>return 1;</N:0.1> }; public class C { } "; var edits = GetTopEdits(src1, src2); var syntaxMap = GetSyntaxMap(src1, src2); edits.VerifySemantics( ActiveStatementsDescription.Empty, new[] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"), syntaxMap[0]) }); } [Fact] public void TopLevelStatements_UpdateMultiple() { var src1 = @" using System; Console.WriteLine(1); Console.WriteLine(2); public class C { } "; var src2 = @" using System; Console.WriteLine(3); Console.WriteLine(4); public class C { } "; var edits = GetTopEdits(src1, src2); // Since each individual statement is a separate update to a separate node, this just validates we correctly // only analyze the things once edits.VerifySemantics(SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$"))); } [Fact] public void TopLevelStatements_MoveToOtherFile() { var srcA1 = @" using System; Console.WriteLine(1); public class A { }"; var srcB1 = @" using System; public class B { }"; var srcA2 = @" using System; public class A { }"; var srcB2 = @" using System; Console.WriteLine(2); public class B { }"; EditAndContinueValidation.VerifySemantics( new[] { GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2) }, new[] { DocumentResults(), DocumentResults(semanticEdits: new [] { SemanticEdit(SemanticEditKind.Update, c => c.GetMember("Program.<Main>$")) }), }); } #endregion } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/Core/CodeAnalysisTest/Collections/List/SegmentedList.Generic.Tests.AddRange.cs
// 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. // NOTE: This code is derived from an implementation originally in dotnet/runtime: // https://github.com/dotnet/runtime/blob/v5.0.2/src/libraries/System.Collections/tests/Generic/List/List.Generic.Tests.AddRange.cs // // See the commentary in https://github.com/dotnet/roslyn/pull/50156 for notes on incorporating changes made to the // reference implementation. using System; using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis.Collections; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Collections { /// <summary> /// Contains tests that ensure the correctness of the List class. /// </summary> public abstract partial class SegmentedList_Generic_Tests<T> : IList_Generic_Tests<T> { // Has tests that pass a variably sized TestCollection and MyEnumerable to the AddRange function [Theory] [MemberData(nameof(EnumerableTestData))] public void AddRange(EnumerableType enumerableType, int listLength, int enumerableLength, int numberOfMatchingElements, int numberOfDuplicateElements) { SegmentedList<T> list = GenericListFactory(listLength); SegmentedList<T> listBeforeAdd = list.ToSegmentedList(); IEnumerable<T> enumerable = CreateEnumerable(enumerableType, list, enumerableLength, numberOfMatchingElements, numberOfDuplicateElements); list.AddRange(enumerable); // Check that the first section of the List is unchanged Assert.All(Enumerable.Range(0, listLength), index => { Assert.Equal(listBeforeAdd[index], list[index]); }); // Check that the added elements are correct Assert.All(Enumerable.Range(0, enumerableLength), index => { Assert.Equal(enumerable.ElementAt(index), list[index + listLength]); }); } [Theory] [MemberData(nameof(ValidCollectionSizes))] public void AddRange_NullEnumerable_ThrowsArgumentNullException(int count) { SegmentedList<T> list = GenericListFactory(count); SegmentedList<T> listBeforeAdd = list.ToSegmentedList(); Assert.Throws<ArgumentNullException>(() => list.AddRange(null!)); Assert.Equal(listBeforeAdd, list); } [Fact] public void AddRange_AddSelfAsEnumerable_ThrowsExceptionWhenNotEmpty() { SegmentedList<T?> list = GenericListFactory(0)!; // Succeeds when list is empty. list.AddRange(list); list.AddRange(list.Where(_ => true)); // Succeeds when list has elements and is added as collection. list.Add(default); Assert.Equal(1, list.Count); list.AddRange(list); Assert.Equal(2, list.Count); list.AddRange(list); Assert.Equal(4, list.Count); // Fails version check when list has elements and is added as non-collection. Assert.Throws<InvalidOperationException>(() => list.AddRange(list.Where(_ => true))); Assert.Equal(5, list.Count); Assert.Throws<InvalidOperationException>(() => list.AddRange(list.Where(_ => true))); Assert.Equal(6, list.Count); } } }
// 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. // NOTE: This code is derived from an implementation originally in dotnet/runtime: // https://github.com/dotnet/runtime/blob/v5.0.2/src/libraries/System.Collections/tests/Generic/List/List.Generic.Tests.AddRange.cs // // See the commentary in https://github.com/dotnet/roslyn/pull/50156 for notes on incorporating changes made to the // reference implementation. using System; using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis.Collections; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests.Collections { /// <summary> /// Contains tests that ensure the correctness of the List class. /// </summary> public abstract partial class SegmentedList_Generic_Tests<T> : IList_Generic_Tests<T> { // Has tests that pass a variably sized TestCollection and MyEnumerable to the AddRange function [Theory] [MemberData(nameof(EnumerableTestData))] public void AddRange(EnumerableType enumerableType, int listLength, int enumerableLength, int numberOfMatchingElements, int numberOfDuplicateElements) { SegmentedList<T> list = GenericListFactory(listLength); SegmentedList<T> listBeforeAdd = list.ToSegmentedList(); IEnumerable<T> enumerable = CreateEnumerable(enumerableType, list, enumerableLength, numberOfMatchingElements, numberOfDuplicateElements); list.AddRange(enumerable); // Check that the first section of the List is unchanged Assert.All(Enumerable.Range(0, listLength), index => { Assert.Equal(listBeforeAdd[index], list[index]); }); // Check that the added elements are correct Assert.All(Enumerable.Range(0, enumerableLength), index => { Assert.Equal(enumerable.ElementAt(index), list[index + listLength]); }); } [Theory] [MemberData(nameof(ValidCollectionSizes))] public void AddRange_NullEnumerable_ThrowsArgumentNullException(int count) { SegmentedList<T> list = GenericListFactory(count); SegmentedList<T> listBeforeAdd = list.ToSegmentedList(); Assert.Throws<ArgumentNullException>(() => list.AddRange(null!)); Assert.Equal(listBeforeAdd, list); } [Fact] public void AddRange_AddSelfAsEnumerable_ThrowsExceptionWhenNotEmpty() { SegmentedList<T?> list = GenericListFactory(0)!; // Succeeds when list is empty. list.AddRange(list); list.AddRange(list.Where(_ => true)); // Succeeds when list has elements and is added as collection. list.Add(default); Assert.Equal(1, list.Count); list.AddRange(list); Assert.Equal(2, list.Count); list.AddRange(list); Assert.Equal(4, list.Count); // Fails version check when list has elements and is added as non-collection. Assert.Throws<InvalidOperationException>(() => list.AddRange(list.Where(_ => true))); Assert.Equal(5, list.Count); Assert.Throws<InvalidOperationException>(() => list.AddRange(list.Where(_ => true))); Assert.Equal(6, list.Count); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/VisualBasic/Impl/Snippets/SnippetFunctions/SnippetFunctionClassName.vb
' 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. Imports System.Threading Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Shared.Extensions Imports Microsoft.CodeAnalysis.VisualBasic.Extensions Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.VisualStudio.Text Imports Microsoft.VisualStudio.LanguageServices.Implementation.Snippets Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFunctions Friend NotInheritable Class SnippetFunctionClassName Inherits AbstractSnippetFunctionClassName Public Sub New(snippetExpansionClient As SnippetExpansionClient, subjectBuffer As ITextBuffer, fieldName As String) MyBase.New(snippetExpansionClient, subjectBuffer, fieldName) End Sub Protected Overrides Function GetContainingClassName(document As Document, subjectBufferFieldSpan As SnapshotSpan, cancellationToken As CancellationToken, ByRef value As String, ByRef hasDefaultValue As Integer) As Integer Dim syntaxTree = document.GetSyntaxTreeSynchronously(cancellationToken) Dim typeBlock = syntaxTree.FindTokenOnLeftOfPosition(subjectBufferFieldSpan.Start.Position, cancellationToken).GetAncestor(Of TypeBlockSyntax) If typeBlock IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(typeBlock.GetNameToken().ValueText) Then value = typeBlock.GetNameToken().ValueText hasDefaultValue = 1 End If Return VSConstants.S_OK End Function End Class End Namespace
' 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. Imports System.Threading Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Shared.Extensions Imports Microsoft.CodeAnalysis.VisualBasic.Extensions Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.VisualStudio.Text Imports Microsoft.VisualStudio.LanguageServices.Implementation.Snippets Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Snippets.SnippetFunctions Friend NotInheritable Class SnippetFunctionClassName Inherits AbstractSnippetFunctionClassName Public Sub New(snippetExpansionClient As SnippetExpansionClient, subjectBuffer As ITextBuffer, fieldName As String) MyBase.New(snippetExpansionClient, subjectBuffer, fieldName) End Sub Protected Overrides Function GetContainingClassName(document As Document, subjectBufferFieldSpan As SnapshotSpan, cancellationToken As CancellationToken, ByRef value As String, ByRef hasDefaultValue As Integer) As Integer Dim syntaxTree = document.GetSyntaxTreeSynchronously(cancellationToken) Dim typeBlock = syntaxTree.FindTokenOnLeftOfPosition(subjectBufferFieldSpan.Start.Position, cancellationToken).GetAncestor(Of TypeBlockSyntax) If typeBlock IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(typeBlock.GetNameToken().ValueText) Then value = typeBlock.GetNameToken().ValueText hasDefaultValue = 1 End If Return VSConstants.S_OK End Function End Class End Namespace
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/Core/Portable/Diagnostics/SkippedHostAnalyzersInfo.cs
// 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 System.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis.PooledObjects; #if !NETCOREAPP using Roslyn.Utilities; #endif namespace Microsoft.CodeAnalysis.Diagnostics { /// <summary> /// Information about analyzers supplied by the host (IDE), which can be completely skipped or its diagnostics partially filtered for the corresponding project /// as project analyzer reference (from NuGet) has equivalent analyzer(s) reporting all or subset of diagnostic IDs reported by these analyzers. /// </summary> internal readonly struct SkippedHostAnalyzersInfo { public static readonly SkippedHostAnalyzersInfo Empty = new( ImmutableHashSet<DiagnosticAnalyzer>.Empty, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<string>>.Empty); /// <summary> /// Analyzers supplied by the host (IDE), which can be completely skipped for the corresponding project /// as project analyzer reference has equivalent analyzer(s) reporting all diagnostic IDs reported by these analyzers. /// </summary> public ImmutableHashSet<DiagnosticAnalyzer> SkippedAnalyzers { get; } /// <summary> /// Analyzer to diagnostic ID map, such that the diagnostics of those IDs reported by the analyzer should be filtered /// for a correspndiong project. /// This includes the analyzers supplied by the host (IDE), such that project's analyzer references (from NuGet) /// has equivalent analyzer(s) reporting subset of diagnostic IDs reported by these analyzers. /// </summary> public ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<string>> FilteredDiagnosticIdsForAnalyzers { get; } private SkippedHostAnalyzersInfo( ImmutableHashSet<DiagnosticAnalyzer> skippedHostAnalyzers, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<string>> filteredDiagnosticIdsForAnalyzers) { SkippedAnalyzers = skippedHostAnalyzers; FilteredDiagnosticIdsForAnalyzers = filteredDiagnosticIdsForAnalyzers; } public static SkippedHostAnalyzersInfo Create( HostDiagnosticAnalyzers hostAnalyzers, IReadOnlyList<AnalyzerReference> projectAnalyzerReferences, string language, DiagnosticAnalyzerInfoCache analyzerInfoCache) { using var _1 = PooledHashSet<object>.GetInstance(out var projectAnalyzerIds); using var _2 = PooledHashSet<string>.GetInstance(out var projectAnalyzerDiagnosticIds); using var _3 = PooledHashSet<string>.GetInstance(out var projectSuppressedDiagnosticIds); foreach (var (analyzerId, analyzers) in hostAnalyzers.CreateProjectDiagnosticAnalyzersPerReference(projectAnalyzerReferences, language)) { projectAnalyzerIds.Add(analyzerId); foreach (var analyzer in analyzers) { foreach (var descriptor in analyzerInfoCache.GetDiagnosticDescriptors(analyzer)) { projectAnalyzerDiagnosticIds.Add(descriptor.Id); } if (analyzer is DiagnosticSuppressor suppressor) { foreach (var descriptor in suppressor.SupportedSuppressions) { projectSuppressedDiagnosticIds.Add(descriptor.SuppressedDiagnosticId); } } } } if (projectAnalyzerIds.Count == 0) { return Empty; } var fullySkippedHostAnalyzersBuilder = ImmutableHashSet.CreateBuilder<DiagnosticAnalyzer>(); var partiallySkippedHostAnalyzersBuilder = ImmutableDictionary.CreateBuilder<DiagnosticAnalyzer, ImmutableArray<string>>(); foreach (var (hostAnalyzerId, analyzers) in hostAnalyzers.GetOrCreateHostDiagnosticAnalyzersPerReference(language)) { foreach (var hostAnalyzer in analyzers) { if (projectAnalyzerIds.Contains(hostAnalyzerId)) { // Duplicate project and host analyzer. // Do not mark this as a skipped host analyzer as that will also cause the project analyzer to be skipped. // We already perform the required host analyzer reference de-duping in the executor. continue; } if (!ShouldIncludeHostAnalyzer(hostAnalyzer, projectAnalyzerDiagnosticIds, projectSuppressedDiagnosticIds, analyzerInfoCache, out var skippedIdsForAnalyzer)) { fullySkippedHostAnalyzersBuilder.Add(hostAnalyzer); } else if (skippedIdsForAnalyzer.Length > 0) { partiallySkippedHostAnalyzersBuilder.Add(hostAnalyzer, skippedIdsForAnalyzer); } } } var fullySkippedHostAnalyzers = fullySkippedHostAnalyzersBuilder.ToImmutable(); var filteredDiagnosticIdsForAnalyzers = partiallySkippedHostAnalyzersBuilder.ToImmutable(); if (fullySkippedHostAnalyzers.IsEmpty && filteredDiagnosticIdsForAnalyzers.IsEmpty) { return Empty; } return new SkippedHostAnalyzersInfo(fullySkippedHostAnalyzers, filteredDiagnosticIdsForAnalyzers); static bool ShouldIncludeHostAnalyzer( DiagnosticAnalyzer hostAnalyzer, HashSet<string> projectAnalyzerDiagnosticIds, HashSet<string> projectSuppressedDiagnosticIds, DiagnosticAnalyzerInfoCache analyzerInfoCache, out ImmutableArray<string> skippedDiagnosticIdsForAnalyzer) { // Include only those host (VSIX) analyzers that report at least one unique diagnostic ID // which is not reported by any project (NuGet) analyzer. // See https://github.com/dotnet/roslyn/issues/18818. var shouldInclude = false; var descriptors = analyzerInfoCache.GetDiagnosticDescriptors(hostAnalyzer); var skippedDiagnosticIdsBuilder = ArrayBuilder<string>.GetInstance(); foreach (var descriptor in descriptors) { if (projectAnalyzerDiagnosticIds.Contains(descriptor.Id)) { skippedDiagnosticIdsBuilder.Add(descriptor.Id); } else { shouldInclude = true; } } if (hostAnalyzer is DiagnosticSuppressor suppressor) { skippedDiagnosticIdsForAnalyzer = ImmutableArray<string>.Empty; // Only execute host suppressor if it does not suppress any diagnostic ID reported by project analyzer // and does not share any suppression ID with a project suppressor. foreach (var descriptor in suppressor.SupportedSuppressions) { if (projectAnalyzerDiagnosticIds.Contains(descriptor.SuppressedDiagnosticId) || projectSuppressedDiagnosticIds.Contains(descriptor.SuppressedDiagnosticId)) { return false; } } return true; } skippedDiagnosticIdsForAnalyzer = skippedDiagnosticIdsBuilder.ToImmutableAndFree(); return shouldInclude; } } } }
// 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 System.Collections.Generic; using System.Collections.Immutable; using Microsoft.CodeAnalysis.PooledObjects; #if !NETCOREAPP using Roslyn.Utilities; #endif namespace Microsoft.CodeAnalysis.Diagnostics { /// <summary> /// Information about analyzers supplied by the host (IDE), which can be completely skipped or its diagnostics partially filtered for the corresponding project /// as project analyzer reference (from NuGet) has equivalent analyzer(s) reporting all or subset of diagnostic IDs reported by these analyzers. /// </summary> internal readonly struct SkippedHostAnalyzersInfo { public static readonly SkippedHostAnalyzersInfo Empty = new( ImmutableHashSet<DiagnosticAnalyzer>.Empty, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<string>>.Empty); /// <summary> /// Analyzers supplied by the host (IDE), which can be completely skipped for the corresponding project /// as project analyzer reference has equivalent analyzer(s) reporting all diagnostic IDs reported by these analyzers. /// </summary> public ImmutableHashSet<DiagnosticAnalyzer> SkippedAnalyzers { get; } /// <summary> /// Analyzer to diagnostic ID map, such that the diagnostics of those IDs reported by the analyzer should be filtered /// for a correspndiong project. /// This includes the analyzers supplied by the host (IDE), such that project's analyzer references (from NuGet) /// has equivalent analyzer(s) reporting subset of diagnostic IDs reported by these analyzers. /// </summary> public ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<string>> FilteredDiagnosticIdsForAnalyzers { get; } private SkippedHostAnalyzersInfo( ImmutableHashSet<DiagnosticAnalyzer> skippedHostAnalyzers, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<string>> filteredDiagnosticIdsForAnalyzers) { SkippedAnalyzers = skippedHostAnalyzers; FilteredDiagnosticIdsForAnalyzers = filteredDiagnosticIdsForAnalyzers; } public static SkippedHostAnalyzersInfo Create( HostDiagnosticAnalyzers hostAnalyzers, IReadOnlyList<AnalyzerReference> projectAnalyzerReferences, string language, DiagnosticAnalyzerInfoCache analyzerInfoCache) { using var _1 = PooledHashSet<object>.GetInstance(out var projectAnalyzerIds); using var _2 = PooledHashSet<string>.GetInstance(out var projectAnalyzerDiagnosticIds); using var _3 = PooledHashSet<string>.GetInstance(out var projectSuppressedDiagnosticIds); foreach (var (analyzerId, analyzers) in hostAnalyzers.CreateProjectDiagnosticAnalyzersPerReference(projectAnalyzerReferences, language)) { projectAnalyzerIds.Add(analyzerId); foreach (var analyzer in analyzers) { foreach (var descriptor in analyzerInfoCache.GetDiagnosticDescriptors(analyzer)) { projectAnalyzerDiagnosticIds.Add(descriptor.Id); } if (analyzer is DiagnosticSuppressor suppressor) { foreach (var descriptor in suppressor.SupportedSuppressions) { projectSuppressedDiagnosticIds.Add(descriptor.SuppressedDiagnosticId); } } } } if (projectAnalyzerIds.Count == 0) { return Empty; } var fullySkippedHostAnalyzersBuilder = ImmutableHashSet.CreateBuilder<DiagnosticAnalyzer>(); var partiallySkippedHostAnalyzersBuilder = ImmutableDictionary.CreateBuilder<DiagnosticAnalyzer, ImmutableArray<string>>(); foreach (var (hostAnalyzerId, analyzers) in hostAnalyzers.GetOrCreateHostDiagnosticAnalyzersPerReference(language)) { foreach (var hostAnalyzer in analyzers) { if (projectAnalyzerIds.Contains(hostAnalyzerId)) { // Duplicate project and host analyzer. // Do not mark this as a skipped host analyzer as that will also cause the project analyzer to be skipped. // We already perform the required host analyzer reference de-duping in the executor. continue; } if (!ShouldIncludeHostAnalyzer(hostAnalyzer, projectAnalyzerDiagnosticIds, projectSuppressedDiagnosticIds, analyzerInfoCache, out var skippedIdsForAnalyzer)) { fullySkippedHostAnalyzersBuilder.Add(hostAnalyzer); } else if (skippedIdsForAnalyzer.Length > 0) { partiallySkippedHostAnalyzersBuilder.Add(hostAnalyzer, skippedIdsForAnalyzer); } } } var fullySkippedHostAnalyzers = fullySkippedHostAnalyzersBuilder.ToImmutable(); var filteredDiagnosticIdsForAnalyzers = partiallySkippedHostAnalyzersBuilder.ToImmutable(); if (fullySkippedHostAnalyzers.IsEmpty && filteredDiagnosticIdsForAnalyzers.IsEmpty) { return Empty; } return new SkippedHostAnalyzersInfo(fullySkippedHostAnalyzers, filteredDiagnosticIdsForAnalyzers); static bool ShouldIncludeHostAnalyzer( DiagnosticAnalyzer hostAnalyzer, HashSet<string> projectAnalyzerDiagnosticIds, HashSet<string> projectSuppressedDiagnosticIds, DiagnosticAnalyzerInfoCache analyzerInfoCache, out ImmutableArray<string> skippedDiagnosticIdsForAnalyzer) { // Include only those host (VSIX) analyzers that report at least one unique diagnostic ID // which is not reported by any project (NuGet) analyzer. // See https://github.com/dotnet/roslyn/issues/18818. var shouldInclude = false; var descriptors = analyzerInfoCache.GetDiagnosticDescriptors(hostAnalyzer); var skippedDiagnosticIdsBuilder = ArrayBuilder<string>.GetInstance(); foreach (var descriptor in descriptors) { if (projectAnalyzerDiagnosticIds.Contains(descriptor.Id)) { skippedDiagnosticIdsBuilder.Add(descriptor.Id); } else { shouldInclude = true; } } if (hostAnalyzer is DiagnosticSuppressor suppressor) { skippedDiagnosticIdsForAnalyzer = ImmutableArray<string>.Empty; // Only execute host suppressor if it does not suppress any diagnostic ID reported by project analyzer // and does not share any suppression ID with a project suppressor. foreach (var descriptor in suppressor.SupportedSuppressions) { if (projectAnalyzerDiagnosticIds.Contains(descriptor.SuppressedDiagnosticId) || projectSuppressedDiagnosticIds.Contains(descriptor.SuppressedDiagnosticId)) { return false; } } return true; } skippedDiagnosticIdsForAnalyzer = skippedDiagnosticIdsBuilder.ToImmutableAndFree(); return shouldInclude; } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./.git/config
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = https://github.com/dotnet/roslyn.git fetch = +refs/heads/*:refs/remotes/origin/* gh-resolved = base [branch "main"] remote = origin merge = refs/heads/main
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = https://github.com/dotnet/roslyn.git fetch = +refs/heads/*:refs/remotes/origin/* gh-resolved = base [branch "main"] remote = origin merge = refs/heads/main
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/CSharp/Portable/Completion/KeywordRecommenders/OperatorKeywordRecommender.cs
// 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. #nullable disable using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class OperatorKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public OperatorKeywordRecommender() : base(SyntaxKind.OperatorKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { // cases: // public static implicit | // public static explicit | var token = context.TargetToken; return token.Kind() == SyntaxKind.ImplicitKeyword || token.Kind() == SyntaxKind.ExplicitKeyword; } } }
// 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. #nullable disable using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class OperatorKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public OperatorKeywordRecommender() : base(SyntaxKind.OperatorKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { // cases: // public static implicit | // public static explicit | var token = context.TargetToken; return token.Kind() == SyntaxKind.ImplicitKeyword || token.Kind() == SyntaxKind.ExplicitKeyword; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./eng/common/init-tools-native.cmd
@echo off powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -command "& """%~dp0init-tools-native.ps1""" %*" exit /b %ErrorLevel%
@echo off powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -command "& """%~dp0init-tools-native.ps1""" %*" exit /b %ErrorLevel%
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/IntegrationTest/TestUtilities/InProcess/AddParameterDialog_InProc.cs
// 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 System.Threading; using Microsoft.VisualStudio.LanguageServices.Implementation.ChangeSignature; using Microsoft.VisualStudio.Threading; namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess { internal class AddParameterDialog_InProc : AbstractCodeRefactorDialog_InProc<AddParameterDialog, AddParameterDialog.TestAccessor> { private AddParameterDialog_InProc() { } public static AddParameterDialog_InProc Create() => new AddParameterDialog_InProc(); public void FillCallSiteField(string callSiteValue) { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(async () => { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationTokenSource.Token); var dialog = await GetDialogAsync(cancellationTokenSource.Token); dialog.CallsiteValueTextBox.Focus(); dialog.CallsiteValueTextBox.Text = callSiteValue; }); } } public void FillNameField(string parameterName) { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(async () => { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationTokenSource.Token); var dialog = await GetDialogAsync(cancellationTokenSource.Token); dialog.NameContentControl.Focus(); dialog.NameContentControl.Text = parameterName; }); } } public void SetCallSiteTodo() { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(async () => { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationTokenSource.Token); var dialog = await GetDialogAsync(cancellationTokenSource.Token); dialog.IntroduceErrorRadioButton.Focus(); dialog.IntroduceErrorRadioButton.IsChecked = true; }); } } public void FillTypeField(string typeName) { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(async () => { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationTokenSource.Token); var dialog = await GetDialogAsync(cancellationTokenSource.Token); dialog.TypeContentControl.Focus(); dialog.TypeContentControl.Text = typeName; }); } } public void ClickOK() { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(() => ClickAsync(testAccessor => testAccessor.OKButton, cancellationTokenSource.Token)); } } public void ClickCancel() { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(() => ClickAsync(testAccessor => testAccessor.CancelButton, cancellationTokenSource.Token)); } } public bool CloseWindow() { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { if (JoinableTaskFactory.Run(() => TryGetDialogAsync(cancellationTokenSource.Token)) is null) { return false; } } ClickCancel(); return true; } protected override AddParameterDialog.TestAccessor GetAccessor(AddParameterDialog dialog) => dialog.GetTestAccessor(); } }
// 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 System.Threading; using Microsoft.VisualStudio.LanguageServices.Implementation.ChangeSignature; using Microsoft.VisualStudio.Threading; namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess { internal class AddParameterDialog_InProc : AbstractCodeRefactorDialog_InProc<AddParameterDialog, AddParameterDialog.TestAccessor> { private AddParameterDialog_InProc() { } public static AddParameterDialog_InProc Create() => new AddParameterDialog_InProc(); public void FillCallSiteField(string callSiteValue) { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(async () => { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationTokenSource.Token); var dialog = await GetDialogAsync(cancellationTokenSource.Token); dialog.CallsiteValueTextBox.Focus(); dialog.CallsiteValueTextBox.Text = callSiteValue; }); } } public void FillNameField(string parameterName) { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(async () => { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationTokenSource.Token); var dialog = await GetDialogAsync(cancellationTokenSource.Token); dialog.NameContentControl.Focus(); dialog.NameContentControl.Text = parameterName; }); } } public void SetCallSiteTodo() { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(async () => { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationTokenSource.Token); var dialog = await GetDialogAsync(cancellationTokenSource.Token); dialog.IntroduceErrorRadioButton.Focus(); dialog.IntroduceErrorRadioButton.IsChecked = true; }); } } public void FillTypeField(string typeName) { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(async () => { await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationTokenSource.Token); var dialog = await GetDialogAsync(cancellationTokenSource.Token); dialog.TypeContentControl.Focus(); dialog.TypeContentControl.Text = typeName; }); } } public void ClickOK() { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(() => ClickAsync(testAccessor => testAccessor.OKButton, cancellationTokenSource.Token)); } } public void ClickCancel() { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { JoinableTaskFactory.Run(() => ClickAsync(testAccessor => testAccessor.CancelButton, cancellationTokenSource.Token)); } } public bool CloseWindow() { using (var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout)) { if (JoinableTaskFactory.Run(() => TryGetDialogAsync(cancellationTokenSource.Token)) is null) { return false; } } ClickCancel(); return true; } protected override AddParameterDialog.TestAccessor GetAccessor(AddParameterDialog dialog) => dialog.GetTestAccessor(); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/CSharp/Portable/Debugging/DataTipInfoGetter.cs
// 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. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Debugging; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.CSharp.Debugging { internal static class DataTipInfoGetter { internal static async Task<DebugDataTipInfo> GetInfoAsync(Document document, int position, CancellationToken cancellationToken) { try { var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); if (root == null) { return default; } var token = root.FindToken(position); if (!(token.Parent is ExpressionSyntax expression)) { return token.IsKind(SyntaxKind.IdentifierToken) ? new DebugDataTipInfo(token.Span, text: null) : default; } if (expression.IsAnyLiteralExpression()) { // If the user hovers over a literal, give them a DataTip for the type of the // literal they're hovering over. // Partial semantics should always be sufficient because the (unconverted) type // of a literal can always easily be determined. var (_, semanticModel) = await document.GetPartialSemanticModelAsync(cancellationToken).ConfigureAwait(false); var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; return type == null ? default : new DebugDataTipInfo(expression.Span, type.ToNameDisplayString()); } if (expression.IsRightSideOfDotOrArrow()) { var curr = expression.GetRootConditionalAccessExpression() ?? expression; if (curr == expression) { // NB: Parent.Span, not Span as below. return new DebugDataTipInfo(expression.Parent.Span, text: null); } // NOTE: There may not be an ExpressionSyntax corresponding to the range we want. // For example, for input a?.$$B?.C, we want span [|a?.B|]?.C. return new DebugDataTipInfo(TextSpan.FromBounds(curr.SpanStart, expression.Span.End), text: null); } // NOTE(cyrusn): This behavior is to mimic what we did in Dev10, I'm not sure if it's // necessary or not. if (expression.IsKind(SyntaxKind.InvocationExpression, out InvocationExpressionSyntax invocation)) { expression = invocation.Expression; } string textOpt = null; if (expression is TypeSyntax typeSyntax && typeSyntax.IsVar) { // If the user is hovering over 'var', then pass back the full type name that 'var' // binds to. var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var type = semanticModel.GetTypeInfo(typeSyntax, cancellationToken).Type; if (type != null) { textOpt = type.ToNameDisplayString(); } } return new DebugDataTipInfo(expression.Span, textOpt); } catch (Exception e) when (FatalError.ReportAndCatchUnlessCanceled(e, cancellationToken)) { return default; } } } }
// 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. #nullable disable using System; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Debugging; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.CSharp.Debugging { internal static class DataTipInfoGetter { internal static async Task<DebugDataTipInfo> GetInfoAsync(Document document, int position, CancellationToken cancellationToken) { try { var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); if (root == null) { return default; } var token = root.FindToken(position); if (!(token.Parent is ExpressionSyntax expression)) { return token.IsKind(SyntaxKind.IdentifierToken) ? new DebugDataTipInfo(token.Span, text: null) : default; } if (expression.IsAnyLiteralExpression()) { // If the user hovers over a literal, give them a DataTip for the type of the // literal they're hovering over. // Partial semantics should always be sufficient because the (unconverted) type // of a literal can always easily be determined. var (_, semanticModel) = await document.GetPartialSemanticModelAsync(cancellationToken).ConfigureAwait(false); var type = semanticModel.GetTypeInfo(expression, cancellationToken).Type; return type == null ? default : new DebugDataTipInfo(expression.Span, type.ToNameDisplayString()); } if (expression.IsRightSideOfDotOrArrow()) { var curr = expression.GetRootConditionalAccessExpression() ?? expression; if (curr == expression) { // NB: Parent.Span, not Span as below. return new DebugDataTipInfo(expression.Parent.Span, text: null); } // NOTE: There may not be an ExpressionSyntax corresponding to the range we want. // For example, for input a?.$$B?.C, we want span [|a?.B|]?.C. return new DebugDataTipInfo(TextSpan.FromBounds(curr.SpanStart, expression.Span.End), text: null); } // NOTE(cyrusn): This behavior is to mimic what we did in Dev10, I'm not sure if it's // necessary or not. if (expression.IsKind(SyntaxKind.InvocationExpression, out InvocationExpressionSyntax invocation)) { expression = invocation.Expression; } string textOpt = null; if (expression is TypeSyntax typeSyntax && typeSyntax.IsVar) { // If the user is hovering over 'var', then pass back the full type name that 'var' // binds to. var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var type = semanticModel.GetTypeInfo(typeSyntax, cancellationToken).Type; if (type != null) { textOpt = type.ToNameDisplayString(); } } return new DebugDataTipInfo(expression.Span, textOpt); } catch (Exception e) when (FatalError.ReportAndCatchUnlessCanceled(e, cancellationToken)) { return default; } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/VisualBasic/Test/Emit/ExpressionTrees/Tests/TestUnary_UDO_PlusMinusNot.vb
' 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. Imports System Imports System.Linq.Expressions Structure S1 Public Shared Operator +(x As S1?) As S1? Return x End Operator Public Shared Operator -(x As S1?) As S1? Return x End Operator Public Shared Operator Not(x As S1?) As S1? Return x End Operator End Structure Structure S2 Public Shared Operator +(x As S2) As S2 Return x End Operator Public Shared Operator -(x As S2) As S2 Return x End Operator Public Shared Operator Not(x As S2) As S2 Return x End Operator End Structure Class O1 Public Shared Operator +(x As O1) As O1 Return x End Operator Public Shared Operator -(x As O1) As O1 Return x End Operator Public Shared Operator Not(x As O1) As O1 Return x End Operator End Class Module Form1 Sub Main() Dim retS1_1 As Expression(Of Func(Of S1, S1)) = Function(x) +x Console.WriteLine(retS1_1.Dump) Dim retS1_2 As Expression(Of Func(Of S1?, S1)) = Function(x) +x Console.WriteLine(retS1_2.Dump) Dim retS1_3 As Expression(Of Func(Of S1, S1?)) = Function(x) +x Console.WriteLine(retS1_3.Dump) Dim retS1_4 As Expression(Of Func(Of S1?, S1?)) = Function(x) +x Console.WriteLine(retS1_4.Dump) Dim retS1_5 As Expression(Of Func(Of S1, S1)) = Function(x) -x Console.WriteLine(retS1_5.Dump) Dim retS1_6 As Expression(Of Func(Of S1?, S1)) = Function(x) -x Console.WriteLine(retS1_6.Dump) Dim retS1_7 As Expression(Of Func(Of S1, S1?)) = Function(x) -x Console.WriteLine(retS1_7.Dump) Dim retS1_8 As Expression(Of Func(Of S1?, S1?)) = Function(x) -x Console.WriteLine(retS1_8.Dump) Dim retS1_9 As Expression(Of Func(Of S1, S1)) = Function(x) Not x Console.WriteLine(retS1_9.Dump) Dim retS1_10 As Expression(Of Func(Of S1?, S1)) = Function(x) Not x Console.WriteLine(retS1_10.Dump) Dim retS1_11 As Expression(Of Func(Of S1, S1?)) = Function(x) Not x Console.WriteLine(retS1_11.Dump) Dim retS1_12 As Expression(Of Func(Of S1?, S1?)) = Function(x) Not x Console.WriteLine(retS1_12.Dump) Dim retS2_1 As Expression(Of Func(Of S2, S2)) = Function(x) +x Console.WriteLine(retS2_1.Dump) Dim retS2_2 As Expression(Of Func(Of S2?, S2)) = Function(x) +x Console.WriteLine(retS2_2.Dump) Dim retS2_3 As Expression(Of Func(Of S2, S2?)) = Function(x) +x Console.WriteLine(retS2_3.Dump) Dim retS2_4 As Expression(Of Func(Of S2?, S2?)) = Function(x) +x Console.WriteLine(retS2_4.Dump) Dim retS2_5 As Expression(Of Func(Of S2, S2)) = Function(x) -x Console.WriteLine(retS2_5.Dump) Dim retS2_6 As Expression(Of Func(Of S2?, S2)) = Function(x) -x Console.WriteLine(retS2_6.Dump) Dim retS2_7 As Expression(Of Func(Of S2, S2?)) = Function(x) -x Console.WriteLine(retS2_7.Dump) Dim retS2_8 As Expression(Of Func(Of S2?, S2?)) = Function(x) -x Console.WriteLine(retS2_8.Dump) Dim retS2_9 As Expression(Of Func(Of S2, S2)) = Function(x) Not x Console.WriteLine(retS2_9.Dump) Dim retS2_10 As Expression(Of Func(Of S2?, S2)) = Function(x) Not x Console.WriteLine(retS2_10.Dump) Dim retS2_11 As Expression(Of Func(Of S2, S2?)) = Function(x) Not x Console.WriteLine(retS2_11.Dump) Dim retS2_12 As Expression(Of Func(Of S2?, S2?)) = Function(x) Not x Console.WriteLine(retS2_12.Dump) Dim retO1_1 As Expression(Of Func(Of O1, O1)) = Function(x) +x Console.WriteLine(retO1_1.Dump) Dim retO1_5 As Expression(Of Func(Of O1, O1)) = Function(x) -x Console.WriteLine(retO1_5.Dump) Dim retO1_9 As Expression(Of Func(Of O1, O1)) = Function(x) Not x End Sub End Module
' 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. Imports System Imports System.Linq.Expressions Structure S1 Public Shared Operator +(x As S1?) As S1? Return x End Operator Public Shared Operator -(x As S1?) As S1? Return x End Operator Public Shared Operator Not(x As S1?) As S1? Return x End Operator End Structure Structure S2 Public Shared Operator +(x As S2) As S2 Return x End Operator Public Shared Operator -(x As S2) As S2 Return x End Operator Public Shared Operator Not(x As S2) As S2 Return x End Operator End Structure Class O1 Public Shared Operator +(x As O1) As O1 Return x End Operator Public Shared Operator -(x As O1) As O1 Return x End Operator Public Shared Operator Not(x As O1) As O1 Return x End Operator End Class Module Form1 Sub Main() Dim retS1_1 As Expression(Of Func(Of S1, S1)) = Function(x) +x Console.WriteLine(retS1_1.Dump) Dim retS1_2 As Expression(Of Func(Of S1?, S1)) = Function(x) +x Console.WriteLine(retS1_2.Dump) Dim retS1_3 As Expression(Of Func(Of S1, S1?)) = Function(x) +x Console.WriteLine(retS1_3.Dump) Dim retS1_4 As Expression(Of Func(Of S1?, S1?)) = Function(x) +x Console.WriteLine(retS1_4.Dump) Dim retS1_5 As Expression(Of Func(Of S1, S1)) = Function(x) -x Console.WriteLine(retS1_5.Dump) Dim retS1_6 As Expression(Of Func(Of S1?, S1)) = Function(x) -x Console.WriteLine(retS1_6.Dump) Dim retS1_7 As Expression(Of Func(Of S1, S1?)) = Function(x) -x Console.WriteLine(retS1_7.Dump) Dim retS1_8 As Expression(Of Func(Of S1?, S1?)) = Function(x) -x Console.WriteLine(retS1_8.Dump) Dim retS1_9 As Expression(Of Func(Of S1, S1)) = Function(x) Not x Console.WriteLine(retS1_9.Dump) Dim retS1_10 As Expression(Of Func(Of S1?, S1)) = Function(x) Not x Console.WriteLine(retS1_10.Dump) Dim retS1_11 As Expression(Of Func(Of S1, S1?)) = Function(x) Not x Console.WriteLine(retS1_11.Dump) Dim retS1_12 As Expression(Of Func(Of S1?, S1?)) = Function(x) Not x Console.WriteLine(retS1_12.Dump) Dim retS2_1 As Expression(Of Func(Of S2, S2)) = Function(x) +x Console.WriteLine(retS2_1.Dump) Dim retS2_2 As Expression(Of Func(Of S2?, S2)) = Function(x) +x Console.WriteLine(retS2_2.Dump) Dim retS2_3 As Expression(Of Func(Of S2, S2?)) = Function(x) +x Console.WriteLine(retS2_3.Dump) Dim retS2_4 As Expression(Of Func(Of S2?, S2?)) = Function(x) +x Console.WriteLine(retS2_4.Dump) Dim retS2_5 As Expression(Of Func(Of S2, S2)) = Function(x) -x Console.WriteLine(retS2_5.Dump) Dim retS2_6 As Expression(Of Func(Of S2?, S2)) = Function(x) -x Console.WriteLine(retS2_6.Dump) Dim retS2_7 As Expression(Of Func(Of S2, S2?)) = Function(x) -x Console.WriteLine(retS2_7.Dump) Dim retS2_8 As Expression(Of Func(Of S2?, S2?)) = Function(x) -x Console.WriteLine(retS2_8.Dump) Dim retS2_9 As Expression(Of Func(Of S2, S2)) = Function(x) Not x Console.WriteLine(retS2_9.Dump) Dim retS2_10 As Expression(Of Func(Of S2?, S2)) = Function(x) Not x Console.WriteLine(retS2_10.Dump) Dim retS2_11 As Expression(Of Func(Of S2, S2?)) = Function(x) Not x Console.WriteLine(retS2_11.Dump) Dim retS2_12 As Expression(Of Func(Of S2?, S2?)) = Function(x) Not x Console.WriteLine(retS2_12.Dump) Dim retO1_1 As Expression(Of Func(Of O1, O1)) = Function(x) +x Console.WriteLine(retO1_1.Dump) Dim retO1_5 As Expression(Of Func(Of O1, O1)) = Function(x) -x Console.WriteLine(retO1_5.Dump) Dim retO1_9 As Expression(Of Func(Of O1, O1)) = Function(x) Not x End Sub End Module
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/VisualBasic/Portable/Indentation/SpecialFormattingOperation.vb
' 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. Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Formatting Imports Microsoft.CodeAnalysis.Formatting.Rules Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation Friend Class SpecialFormattingRule Inherits CompatAbstractFormattingRule Private ReadOnly _indentStyle As FormattingOptions.IndentStyle Public Sub New(indentStyle As FormattingOptions.IndentStyle) _indentStyle = indentStyle End Sub Public Overrides Sub AddSuppressOperationsSlow(list As List(Of SuppressOperation), node As SyntaxNode, ByRef nextOperation As NextSuppressOperationAction) ' don't suppress anything End Sub Public Overrides Function GetAdjustNewLinesOperationSlow(ByRef previousToken As SyntaxToken, ByRef currentToken As SyntaxToken, ByRef nextOperation As NextGetAdjustNewLinesOperation) As AdjustNewLinesOperation ' unlike regular one. force position of attribute Dim attributeNode = TryCast(previousToken.Parent, AttributeListSyntax) If attributeNode IsNot Nothing AndAlso attributeNode.GreaterThanToken = previousToken Then Return FormattingOperations.CreateAdjustNewLinesOperation(0, AdjustNewLinesOption.PreserveLines) End If ' no line operation. no line changes what so ever Dim lineOperation = MyBase.GetAdjustNewLinesOperationSlow(previousToken, currentToken, nextOperation) If lineOperation IsNot Nothing Then ' basically means don't ever put new line if there isn't already one, but do ' indentation. Return FormattingOperations.CreateAdjustNewLinesOperation(line:=0, option:=AdjustNewLinesOption.PreserveLines) End If Return Nothing End Function Public Overrides Function GetAdjustSpacesOperationSlow(ByRef previousToken As SyntaxToken, ByRef currentToken As SyntaxToken, ByRef nextOperation As NextGetAdjustSpacesOperation) As AdjustSpacesOperation Dim spaceOperation = MyBase.GetAdjustSpacesOperationSlow(previousToken, currentToken, nextOperation) ' if there is force space operation, convert it to ForceSpaceIfSingleLine operation. ' (force space basically means remove all line breaks) If spaceOperation IsNot Nothing AndAlso spaceOperation.Option = AdjustSpacesOption.ForceSpaces Then Return FormattingOperations.CreateAdjustSpacesOperation(spaceOperation.Space, AdjustSpacesOption.ForceSpacesIfOnSingleLine) End If Return spaceOperation End Function Public Overrides Sub AddIndentBlockOperationsSlow(list As List(Of IndentBlockOperation), node As SyntaxNode, ByRef nextOperation As NextIndentBlockOperationAction) nextOperation.Invoke() Dim singleLineLambdaFunction = TryCast(node, SingleLineLambdaExpressionSyntax) If singleLineLambdaFunction IsNot Nothing Then Dim baseToken = node.GetFirstToken(includeZeroWidth:=True) Dim endToken = node.GetLastToken() Dim nextToken = endToken.GetNextToken(includeZeroWidth:=True) If SyntaxFacts.AllowsTrailingImplicitLineContinuation(endToken) OrElse SyntaxFacts.AllowsLeadingImplicitLineContinuation(nextToken) OrElse endToken.TrailingTrivia.Any(SyntaxKind.LineContinuationTrivia) Then Dim startToken = baseToken.GetNextToken(includeZeroWidth:=True) list.Add(FormattingOperations.CreateRelativeIndentBlockOperation( baseToken, startToken, endToken, TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition)) End If Return End If AddIndentBlockOperations(Of ParameterListSyntax)(list, node, Function(n) Not n.OpenParenToken.IsMissing AndAlso n.Parameters.Count > 0) AddArgumentListIndentBlockOperations(list, node) AddIndentBlockOperations(Of TypeParameterListSyntax)(list, node, Function(n) Not n.OpenParenToken.IsMissing AndAlso n.Parameters.Count > 0, indentationDelta:=1) End Sub Private Overloads Shared Sub AddIndentBlockOperations(Of T As SyntaxNode)(list As List(Of IndentBlockOperation), node As SyntaxNode, predicate As Func(Of T, Boolean), Optional indentationDelta As Integer = 0) Dim parameterOrArgumentList = TryCast(node, T) If parameterOrArgumentList Is Nothing Then Return End If If Not predicate(parameterOrArgumentList) Then Return End If AddIndentBlockOperations(list, parameterOrArgumentList, indentationDelta) End Sub Private Overloads Shared Sub AddIndentBlockOperations(list As List(Of IndentBlockOperation), parameterOrArgumentList As SyntaxNode, indentationDelta As Integer) Dim openBrace = parameterOrArgumentList.GetFirstToken(includeZeroWidth:=True) Dim closeBrace = parameterOrArgumentList.GetLastToken(includeZeroWidth:=True) ' first token of first argument (first token of the node should be "open brace") Dim baseToken = openBrace.GetNextToken(includeZeroWidth:=True) ' indent block start token Dim startToken = baseToken.GetNextToken(includeZeroWidth:=True) ' last token of last argument (last token of the node should be "close brace") Dim endToken = closeBrace.GetPreviousToken(includeZeroWidth:=True) list.Add(FormattingOperations.CreateRelativeIndentBlockOperation( baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) End Sub Private Shared Sub AddArgumentListIndentBlockOperations(operations As List(Of IndentBlockOperation), node As SyntaxNode) Dim argumentList = TryCast(node, ArgumentListSyntax) If argumentList Is Nothing OrElse argumentList.OpenParenToken.IsMissing OrElse argumentList.Arguments.Count = 0 OrElse argumentList.Arguments.All(Function(a) a.IsMissing) Then Return End If Dim openBrace = argumentList.GetFirstToken(includeZeroWidth:=True) Dim closeBrace = argumentList.GetLastToken(includeZeroWidth:=True) Dim sourceText = node.SyntaxTree.GetText() ' First, create a list of all arguments that start lines. Dim arguments = New List(Of ArgumentSyntax) Dim previousLineNumber = -1 For Each argument In argumentList.Arguments Dim lineNumber = sourceText.Lines.GetLineFromPosition(argument.SpanStart).LineNumber If lineNumber > previousLineNumber Then arguments.Add(argument) previousLineNumber = lineNumber End If Next ' Next create indent block operations using the arguments that start each line. ' These indent block operations span to the start of the next argument starting a line, ' or the close brace of the argument list if there isn't another argument. For i = 0 To arguments.Count - 1 Dim argument = arguments(i) Dim baseToken = argument.GetFirstToken(includeZeroWidth:=True) Dim startToken = baseToken.GetNextToken(includeZeroWidth:=True) Dim endToken As SyntaxToken Dim span As TextSpan If i < arguments.Count - 1 Then Dim nextArgument = arguments(i + 1) Dim firstToken = nextArgument.GetFirstToken(includeZeroWidth:=True) endToken = firstToken.GetPreviousToken(includeZeroWidth:=True) span = TextSpan.FromBounds(baseToken.Span.End, firstToken.SpanStart) Else endToken = closeBrace.GetPreviousToken(includeZeroWidth:=True) span = TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End) End If Dim operation = FormattingOperations.CreateRelativeIndentBlockOperation( baseToken, startToken, endToken, span, indentationDelta:=0, IndentBlockOption.RelativePosition) operations.Add(operation) Next End Sub Public Overrides Sub AddAlignTokensOperationsSlow(operations As List(Of AlignTokensOperation), node As SyntaxNode, ByRef nextAction As NextAlignTokensOperationAction) MyBase.AddAlignTokensOperationsSlow(operations, node, nextAction) ' Smart token formatting off: No token alignment If _indentStyle <> FormattingOptions.IndentStyle.Smart Then Return End If AddAlignTokensOperations(Of ParameterListSyntax)(operations, node, Function(n) n.OpenParenToken) AddAlignTokensOperations(Of TypeParameterListSyntax)(operations, node, Function(n) n.OpenParenToken) AddAlignTokensOperations(Of ArrayRankSpecifierSyntax)(operations, node, Function(n) n.OpenParenToken) AddCaseClauseAlignTokensOperations(operations, node) End Sub Private Shared Sub AddCaseClauseAlignTokensOperations(operations As List(Of AlignTokensOperation), node As SyntaxNode) Dim caseStatement = TryCast(node, CaseStatementSyntax) If caseStatement Is Nothing OrElse caseStatement.Cases.Count = 0 Then Return End If Dim cases = caseStatement.Cases.OfType(Of SimpleCaseClauseSyntax).ToList() If cases.Count < 2 Then Return End If operations.Add(FormattingOperations.CreateAlignTokensOperation( cases(0).GetFirstToken(includeZeroWidth:=True), cases.Skip(1).Select(Function(n) n.GetFirstToken(includeZeroWidth:=True)), AlignTokensOption.AlignIndentationOfTokensToBaseToken)) End Sub Private Overloads Shared Sub AddAlignTokensOperations(Of T As SyntaxNode)(operations As List(Of AlignTokensOperation), node As SyntaxNode, baseTokenGetter As Func(Of T, SyntaxToken)) Dim parameterList = TryCast(node, T) If parameterList Is Nothing Then Return End If Dim baseToken = baseTokenGetter(parameterList) If baseToken.IsMissing Then Return End If AddAlignTokensOperations(operations, baseToken) End Sub Private Overloads Shared Sub AddAlignTokensOperations(operations As List(Of AlignTokensOperation), baseToken As SyntaxToken) operations.Add(FormattingOperations.CreateAlignTokensOperation( baseToken, SpecializedCollections.SingletonEnumerable(baseToken.GetNextToken(includeZeroWidth:=True)), AlignTokensOption.AlignIndentationOfTokensToBaseToken)) End Sub End Class End Namespace
' 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. Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Formatting Imports Microsoft.CodeAnalysis.Formatting.Rules Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation Friend Class SpecialFormattingRule Inherits CompatAbstractFormattingRule Private ReadOnly _indentStyle As FormattingOptions.IndentStyle Public Sub New(indentStyle As FormattingOptions.IndentStyle) _indentStyle = indentStyle End Sub Public Overrides Sub AddSuppressOperationsSlow(list As List(Of SuppressOperation), node As SyntaxNode, ByRef nextOperation As NextSuppressOperationAction) ' don't suppress anything End Sub Public Overrides Function GetAdjustNewLinesOperationSlow(ByRef previousToken As SyntaxToken, ByRef currentToken As SyntaxToken, ByRef nextOperation As NextGetAdjustNewLinesOperation) As AdjustNewLinesOperation ' unlike regular one. force position of attribute Dim attributeNode = TryCast(previousToken.Parent, AttributeListSyntax) If attributeNode IsNot Nothing AndAlso attributeNode.GreaterThanToken = previousToken Then Return FormattingOperations.CreateAdjustNewLinesOperation(0, AdjustNewLinesOption.PreserveLines) End If ' no line operation. no line changes what so ever Dim lineOperation = MyBase.GetAdjustNewLinesOperationSlow(previousToken, currentToken, nextOperation) If lineOperation IsNot Nothing Then ' basically means don't ever put new line if there isn't already one, but do ' indentation. Return FormattingOperations.CreateAdjustNewLinesOperation(line:=0, option:=AdjustNewLinesOption.PreserveLines) End If Return Nothing End Function Public Overrides Function GetAdjustSpacesOperationSlow(ByRef previousToken As SyntaxToken, ByRef currentToken As SyntaxToken, ByRef nextOperation As NextGetAdjustSpacesOperation) As AdjustSpacesOperation Dim spaceOperation = MyBase.GetAdjustSpacesOperationSlow(previousToken, currentToken, nextOperation) ' if there is force space operation, convert it to ForceSpaceIfSingleLine operation. ' (force space basically means remove all line breaks) If spaceOperation IsNot Nothing AndAlso spaceOperation.Option = AdjustSpacesOption.ForceSpaces Then Return FormattingOperations.CreateAdjustSpacesOperation(spaceOperation.Space, AdjustSpacesOption.ForceSpacesIfOnSingleLine) End If Return spaceOperation End Function Public Overrides Sub AddIndentBlockOperationsSlow(list As List(Of IndentBlockOperation), node As SyntaxNode, ByRef nextOperation As NextIndentBlockOperationAction) nextOperation.Invoke() Dim singleLineLambdaFunction = TryCast(node, SingleLineLambdaExpressionSyntax) If singleLineLambdaFunction IsNot Nothing Then Dim baseToken = node.GetFirstToken(includeZeroWidth:=True) Dim endToken = node.GetLastToken() Dim nextToken = endToken.GetNextToken(includeZeroWidth:=True) If SyntaxFacts.AllowsTrailingImplicitLineContinuation(endToken) OrElse SyntaxFacts.AllowsLeadingImplicitLineContinuation(nextToken) OrElse endToken.TrailingTrivia.Any(SyntaxKind.LineContinuationTrivia) Then Dim startToken = baseToken.GetNextToken(includeZeroWidth:=True) list.Add(FormattingOperations.CreateRelativeIndentBlockOperation( baseToken, startToken, endToken, TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition)) End If Return End If AddIndentBlockOperations(Of ParameterListSyntax)(list, node, Function(n) Not n.OpenParenToken.IsMissing AndAlso n.Parameters.Count > 0) AddArgumentListIndentBlockOperations(list, node) AddIndentBlockOperations(Of TypeParameterListSyntax)(list, node, Function(n) Not n.OpenParenToken.IsMissing AndAlso n.Parameters.Count > 0, indentationDelta:=1) End Sub Private Overloads Shared Sub AddIndentBlockOperations(Of T As SyntaxNode)(list As List(Of IndentBlockOperation), node As SyntaxNode, predicate As Func(Of T, Boolean), Optional indentationDelta As Integer = 0) Dim parameterOrArgumentList = TryCast(node, T) If parameterOrArgumentList Is Nothing Then Return End If If Not predicate(parameterOrArgumentList) Then Return End If AddIndentBlockOperations(list, parameterOrArgumentList, indentationDelta) End Sub Private Overloads Shared Sub AddIndentBlockOperations(list As List(Of IndentBlockOperation), parameterOrArgumentList As SyntaxNode, indentationDelta As Integer) Dim openBrace = parameterOrArgumentList.GetFirstToken(includeZeroWidth:=True) Dim closeBrace = parameterOrArgumentList.GetLastToken(includeZeroWidth:=True) ' first token of first argument (first token of the node should be "open brace") Dim baseToken = openBrace.GetNextToken(includeZeroWidth:=True) ' indent block start token Dim startToken = baseToken.GetNextToken(includeZeroWidth:=True) ' last token of last argument (last token of the node should be "close brace") Dim endToken = closeBrace.GetPreviousToken(includeZeroWidth:=True) list.Add(FormattingOperations.CreateRelativeIndentBlockOperation( baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) End Sub Private Shared Sub AddArgumentListIndentBlockOperations(operations As List(Of IndentBlockOperation), node As SyntaxNode) Dim argumentList = TryCast(node, ArgumentListSyntax) If argumentList Is Nothing OrElse argumentList.OpenParenToken.IsMissing OrElse argumentList.Arguments.Count = 0 OrElse argumentList.Arguments.All(Function(a) a.IsMissing) Then Return End If Dim openBrace = argumentList.GetFirstToken(includeZeroWidth:=True) Dim closeBrace = argumentList.GetLastToken(includeZeroWidth:=True) Dim sourceText = node.SyntaxTree.GetText() ' First, create a list of all arguments that start lines. Dim arguments = New List(Of ArgumentSyntax) Dim previousLineNumber = -1 For Each argument In argumentList.Arguments Dim lineNumber = sourceText.Lines.GetLineFromPosition(argument.SpanStart).LineNumber If lineNumber > previousLineNumber Then arguments.Add(argument) previousLineNumber = lineNumber End If Next ' Next create indent block operations using the arguments that start each line. ' These indent block operations span to the start of the next argument starting a line, ' or the close brace of the argument list if there isn't another argument. For i = 0 To arguments.Count - 1 Dim argument = arguments(i) Dim baseToken = argument.GetFirstToken(includeZeroWidth:=True) Dim startToken = baseToken.GetNextToken(includeZeroWidth:=True) Dim endToken As SyntaxToken Dim span As TextSpan If i < arguments.Count - 1 Then Dim nextArgument = arguments(i + 1) Dim firstToken = nextArgument.GetFirstToken(includeZeroWidth:=True) endToken = firstToken.GetPreviousToken(includeZeroWidth:=True) span = TextSpan.FromBounds(baseToken.Span.End, firstToken.SpanStart) Else endToken = closeBrace.GetPreviousToken(includeZeroWidth:=True) span = TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End) End If Dim operation = FormattingOperations.CreateRelativeIndentBlockOperation( baseToken, startToken, endToken, span, indentationDelta:=0, IndentBlockOption.RelativePosition) operations.Add(operation) Next End Sub Public Overrides Sub AddAlignTokensOperationsSlow(operations As List(Of AlignTokensOperation), node As SyntaxNode, ByRef nextAction As NextAlignTokensOperationAction) MyBase.AddAlignTokensOperationsSlow(operations, node, nextAction) ' Smart token formatting off: No token alignment If _indentStyle <> FormattingOptions.IndentStyle.Smart Then Return End If AddAlignTokensOperations(Of ParameterListSyntax)(operations, node, Function(n) n.OpenParenToken) AddAlignTokensOperations(Of TypeParameterListSyntax)(operations, node, Function(n) n.OpenParenToken) AddAlignTokensOperations(Of ArrayRankSpecifierSyntax)(operations, node, Function(n) n.OpenParenToken) AddCaseClauseAlignTokensOperations(operations, node) End Sub Private Shared Sub AddCaseClauseAlignTokensOperations(operations As List(Of AlignTokensOperation), node As SyntaxNode) Dim caseStatement = TryCast(node, CaseStatementSyntax) If caseStatement Is Nothing OrElse caseStatement.Cases.Count = 0 Then Return End If Dim cases = caseStatement.Cases.OfType(Of SimpleCaseClauseSyntax).ToList() If cases.Count < 2 Then Return End If operations.Add(FormattingOperations.CreateAlignTokensOperation( cases(0).GetFirstToken(includeZeroWidth:=True), cases.Skip(1).Select(Function(n) n.GetFirstToken(includeZeroWidth:=True)), AlignTokensOption.AlignIndentationOfTokensToBaseToken)) End Sub Private Overloads Shared Sub AddAlignTokensOperations(Of T As SyntaxNode)(operations As List(Of AlignTokensOperation), node As SyntaxNode, baseTokenGetter As Func(Of T, SyntaxToken)) Dim parameterList = TryCast(node, T) If parameterList Is Nothing Then Return End If Dim baseToken = baseTokenGetter(parameterList) If baseToken.IsMissing Then Return End If AddAlignTokensOperations(operations, baseToken) End Sub Private Overloads Shared Sub AddAlignTokensOperations(operations As List(Of AlignTokensOperation), baseToken As SyntaxToken) operations.Add(FormattingOperations.CreateAlignTokensOperation( baseToken, SpecializedCollections.SingletonEnumerable(baseToken.GetNextToken(includeZeroWidth:=True)), AlignTokensOption.AlignIndentationOfTokensToBaseToken)) End Sub End Class End Namespace
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/Remote/Core/ExternalAccess/UnitTesting/Api/UnitTestingRemoteCallbackWrapper.cs
// 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 System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Remote; namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api { internal readonly struct UnitTestingRemoteCallbackWrapper<T> where T : class { internal readonly RemoteCallback<T> UnderlyingObject; public UnitTestingRemoteCallbackWrapper(T callback) => UnderlyingObject = new RemoteCallback<T>(callback); public ValueTask InvokeAsync(Func<T, CancellationToken, ValueTask> invocation, CancellationToken cancellationToken) => UnderlyingObject.InvokeAsync(invocation, cancellationToken); public ValueTask<TResult> InvokeAsync<TResult>(Func<T, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) => UnderlyingObject.InvokeAsync(invocation, cancellationToken); } }
// 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 System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Remote; namespace Microsoft.CodeAnalysis.ExternalAccess.UnitTesting.Api { internal readonly struct UnitTestingRemoteCallbackWrapper<T> where T : class { internal readonly RemoteCallback<T> UnderlyingObject; public UnitTestingRemoteCallbackWrapper(T callback) => UnderlyingObject = new RemoteCallback<T>(callback); public ValueTask InvokeAsync(Func<T, CancellationToken, ValueTask> invocation, CancellationToken cancellationToken) => UnderlyingObject.InvokeAsync(invocation, cancellationToken); public ValueTask<TResult> InvokeAsync<TResult>(Func<T, CancellationToken, ValueTask<TResult>> invocation, CancellationToken cancellationToken) => UnderlyingObject.InvokeAsync(invocation, cancellationToken); } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/Core/Portable/Diagnostics/Log/DiagnosticLogger.cs
// 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. #nullable disable using Microsoft.CodeAnalysis.Internal.Log; namespace Microsoft.CodeAnalysis.Diagnostics.Log { internal static class DiagnosticLogger { private const string From = nameof(From); private const string Id = nameof(Id); private const string HasDescription = nameof(HasDescription); private const string Uri = nameof(Uri); public static void LogHyperlink( string from, string id, bool description, bool telemetry, string uri) { Logger.Log(FunctionId.Diagnostics_HyperLink, KeyValueLogMessage.Create(m => { m[From] = from; m[Id] = telemetry ? id : id.GetHashCode().ToString(); m[HasDescription] = description; m[Uri] = telemetry ? uri : uri.GetHashCode().ToString(); })); } } }
// 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. #nullable disable using Microsoft.CodeAnalysis.Internal.Log; namespace Microsoft.CodeAnalysis.Diagnostics.Log { internal static class DiagnosticLogger { private const string From = nameof(From); private const string Id = nameof(Id); private const string HasDescription = nameof(HasDescription); private const string Uri = nameof(Uri); public static void LogHyperlink( string from, string id, bool description, bool telemetry, string uri) { Logger.Log(FunctionId.Diagnostics_HyperLink, KeyValueLogMessage.Create(m => { m[From] = from; m[Id] = telemetry ? id : id.GetHashCode().ToString(); m[HasDescription] = description; m[Uri] = telemetry ? uri : uri.GetHashCode().ToString(); })); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/Test2/Rename/RenameEngineTests.vb
' 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. Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.Remote.Testing Imports Microsoft.CodeAnalysis.Rename Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename ''' <summary> ''' This test class contains tests which verifies that the rename engine performs correct ''' refactorings that do not break user code. These tests call through the ''' Renamer.RenameSymbol entrypoint, and thus do not test any behavior with interactive ''' rename. The position given with the $$ mark in the tests is just the symbol that is renamed; ''' there is no fancy logic applied to it. ''' </summary> <[UseExportProvider]> Partial Public Class RenameEngineTests Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper Public Sub New(outputHelper As Abstractions.ITestOutputHelper) _outputHelper = outputHelper End Sub <WorkItem(543661, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543661")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CannotRenameNamespaceAlias(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using [|sys|] = System; class Program { static void Main(string[] args) { [|$$sys|].Console.Write("test"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Sys2") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInaccessibleMember1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void Main() { D.[|field|] = 8; } } class D { private static int [|$$field|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="_field") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInaccessibleMember2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void Main() { D.[|$$field|] = 8; } } class D { private static int [|field|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="_field") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNonAttribute1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [[|NotAnAttribute|]] class C { } class [|$$NotAnAttribute|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNonAttribute2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [[|$$NotAnAttribute|]] class C { } class [|NotAnAttribute|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameWrongArity1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|$$List|]&lt;T&gt; { } class C { [|List|]&lt;int,string&gt; list; } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameWrongArity2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|List|]&lt;T&gt; { } class C { [|$$List|]&lt;int,string&gt; list; } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNotCreatable1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> abstract class [|A|] { } class C { void M() { var v = new [|$$A|](); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNotCreatable2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> abstract class [|$$A|] { } class C { void M() { var v = new [|A|](); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocable1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void M() { var [|$$v|] = ""; {|unresolved:v|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") result.AssertLabeledSpansAre("unresolved", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocable2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void M() { var [|v|] = ""; {|unresolved:$$v|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") result.AssertLabeledSpansAre("unresolved", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticInstance1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { static void M() { var v = [|$$N|]; } int [|N|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticInstance2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { static void M() { var v = [|N|]; } int [|$$N|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(813409, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813409")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeDoesNotRenameGeneratedConstructorCalls(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> struct [|$$Type|] { [|Type|](int x) : this() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="U") End Using End Sub <WorkItem(856078, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/856078")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub UnmodifiedDocumentsAreNotCheckedOutBySourceControl(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document FilePath="Test1.cs"> class C { int [|$$abc|] = 5; } </Document> <Document FilePath="Test2.cs"> class C2 { int abc = 5; } </Document> </Project> </Workspace>, host:=host, renameTo:="def") Dim originalDocument = result.ConflictResolution.OldSolution.Projects.First().Documents.Where(Function(d) d.FilePath = "Test2.cs").Single() Dim newDocument = result.ConflictResolution.NewSolution.Projects.First().Documents.Where(Function(d) d.FilePath = "Test2.cs").Single() Assert.Same(originalDocument.State, newDocument.State) Assert.Equal(1, result.ConflictResolution.NewSolution.GetChangedDocuments(result.ConflictResolution.OldSolution).Count) End Using End Sub <WorkItem(773400, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/773400")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub ReferenceConflictInsideDelegateLocalNotRenamed(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { public delegate void Goo(int x); public void GooMeth(int x) { } public void Sub() { Goo {|DeclConflict:x|} = new Goo(GooMeth); int [|$$z|] = 1; // Rename z to x x({|unresolve2:z|}); } } </Document> </Project> </Workspace>, host:=host, renameTo:="x") result.AssertLabeledSpansAre("DeclConflict", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("unresolve2", "x", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(773673, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/773673")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMoreThanOneTokenInUnResolvedStatement(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|DeclConflict:C|} { public void Sub() { {|unresolve1:D|} d = new {|unresolve2:D|}(); } } class {|unresolve3:$$D|} // Rename to C { } </Document> </Project> </Workspace>, host:=host, renameTo:="C") result.AssertLabeledSpansAre("DeclConflict", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("unresolve1", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("unresolve2", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("unresolve3", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocationExpressionAcrossProjects(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test1.cs"> public class [|$$ClassA|] { public static void Bar() { } } </Document> </Project> <Project Language="C#" CommonReferences="true"> <ProjectReference>CSharpAssembly</ProjectReference> <Document FilePath="Test2.cs"> public class B { void goo() { [|ClassA|].Bar(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="A") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocationExpressionAcrossProjectsWithPartialClass(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test1.cs"> public partial class [|$$ClassA|] { public static void Bar() { } } public partial class [|ClassA|] { } </Document> </Project> <Project Language="C#" CommonReferences="true"> <ProjectReference>CSharpAssembly</ProjectReference> <Document FilePath="Test2.cs"> public class B { void goo() { [|ClassA|].Bar(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="A") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocationExpressionAcrossProjectsWithConflictResolve(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test1.cs"> namespace X { public class [|$$ClassA|] { public {|resolve:A|}.B B; public static void Bar() { } } } namespace A { public class B { } } </Document> </Project> <Project Language="C#" CommonReferences="true"> <ProjectReference>CSharpAssembly</ProjectReference> <Document FilePath="Test2.cs"> using X; public class B { void goo() { {|resolve2:ClassA|}.Bar(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="A") result.AssertLabeledSpansAre("resolve", "global::A", RelatedLocationType.ResolvedNonReferenceConflict) result.AssertLabeledSpansAre("resolve2", "X.A.Bar();", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RollBackExpandedConflicts_WithinInvocationExpression(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; class Program { static void Main(string[] {|conflict1:a|}) { var [|$$b|] = Convert.{|conflict3:ToDouble|}({|conflict2:a|}[0]); } } </Document> </Project> </Workspace>, host:=host, renameTo:="a") result.AssertLabeledSpansAre("conflict1", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("conflict2", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("conflict3", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RollBackExpandedConflicts_WithinQuery(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Dim [|$$x|] As String() ' rename x to y Dim {|conflict1:y|} = From x In {|conflict2:x|} Select x End Class </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("conflict1", "y", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("conflict2", "y", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameOverloadCSharp(host As RenameTestHost) Dim changingOptions = New Dictionary(Of OptionKey, Object)() changingOptions.Add(RenameOptions.RenameOverloads, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; class Program { public void [|$$goo|]() { [|goo|](); } public void [|goo|]&lt;T&gt;() { [|goo|]&lt;T&gt;(); } public void [|goo|](int i) { [|goo|](i); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz", changedOptionSet:=changingOptions) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameOverloadVisualBasic(host As RenameTestHost) Dim changingOptions = New Dictionary(Of OptionKey, Object)() changingOptions.Add(RenameOptions.RenameOverloads, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Imports System.Collections.Generic Imports System.Linq Public Class Program Sub Main(args As String()) End Sub Public Sub [|$$goo|]() [|goo|]() End Sub Public Sub [|goo|](Of T)() [|goo|](Of T)() End Sub Public Sub [|goo|](s As String) [|goo|](s) End Sub Public Shared Sub [|goo|](d As Double) [|goo|](d) End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz", changedOptionSet:=changingOptions) End Using End Sub <Theory, WorkItem(761929, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/761929"), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub ConflictCheckInInvocationCSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication5 { class [|$$Program2|] { private static Func&lt;[|Program2|], bool> func = null; private static void Main23(object v) { func(new [|Program2|]()); } } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <Theory, WorkItem(761922, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/761922"), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub ConflictCheckInInvocationVisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Imports System.Collections.Generic Imports System.Linq Namespace ns Class [|Program2|] Private Shared func As Func(Of [|Program2|], Boolean) = Nothing Private Shared Sub Main2343(args As String()) func(New [|$$Program2|]()) End Sub End Class End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameType(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|$$Goo|] { void Blah() { {|stmt1:Goo|} f = new {|stmt1:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeAcrossFiles(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|$$Goo|] { void Blah() { {|stmt1:Goo|} f = new {|stmt1:Goo|}(); } } </Document> <Document> class FogBar { void Blah() { {|stmt2:Goo|} f = new {|stmt2:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeAcrossFiles_WithoutCommonReferences(host As RenameTestHost) ' without a reference to mscorlib, compiler can't find types like System.Void. This causes it to have ' overload resolution errors for `new Goo();` which causes rename to not update the constructor calls. This ' should not normally ever hit a realistic user scenario. The test exists just to document our behavior ' here. Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#"> <Document> class [|$$Goo|] { void Blah() { {|stmt1:Goo|} f = new {|conflict:Goo|}(); } } </Document> <Document> class FogBar { void Blah() { {|stmt2:Goo|} f = new {|conflict:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeAcrossProjectsAndLanguages(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document> namespace N { public class [|$$Goo|] { void Blah() { {|csstmt1:Goo|} f = new {|csstmt1:Goo|}(); } } } </Document> </Project> <Project Language="Visual Basic" CommonReferences="true"> <ProjectReference>CSharpAssembly</ProjectReference> <Document> Imports N Class FogBar Sub Blah() Dim f = new {|vbstmt1:Goo|}() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("csstmt1", "BarBaz", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("vbstmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpTypeFromConstructorDefinition(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|Goo|] { [|$$Goo|]() { } void Blah() { {|stmt1:Goo|} f = new {|stmt1:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpTypeFromConstructorUse(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|Goo|] { [|Goo|]() { } void Blah() { {|stmt1:Goo|} f = new {|stmt1:$$Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", replacement:="Bar", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpTypeFromDestructor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|Goo|] { ~[|$$Goo|]() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpTypeFromSynthesizedConstructorUse(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|Goo|] { void Blah() { {|stmt1:Goo|} f = new {|stmt1:$$Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", replacement:="Bar", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpPredefinedTypeVariables1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { System.Int32 {|stmt1:$$goofoo|} = 23; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpPredefinedTypeVariables2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { Int32 {|stmt1:$$goofoo|} = 23; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpPredefinedTypeVariables3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { int {|stmt1:$$fogbar|} = 45; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicPredefinedTypeVariables1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Module Program Sub Main(args As String()) Dim {|stmt1:$$a|} As System.Int32 = 1 End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicPredefinedTypeVariables2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Module Program Sub Main(args As String()) Dim {|stmt1:$$a|} As Int32 = 1 End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicPredefinedTypeVariables3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Module Program Sub Main(args As String()) Dim {|stmt1:$$a|} As Integer = 1 End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(539801, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539801")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpEnumMemberToContainingEnumName(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> enum Test { [|$$FogBar|], }; </Document> </Project> </Workspace>, host:=host, renameTo:="Test") End Using End Sub <WorkItem(539801, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539801")> <WorkItem(5886, "https://github.com/dotnet/roslyn/pull/5886")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpEnumToEnumMemberName(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> enum [|$$FogBar|] { TestEnum, }; </Document> </Project> </Workspace>, host:=host, renameTo:="TestEnum") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicTypeFromConstructorUse(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class [|Goo|] Public Sub New() End Sub Public Sub Blah() Dim x = New {|stmt1:$$Goo|}() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicTypeFromSynthesizedConstructorUse(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class [|Goo|] Public Sub Blah() Dim x = New {|stmt1:$$Goo|}() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNamespace(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Namespace [|$$GooNamespace|] End Namespace </Document> <Document> namespace [|GooNamespace|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBazNamespace") End Using End Sub <Theory, WorkItem(6874, "http://vstfdevdiv:8080/DevDiv_Projects/Roslyn/_workitems/edit/6874")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicEnum(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Enum [|$$Test|] One Two End Enum </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, WorkItem(6874, "http://vstfdevdiv:8080/DevDiv_Projects/Roslyn/_workitems/edit/6874")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicEnumMember(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Enum Test [|$$One|] Two End Enum </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, WorkItem(539525, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539525")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub DoNothingRename(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Goo { void [|$$Blah|]() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="Blah") End Using End Sub <Theory, WorkItem(553631, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/553631")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpBugfix553631(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Program { void Main(string[] args) { string {|stmt1:$$s|} = Goo&lt;string, string&gt;(); } string Goo&lt;T, S&gt;() { Return Goo &lt;T, S&gt;(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Blah") result.AssertLabeledSpansAre("stmt1", replacement:="Blah", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(553631, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/553631")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub VisualBasicBugfix553631(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Imports System.Collections.Generic Imports System.Linq Class Program Sub Main(args As String()) End Sub Public Sub Bar() Dim {|stmt1:$$e|} As String = Goo(Of String)() End Sub Public Function Goo(Of A)() As String End Function End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Blah") result.AssertLabeledSpansAre("stmt1", replacement:="Blah", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(541697, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541697")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExtensionMethod(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public static class C { public static void [|$$Goo|](this string s) { } } class Program { static void Main() { "".{|stmt1:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(542202, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542202")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpIndexerNamedArgument1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { int this[int x = 5, int [|y|] = 7] { get { return 0; } set { } } void Goo() { var y = this[{|stmt1:$$y|}: 1]; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(542106, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542106")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpIndexerNamedArgument2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { int this[int [|$$x|]] { set { } } void Goo() { this[{|stmt1:x|}: 1] = 0; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(541928, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541928")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameRangeVariable(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System.Linq; class C { static void Main(string[] args) { var temp = from x in "abc" let {|stmt1:y|} = x.ToString() select {|stmt1:$$y|} into w select w; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(542106, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542106")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicParameterizedPropertyNamedArgument(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Default Property Item([|$$x|] As Integer) As Integer Get Return 42 End Get Set End Set End Property Sub Goo() Me({|stmt1:x|}:=1) = 0 End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(543340, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543340")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIndexerParameterFromDeclaration(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Program { int this[int [|$$x|], int y] { get { return {|stmt1:x|} + y; } set { value = {|stmt2:x|} + y; } } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(543340, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543340")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIndexerParameterFromUseInsideGetAccessor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Program { int this[int [|x|], int y] { get { return {|stmt1:$$x|} + y; } set { value = {|stmt2:x|} + y; } } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(543340, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543340")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIndexerParameterFromUseInsideSetAccessor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Program { int this[int [|x|], int y] { get { return {|stmt1:x|} + y; } set { value = {|stmt2:$$x|} + y; } } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(542492, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542492")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethodParameter(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; public partial class Test { partial void Goo(object [|$$o|]) { } } partial class Test { partial void Goo(object [|o|]); } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, WorkItem(542492, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542492")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExtendedPartialMethodParameter(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; public partial class Test { public partial void Goo(object [|$$o|]) { } } partial class Test { public partial void Goo(object [|o|]); } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(528820, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528820")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicAnonymousKey(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Option Infer On Imports System Module Program Sub Main(args As String()) Dim namedCust = New With {.Name = "Blue Yonder Airlines", .[|$$City|] = "Snoqualmie"} End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(542543, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542543")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIncludesPreviouslyInvalidReference(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { int [|$$y|] = 2; static void Main(string[] args) { {|stmt1:x|} = 1; } } </Document> </Project> </Workspace>, host:=host, renameTo:="x") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(543027, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543027")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVariableInQueryAsUsingStatement(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> using System; using System.Linq; class Program { public static void Main(string[] args) { MyManagedType {|stmt1:mnObj1|} = new MyManagedType(); using ({|stmt2:m$$nObj1|}) { } } } class MyManagedType : System.IDisposable { public void Dispose() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("stmt1", replacement:="y", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(543169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543169")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub LambdaWithOutParameter(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> using System; using System.Linq; class D { static void Main(string[] args) { string[] str = new string[] { }; var s = str.Where(out {|stmt1:$$x|} => { return {|stmt1:x|} == "1"; }); } } </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("stmt1", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(543567, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543567")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CascadeBetweenOverridingProperties(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document FilePath="Test.vb"> Module Program Sub Main(args As String()) End Sub End Module Class C Public Overridable ReadOnly Property [|$$Total|]() As Double Get Return 42 End Get End Property End Class Class M Inherits C Public Overrides ReadOnly Property [|Total|]() As Double Get Return MyBase.{|stmt1:Total|} * rate End Get End Property End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") result.AssertLabeledSpansAre("stmt1", "Goo", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(529799, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529799")> Public Sub CascadeBetweenImplementedInterfaceEvent(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document FilePath="Test.vb"> Class C Event E([|$$x|] As Integer) Sub Goo() RaiseEvent E({|stmt1:x|}:=1) End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("stmt1", "y", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(543567, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543567")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CascadeBetweenEventParameters(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> using System; interface IGoo { event EventHandler [|$$Goo|]; } class Bar : IGoo { public event EventHandler [|Goo|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(531260, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531260")> Public Sub DoNotCascadeToMetadataSymbols(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Public Class C Implements System.ICloneable Public Function [|$$Clone|]() As Object Implements System.ICloneable.Clone Throw New System.NotImplementedException() End Function End Class </Document> </Project> </Workspace>, host:=host, renameTo:="CloneImpl") End Using End Sub <WorkItem(545473, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545473")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialTypeParameter_CSharp1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ partial class Class1 { partial void goo<$$[|T|]>([|T|] x); partial void goo<[|T|]>([|T|] x) { } }]]></Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(545473, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545473")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialTypeParameter_CSharp2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ partial class Class1 { partial void goo<[|T|]>([|T|] x); partial void goo<$$[|T|]>([|T|] x) { } }]]></Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(545472, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545472")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialTypeParameter_VB1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Public Module Module1 Partial Private Sub Goo(Of [|$$T|] As Class)(x as [|T|]) End Sub Private Sub goo(Of [|T|] As Class)(x as [|T|]) End Sub End Module ]]></Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(545472, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545472")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialTypeParameter_VB2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Public Module Module1 Partial Private Sub Goo(Of [|T|] As Class)(x as [|T|]) End Sub Private Sub goo(Of [|$$T|] As Class)(x as [|T|]) End Sub End Module ]]></Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(529163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529163")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub AmbiguousBeforeRenameHandledCorrectly_Bug11516(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Namespace NS Module M End Module End Namespace Namespace NS.[|$$M|] End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="N") End Using End Sub <WorkItem(529163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529163")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub AmbiguousBeforeRenameHandledCorrectly_Bug11516_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace Goo { class B { } } namespace Goo.[|$$B|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="N") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethods_1_CS(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class Goo { partial void [|F|](); } partial class Goo { partial void [|$$F|]() { throw new System.Exception("F"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExtendedPartialMethods_1_CS(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class Goo { public partial void [|F|](); } partial class Goo { public partial void [|$$F|]() { throw new System.Exception("F"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethods_2_CS(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class Goo { partial void [|$$F|](); } partial class Goo { partial void [|F|]() { throw new System.Exception("F"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExtendedPartialMethods_2_CS(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class Goo { public partial void [|$$F|](); } partial class Goo { public partial void [|F|]() { throw new System.Exception("F"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethods_1_VB(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> partial class Goo partial private sub [|F|]() end class partial class Goo private sub [|$$F|]() throw new System.Exception("F") end sub end class </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethods_2_VB(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> partial class Goo partial private sub [|$$F|]() end class partial class Goo private sub [|F|]() throw new System.Exception("F") end sub end class </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(530740, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530740")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug530740(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using MyInt = System.[|Int32|]; namespace System { public struct [|$$Int32|] { public static implicit operator MyInt(int x) { return default(MyInt); } } } class A { static void Goo(int x) { Console.WriteLine("int"); } static void Goo(MyInt x) { Console.WriteLine("MyInt"); } static void Main() { Goo((MyInt)0); } } </Document> </Project> </Workspace>, host:=host, renameTo:="MyInt") End Using End Sub <WorkItem(530082, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530082")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMethodThatImplementsInterfaceMethod(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Interface I Sub Goo(Optional x As Integer = 0) End Interface Class C Implements I Shared Sub Main() DirectCast(New C(), I).Goo() End Sub Private Sub [|$$I_Goo|](Optional x As Integer = 0) Implements I.Goo Console.WriteLine("test") End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub <WorkItem(529874, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529874")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub DoNotRemoveAttributeSuffixOn__Attribute(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System &lt;[|_Attribute2|]&gt; ' full width _! Class [|$$_Attribute2|] Inherits Attribute End Class </Document> </Project> </Workspace>, host:=host, renameTo:="_Attribute") End Using End Sub <WorkItem(553315, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/553315")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameEventParameterOnUsage(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Event E([|x|] As Integer) Sub Goo() RaiseEvent E({|stmt1:$$x|}:=1) End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="bar") result.AssertLabeledSpansAre("stmt1", "bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529819, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529819")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCompilerGeneratedBackingFieldForNonCustomEvent(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class B Event [|$$X|]() ' Rename X to Y Sub Goo() {|stmt1:XEvent|}() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("stmt1", "YEvent", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(576607, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/576607")> <WorkItem(529819, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529819")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCompilerGeneratedEventHandlerForNonCustomEvent(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class B Event [|$$X|]() ' Rename X to Y Sub Goo() Dim y = New B.{|stmt1:XEventHandler|}(AddressOf bar) End Sub Shared Sub bar() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("stmt1", "YEventHandler", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(576966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/576966")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpRenameParenthesizedFunctionName(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void [|$$Goo|]() { (({|stmt1:Goo|}))(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub VisualBasicAwaitAsIdentifierInAsyncShouldBeEscaped(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Module M Async Function methodIt() As Task(Of String) Dim a As Func(Of String) = AddressOf {|stmt1:Goo|} End Function Function [|$$Goo|]() As String End Function End Module </Document> </Project> </Workspace>, host:=host, renameTo:="Await") result.AssertLabeledSpecialSpansAre("stmt1", "[Await]", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpAwaitAsIdentifierInAsyncMethodShouldBeEscaped0(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; using System.Threading.Tasks; class M { async public Task<string> methodIt() { Func<string> a = {|stmt1:Goo|}; return null; } public static string [|$$Goo|]() { return ""; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="await") result.AssertLabeledSpansAre("stmt1", "@await", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpAwaitAsIdentifierInAsyncLambdaShouldBeEscaped(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; using System.Threading.Tasks; class s { public void abc() { Func<Task> sin = async () => { {|stmt1:Goo|}(); }; } public int [|$$Goo|]() { return 0; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="await") result.AssertLabeledSpansAre("stmt1", "@await", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpAwaitAsIdentifierInAsyncLambdaShouldBeEscaped1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; using System.Threading.Tasks; class s { public void abc() { Func<int, Task<int>> sink2 = (async c => { return {|stmt2:Goo|}(); }); } public int [|$$Goo|]() { return 0; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="await") result.AssertLabeledSpansAre("stmt2", "@await", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpAwaitAsIdentifierInAsyncLambdaShouldNotBeEscaped(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; using System.Threading.Tasks; class s { public void abc() { Func<int, int> sink4 = ((c) => { return {|stmt3:Goo|}(); }); } public int [|$$Goo|]() { return 0; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="await") result.AssertLabeledSpansAre("stmt3", "await", RelatedLocationType.NoConflict) End Using End Sub <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub VBRoundTripMissingModuleName_1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports N Module Program Sub Main() Dim mybar As N.{|stmt1:Goo|} = New {|stmt1:Goo|}() End Sub End Module Namespace N Module X Class [|$$Goo|] End Class End Module End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub VBRoundTripMissingModuleName_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports N Module Program Sub Main() N.{|stmt1:Goo|}() End Sub End Module Namespace N Module X Sub [|$$Goo|]() End Sub End Module End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(603767, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/603767")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug603767_RenamePartialAttributeDeclarationWithDifferentCasingAndCSharpUsage(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Imports System Public Class [|XAttribute|] Inherits Attribute End Class Partial Public Class [|$$XATTRIBUTE|] Inherits Attribute End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> [{|resolved:X|}] class C { } </Document> </Project> </Workspace>, host:=host, renameTo:="XATTRIBUTe") result.AssertLabeledSpansAre("resolved", "XATTRIBUTe", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(603371, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/603371")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug603371_VisualBasicRenameAttributeToGlobal(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Imports System &lt;{|escaped:Goo|}&gt; Class {|escaped:$$Goo|} ' Rename Goo to Global Inherits Attribute End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Global") result.AssertLabeledSpecialSpansAre("escaped", "[Global]", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(603371, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/603371")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug603371_VisualBasicRenameAttributeToGlobal_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Imports System &lt;{|escaped:Goo|}&gt; Class {|escaped:$$Goo|} ' Rename Goo to Global Inherits Attribute End Class </Document> </Project> </Workspace>, host:=host, renameTo:="[global]") result.AssertLabeledSpansAre("escaped", "[global]", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(602494, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/602494")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug602494_RenameOverrideWithNoOverriddenMember(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> class C1 { override void [|$$Goo|]() {} } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(576607, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/576607")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug576607(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Class B Event [|$$X|]() Sub Goo() Dim y = New {|stmt1:XEventHandler|}(AddressOf bar) End Sub Shared Sub bar() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Baz") result.AssertLabeledSpecialSpansAre("stmt1", "BazEventHandler", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_VisualBasicOverrideImplicitPropertyAccessor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable ReadOnly Property [|$$X|](y As Integer) As Integer Get Return 0 End Get End Property End Class Public Class C Inherits A Public Overrides Function {|getaccessor:get_X|}(Y As Integer) As Integer End Function End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_VisualBasicOverrideImplicitPropertyAccessor_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable ReadOnly Property [|X|](y As Integer) As Integer Get Return 0 End Get End Property End Class Public Class C Inherits A Public Overrides Function {|getaccessor:$$Get_X|}(Y As Integer) As Integer End Function End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "Get_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_VisualBasicOverrideImplicitPropertyAccessor_3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable ReadOnly Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property End Class Public Class C Inherits A Public Overrides Function {|getaccessor:$$Get_X|}(Y As Integer) As Integer End Function Public Overrides Sub {|setaccessor:Set_X|}(index as integer, Y As Integer) End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "Get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "Set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|$$X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { } public override void {|setaccessor:set_X|}(int y, int value) { } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|$$X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:set_X|}(int y, int value) { base.{|setaccessorstmt:set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessorstmt", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessorstmt", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:set_X|}(int y, int value) { base.{|setaccessorstmt:$$set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessorstmt", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessorstmt", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_4(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class Public Class B Inherits A Public Overrides Property [|$$X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:set_X|}(int y, int value) { base.{|setaccessorstmt:set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessorstmt", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessorstmt", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_5(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property End Class Public Class B Inherits A Public Overrides Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:$$set_X|}(int y, int value) { base.{|setaccessorstmt:set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessorstmt", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessorstmt", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(610120, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/610120")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug610120_CrossLanguageOverrideImplicitPropertyAccessorConflictWithVBProperty(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property {|conflict:X|}({|declconflict:y|} As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class Public Class B Inherits A Public Overrides Property {|conflict:X|}({|declconflict:y|} As Integer) As Integer Get Return 0 End Get Set End Set End Property End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:$$set_X|}(int y, int value) { base.{|setaccessorstmt:set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("conflict", "y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("getaccessorstmt", "get_y", RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("setaccessorstmt", "set_y", RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("declconflict", "y", RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_y", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessor", "get_y", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(612380, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/612380")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug612380_CrossLanguageOverrideImplicitPropertyAccessorCascadesToInterface(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property {|conflict:$$X|}({|declconflict:y|} As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } } interface I { int {|getaccessor:get_X|}(int y); } class C : B, I { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessor:get_X|}(y); } } </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("conflict", "y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("declconflict", "y", RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpecialSpansAre("getaccessor", "get_y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("getaccessorstmt", "get_y", RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(866094, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/866094")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug866094(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Module A Public Sub [|M|]() End Sub End Module </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class C { static void N() { A.[|$$M|](); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameDynamicallyBoundFunction(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> Imports System class A { class B { public void [|Boo|](int d) { } } void Bar() { B b = new B(); dynamic d = 1.5f; b.{|Stmt1:$$Boo|}(d); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("Stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529989, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529989")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharp_RenameToIdentifierWithUnicodeEscaping(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> public class A { public static void [|$$Main|]() { A.{|stmt1:Main|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="M\u0061in") result.AssertLabeledSpansAre("stmt1", "M\u0061in", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(576966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/576966")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharp_RenameParenthesizedMethodNames(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> class C { void [|$$Goo|]() { (({|stmt1:Goo|}))(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(632052, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/632052")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharp_RenameParameterUsedInObjectInitializer(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> using System; class Program { void M(int [|$$p|]) { var v1 = new C() { tuple = Tuple.Create({|stmt1:p|}) }; Tuple&lt;int&gt; v2 = Tuple.Create({|stmt2:p|}); } } class C { public Tuple&lt;int&gt; tuple; } </Document> </Project> </Workspace>, host:=host, renameTo:="n") result.AssertLabeledSpansAre("stmt1", "n", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", "n", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(624092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/624092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub LocationsIssue(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> namespace N { public class D { } } </Document> </Project> <Project Language="Visual Basic" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> Namespace N Module M Public Class [|$$C|] 'Rename C to D End Class End Module End Namespace Module Program Sub Main(args As String()) Dim d = New N.D() Dim c = New N.{|resolved:C|}() End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="D") result.AssertLabeledSpansAre("resolved", "Dim c = New N.M.D()", type:=RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameParam1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { /// <summary> /// <paramref name="[|args|]" /> /// </summary> /// <param name="[|args|]"></param> static void Main(string[] [|$$args|]) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="pargs") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameParam1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class Program ''' <summary> ''' <paramref name="[|args|]" /> ''' </summary> ''' <param name="[|args|]"></param> Private Shared Sub Main([|$$args|] As String()) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="pargs") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameParam2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { /// <summary> /// <paramref name="{|ResolveWithoutAt:args|}" /> /// </summary> /// <param name="{|ResolveWithoutAt:$$args|}"></param> static void Main(string[] {|Resolve:args|}) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="if") result.AssertLabeledSpecialSpansAre("Resolve", "@if", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("ResolveWithoutAt", "if", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameParam2_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class Program ''' <summary> ''' <paramref name="{|Resolve:args|}" /> ''' </summary> ''' <param name="{|Resolve:$$args|}"></param> Private Shared Sub Main({|Resolve:args|} As String()) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="[If]") result.AssertLabeledSpansAre("Resolve", <![CDATA[[If]]]>.Value, RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeParam1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ /// <summary> /// <typeparamref name="[|$$T|]"/> /// </summary> /// <typeparam name="[|T|]"></typeparam> class B<[|T|]> { /// <summary> /// <typeparamref name="[|T|]"/> /// </summary> /// <typeparam name="U"></typeparam> /// <typeparam name="P"></typeparam> /// <param name="x"></param> /// <param name="z"></param> [|T|] Goo<U, P>(U x, [|T|] z) { return z; } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeParam1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ ''' <summary> ''' <typeparamref name="[|$$T|]"/> ''' </summary> ''' <typeparam name="[|T|]"></typeparam> Class B(Of [|T|]) ''' <summary> ''' <typeparamref name="[|T|]"/> ''' </summary> ''' <typeparam name="U"></typeparam> ''' <typeparam name="P"></typeparam> ''' <param name="x"></param> ''' <param name="z"></param> Private Function Goo(Of U, P)(x As U, z As [|T|]) As [|T|] Return z End Function End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(624310, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/624310")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug624310_VBCascadeLambdaParameterInFieldInitializer(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Option Strict On Module M Dim field As Object = If(True, Function({|fieldinit:$$y|} As String) {|fieldinit:y|}.ToUpper(), Function({|fieldinit:y|} As String) {|fieldinit:y|}.ToLower()) Sub Main() Dim local As Object = If(True, Function(x As String) x.ToUpper(), Function(x As String) x.ToLower()) End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="z") result.AssertLabeledSpansAre("fieldinit", "z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(624310, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/624310")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug624310_CSNoCascadeLambdaParameterInFieldInitializer(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System; class Program { public object O = true ? (Func<string, string>)((string {|fieldinit:$$x|}) => {return {|fieldinit:x|}.ToUpper(); }) : (Func<string, string>)((string x) => {return x.ToLower(); }); } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="z") result.AssertLabeledSpansAre("fieldinit", "z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(633582, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/633582")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug633582_CSDoNotAddParenthesesInExpansionForParenthesizedBinaryExpression(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System.Linq; class Program { void aaa() { var bbb = from x in new[] { 1, 2, 3 } where ((1 + x > 'a')) join {|stmt:$$ddd|} in new[] { 5, 2, 9, 4, } on 7 equals {|stmt:ddd|} + 5 into eee select eee; } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="xxx") result.AssertLabeledSpansAre("stmt", "xxx", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(622086, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/622086")> <Theory(Skip:="https://github.com/dotnet/roslyn/issues/9412")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameExplicitInterfaceImplementation(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ namespace X { interface [|$$IGoo|] { void Clone(); } class Baz : [|IGoo|] { void [|IGoo|].Clone() { } } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="IGooEx") End Using End Sub <WorkItem(8139, "https://github.com/dotnet/roslyn/issues/8139")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExplicitInterfaceImplementationFromDifferentProject(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <ProjectReference>Project2</ProjectReference> <Document> class Program { static void Main(string[] args) { Test(new Class1()); } static void Test(IInterface i) { i.[|M|](); } } </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <Document> public class Class1 : IInterface { void IInterface.[|$$M|]() { } // Rename 'M' from here } public interface IInterface { void [|M|](); } </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub <WorkItem(529803, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529803")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingEventCascadesToCSUsingEventHandlerDelegate(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|$$X|]() ' Rename X to Y End Interface Class C Implements IA Public Event [|X|] As IA.{|handler:XEventHandler|} Implements IA.[|X|] End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class Program : IA { event IA.{|handler:XEventHandler|} IA.[|X|] { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529803, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529803")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|X|]() ' Rename X to Y End Interface Class C Implements IA Dim A As IA.{|handler:XEventHandler|} Public Event [|$$X|] Implements IA.[|X|] End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class Program : IA { event IA.{|handler:XEventHandler|} IA.[|X|] { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529803, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529803")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|X|]() ' Rename X to Y End Interface Class C Implements IA Public Event [|X|] As IA.{|handler:XEventHandler|} Implements IA.[|X|] End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class Program : IA { event IA.{|handler:$$XEventHandler|} IA.[|X|] { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(655621, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/655621")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|$$X|]() ' Rename X to Y End Interface </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class C { object x = new IA.{|handler:XEventHandler|}(() => { }); } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(655621, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/655621")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_4(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|X|]() ' Rename X to Y End Interface </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class C { object x = new IA.{|handler:$$XEventHandler|}(() => { }); } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(655621, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/655621"), WorkItem(762094, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/762094")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_5(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|X|]() ' Rename X to Y End Interface </Document> </Project> <Project Language="Visual Basic" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> Imports System Class C public x as new IA.{|handler:$$XEventHandler|}( Sub() Console.WriteLine() ) Class C </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameVarNotSupported(host As RenameTestHost) Dim result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System; namespace X { class Baz { void M() { [|$$var|] x = new Int32(); } } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="Int32", expectFailure:=True) End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameCustomTypeNamedVarSupported(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System; namespace X { class [|var|] {} class Baz { void M() { {|stmt:$$var|} x = new {|stmt:var|}();; } } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="bar") result.AssertLabeledSpansAre("stmt", "bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameDynamicNotSupported(host As RenameTestHost) Dim result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System; namespace X { class Baz { void M() { [|$$dynamic|] x = new Int32(); } } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="Int32", expectFailure:=True) End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameToVarNotSupportedNoConflictsWithOtherVar(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:Program|} { static void Main(string[] args) { {|Conflict:$$Program|} x = null; var y = 23; } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="var") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameToDynamicNotSupported(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:Program|} { static void Main(string[] args) { {|Conflict:$$Program|} x = null; } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="dynamic") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameToDynamicNotSupported2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:Program|} { static void Main(string[] args) { {|Conflict:$$Program|} x = null; dynamic y = 23; } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="dynamic") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameToDynamicSupportedButConflictsWithOtherDynamic_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:Program|} { static void Main(string[] args) { {|Conflict:$$Program|} x = null; dynamic y = new {|Conflict:Program|}(); } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="dynamic") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(608988, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/608988")> <WorkItem(608989, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/608989")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNamespaceInVbFromCSharReference(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Namespace [|N|] Public Class X End Class End Namespace </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class Y : [|$$N|].X { } </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub #Region "Cref" <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeFromCref(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ class [|Program|] { /// <see cref="[|$$Program|]"/> to start the program. static void Main(string[] args) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeFromCref_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document> <![CDATA[ Class [|Program|] ''' <see cref="[|$$Program|]"/> to start the program. Private Shared Sub Main(args As String()) End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Y") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMemberFromCref(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ class Program { /// <see cref="Program.[|$$Main|]"/> to start the program. static void [|Main|](string[] args) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMemberFromCref_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document> <![CDATA[ Class Program ''' <see cref="Program.[|$$Main|]"/> to start the program. Private Shared Sub [|Main|](args As String()) End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Y") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefFromMember(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ class Program { /// <see cref="Program.[|Main|]"/> to start the program. static void [|$$Main|](string[] args) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefFromMember_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document> <![CDATA[ Class Program ''' <see cref="Program.[|Main|]"/> to start the program. Private Shared Sub [|$$Main|](args As String()) End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <WorkItem(546952, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546952")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIncludingCrefContainingAttribute(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ using System; /// <summary> /// <see cref="{|yAttribute:GooAttribute|}" /> /// </summary> [{|y:Goo|}] class {|yAttribute:G$$ooAttribute|} : Attribute { } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="yAttribute") result.AssertLabeledSpansAre("yAttribute", replacement:="yAttribute", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("y", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(546952, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546952")> <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIncludingCrefContainingAttribute_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document> <![CDATA[ ''' <summary> ''' <see cref="{|YAttribute:$$GooAttribute|}" /> ''' </summary> <{|Y:Goo|}> Class {|YAttribute:GooAttribute|} Inherits Attribute End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="YAttribute") result.AssertLabeledSpansAre("YAttribute", replacement:="YAttribute", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("Y", replacement:="Y", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(546952, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546952")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameFromCrefContainingAttribute(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ using System; /// <summary> /// <see cref="{|yAttribute:GooA$$ttribute|}" /> /// </summary> [{|y:Goo|}] class {|yAttribute:GooAttribute|} : Attribute { } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="yAttribute") result.AssertLabeledSpansAre("yAttribute", replacement:="yAttribute", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("y", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(546952, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546952"), WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameFromCrefContainingAttribute_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document FilePath="Test.vb"> <![CDATA[ Imports System ''' <summary> ''' <see cref="{|yAttribute:GooA$$ttribute|}" /> ''' </summary> <{|y:Goo|}> Class {|yAttribute:GooAttribute|} : Inherits Attribute End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="yAttribute") result.AssertLabeledSpansAre("yAttribute", replacement:="yAttribute", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("y", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(531015, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531015")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefTypeParameter(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ /// <see cref="C{[|$$T|]}.M({|Conflict:T|})"/> class C<T> { } ]]></Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(640373, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/640373")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Tester { private int {|Resolve:$$x|}; /// <summary> /// <see cref="Tester.{|Resolve:x|}"/> /// </summary> public int X { get { return {|Resolve:x|}; } set { {|Resolve:x|} = value; } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="if") result.AssertLabeledSpecialSpansAre("Resolve", "@if", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(640373, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/640373")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class Tester Private {|Resolve1:$$_x|} As Integer ''' <summary> ''' <see cref="Tester.{|Resolve2:_x|}"/> ''' </summary> Public Property X As Integer Get Return {|Resolve1:_x|}; End Get Set {|Resolve1:_x|} = value; End Set End Property End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="If") result.AssertLabeledSpecialSpansAre("Resolve1", "[If]", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("Resolve2", "If", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Tester { private int [|$$x|]; /// <summary> /// <see cref="[|x|]"/> /// </summary> public int X { get { return {|Stmt1:x|}; } set { {|Stmt2:x|} = value; } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("Stmt1", "y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("Stmt2", "y", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref2_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class Tester Private [|$$_x|] As Integer ''' <summary> ''' <see cref="[|_x|]"/> ''' </summary> Public Property X As Integer Get Return {|Stmt1:_x|} End Get Set {|Stmt2:_x|} = value End Set End Property End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("Stmt1", "y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("Stmt2", "y", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C<[|$$T|]> { /// <summary> /// <see cref="C{T}"/> /// </summary> /// <param name="x"></param> void Goo(C<dynamic> x, C<string> y) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref3_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class C(Of [|$$T|]) ''' <summary> ''' <see cref="C(Of [|T|])"/> ''' </summary> ''' <param name="x"></param> Sub Goo(x As C(Of Object), y As C(Of String)) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref4(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C<T> { /// <summary> /// <see cref="C{[|$$T|]}"/> /// <see cref="C{T}.Bar(T)" /> /// </summary> /// <param name="x"></param> void Goo(C<dynamic> x, C<string> y) { } void Bar(T x) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref4_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class C(Of [|T|]) ''' <summary> ''' <see cref="C(Of [|$$T|])"/> ''' <see cref="C(Of [|T|]).Bar(Of [|T|])" /> ''' </summary> ''' <param name="x"></param> Sub Goo(x As C(Of Object), y As C(Of String)) End Sub Sub Bar(x As [|T|]) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref5(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Resolve:C|}<T> { /// <summary> /// <see cref="{|Resolve:C|}{T}"/> /// </summary> /// <param name="x"></param> void Goo({|Resolve:$$C|}<dynamic> x, {|Resolve:C|}<string> y) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="string") result.AssertLabeledSpecialSpansAre("Resolve", "@string", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref5_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class {|Resolve:C|}(Of T) ''' <summary> ''' <see cref="{|Resolve:C|}(Of T)"/> ''' </summary> ''' <param name="x"></param> Sub Goo(x As {|Resolve:$$C|}(Of Object), y As {|Resolve:C|}(Of String)) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="String") result.AssertLabeledSpecialSpansAre("Resolve", "[String]", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref6(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace Test { /// <summary> /// <seealso cref="global::[|$$C|]"/> /// </summary> class C { void Goo() { } } } class [|C|] { }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref6_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Namespace Test ''' <summary> ''' <seealso cref="Global.[|$$C|]"/> ''' </summary> Class C Sub Goo() End Sub End Class End Namespace Class [|C|] End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref7(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace Test { /// <summary> /// <see cref="P"/> /// <see cref="P.[|K|]"/> /// </summary> public class C { /// <summary> /// <see cref="P"/> /// <see cref="[|K|]"/> /// </summary> public class P { /// <summary> /// <see cref="[|$$K|]"/> /// </summary> public class [|K|] { } } } /// <summary> /// <see cref="C.P.[|K|]"/> /// </summary> public class P { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="C") End Using End Sub <Theory(), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref7_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Namespace Test ''' <summary> ''' <see cref="P"/> ''' <see cref="P.[|K|]"/> ''' </summary> Class C ''' <summary> ''' <see cref="P"/> ''' <see cref="[|K|]"/> ''' </summary> Class P ''' <summary> ''' <see cref="[|$$K|]"/> ''' </summary> Class [|K|] End Class End Class End Class ''' <summary> ''' <see cref="C.P.[|K|]"/> ''' </summary> Class P End Class End Namespace]]> </Document> </Project> </Workspace>, host:=host, renameTo:="C") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref8(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I { void [|Bar|](); } abstract class C { public abstract void [|Bar|](); } class B : C, I { /// <summary> /// <see cref="I.[|Bar|]()"/> /// <see cref="[|$$Bar|]()"/> /// <see cref="C.[|Bar|]()"/> /// </summary> public override void [|Bar|]() { throw new NotImplementedException(); } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub <Theory(), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref8_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Interface I Sub [|Bar|] End Interface MustInherit Class C Public MustOverride Sub [|Bar|]() End Class Class B : Inherits C : Implements I ''' <summary> ''' <see cref="I.[|Bar|]()"/> ''' <see cref="[|$$Bar|]()"/> ''' <see cref="B.[|Bar|]()"/> ''' <see cref="C.[|Bar|]()"/> ''' </summary> Public Overrides Sub [|Bar|]() Implements I.[|Bar|] Throw new NotImplementedException() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub <WpfTheory(Skip:="640502"), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref9(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I { void [|Goo|](); } abstract class C { public void [|Goo|]() { } } class B : C, I { /// <summary> /// <see cref="I.[|Goo|]()"/> /// <see cref="[|Goo|]()"/> /// <see cref="C.[|Goo|]()"/> /// </summary> public void Bar() { [|$$Goo|](); } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Baz") End Using End Sub <Theory(), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref9_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Interface I Sub {|Interface:Goo|}() End Interface MustInherit Class C Public Sub [|Goo|]() End Sub End Class Class B : Inherits C : Implements I ''' <summary> ''' <see cref="I.{|Interface:Goo|}()"/> ''' <see cref="[|Goo|]()"/> ''' <see cref="C.[|Goo|]()"/> ''' </summary> Public Sub Bar() Implements I.Goo [|$$Goo|]() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Baz") result.AssertLabeledSpansAre("Interface", "Goo") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref10(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { delegate void [|$$Del|](int x); /// <summary> /// <see cref="[|Del|]"/> /// <see cref="B.Del" /> /// </summary> void Goo() { [|Del|] d; } class B { /// <summary> /// <see cref="C.[|Del|]"/> /// </summary> /// <param name="x"></param> delegate void Del(int x); } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bel") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref10_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class C Delegate Sub [|$$Del|](x As Integer) ''' <summary> ''' <see cref="[|Del|]"/> ''' <see cref="B.Del" /> ''' </summary> Sub Goo() Dim d As [|Del|] End Sub Class B ''' <summary> ''' <see cref="C.[|Del|]"/> ''' </summary> ''' <param name="x"></param> Delegate Sub Del(x As Integer) End Class End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bel") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref11(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class Test { /// <summary> /// <see cref="[|P|]"/> /// </summary> /// <param name="x"></param> public delegate void Del(int x); public event Del [|P|]; void Sub() { [|$$P|](1); } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bel") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref11_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class Test ''' <summary> ''' <see cref="[|P|]"/> ''' </summary> Public Event [|P|](x As Integer) Sub Subroutine() RaiseEvent [|$$P|](1) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bel") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref12(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { /// <summary> /// <see cref="{|resolve:Bar|}"></see> /// </summary> /// <param name="args"></param> static void Main(string[] args) { } static void [|$$Goo|]() { } } class Bar { }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("resolve", "global::Bar", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref12_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class Program ''' <summary> ''' <see cref="{|resolve:Bar|}"></see> ''' </summary> ''' <param name="args"></param> Shared Sub Main(args As String()) End Sub Shared Sub [|$$Goo|]() End Sub End Class Class Bar End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("resolve", "Global.Bar", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref13(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { /// <summary> /// <see cref="{|resolve:Bar|}"></see> /// </summary> /// <param name="args"></param> static void Main(string[] args) { } public class [|$$Baz|] { } } public class Bar { }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("resolve", "global::Bar", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref13_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class Program ''' <summary> ''' <see cref="{|resolve:Bar|}"></see> ''' </summary> ''' <param name="args"></param> Shared Sub Main(args As String()) End Sub Public Class [|$$Baz|] End Class End Class Public Class Bar End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("resolve", "Global.Bar", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref14(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ public class A { public class B { public class C { /// <summary> /// <see cref=" {|resolve:D|}"/> /// </summary> static void [|$$goo|]() { } } public class D { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") result.AssertLabeledSpansAre("resolve", "B.D", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref14_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Public Class A Public Class B Public Class C ''' <summary> ''' <see cref="{|resolve:D|}"/> ''' </summary> Shared Sub [|$$goo|]() End Sub End Class Public Class D End Class End Class End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") result.AssertLabeledSpansAre("resolve", "B.D", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673562, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673562")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref15(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class C { /// <summary> /// <see cref="{|Resolve:N|}.C"/> /// </summary> void Sub() { } } namespace [|$$K|] // Rename K to N { class C { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") result.AssertLabeledSpansAre("Resolve", "global::N", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673562, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673562")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref15_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Namespace N Class C ''' <summary> ''' <see cref="{|Resolve:N|}.C"/> ''' </summary> Sub Subroutine() End Sub End Class Namespace [|$$K|] ' Rename K to N Class C End Class End Namespace End Namespace]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") result.AssertLabeledSpansAre("Resolve", "Global.N.C", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673667, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673667"), WorkItem(760850, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/760850")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref17(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class P { /// <summary> /// <see cref="[|b|]"/> /// </summary> Action<int> [|$$b|] = (int x) => { }; // Rename b to a class B { /// <summary> /// <see cref="{|Resolve:b|}"/> /// </summary> void a() { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="a") result.AssertLabeledSpansAre("Resolve", "P.a", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(673667, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673667"), WorkItem(760850, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/760850")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref17_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class P ''' <summary> ''' <see cref="[|_b|]"/> ''' </summary> Private [|$$_b|] As Action(Of Integer) = Sub(x As Integer) End Sub ' Rename _b to a Class B ''' <summary> ''' <see cref="{|Resolve:_b|}"/> ''' </summary> Sub a() End Sub End Class End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="a") result.AssertLabeledSpansAre("Resolve", "P.a", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(673667, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673667")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref18(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { using K = {|Resolve:N|}.C; class C { } /// <summary> /// <see cref="[|D|]"/> /// </summary> class [|$$D|] { class C { [|D|] x; } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") result.AssertLabeledSpansAre("Resolve", "global::N", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithUsing1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using R1 = N1.C1; namespace N1 { class C1 { public class C2 { } } namespace N2 { /// <summary> /// <see cref="{|Resolve:R1|}.C2"/> /// </summary> class [|$$K|] { class C2 { } } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R1") result.AssertLabeledSpansAre("Resolve", "C1", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithUsing1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports R1 = N1.C1 Namespace N1 Class C1 Public Class C2 End Class End Class Namespace N2 ''' <summary> ''' <see cref="{|Resolve:R1|}.C2"/> ''' </summary> Class [|$$K|] Private Class C2 End Class End Class End Namespace End Namespace ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R1") result.AssertLabeledSpansAre("Resolve", "C1.C2", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithUsing2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using R1 = N1; namespace N1 { public class C1 { public class C2 { } } } namespace N2 { class N1 { class C2 { /// <summary> /// <see cref="{|Resolve:R1|}.C1.C2"/> /// </summary> class C3 { } class [|$$K|] { } } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R1") result.AssertLabeledSpansAre("Resolve", "global::N1", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(767163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767163")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithUsing2_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports R1 = N1 Namespace N1 Public Class C1 Public Class C2 End Class End Class End Namespace Namespace N2 Class N1 Class C2 ''' <summary> ''' <see cref="{|Resolve:R1|}.C1.C2"/> ''' </summary> Class C3 End Class Class [|$$K|] End Class End Class End Class End Namespace ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R1") result.AssertLabeledSpansAre("Resolve", "Global.N1.C1.C2", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithInterface(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { interface [|I|] { void Goo(); } class C : [|I|] { /// <summary> /// <see cref="{|Resolve:$$I|}.Goo"/> /// </summary> public void Goo() { } class K { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Resolve", "N.K", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(767163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767163")> <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithInterface_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Namespace N Interface [|I|] Sub Goo() End Interface Class C : Implements {|Resolve1:I|} ''' <summary> ''' <see cref="{|Resolve2:$$I|}.Goo"/> ''' </summary> Public Sub Goo(host as TestHost) Implements {|Resolve1:I|}.Goo End Sub Class K End Class End Class End Namespace]]> </Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Resolve1", "N.K", RelatedLocationType.ResolvedReferenceConflict) result.AssertLabeledSpansAre("Resolve2", "N.K.Goo", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefCrossAssembly(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <ProjectReference>VBAssembly</ProjectReference> <Document><![CDATA[ class D : [|N|].C { /// <summary> /// <see cref="{|Resolve:N|}.C.Goo"/> /// </summary> public void Sub() { Goo(); } class R { class C { public void Goo() { } } } }]]> </Document> </Project> <Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBAssembly"> <Document> Namespace [|$$N|] Public Class C Public Sub Goo() End Sub End Class End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="R") result.AssertLabeledSpansAre("Resolve", "global::R", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(767163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767163")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefCrossAssembly_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <ProjectReference>CSAssembly</ProjectReference> <Document><![CDATA[ Class D : Inherits {|Resolve1:N|}.C ''' <summary> ''' <see cref="{|Resolve2:N|}.C.Goo"/> ''' </summary> Public Sub Subroutine() Goo() End Sub Class R Class C Public Sub Goo() End Sub End Class End Class End Class]]> </Document> </Project> <Project Language="C#" CommonReferences="true" AssemblyName="CSAssembly"> <Document><![CDATA[ namespace [|$$N|] { public class C { public void Goo() { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R") result.AssertLabeledSpansAre("Resolve1", "Global.R", RelatedLocationType.ResolvedReferenceConflict) result.AssertLabeledSpansAre("Resolve2", "Global.R.C.Goo", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(673809, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673809")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructorInsideCref1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class [|P|] { /// <summary> /// <see cref="[|P|].[|P|]"/> /// </summary> static [|$$P|]() { } /// <summary> /// <see cref="[|P|].[|P|]"/> /// </summary> public [|P|]() { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Q") End Using End Sub <WorkItem(673809, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673809")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructorInsideCref1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class [|$$P|] ''' <summary> ''' <see cref="[|P|].New()"/> ''' </summary> Shared Sub New() End Sub ''' <summary> ''' <see cref="[|P|].New()"/> ''' </summary> Public Sub New() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Q") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructorInsideCref2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class [|P|] { /// <summary> /// <see cref="[|P|].[|$$P|]"/> /// </summary> static [|P|]() { } /// <summary> /// <see cref="[|P|].[|P|]"/> /// </summary> public [|P|]() { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Q") End Using End Sub <WorkItem(673809, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673809")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructorInsideCref2_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class [|P|] ''' <summary> ''' <see cref="[|P|].New()"/> ''' </summary> Shared Sub New() End Sub ''' <summary> ''' <see cref="[|$$P|].New()"/> ''' </summary> Public Sub New() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Q") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInheritanceCref1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class P { public int y; } class Q : P { int [|$$x|]; /// <summary> /// <see cref="y"/> /// </summary> void Sub() { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInheritanceCref1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class P Public y As Integer End Class Class Q : Inherits P Private [|$$x|] As Integer ''' <summary> ''' <see cref="{|Resolve:y|}"/> ''' </summary> Sub Subroutine() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("Resolve", "P.y", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673858, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673858"), WorkItem(666167, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/666167")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameGenericTypeCrefWithConflict(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { using K = C<int>; class C<T> { /// <summary> /// <see cref="C{T}"/> /// </summary> /// <typeparam name="T"></typeparam> class D<T> { /// <summary> /// <see cref="{|Resolve:K|}.D{int}"/> /// </summary> /// <typeparam name="P"></typeparam> class [|$$C|] // Rename C To K { class D<T> { } } class C<T> { } } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Resolve", "N.C{int}", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673858, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673858"), WorkItem(666167, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/666167"), WorkItem(768000, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768000")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameGenericTypeCrefWithConflict_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports K = N.C(Of Integer) Namespace N Class C(Of T) ''' <summary> ''' <see cref="C(Of T)"/> ''' </summary> ''' <typeparam name="T"></typeparam> Class D(Of T) ''' <summary> ''' <see cref="{|Resolve:K|}.D(Of Integer)"/> ''' </summary> ''' <typeparam name="P"></typeparam> Class [|$$C|] ' Rename C To K Class D(Of T) End Class End Class Class C(Of T) End Class End Class End Class End Namespace]]> </Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Resolve", "N.C(Of Integer).D(Of Integer)", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub #End Region <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNestedNamespaceToParent1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { namespace [|$$K|] { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") End Using End Sub <WorkItem(673641, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673641")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNestedNamespaceToParent2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class C { void Goo() { {|Resolve:N|}.C x; } } namespace [|$$K|] { class C { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") result.AssertLabeledSpansAre("Resolve", "global::N.C x;", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673809, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673809")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class [|Simple|] { static [|$$Simple|]() // Rename simple here to p { } public [|Simple|]() { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P") End Using End Sub <WorkItem(675882, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/675882")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub SingleOnlyLocalDeclarationInsideLambdaRecurseInfinitely(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Module Lambdas Sub Main() End Sub Public l1 = Sub() Dim x = 1 End Sub Public L3 = Function([|x|] As Integer) [|$$x|] Mod 2 End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="xx") End Using End Sub <WorkItem(641231, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/641231")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameDontReplaceBaseConstructorToken_CSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class [|A|] {} class B : [|A|] { public B() : base() { } } class Program { static void Main() { [|$$A|] a = new B(); } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P") End Using End Sub <WorkItem(641231, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/641231")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameDontReplaceBaseConstructorToken_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Module Program Sub Main(args As String()) Dim Asa As [|$$A|] = New B() End Sub End Module Class [|A|] End Class Class B Inherits [|A|] Public Sub New() MyBase.New() End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(674762, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/674762")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMergedNamespaceAcrossProjects(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Namespace [|$$N|] Public Class X End Class End Namespace ]]> </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class Y : [|N|].X { } namespace [|N|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(674764, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/674764")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMergedNamespaceAcrossProjects_1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Namespace [|N|] Public Class X End Class End Namespace ]]> </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class Y : [|$$N|].X { } namespace [|N|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(716278, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/716278")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMainWithoutAssertFailureVB(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Linq Module Program Sub [|$$Main|](args As String()) End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(716278, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/716278")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMainWithoutAssertFailureCSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; class Program { static void [|$$Main|](string[] args) { } } </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(719062, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/719062")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameEscapedIdentifierToUnescapedIdentifier(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Linq Module Program Sub Main(args As String()) Dim [|[dim]$$|] = 4 End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(719062, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/719062")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameEscapedIdentifierToUnescapedIdentifierKeyword(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Linq Module Program Sub Main(args As String()) Dim {|iden1:[dim]$$|} = 4 End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="do") result.AssertLabeledSpecialSpansAre("iden1", "[do]", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(767187, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767187")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameEscapedTypeNew(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Class [|[New]|] End Class Class C Public Sub F() Dim a = New [|$$[New]|] End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(767187, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767187")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameConstructorInCref(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ /// <see cref="[|C|].[|$$C|]"> class [|C|] { public [|C|]() {} } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(1009633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1009633")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameWithTryCatchBlock1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Class C Sub M() Dim [|$$msg|] = "hello" Try Catch Dim newMsg = [|msg|] End Try End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="msg2") End Using End Sub <WorkItem(1009633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1009633")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameWithTryCatchBlock2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Class C Sub M() Dim [|$$msg|] = "hello" Try Catch ex As Exception Dim newMsg = [|msg|] End Try End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="msg2") End Using End Sub <WorkItem(8297, "https://github.com/dotnet/roslyn/issues/8297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVBClassNamedNew(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Class [|[$$New]|] Sub New() End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="New2") End Using End Sub <WorkItem(25655, "https://github.com/dotnet/roslyn/issues/25655")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameClassWithNoCompilationProjectReferencingProject(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="NoCompilation" CommonReferences="false"> <ProjectReference>CSharpProject</ProjectReference> <Document> // a no-compilation document </Document> </Project> <Project Language="C#" AssemblyName="CSharpProject" CommonReferences="true"> <Document> public class [|$$A|] { public [|A|]() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="B") End Using End Sub #Region "Rename in strings/comments" <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStrings(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, False) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] ''' <summary> ''' Program PROGRAM! Program! ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) ' Program PROGRAM! Program! Dim renamed = {|RenameInString:"Program Program!"|} ' Program Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStrings_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, False) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { /// <summary> /// Program PROGRAM! Program! /// <Program></Program> /// </summary> public static void Main(string[] args) { // Program PROGRAM! Program! var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = "Program Program!" {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = "Program Program!"; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// NewProgram PROGRAM! NewProgram!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_XmlName(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ ''' <summary> ''' <{|RenameInComment:Program|}> </{|RenameInComment:Program|}> ''' </summary> Public Class [|$$Program|] End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment", "NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_XmlName2(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, False) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ ' Should not rename XmlName if not renaming in comments ''' <summary> ''' <Program> </Program> ''' </summary> Public Class [|$$Program|] End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) Assert.Equal(1, result.ConflictResolution.RelatedLocations.Count) End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_XmlName_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ /// <summary> /// <{|RenameInComment:Program|}> </{|RenameInComment:Program|}> /// </summary> public class [|$$Program|] { } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment", "NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_XmlName_CSharp2(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, False) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ // Should not rename XmlName if not renaming in comments /// <summary> /// <Program> </Program> /// </summary> public class [|$$Program|] { } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) Assert.Equal(1, result.ConflictResolution.RelatedLocations.Count) End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = {|RenameInString:"Program Program!"|} {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// NewProgram PROGRAM! NewProgram!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_SmallerReplacementString(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = {|RenameInString:"Program Program!"|} {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """P P!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' P") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_SmallerReplacementString_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """P P!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// P PROGRAM! P!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherSourceFile(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] End Module ]]> </Document> <Document><![CDATA[ Class AnotherFile ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = {|RenameInString:"Program Program!"|} {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """P P!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' P") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherSourceFile_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { } ]]> </Document> <Document><![CDATA[ public class AnotherFile { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// NewProgram PROGRAM! NewProgram!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherProject(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Public Class [|$$Program|] End Class ]]> </Document> </Project> <Project Language="Visual Basic" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document><![CDATA[ ' Renames should occur in referencing projects where rename symbol is accessible. Class ReferencingProject ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = {|RenameInString:"Program Program!"|} {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherProject_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { } ]]> </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document><![CDATA[ // Renames should occur in referencing projects where rename symbol is accessible. public class AnotherFile { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// NewProgram PROGRAM! NewProgram!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherProject2(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Namespace N Private Class [|$$Program|] End Class End Namespace ]]> </Document> </Project> <Project Language="Visual Basic" AssemblyName="ReferencingProjectButSymbolNotVisible" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document><![CDATA[ ' Renames should not occur in referencing projects where rename symbol is not accessible. ' Type "Program" is not accessible in this project Imports N Class ReferencingProjectButSymbolNotVisible ''' <summary> ''' Program PROGRAM! Program! ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) ' Program PROGRAM! Program! ' Program PROGRAM! Program! Dim renamed = "Program Program!" ' Program Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Class ]]> </Document> </Project> <Project Language="Visual Basic" AssemblyName="NotReferencingProject" CommonReferences="true"> <Document><![CDATA[ ' Renames should not occur in non-referencing projects. ' Type "Program" is not visible in this project Imports N Class NotReferencingProject ''' <summary> ''' Program PROGRAM! Program! ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) ' Program PROGRAM! Program! ' Program PROGRAM! Program! Dim renamed = "Program Program!" ' Program Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) Assert.Equal(1, result.ConflictResolution.RelatedLocations.Count) End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherProject_CSharp2(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ namespace N { private class [|$$Program|] { } } ]]> </Document> </Project> <Project Language="C#" AssemblyName="ReferencingProjectButSymbolNotVisible" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document><![CDATA[ // Renames should not occur in referencing projects where rename symbol is not accessible. // Type "Program" is not accessible in this project using N; public class ReferencingProjectButSymbolNotVisible { /// <summary> /// Program PROGRAM! Program! /// </summary> public static void Main(string[] args) { // Program PROGRAM! Program! var renamed = "Program Program!"; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> <Project Language="C#" AssemblyName="NotReferencingProject" CommonReferences="true"> <Document><![CDATA[ // Renames should not occur in non-referencing projects. // Type "Program" is not visible in this project public class NotReferencingProject { /// <summary> /// Program PROGRAM! Program! /// </summary> public static void Main(string[] args) { // Program PROGRAM! Program! var renamed = "Program Program!"; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) Assert.Equal(1, result.ConflictResolution.RelatedLocations.Count) End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_WithResolvableConflict(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module M Public Sub [|$$Goo|](Of T)(ByVal x As T) {|RenameInComment1:' Rename Goo to Bar|} End Sub End Module Class C Public Sub Bar(ByVal x As String) End Sub Class M Public Shared Bar As Action(Of String) = Sub(ByVal x As String) End Sub End Class Public Sub Test() {|stmt1:Goo|}("1") {|RenameInComment2:' Goo GOO! Goo!|} Dim renamed = {|RenameInString:"Goo Goo!"|} {|RenameInComment3:' Goo|} Dim notRenamed = "GOO! Goo1 GooGoo" End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar", changedOptionSet:=renamingOptions) result.AssertLabeledSpansAre("stmt1", "Call Global.M.Bar(""1"")", RelatedLocationType.ResolvedReferenceConflict) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", "' Rename Bar to Bar") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """Bar Bar!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' Bar GOO! Bar!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' Bar") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_WithResolvableConflict_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class Goo { int goo; void Blah(int [|$$bar|]) { {|stmt2:goo|} = {|stmt1:bar|}; {|RenameInComment:// bar BAR! bar!|} var renamed = {|RenameInString:"bar bar!"|}; var notRenamed = "BAR! bar1 barbar"; } } End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="goo", changedOptionSet:=renamingOptions) result.AssertLabeledSpansAre("stmt1", "this.goo = goo;", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", "this.goo = goo;", RelatedLocationType.ResolvedNonReferenceConflict) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """goo goo!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment", "// goo BAR! goo!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_WithUnresolvableConflict(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Option Explicit Off Module Program Function [|$$Goo|] {|Conflict:Bar|} = 1 {|RenameInComment1:' Goo GOO! Goo!|} Dim renamed = {|RenameInString:"Goo Goo!"|} {|RenameInComment2:' Goo|} Dim notRenamed = "GOO! Goo1 GooGoo" End Function End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar", changedOptionSet:=renamingOptions) result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """Bar Bar!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", "' Bar GOO! Bar!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' Bar") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_WithUnresolvableConflict_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:goo|} { int [|$$bar|]; {|RenameInComment:// bar BAR! bar!|} var renamed = {|RenameInString:"bar bar!"|}; var notRenamed = "BAR! bar1 barbar"; } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="goo", changedOptionSet:=renamingOptions) result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """goo goo!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment", "// goo BAR! goo!") End Using End Sub #End Region #Region "Rename In NameOf" <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMethodWithNameof_NoOverloads_CSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class C { void [|$$M|]() { nameof([|M|]).ToString(); } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Mo") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMethodWithNameof_WithOverloads_CSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class C { void [|$$M|]() { nameof(M).ToString(); } void M(int x) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Mo") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMethodWithNameof_WithOverloads_WithRenameOverloadsOption_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameOverloads, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class C { void [|$$M|]() { nameof([|M|]).ToString(); } void [|M|](int x) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Mo", changedOptionSet:=renamingOptions) End Using End Sub #End Region <WpfTheory> <WorkItem(28474, "https://github.com/dotnet/roslyn/issues/28474")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub HandleProjectsWithoutCompilations(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpProject" CommonReferences="true"> <Document> public interface IGoo { void [|$$Goo|](); } public class C : IGoo { public void [|Goo|]() {} } </Document> </Project> <Project Language="NoCompilation" CommonReferences="false"> <ProjectReference>CSharpProject</ProjectReference> <Document> // a no-compilation document </Document> </Project> </Workspace>, host:=host, renameTo:="Cat") End Using End Sub <WorkItem(44070, "https://github.com/dotnet/roslyn/issues/44070")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeParameterFromCRef(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { /// <summary> /// <see cref="Goo{$${|Complex:{|unresolved:X|}|}}(X)"/> /// </summary> void Goo<T>(T t) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") result.AssertLabeledSpansAre("Complex", "C.Goo{D}(X)", RelatedLocationType.UnresolvedConflict) End Using End Sub End Class End Namespace
' 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. Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.Remote.Testing Imports Microsoft.CodeAnalysis.Rename Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename ''' <summary> ''' This test class contains tests which verifies that the rename engine performs correct ''' refactorings that do not break user code. These tests call through the ''' Renamer.RenameSymbol entrypoint, and thus do not test any behavior with interactive ''' rename. The position given with the $$ mark in the tests is just the symbol that is renamed; ''' there is no fancy logic applied to it. ''' </summary> <[UseExportProvider]> Partial Public Class RenameEngineTests Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper Public Sub New(outputHelper As Abstractions.ITestOutputHelper) _outputHelper = outputHelper End Sub <WorkItem(543661, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543661")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CannotRenameNamespaceAlias(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using [|sys|] = System; class Program { static void Main(string[] args) { [|$$sys|].Console.Write("test"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Sys2") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInaccessibleMember1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void Main() { D.[|field|] = 8; } } class D { private static int [|$$field|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="_field") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInaccessibleMember2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void Main() { D.[|$$field|] = 8; } } class D { private static int [|field|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="_field") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNonAttribute1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [[|NotAnAttribute|]] class C { } class [|$$NotAnAttribute|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNonAttribute2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> [[|$$NotAnAttribute|]] class C { } class [|NotAnAttribute|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameWrongArity1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|$$List|]&lt;T&gt; { } class C { [|List|]&lt;int,string&gt; list; } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameWrongArity2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|List|]&lt;T&gt; { } class C { [|$$List|]&lt;int,string&gt; list; } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNotCreatable1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> abstract class [|A|] { } class C { void M() { var v = new [|$$A|](); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNotCreatable2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> abstract class [|$$A|] { } class C { void M() { var v = new [|A|](); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocable1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void M() { var [|$$v|] = ""; {|unresolved:v|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") result.AssertLabeledSpansAre("unresolved", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocable2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void M() { var [|v|] = ""; {|unresolved:$$v|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") result.AssertLabeledSpansAre("unresolved", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticInstance1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { static void M() { var v = [|$$N|]; } int [|N|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(4904, "https://github.com/dotnet/roslyn/issues/4904")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticInstance2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { static void M() { var v = [|N|]; } int [|$$N|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <WorkItem(813409, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/813409")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeDoesNotRenameGeneratedConstructorCalls(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> struct [|$$Type|] { [|Type|](int x) : this() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="U") End Using End Sub <WorkItem(856078, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/856078")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub UnmodifiedDocumentsAreNotCheckedOutBySourceControl(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document FilePath="Test1.cs"> class C { int [|$$abc|] = 5; } </Document> <Document FilePath="Test2.cs"> class C2 { int abc = 5; } </Document> </Project> </Workspace>, host:=host, renameTo:="def") Dim originalDocument = result.ConflictResolution.OldSolution.Projects.First().Documents.Where(Function(d) d.FilePath = "Test2.cs").Single() Dim newDocument = result.ConflictResolution.NewSolution.Projects.First().Documents.Where(Function(d) d.FilePath = "Test2.cs").Single() Assert.Same(originalDocument.State, newDocument.State) Assert.Equal(1, result.ConflictResolution.NewSolution.GetChangedDocuments(result.ConflictResolution.OldSolution).Count) End Using End Sub <WorkItem(773400, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/773400")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub ReferenceConflictInsideDelegateLocalNotRenamed(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { public delegate void Goo(int x); public void GooMeth(int x) { } public void Sub() { Goo {|DeclConflict:x|} = new Goo(GooMeth); int [|$$z|] = 1; // Rename z to x x({|unresolve2:z|}); } } </Document> </Project> </Workspace>, host:=host, renameTo:="x") result.AssertLabeledSpansAre("DeclConflict", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("unresolve2", "x", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(773673, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/773673")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMoreThanOneTokenInUnResolvedStatement(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class {|DeclConflict:C|} { public void Sub() { {|unresolve1:D|} d = new {|unresolve2:D|}(); } } class {|unresolve3:$$D|} // Rename to C { } </Document> </Project> </Workspace>, host:=host, renameTo:="C") result.AssertLabeledSpansAre("DeclConflict", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("unresolve1", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("unresolve2", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("unresolve3", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocationExpressionAcrossProjects(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test1.cs"> public class [|$$ClassA|] { public static void Bar() { } } </Document> </Project> <Project Language="C#" CommonReferences="true"> <ProjectReference>CSharpAssembly</ProjectReference> <Document FilePath="Test2.cs"> public class B { void goo() { [|ClassA|].Bar(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="A") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocationExpressionAcrossProjectsWithPartialClass(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test1.cs"> public partial class [|$$ClassA|] { public static void Bar() { } } public partial class [|ClassA|] { } </Document> </Project> <Project Language="C#" CommonReferences="true"> <ProjectReference>CSharpAssembly</ProjectReference> <Document FilePath="Test2.cs"> public class B { void goo() { [|ClassA|].Bar(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="A") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInvocationExpressionAcrossProjectsWithConflictResolve(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test1.cs"> namespace X { public class [|$$ClassA|] { public {|resolve:A|}.B B; public static void Bar() { } } } namespace A { public class B { } } </Document> </Project> <Project Language="C#" CommonReferences="true"> <ProjectReference>CSharpAssembly</ProjectReference> <Document FilePath="Test2.cs"> using X; public class B { void goo() { {|resolve2:ClassA|}.Bar(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="A") result.AssertLabeledSpansAre("resolve", "global::A", RelatedLocationType.ResolvedNonReferenceConflict) result.AssertLabeledSpansAre("resolve2", "X.A.Bar();", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RollBackExpandedConflicts_WithinInvocationExpression(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; class Program { static void Main(string[] {|conflict1:a|}) { var [|$$b|] = Convert.{|conflict3:ToDouble|}({|conflict2:a|}[0]); } } </Document> </Project> </Workspace>, host:=host, renameTo:="a") result.AssertLabeledSpansAre("conflict1", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("conflict2", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("conflict3", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RollBackExpandedConflicts_WithinQuery(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Dim [|$$x|] As String() ' rename x to y Dim {|conflict1:y|} = From x In {|conflict2:x|} Select x End Class </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("conflict1", "y", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("conflict2", "y", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameOverloadCSharp(host As RenameTestHost) Dim changingOptions = New Dictionary(Of OptionKey, Object)() changingOptions.Add(RenameOptions.RenameOverloads, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; class Program { public void [|$$goo|]() { [|goo|](); } public void [|goo|]&lt;T&gt;() { [|goo|]&lt;T&gt;(); } public void [|goo|](int i) { [|goo|](i); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz", changedOptionSet:=changingOptions) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameOverloadVisualBasic(host As RenameTestHost) Dim changingOptions = New Dictionary(Of OptionKey, Object)() changingOptions.Add(RenameOptions.RenameOverloads, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Imports System.Collections.Generic Imports System.Linq Public Class Program Sub Main(args As String()) End Sub Public Sub [|$$goo|]() [|goo|]() End Sub Public Sub [|goo|](Of T)() [|goo|](Of T)() End Sub Public Sub [|goo|](s As String) [|goo|](s) End Sub Public Shared Sub [|goo|](d As Double) [|goo|](d) End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz", changedOptionSet:=changingOptions) End Using End Sub <Theory, WorkItem(761929, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/761929"), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub ConflictCheckInInvocationCSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication5 { class [|$$Program2|] { private static Func&lt;[|Program2|], bool> func = null; private static void Main23(object v) { func(new [|Program2|]()); } } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <Theory, WorkItem(761922, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/761922"), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub ConflictCheckInInvocationVisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Imports System.Collections.Generic Imports System.Linq Namespace ns Class [|Program2|] Private Shared func As Func(Of [|Program2|], Boolean) = Nothing Private Shared Sub Main2343(args As String()) func(New [|$$Program2|]()) End Sub End Class End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameType(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|$$Goo|] { void Blah() { {|stmt1:Goo|} f = new {|stmt1:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeAcrossFiles(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|$$Goo|] { void Blah() { {|stmt1:Goo|} f = new {|stmt1:Goo|}(); } } </Document> <Document> class FogBar { void Blah() { {|stmt2:Goo|} f = new {|stmt2:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeAcrossFiles_WithoutCommonReferences(host As RenameTestHost) ' without a reference to mscorlib, compiler can't find types like System.Void. This causes it to have ' overload resolution errors for `new Goo();` which causes rename to not update the constructor calls. This ' should not normally ever hit a realistic user scenario. The test exists just to document our behavior ' here. Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#"> <Document> class [|$$Goo|] { void Blah() { {|stmt1:Goo|} f = new {|conflict:Goo|}(); } } </Document> <Document> class FogBar { void Blah() { {|stmt2:Goo|} f = new {|conflict:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeAcrossProjectsAndLanguages(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document> namespace N { public class [|$$Goo|] { void Blah() { {|csstmt1:Goo|} f = new {|csstmt1:Goo|}(); } } } </Document> </Project> <Project Language="Visual Basic" CommonReferences="true"> <ProjectReference>CSharpAssembly</ProjectReference> <Document> Imports N Class FogBar Sub Blah() Dim f = new {|vbstmt1:Goo|}() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("csstmt1", "BarBaz", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("vbstmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpTypeFromConstructorDefinition(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|Goo|] { [|$$Goo|]() { } void Blah() { {|stmt1:Goo|} f = new {|stmt1:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpTypeFromConstructorUse(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|Goo|] { [|Goo|]() { } void Blah() { {|stmt1:Goo|} f = new {|stmt1:$$Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", replacement:="Bar", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpTypeFromDestructor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|Goo|] { ~[|$$Goo|]() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpTypeFromSynthesizedConstructorUse(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class [|Goo|] { void Blah() { {|stmt1:Goo|} f = new {|stmt1:$$Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", replacement:="Bar", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpPredefinedTypeVariables1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { System.Int32 {|stmt1:$$goofoo|} = 23; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpPredefinedTypeVariables2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { Int32 {|stmt1:$$goofoo|} = 23; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpPredefinedTypeVariables3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { static void Main(string[] args) { int {|stmt1:$$fogbar|} = 45; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicPredefinedTypeVariables1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Module Program Sub Main(args As String()) Dim {|stmt1:$$a|} As System.Int32 = 1 End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicPredefinedTypeVariables2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Module Program Sub Main(args As String()) Dim {|stmt1:$$a|} As Int32 = 1 End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicPredefinedTypeVariables3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Module Program Sub Main(args As String()) Dim {|stmt1:$$a|} As Integer = 1 End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(539801, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539801")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpEnumMemberToContainingEnumName(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> enum Test { [|$$FogBar|], }; </Document> </Project> </Workspace>, host:=host, renameTo:="Test") End Using End Sub <WorkItem(539801, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539801")> <WorkItem(5886, "https://github.com/dotnet/roslyn/pull/5886")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpEnumToEnumMemberName(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> enum [|$$FogBar|] { TestEnum, }; </Document> </Project> </Workspace>, host:=host, renameTo:="TestEnum") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicTypeFromConstructorUse(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class [|Goo|] Public Sub New() End Sub Public Sub Blah() Dim x = New {|stmt1:$$Goo|}() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicTypeFromSynthesizedConstructorUse(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class [|Goo|] Public Sub Blah() Dim x = New {|stmt1:$$Goo|}() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNamespace(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Namespace [|$$GooNamespace|] End Namespace </Document> <Document> namespace [|GooNamespace|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBazNamespace") End Using End Sub <Theory, WorkItem(6874, "http://vstfdevdiv:8080/DevDiv_Projects/Roslyn/_workitems/edit/6874")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicEnum(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Enum [|$$Test|] One Two End Enum </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, WorkItem(6874, "http://vstfdevdiv:8080/DevDiv_Projects/Roslyn/_workitems/edit/6874")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicEnumMember(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Enum Test [|$$One|] Two End Enum </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, WorkItem(539525, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539525")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub DoNothingRename(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Goo { void [|$$Blah|]() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="Blah") End Using End Sub <Theory, WorkItem(553631, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/553631")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpBugfix553631(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Program { void Main(string[] args) { string {|stmt1:$$s|} = Goo&lt;string, string&gt;(); } string Goo&lt;T, S&gt;() { Return Goo &lt;T, S&gt;(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Blah") result.AssertLabeledSpansAre("stmt1", replacement:="Blah", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(553631, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/553631")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub VisualBasicBugfix553631(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Imports System.Collections.Generic Imports System.Linq Class Program Sub Main(args As String()) End Sub Public Sub Bar() Dim {|stmt1:$$e|} As String = Goo(Of String)() End Sub Public Function Goo(Of A)() As String End Function End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Blah") result.AssertLabeledSpansAre("stmt1", replacement:="Blah", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(541697, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541697")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExtensionMethod(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> public static class C { public static void [|$$Goo|](this string s) { } } class Program { static void Main() { "".{|stmt1:Goo|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(542202, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542202")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpIndexerNamedArgument1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { int this[int x = 5, int [|y|] = 7] { get { return 0; } set { } } void Goo() { var y = this[{|stmt1:$$y|}: 1]; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(542106, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542106")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCSharpIndexerNamedArgument2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { int this[int [|$$x|]] { set { } } void Goo() { this[{|stmt1:x|}: 1] = 0; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(541928, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541928")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameRangeVariable(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System.Linq; class C { static void Main(string[] args) { var temp = from x in "abc" let {|stmt1:y|} = x.ToString() select {|stmt1:$$y|} into w select w; } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(542106, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542106")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicParameterizedPropertyNamedArgument(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Default Property Item([|$$x|] As Integer) As Integer Get Return 42 End Get Set End Set End Property Sub Goo() Me({|stmt1:x|}:=1) = 0 End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", "BarBaz", RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(543340, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543340")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIndexerParameterFromDeclaration(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Program { int this[int [|$$x|], int y] { get { return {|stmt1:x|} + y; } set { value = {|stmt2:x|} + y; } } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(543340, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543340")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIndexerParameterFromUseInsideGetAccessor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Program { int this[int [|x|], int y] { get { return {|stmt1:$$x|} + y; } set { value = {|stmt2:x|} + y; } } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(543340, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543340")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIndexerParameterFromUseInsideSetAccessor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class Program { int this[int [|x|], int y] { get { return {|stmt1:x|} + y; } set { value = {|stmt2:$$x|} + y; } } } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") result.AssertLabeledSpansAre("stmt1", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="BarBaz", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, WorkItem(542492, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542492")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethodParameter(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; public partial class Test { partial void Goo(object [|$$o|]) { } } partial class Test { partial void Goo(object [|o|]); } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, WorkItem(542492, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542492")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExtendedPartialMethodParameter(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; public partial class Test { public partial void Goo(object [|$$o|]) { } } partial class Test { public partial void Goo(object [|o|]); } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(528820, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528820")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVisualBasicAnonymousKey(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Option Infer On Imports System Module Program Sub Main(args As String()) Dim namedCust = New With {.Name = "Blue Yonder Airlines", .[|$$City|] = "Snoqualmie"} End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(542543, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/542543")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIncludesPreviouslyInvalidReference(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; class Program { int [|$$y|] = 2; static void Main(string[] args) { {|stmt1:x|} = 1; } } </Document> </Project> </Workspace>, host:=host, renameTo:="x") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(543027, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543027")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVariableInQueryAsUsingStatement(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> using System; using System.Linq; class Program { public static void Main(string[] args) { MyManagedType {|stmt1:mnObj1|} = new MyManagedType(); using ({|stmt2:m$$nObj1|}) { } } } class MyManagedType : System.IDisposable { public void Dispose() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("stmt1", replacement:="y", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(543169, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543169")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub LambdaWithOutParameter(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> using System; using System.Linq; class D { static void Main(string[] args) { string[] str = new string[] { }; var s = str.Where(out {|stmt1:$$x|} => { return {|stmt1:x|} == "1"; }); } } </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("stmt1", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(543567, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543567")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CascadeBetweenOverridingProperties(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document FilePath="Test.vb"> Module Program Sub Main(args As String()) End Sub End Module Class C Public Overridable ReadOnly Property [|$$Total|]() As Double Get Return 42 End Get End Property End Class Class M Inherits C Public Overrides ReadOnly Property [|Total|]() As Double Get Return MyBase.{|stmt1:Total|} * rate End Get End Property End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") result.AssertLabeledSpansAre("stmt1", "Goo", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(529799, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529799")> Public Sub CascadeBetweenImplementedInterfaceEvent(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document FilePath="Test.vb"> Class C Event E([|$$x|] As Integer) Sub Goo() RaiseEvent E({|stmt1:x|}:=1) End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("stmt1", "y", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(543567, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543567")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CascadeBetweenEventParameters(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> using System; interface IGoo { event EventHandler [|$$Goo|]; } class Bar : IGoo { public event EventHandler [|Goo|]; } </Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> <WorkItem(531260, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531260")> Public Sub DoNotCascadeToMetadataSymbols(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Public Class C Implements System.ICloneable Public Function [|$$Clone|]() As Object Implements System.ICloneable.Clone Throw New System.NotImplementedException() End Function End Class </Document> </Project> </Workspace>, host:=host, renameTo:="CloneImpl") End Using End Sub <WorkItem(545473, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545473")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialTypeParameter_CSharp1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ partial class Class1 { partial void goo<$$[|T|]>([|T|] x); partial void goo<[|T|]>([|T|] x) { } }]]></Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(545473, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545473")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialTypeParameter_CSharp2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ partial class Class1 { partial void goo<[|T|]>([|T|] x); partial void goo<$$[|T|]>([|T|] x) { } }]]></Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(545472, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545472")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialTypeParameter_VB1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Public Module Module1 Partial Private Sub Goo(Of [|$$T|] As Class)(x as [|T|]) End Sub Private Sub goo(Of [|T|] As Class)(x as [|T|]) End Sub End Module ]]></Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(545472, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545472")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialTypeParameter_VB2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Public Module Module1 Partial Private Sub Goo(Of [|T|] As Class)(x as [|T|]) End Sub Private Sub goo(Of [|$$T|] As Class)(x as [|T|]) End Sub End Module ]]></Document> </Project> </Workspace>, host:=host, renameTo:="BarBaz") End Using End Sub <WorkItem(529163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529163")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub AmbiguousBeforeRenameHandledCorrectly_Bug11516(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Namespace NS Module M End Module End Namespace Namespace NS.[|$$M|] End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="N") End Using End Sub <WorkItem(529163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529163")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub AmbiguousBeforeRenameHandledCorrectly_Bug11516_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> namespace Goo { class B { } } namespace Goo.[|$$B|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="N") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethods_1_CS(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class Goo { partial void [|F|](); } partial class Goo { partial void [|$$F|]() { throw new System.Exception("F"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExtendedPartialMethods_1_CS(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class Goo { public partial void [|F|](); } partial class Goo { public partial void [|$$F|]() { throw new System.Exception("F"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethods_2_CS(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class Goo { partial void [|$$F|](); } partial class Goo { partial void [|F|]() { throw new System.Exception("F"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExtendedPartialMethods_2_CS(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> partial class Goo { public partial void [|$$F|](); } partial class Goo { public partial void [|F|]() { throw new System.Exception("F"); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethods_1_VB(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> partial class Goo partial private sub [|F|]() end class partial class Goo private sub [|$$F|]() throw new System.Exception("F") end sub end class </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(554092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/554092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamePartialMethods_2_VB(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> partial class Goo partial private sub [|$$F|]() end class partial class Goo private sub [|F|]() throw new System.Exception("F") end sub end class </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(530740, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530740")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug530740(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using MyInt = System.[|Int32|]; namespace System { public struct [|$$Int32|] { public static implicit operator MyInt(int x) { return default(MyInt); } } } class A { static void Goo(int x) { Console.WriteLine("int"); } static void Goo(MyInt x) { Console.WriteLine("MyInt"); } static void Main() { Goo((MyInt)0); } } </Document> </Project> </Workspace>, host:=host, renameTo:="MyInt") End Using End Sub <WorkItem(530082, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530082")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMethodThatImplementsInterfaceMethod(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Interface I Sub Goo(Optional x As Integer = 0) End Interface Class C Implements I Shared Sub Main() DirectCast(New C(), I).Goo() End Sub Private Sub [|$$I_Goo|](Optional x As Integer = 0) Implements I.Goo Console.WriteLine("test") End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub <WorkItem(529874, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529874")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub DoNotRemoveAttributeSuffixOn__Attribute(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System &lt;[|_Attribute2|]&gt; ' full width _! Class [|$$_Attribute2|] Inherits Attribute End Class </Document> </Project> </Workspace>, host:=host, renameTo:="_Attribute") End Using End Sub <WorkItem(553315, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/553315")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameEventParameterOnUsage(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class C Event E([|x|] As Integer) Sub Goo() RaiseEvent E({|stmt1:$$x|}:=1) End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="bar") result.AssertLabeledSpansAre("stmt1", "bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529819, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529819")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCompilerGeneratedBackingFieldForNonCustomEvent(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class B Event [|$$X|]() ' Rename X to Y Sub Goo() {|stmt1:XEvent|}() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("stmt1", "YEvent", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(576607, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/576607")> <WorkItem(529819, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529819")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCompilerGeneratedEventHandlerForNonCustomEvent(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Class B Event [|$$X|]() ' Rename X to Y Sub Goo() Dim y = New B.{|stmt1:XEventHandler|}(AddressOf bar) End Sub Shared Sub bar() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("stmt1", "YEventHandler", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(576966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/576966")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpRenameParenthesizedFunctionName(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> class C { void [|$$Goo|]() { (({|stmt1:Goo|}))(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub VisualBasicAwaitAsIdentifierInAsyncShouldBeEscaped(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports System Module M Async Function methodIt() As Task(Of String) Dim a As Func(Of String) = AddressOf {|stmt1:Goo|} End Function Function [|$$Goo|]() As String End Function End Module </Document> </Project> </Workspace>, host:=host, renameTo:="Await") result.AssertLabeledSpecialSpansAre("stmt1", "[Await]", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpAwaitAsIdentifierInAsyncMethodShouldBeEscaped0(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; using System.Threading.Tasks; class M { async public Task<string> methodIt() { Func<string> a = {|stmt1:Goo|}; return null; } public static string [|$$Goo|]() { return ""; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="await") result.AssertLabeledSpansAre("stmt1", "@await", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpAwaitAsIdentifierInAsyncLambdaShouldBeEscaped(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; using System.Threading.Tasks; class s { public void abc() { Func<Task> sin = async () => { {|stmt1:Goo|}(); }; } public int [|$$Goo|]() { return 0; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="await") result.AssertLabeledSpansAre("stmt1", "@await", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpAwaitAsIdentifierInAsyncLambdaShouldBeEscaped1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; using System.Threading.Tasks; class s { public void abc() { Func<int, Task<int>> sink2 = (async c => { return {|stmt2:Goo|}(); }); } public int [|$$Goo|]() { return 0; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="await") result.AssertLabeledSpansAre("stmt2", "@await", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(601123, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/601123")> <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharpAwaitAsIdentifierInAsyncLambdaShouldNotBeEscaped(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> <![CDATA[ using System; using System.Threading.Tasks; class s { public void abc() { Func<int, int> sink4 = ((c) => { return {|stmt3:Goo|}(); }); } public int [|$$Goo|]() { return 0; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="await") result.AssertLabeledSpansAre("stmt3", "await", RelatedLocationType.NoConflict) End Using End Sub <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub VBRoundTripMissingModuleName_1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports N Module Program Sub Main() Dim mybar As N.{|stmt1:Goo|} = New {|stmt1:Goo|}() End Sub End Module Namespace N Module X Class [|$$Goo|] End Class End Module End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <Theory()> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub VBRoundTripMissingModuleName_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document> Imports N Module Program Sub Main() N.{|stmt1:Goo|}() End Sub End Module Namespace N Module X Sub [|$$Goo|]() End Sub End Module End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(603767, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/603767")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug603767_RenamePartialAttributeDeclarationWithDifferentCasingAndCSharpUsage(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Imports System Public Class [|XAttribute|] Inherits Attribute End Class Partial Public Class [|$$XATTRIBUTE|] Inherits Attribute End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> [{|resolved:X|}] class C { } </Document> </Project> </Workspace>, host:=host, renameTo:="XATTRIBUTe") result.AssertLabeledSpansAre("resolved", "XATTRIBUTe", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(603371, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/603371")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug603371_VisualBasicRenameAttributeToGlobal(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Imports System &lt;{|escaped:Goo|}&gt; Class {|escaped:$$Goo|} ' Rename Goo to Global Inherits Attribute End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Global") result.AssertLabeledSpecialSpansAre("escaped", "[Global]", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(603371, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/603371")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug603371_VisualBasicRenameAttributeToGlobal_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Imports System &lt;{|escaped:Goo|}&gt; Class {|escaped:$$Goo|} ' Rename Goo to Global Inherits Attribute End Class </Document> </Project> </Workspace>, host:=host, renameTo:="[global]") result.AssertLabeledSpansAre("escaped", "[global]", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(602494, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/602494")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug602494_RenameOverrideWithNoOverriddenMember(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> class C1 { override void [|$$Goo|]() {} } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") End Using End Sub <WorkItem(576607, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/576607")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug576607(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Class B Event [|$$X|]() Sub Goo() Dim y = New {|stmt1:XEventHandler|}(AddressOf bar) End Sub Shared Sub bar() End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Baz") result.AssertLabeledSpecialSpansAre("stmt1", "BazEventHandler", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_VisualBasicOverrideImplicitPropertyAccessor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable ReadOnly Property [|$$X|](y As Integer) As Integer Get Return 0 End Get End Property End Class Public Class C Inherits A Public Overrides Function {|getaccessor:get_X|}(Y As Integer) As Integer End Function End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_VisualBasicOverrideImplicitPropertyAccessor_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable ReadOnly Property [|X|](y As Integer) As Integer Get Return 0 End Get End Property End Class Public Class C Inherits A Public Overrides Function {|getaccessor:$$Get_X|}(Y As Integer) As Integer End Function End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "Get_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_VisualBasicOverrideImplicitPropertyAccessor_3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable ReadOnly Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property End Class Public Class C Inherits A Public Overrides Function {|getaccessor:$$Get_X|}(Y As Integer) As Integer End Function Public Overrides Sub {|setaccessor:Set_X|}(index as integer, Y As Integer) End Sub End Class </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "Get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "Set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|$$X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { } public override void {|setaccessor:set_X|}(int y, int value) { } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|$$X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:set_X|}(int y, int value) { base.{|setaccessorstmt:set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessorstmt", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessorstmt", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:set_X|}(int y, int value) { base.{|setaccessorstmt:$$set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessorstmt", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessorstmt", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_4(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class Public Class B Inherits A Public Overrides Property [|$$X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:set_X|}(int y, int value) { base.{|setaccessorstmt:set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessorstmt", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessorstmt", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529765, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529765")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_5(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property End Class Public Class B Inherits A Public Overrides Property [|X|](y As Integer) As Integer Get Return 0 End Get Set End Set End Property End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:$$set_X|}(int y, int value) { base.{|setaccessorstmt:set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Z") result.AssertLabeledSpecialSpansAre("getaccessor", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessorstmt", "get_Z", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("setaccessorstmt", "set_Z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(610120, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/610120")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug610120_CrossLanguageOverrideImplicitPropertyAccessorConflictWithVBProperty(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property {|conflict:X|}({|declconflict:y|} As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class Public Class B Inherits A Public Overrides Property {|conflict:X|}({|declconflict:y|} As Integer) As Integer Get Return 0 End Get Set End Set End Property End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } public override void {|setaccessor:$$set_X|}(int y, int value) { base.{|setaccessorstmt:set_X|}(y, value); } } </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("conflict", "y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("getaccessorstmt", "get_y", RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("setaccessorstmt", "set_y", RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansAre("declconflict", "y", RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpecialSpansAre("setaccessor", "set_y", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("getaccessor", "get_y", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(612380, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/612380")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug612380_CrossLanguageOverrideImplicitPropertyAccessorCascadesToInterface(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Class A Public Overridable Property {|conflict:$$X|}({|declconflict:y|} As Integer) As Integer Get Return 0 End Get Set End Set End Property Public Shared Sub Main() End Sub End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class B : A { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessorstmt:get_X|}(y); } } interface I { int {|getaccessor:get_X|}(int y); } class C : B, I { public override int {|getaccessor:get_X|}(int y) { return base.{|getaccessor:get_X|}(y); } } </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("conflict", "y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("declconflict", "y", RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpecialSpansAre("getaccessor", "get_y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("getaccessorstmt", "get_y", RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(866094, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/866094")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug866094(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Module A Public Sub [|M|]() End Sub End Module </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class C { static void N() { A.[|$$M|](); } } </Document> </Project> </Workspace>, host:=host, renameTo:="X") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameDynamicallyBoundFunction(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> Imports System class A { class B { public void [|Boo|](int d) { } } void Bar() { B b = new B(); dynamic d = 1.5f; b.{|Stmt1:$$Boo|}(d); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("Stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529989, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529989")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharp_RenameToIdentifierWithUnicodeEscaping(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> public class A { public static void [|$$Main|]() { A.{|stmt1:Main|}(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="M\u0061in") result.AssertLabeledSpansAre("stmt1", "M\u0061in", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(576966, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/576966")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharp_RenameParenthesizedMethodNames(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> class C { void [|$$Goo|]() { (({|stmt1:Goo|}))(); } } </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("stmt1", "Bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(632052, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/632052")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub CSharp_RenameParameterUsedInObjectInitializer(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> using System; class Program { void M(int [|$$p|]) { var v1 = new C() { tuple = Tuple.Create({|stmt1:p|}) }; Tuple&lt;int&gt; v2 = Tuple.Create({|stmt2:p|}); } } class C { public Tuple&lt;int&gt; tuple; } </Document> </Project> </Workspace>, host:=host, renameTo:="n") result.AssertLabeledSpansAre("stmt1", "n", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", "n", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(624092, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/624092")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub LocationsIssue(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document> namespace N { public class D { } } </Document> </Project> <Project Language="Visual Basic" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> Namespace N Module M Public Class [|$$C|] 'Rename C to D End Class End Module End Namespace Module Program Sub Main(args As String()) Dim d = New N.D() Dim c = New N.{|resolved:C|}() End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="D") result.AssertLabeledSpansAre("resolved", "Dim c = New N.M.D()", type:=RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameParam1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { /// <summary> /// <paramref name="[|args|]" /> /// </summary> /// <param name="[|args|]"></param> static void Main(string[] [|$$args|]) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="pargs") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameParam1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class Program ''' <summary> ''' <paramref name="[|args|]" /> ''' </summary> ''' <param name="[|args|]"></param> Private Shared Sub Main([|$$args|] As String()) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="pargs") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameParam2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { /// <summary> /// <paramref name="{|ResolveWithoutAt:args|}" /> /// </summary> /// <param name="{|ResolveWithoutAt:$$args|}"></param> static void Main(string[] {|Resolve:args|}) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="if") result.AssertLabeledSpecialSpansAre("Resolve", "@if", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("ResolveWithoutAt", "if", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameParam2_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class Program ''' <summary> ''' <paramref name="{|Resolve:args|}" /> ''' </summary> ''' <param name="{|Resolve:$$args|}"></param> Private Shared Sub Main({|Resolve:args|} As String()) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="[If]") result.AssertLabeledSpansAre("Resolve", <![CDATA[[If]]]>.Value, RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeParam1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ /// <summary> /// <typeparamref name="[|$$T|]"/> /// </summary> /// <typeparam name="[|T|]"></typeparam> class B<[|T|]> { /// <summary> /// <typeparamref name="[|T|]"/> /// </summary> /// <typeparam name="U"></typeparam> /// <typeparam name="P"></typeparam> /// <param name="x"></param> /// <param name="z"></param> [|T|] Goo<U, P>(U x, [|T|] z) { return z; } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeParam1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ ''' <summary> ''' <typeparamref name="[|$$T|]"/> ''' </summary> ''' <typeparam name="[|T|]"></typeparam> Class B(Of [|T|]) ''' <summary> ''' <typeparamref name="[|T|]"/> ''' </summary> ''' <typeparam name="U"></typeparam> ''' <typeparam name="P"></typeparam> ''' <param name="x"></param> ''' <param name="z"></param> Private Function Goo(Of U, P)(x As U, z As [|T|]) As [|T|] Return z End Function End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(624310, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/624310")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug624310_VBCascadeLambdaParameterInFieldInitializer(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Option Strict On Module M Dim field As Object = If(True, Function({|fieldinit:$$y|} As String) {|fieldinit:y|}.ToUpper(), Function({|fieldinit:y|} As String) {|fieldinit:y|}.ToLower()) Sub Main() Dim local As Object = If(True, Function(x As String) x.ToUpper(), Function(x As String) x.ToLower()) End Sub End Module </Document> </Project> </Workspace>, host:=host, renameTo:="z") result.AssertLabeledSpansAre("fieldinit", "z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(624310, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/624310")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug624310_CSNoCascadeLambdaParameterInFieldInitializer(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System; class Program { public object O = true ? (Func<string, string>)((string {|fieldinit:$$x|}) => {return {|fieldinit:x|}.ToUpper(); }) : (Func<string, string>)((string x) => {return x.ToLower(); }); } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="z") result.AssertLabeledSpansAre("fieldinit", "z", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(633582, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/633582")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug633582_CSDoNotAddParenthesesInExpansionForParenthesizedBinaryExpression(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System.Linq; class Program { void aaa() { var bbb = from x in new[] { 1, 2, 3 } where ((1 + x > 'a')) join {|stmt:$$ddd|} in new[] { 5, 2, 9, 4, } on 7 equals {|stmt:ddd|} + 5 into eee select eee; } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="xxx") result.AssertLabeledSpansAre("stmt", "xxx", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(622086, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/622086")> <Theory(Skip:="https://github.com/dotnet/roslyn/issues/9412")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameExplicitInterfaceImplementation(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ namespace X { interface [|$$IGoo|] { void Clone(); } class Baz : [|IGoo|] { void [|IGoo|].Clone() { } } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="IGooEx") End Using End Sub <WorkItem(8139, "https://github.com/dotnet/roslyn/issues/8139")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameExplicitInterfaceImplementationFromDifferentProject(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <ProjectReference>Project2</ProjectReference> <Document> class Program { static void Main(string[] args) { Test(new Class1()); } static void Test(IInterface i) { i.[|M|](); } } </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <Document> public class Class1 : IInterface { void IInterface.[|$$M|]() { } // Rename 'M' from here } public interface IInterface { void [|M|](); } </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub <WorkItem(529803, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529803")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingEventCascadesToCSUsingEventHandlerDelegate(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|$$X|]() ' Rename X to Y End Interface Class C Implements IA Public Event [|X|] As IA.{|handler:XEventHandler|} Implements IA.[|X|] End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class Program : IA { event IA.{|handler:XEventHandler|} IA.[|X|] { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529803, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529803")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|X|]() ' Rename X to Y End Interface Class C Implements IA Dim A As IA.{|handler:XEventHandler|} Public Event [|$$X|] Implements IA.[|X|] End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class Program : IA { event IA.{|handler:XEventHandler|} IA.[|X|] { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(529803, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529803")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|X|]() ' Rename X to Y End Interface Class C Implements IA Public Event [|X|] As IA.{|handler:XEventHandler|} Implements IA.[|X|] End Class </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class Program : IA { event IA.{|handler:$$XEventHandler|} IA.[|X|] { add { throw new NotImplementedException(); } remove { throw new NotImplementedException(); } } } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(655621, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/655621")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|$$X|]() ' Rename X to Y End Interface </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class C { object x = new IA.{|handler:XEventHandler|}(() => { }); } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(655621, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/655621")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_4(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|X|]() ' Rename X to Y End Interface </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> using System; class C { object x = new IA.{|handler:$$XEventHandler|}(() => { }); } </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(655621, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/655621"), WorkItem(762094, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/762094")> <WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_5(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Public Interface IA Event [|X|]() ' Rename X to Y End Interface </Document> </Project> <Project Language="Visual Basic" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> Imports System Class C public x as new IA.{|handler:$$XEventHandler|}( Sub() Console.WriteLine() ) Class C </Document> </Project> </Workspace>, host:=host, renameTo:="Y") result.AssertLabeledSpecialSpansAre("handler", "YEventHandler", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameVarNotSupported(host As RenameTestHost) Dim result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System; namespace X { class Baz { void M() { [|$$var|] x = new Int32(); } } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="Int32", expectFailure:=True) End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameCustomTypeNamedVarSupported(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System; namespace X { class [|var|] {} class Baz { void M() { {|stmt:$$var|} x = new {|stmt:var|}();; } } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="bar") result.AssertLabeledSpansAre("stmt", "bar", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameDynamicNotSupported(host As RenameTestHost) Dim result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ using System; namespace X { class Baz { void M() { [|$$dynamic|] x = new Int32(); } } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="Int32", expectFailure:=True) End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameToVarNotSupportedNoConflictsWithOtherVar(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:Program|} { static void Main(string[] args) { {|Conflict:$$Program|} x = null; var y = 23; } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="var") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameToDynamicNotSupported(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:Program|} { static void Main(string[] args) { {|Conflict:$$Program|} x = null; } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="dynamic") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameToDynamicNotSupported2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:Program|} { static void Main(string[] args) { {|Conflict:$$Program|} x = null; dynamic y = 23; } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="dynamic") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(627297, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/627297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub Bug622086_CSRenameToDynamicSupportedButConflictsWithOtherDynamic_2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:Program|} { static void Main(string[] args) { {|Conflict:$$Program|} x = null; dynamic y = new {|Conflict:Program|}(); } } ]]>] </Document> </Project> </Workspace>, host:=host, renameTo:="dynamic") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(608988, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/608988")> <WorkItem(608989, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/608989")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNamespaceInVbFromCSharReference(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document> Namespace [|N|] Public Class X End Class End Namespace </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class Y : [|$$N|].X { } </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub #Region "Cref" <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeFromCref(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ class [|Program|] { /// <see cref="[|$$Program|]"/> to start the program. static void Main(string[] args) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeFromCref_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document> <![CDATA[ Class [|Program|] ''' <see cref="[|$$Program|]"/> to start the program. Private Shared Sub Main(args As String()) End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Y") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMemberFromCref(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ class Program { /// <see cref="Program.[|$$Main|]"/> to start the program. static void [|Main|](string[] args) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMemberFromCref_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document> <![CDATA[ Class Program ''' <see cref="Program.[|$$Main|]"/> to start the program. Private Shared Sub [|Main|](args As String()) End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Y") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefFromMember(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ class Program { /// <see cref="Program.[|Main|]"/> to start the program. static void [|$$Main|](string[] args) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefFromMember_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document> <![CDATA[ Class Program ''' <see cref="Program.[|Main|]"/> to start the program. Private Shared Sub [|$$Main|](args As String()) End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <WorkItem(546952, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546952")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIncludingCrefContainingAttribute(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ using System; /// <summary> /// <see cref="{|yAttribute:GooAttribute|}" /> /// </summary> [{|y:Goo|}] class {|yAttribute:G$$ooAttribute|} : Attribute { } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="yAttribute") result.AssertLabeledSpansAre("yAttribute", replacement:="yAttribute", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("y", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(546952, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546952")> <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameIncludingCrefContainingAttribute_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document> <![CDATA[ ''' <summary> ''' <see cref="{|YAttribute:$$GooAttribute|}" /> ''' </summary> <{|Y:Goo|}> Class {|YAttribute:GooAttribute|} Inherits Attribute End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="YAttribute") result.AssertLabeledSpansAre("YAttribute", replacement:="YAttribute", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("Y", replacement:="Y", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(546952, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546952")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameFromCrefContainingAttribute(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ using System; /// <summary> /// <see cref="{|yAttribute:GooA$$ttribute|}" /> /// </summary> [{|y:Goo|}] class {|yAttribute:GooAttribute|} : Attribute { } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="yAttribute") result.AssertLabeledSpansAre("yAttribute", replacement:="yAttribute", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("y", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(546952, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/546952"), WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameFromCrefContainingAttribute_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="VisualBasicAssembly" CommonReferences="true"> <Document FilePath="Test.vb"> <![CDATA[ Imports System ''' <summary> ''' <see cref="{|yAttribute:GooA$$ttribute|}" /> ''' </summary> <{|y:Goo|}> Class {|yAttribute:GooAttribute|} : Inherits Attribute End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="yAttribute") result.AssertLabeledSpansAre("yAttribute", replacement:="yAttribute", type:=RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("y", replacement:="y", type:=RelatedLocationType.NoConflict) End Using End Sub <WorkItem(531015, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531015")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefTypeParameter(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpAssembly" CommonReferences="true"> <Document FilePath="Test.cs"> <![CDATA[ /// <see cref="C{[|$$T|]}.M({|Conflict:T|})"/> class C<T> { } ]]></Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) End Using End Sub <WorkItem(640373, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/640373")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Tester { private int {|Resolve:$$x|}; /// <summary> /// <see cref="Tester.{|Resolve:x|}"/> /// </summary> public int X { get { return {|Resolve:x|}; } set { {|Resolve:x|} = value; } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="if") result.AssertLabeledSpecialSpansAre("Resolve", "@if", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(640373, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/640373")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class Tester Private {|Resolve1:$$_x|} As Integer ''' <summary> ''' <see cref="Tester.{|Resolve2:_x|}"/> ''' </summary> Public Property X As Integer Get Return {|Resolve1:_x|}; End Get Set {|Resolve1:_x|} = value; End Set End Property End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="If") result.AssertLabeledSpecialSpansAre("Resolve1", "[If]", RelatedLocationType.NoConflict) result.AssertLabeledSpecialSpansAre("Resolve2", "If", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Tester { private int [|$$x|]; /// <summary> /// <see cref="[|x|]"/> /// </summary> public int X { get { return {|Stmt1:x|}; } set { {|Stmt2:x|} = value; } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("Stmt1", "y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("Stmt2", "y", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref2_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class Tester Private [|$$_x|] As Integer ''' <summary> ''' <see cref="[|_x|]"/> ''' </summary> Public Property X As Integer Get Return {|Stmt1:_x|} End Get Set {|Stmt2:_x|} = value End Set End Property End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("Stmt1", "y", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("Stmt2", "y", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref3(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C<[|$$T|]> { /// <summary> /// <see cref="C{T}"/> /// </summary> /// <param name="x"></param> void Goo(C<dynamic> x, C<string> y) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref3_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class C(Of [|$$T|]) ''' <summary> ''' <see cref="C(Of [|T|])"/> ''' </summary> ''' <param name="x"></param> Sub Goo(x As C(Of Object), y As C(Of String)) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref4(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C<T> { /// <summary> /// <see cref="C{[|$$T|]}"/> /// <see cref="C{T}.Bar(T)" /> /// </summary> /// <param name="x"></param> void Goo(C<dynamic> x, C<string> y) { } void Bar(T x) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref4_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class C(Of [|T|]) ''' <summary> ''' <see cref="C(Of [|$$T|])"/> ''' <see cref="C(Of [|T|]).Bar(Of [|T|])" /> ''' </summary> ''' <param name="x"></param> Sub Goo(x As C(Of Object), y As C(Of String)) End Sub Sub Bar(x As [|T|]) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref5(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class {|Resolve:C|}<T> { /// <summary> /// <see cref="{|Resolve:C|}{T}"/> /// </summary> /// <param name="x"></param> void Goo({|Resolve:$$C|}<dynamic> x, {|Resolve:C|}<string> y) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="string") result.AssertLabeledSpecialSpansAre("Resolve", "@string", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref5_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class {|Resolve:C|}(Of T) ''' <summary> ''' <see cref="{|Resolve:C|}(Of T)"/> ''' </summary> ''' <param name="x"></param> Sub Goo(x As {|Resolve:$$C|}(Of Object), y As {|Resolve:C|}(Of String)) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="String") result.AssertLabeledSpecialSpansAre("Resolve", "[String]", RelatedLocationType.NoConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref6(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace Test { /// <summary> /// <seealso cref="global::[|$$C|]"/> /// </summary> class C { void Goo() { } } } class [|C|] { }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref6_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Namespace Test ''' <summary> ''' <seealso cref="Global.[|$$C|]"/> ''' </summary> Class C Sub Goo() End Sub End Class End Namespace Class [|C|] End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref7(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace Test { /// <summary> /// <see cref="P"/> /// <see cref="P.[|K|]"/> /// </summary> public class C { /// <summary> /// <see cref="P"/> /// <see cref="[|K|]"/> /// </summary> public class P { /// <summary> /// <see cref="[|$$K|]"/> /// </summary> public class [|K|] { } } } /// <summary> /// <see cref="C.P.[|K|]"/> /// </summary> public class P { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="C") End Using End Sub <Theory(), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref7_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Namespace Test ''' <summary> ''' <see cref="P"/> ''' <see cref="P.[|K|]"/> ''' </summary> Class C ''' <summary> ''' <see cref="P"/> ''' <see cref="[|K|]"/> ''' </summary> Class P ''' <summary> ''' <see cref="[|$$K|]"/> ''' </summary> Class [|K|] End Class End Class End Class ''' <summary> ''' <see cref="C.P.[|K|]"/> ''' </summary> Class P End Class End Namespace]]> </Document> </Project> </Workspace>, host:=host, renameTo:="C") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref8(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I { void [|Bar|](); } abstract class C { public abstract void [|Bar|](); } class B : C, I { /// <summary> /// <see cref="I.[|Bar|]()"/> /// <see cref="[|$$Bar|]()"/> /// <see cref="C.[|Bar|]()"/> /// </summary> public override void [|Bar|]() { throw new NotImplementedException(); } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub <Theory(), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref8_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Interface I Sub [|Bar|] End Interface MustInherit Class C Public MustOverride Sub [|Bar|]() End Class Class B : Inherits C : Implements I ''' <summary> ''' <see cref="I.[|Bar|]()"/> ''' <see cref="[|$$Bar|]()"/> ''' <see cref="B.[|Bar|]()"/> ''' <see cref="C.[|Bar|]()"/> ''' </summary> Public Overrides Sub [|Bar|]() Implements I.[|Bar|] Throw new NotImplementedException() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Goo") End Using End Sub <WpfTheory(Skip:="640502"), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref9(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ interface I { void [|Goo|](); } abstract class C { public void [|Goo|]() { } } class B : C, I { /// <summary> /// <see cref="I.[|Goo|]()"/> /// <see cref="[|Goo|]()"/> /// <see cref="C.[|Goo|]()"/> /// </summary> public void Bar() { [|$$Goo|](); } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Baz") End Using End Sub <Theory(), CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref9_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Interface I Sub {|Interface:Goo|}() End Interface MustInherit Class C Public Sub [|Goo|]() End Sub End Class Class B : Inherits C : Implements I ''' <summary> ''' <see cref="I.{|Interface:Goo|}()"/> ''' <see cref="[|Goo|]()"/> ''' <see cref="C.[|Goo|]()"/> ''' </summary> Public Sub Bar() Implements I.Goo [|$$Goo|]() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Baz") result.AssertLabeledSpansAre("Interface", "Goo") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref10(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { delegate void [|$$Del|](int x); /// <summary> /// <see cref="[|Del|]"/> /// <see cref="B.Del" /> /// </summary> void Goo() { [|Del|] d; } class B { /// <summary> /// <see cref="C.[|Del|]"/> /// </summary> /// <param name="x"></param> delegate void Del(int x); } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bel") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref10_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class C Delegate Sub [|$$Del|](x As Integer) ''' <summary> ''' <see cref="[|Del|]"/> ''' <see cref="B.Del" /> ''' </summary> Sub Goo() Dim d As [|Del|] End Sub Class B ''' <summary> ''' <see cref="C.[|Del|]"/> ''' </summary> ''' <param name="x"></param> Delegate Sub Del(x As Integer) End Class End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bel") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref11(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class Test { /// <summary> /// <see cref="[|P|]"/> /// </summary> /// <param name="x"></param> public delegate void Del(int x); public event Del [|P|]; void Sub() { [|$$P|](1); } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bel") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref11_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class Test ''' <summary> ''' <see cref="[|P|]"/> ''' </summary> Public Event [|P|](x As Integer) Sub Subroutine() RaiseEvent [|$$P|](1) End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bel") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref12(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { /// <summary> /// <see cref="{|resolve:Bar|}"></see> /// </summary> /// <param name="args"></param> static void Main(string[] args) { } static void [|$$Goo|]() { } } class Bar { }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("resolve", "global::Bar", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref12_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class Program ''' <summary> ''' <see cref="{|resolve:Bar|}"></see> ''' </summary> ''' <param name="args"></param> Shared Sub Main(args As String()) End Sub Shared Sub [|$$Goo|]() End Sub End Class Class Bar End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("resolve", "Global.Bar", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref13(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class Program { /// <summary> /// <see cref="{|resolve:Bar|}"></see> /// </summary> /// <param name="args"></param> static void Main(string[] args) { } public class [|$$Baz|] { } } public class Bar { }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("resolve", "global::Bar", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref13_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class Program ''' <summary> ''' <see cref="{|resolve:Bar|}"></see> ''' </summary> ''' <param name="args"></param> Shared Sub Main(args As String()) End Sub Public Class [|$$Baz|] End Class End Class Public Class Bar End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar") result.AssertLabeledSpansAre("resolve", "Global.Bar", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref14(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ public class A { public class B { public class C { /// <summary> /// <see cref=" {|resolve:D|}"/> /// </summary> static void [|$$goo|]() { } } public class D { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") result.AssertLabeledSpansAre("resolve", "B.D", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref14_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Public Class A Public Class B Public Class C ''' <summary> ''' <see cref="{|resolve:D|}"/> ''' </summary> Shared Sub [|$$goo|]() End Sub End Class Public Class D End Class End Class End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") result.AssertLabeledSpansAre("resolve", "B.D", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673562, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673562")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref15(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class C { /// <summary> /// <see cref="{|Resolve:N|}.C"/> /// </summary> void Sub() { } } namespace [|$$K|] // Rename K to N { class C { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") result.AssertLabeledSpansAre("Resolve", "global::N", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673562, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673562")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref15_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Namespace N Class C ''' <summary> ''' <see cref="{|Resolve:N|}.C"/> ''' </summary> Sub Subroutine() End Sub End Class Namespace [|$$K|] ' Rename K to N Class C End Class End Namespace End Namespace]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") result.AssertLabeledSpansAre("Resolve", "Global.N.C", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673667, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673667"), WorkItem(760850, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/760850")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref17(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using System; class P { /// <summary> /// <see cref="[|b|]"/> /// </summary> Action<int> [|$$b|] = (int x) => { }; // Rename b to a class B { /// <summary> /// <see cref="{|Resolve:b|}"/> /// </summary> void a() { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="a") result.AssertLabeledSpansAre("Resolve", "P.a", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(673667, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673667"), WorkItem(760850, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/760850")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref17_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports System Class P ''' <summary> ''' <see cref="[|_b|]"/> ''' </summary> Private [|$$_b|] As Action(Of Integer) = Sub(x As Integer) End Sub ' Rename _b to a Class B ''' <summary> ''' <see cref="{|Resolve:_b|}"/> ''' </summary> Sub a() End Sub End Class End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="a") result.AssertLabeledSpansAre("Resolve", "P.a", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(673667, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673667")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCref18(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { using K = {|Resolve:N|}.C; class C { } /// <summary> /// <see cref="[|D|]"/> /// </summary> class [|$$D|] { class C { [|D|] x; } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") result.AssertLabeledSpansAre("Resolve", "global::N", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithUsing1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using R1 = N1.C1; namespace N1 { class C1 { public class C2 { } } namespace N2 { /// <summary> /// <see cref="{|Resolve:R1|}.C2"/> /// </summary> class [|$$K|] { class C2 { } } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R1") result.AssertLabeledSpansAre("Resolve", "C1", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithUsing1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports R1 = N1.C1 Namespace N1 Class C1 Public Class C2 End Class End Class Namespace N2 ''' <summary> ''' <see cref="{|Resolve:R1|}.C2"/> ''' </summary> Class [|$$K|] Private Class C2 End Class End Class End Namespace End Namespace ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R1") result.AssertLabeledSpansAre("Resolve", "C1.C2", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithUsing2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ using R1 = N1; namespace N1 { public class C1 { public class C2 { } } } namespace N2 { class N1 { class C2 { /// <summary> /// <see cref="{|Resolve:R1|}.C1.C2"/> /// </summary> class C3 { } class [|$$K|] { } } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R1") result.AssertLabeledSpansAre("Resolve", "global::N1", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(767163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767163")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithUsing2_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports R1 = N1 Namespace N1 Public Class C1 Public Class C2 End Class End Class End Namespace Namespace N2 Class N1 Class C2 ''' <summary> ''' <see cref="{|Resolve:R1|}.C1.C2"/> ''' </summary> Class C3 End Class Class [|$$K|] End Class End Class End Class End Namespace ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R1") result.AssertLabeledSpansAre("Resolve", "Global.N1.C1.C2", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithInterface(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { interface [|I|] { void Goo(); } class C : [|I|] { /// <summary> /// <see cref="{|Resolve:$$I|}.Goo"/> /// </summary> public void Goo() { } class K { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Resolve", "N.K", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(767163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767163")> <WorkItem(569103, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/569103")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefWithInterface_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Namespace N Interface [|I|] Sub Goo() End Interface Class C : Implements {|Resolve1:I|} ''' <summary> ''' <see cref="{|Resolve2:$$I|}.Goo"/> ''' </summary> Public Sub Goo(host as TestHost) Implements {|Resolve1:I|}.Goo End Sub Class K End Class End Class End Namespace]]> </Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Resolve1", "N.K", RelatedLocationType.ResolvedReferenceConflict) result.AssertLabeledSpansAre("Resolve2", "N.K.Goo", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefCrossAssembly(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <ProjectReference>VBAssembly</ProjectReference> <Document><![CDATA[ class D : [|N|].C { /// <summary> /// <see cref="{|Resolve:N|}.C.Goo"/> /// </summary> public void Sub() { Goo(); } class R { class C { public void Goo() { } } } }]]> </Document> </Project> <Project Language="Visual Basic" CommonReferences="true" AssemblyName="VBAssembly"> <Document> Namespace [|$$N|] Public Class C Public Sub Goo() End Sub End Class End Namespace </Document> </Project> </Workspace>, host:=host, renameTo:="R") result.AssertLabeledSpansAre("Resolve", "global::R", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(767163, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767163")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameCrefCrossAssembly_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <ProjectReference>CSAssembly</ProjectReference> <Document><![CDATA[ Class D : Inherits {|Resolve1:N|}.C ''' <summary> ''' <see cref="{|Resolve2:N|}.C.Goo"/> ''' </summary> Public Sub Subroutine() Goo() End Sub Class R Class C Public Sub Goo() End Sub End Class End Class End Class]]> </Document> </Project> <Project Language="C#" CommonReferences="true" AssemblyName="CSAssembly"> <Document><![CDATA[ namespace [|$$N|] { public class C { public void Goo() { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="R") result.AssertLabeledSpansAre("Resolve1", "Global.R", RelatedLocationType.ResolvedReferenceConflict) result.AssertLabeledSpansAre("Resolve2", "Global.R.C.Goo", RelatedLocationType.ResolvedReferenceConflict) End Using End Sub <WorkItem(673809, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673809")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructorInsideCref1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class [|P|] { /// <summary> /// <see cref="[|P|].[|P|]"/> /// </summary> static [|$$P|]() { } /// <summary> /// <see cref="[|P|].[|P|]"/> /// </summary> public [|P|]() { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Q") End Using End Sub <WorkItem(673809, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673809")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructorInsideCref1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class [|$$P|] ''' <summary> ''' <see cref="[|P|].New()"/> ''' </summary> Shared Sub New() End Sub ''' <summary> ''' <see cref="[|P|].New()"/> ''' </summary> Public Sub New() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Q") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructorInsideCref2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class [|P|] { /// <summary> /// <see cref="[|P|].[|$$P|]"/> /// </summary> static [|P|]() { } /// <summary> /// <see cref="[|P|].[|P|]"/> /// </summary> public [|P|]() { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Q") End Using End Sub <WorkItem(673809, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673809")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructorInsideCref2_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class [|P|] ''' <summary> ''' <see cref="[|P|].New()"/> ''' </summary> Shared Sub New() End Sub ''' <summary> ''' <see cref="[|$$P|].New()"/> ''' </summary> Public Sub New() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Q") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInheritanceCref1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class P { public int y; } class Q : P { int [|$$x|]; /// <summary> /// <see cref="y"/> /// </summary> void Sub() { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInheritanceCref1_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Class P Public y As Integer End Class Class Q : Inherits P Private [|$$x|] As Integer ''' <summary> ''' <see cref="{|Resolve:y|}"/> ''' </summary> Sub Subroutine() End Sub End Class]]> </Document> </Project> </Workspace>, host:=host, renameTo:="y") result.AssertLabeledSpansAre("Resolve", "P.y", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673858, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673858"), WorkItem(666167, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/666167")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameGenericTypeCrefWithConflict(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { using K = C<int>; class C<T> { /// <summary> /// <see cref="C{T}"/> /// </summary> /// <typeparam name="T"></typeparam> class D<T> { /// <summary> /// <see cref="{|Resolve:K|}.D{int}"/> /// </summary> /// <typeparam name="P"></typeparam> class [|$$C|] // Rename C To K { class D<T> { } } class C<T> { } } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Resolve", "N.C{int}", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673858, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673858"), WorkItem(666167, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/666167"), WorkItem(768000, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/768000")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameGenericTypeCrefWithConflict_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Imports K = N.C(Of Integer) Namespace N Class C(Of T) ''' <summary> ''' <see cref="C(Of T)"/> ''' </summary> ''' <typeparam name="T"></typeparam> Class D(Of T) ''' <summary> ''' <see cref="{|Resolve:K|}.D(Of Integer)"/> ''' </summary> ''' <typeparam name="P"></typeparam> Class [|$$C|] ' Rename C To K Class D(Of T) End Class End Class Class C(Of T) End Class End Class End Class End Namespace]]> </Document> </Project> </Workspace>, host:=host, renameTo:="K") result.AssertLabeledSpansAre("Resolve", "N.C(Of Integer).D(Of Integer)", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub #End Region <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNestedNamespaceToParent1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { namespace [|$$K|] { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") End Using End Sub <WorkItem(673641, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673641")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameNestedNamespaceToParent2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ namespace N { class C { void Goo() { {|Resolve:N|}.C x; } } namespace [|$$K|] { class C { } } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="N") result.AssertLabeledSpansAre("Resolve", "global::N.C x;", RelatedLocationType.ResolvedNonReferenceConflict) End Using End Sub <WorkItem(673809, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/673809")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameStaticConstructor(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class [|Simple|] { static [|$$Simple|]() // Rename simple here to p { } public [|Simple|]() { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P") End Using End Sub <WorkItem(675882, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/675882")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub SingleOnlyLocalDeclarationInsideLambdaRecurseInfinitely(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Module Lambdas Sub Main() End Sub Public l1 = Sub() Dim x = 1 End Sub Public L3 = Function([|x|] As Integer) [|$$x|] Mod 2 End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="xx") End Using End Sub <WorkItem(641231, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/641231")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameDontReplaceBaseConstructorToken_CSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class [|A|] {} class B : [|A|] { public B() : base() { } } class Program { static void Main() { [|$$A|] a = new B(); } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P") End Using End Sub <WorkItem(641231, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/641231")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameDontReplaceBaseConstructorToken_VisualBasic(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" CommonReferences="true"> <Document><![CDATA[ Module Program Sub Main(args As String()) Dim Asa As [|$$A|] = New B() End Sub End Module Class [|A|] End Class Class B Inherits [|A|] Public Sub New() MyBase.New() End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(674762, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/674762")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMergedNamespaceAcrossProjects(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Namespace [|$$N|] Public Class X End Class End Namespace ]]> </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class Y : [|N|].X { } namespace [|N|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(674764, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/674764")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMergedNamespaceAcrossProjects_1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Namespace [|N|] Public Class X End Class End Namespace ]]> </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document> class Y : [|$$N|].X { } namespace [|N|] { } </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(716278, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/716278")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMainWithoutAssertFailureVB(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Linq Module Program Sub [|$$Main|](args As String()) End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(716278, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/716278")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMainWithoutAssertFailureCSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document> using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; class Program { static void [|$$Main|](string[] args) { } } </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(719062, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/719062")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameEscapedIdentifierToUnescapedIdentifier(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Linq Module Program Sub Main(args As String()) Dim [|[dim]$$|] = 4 End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(719062, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/719062")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameEscapedIdentifierToUnescapedIdentifierKeyword(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Imports System Imports System.Collections.Generic Imports System.Linq Module Program Sub Main(args As String()) Dim {|iden1:[dim]$$|} = 4 End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="do") result.AssertLabeledSpecialSpansAre("iden1", "[do]", RelatedLocationType.NoConflict) End Using End Sub <WorkItem(767187, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767187")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameEscapedTypeNew(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Class [|[New]|] End Class Class C Public Sub F() Dim a = New [|$$[New]|] End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(767187, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/767187")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameConstructorInCref(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ /// <see cref="[|C|].[|$$C|]"> class [|C|] { public [|C|]() {} } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") End Using End Sub <WorkItem(1009633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1009633")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameWithTryCatchBlock1(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Class C Sub M() Dim [|$$msg|] = "hello" Try Catch Dim newMsg = [|msg|] End Try End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="msg2") End Using End Sub <WorkItem(1009633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/1009633")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameWithTryCatchBlock2(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Class C Sub M() Dim [|$$msg|] = "hello" Try Catch ex As Exception Dim newMsg = [|msg|] End Try End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="msg2") End Using End Sub <WorkItem(8297, "https://github.com/dotnet/roslyn/issues/8297")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameVBClassNamedNew(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Class [|[$$New]|] Sub New() End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="New2") End Using End Sub <WorkItem(25655, "https://github.com/dotnet/roslyn/issues/25655")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameClassWithNoCompilationProjectReferencingProject(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="NoCompilation" CommonReferences="false"> <ProjectReference>CSharpProject</ProjectReference> <Document> // a no-compilation document </Document> </Project> <Project Language="C#" AssemblyName="CSharpProject" CommonReferences="true"> <Document> public class [|$$A|] { public [|A|]() { } } </Document> </Project> </Workspace>, host:=host, renameTo:="B") End Using End Sub #Region "Rename in strings/comments" <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStrings(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, False) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] ''' <summary> ''' Program PROGRAM! Program! ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) ' Program PROGRAM! Program! Dim renamed = {|RenameInString:"Program Program!"|} ' Program Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStrings_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, False) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { /// <summary> /// Program PROGRAM! Program! /// <Program></Program> /// </summary> public static void Main(string[] args) { // Program PROGRAM! Program! var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = "Program Program!" {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = "Program Program!"; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// NewProgram PROGRAM! NewProgram!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_XmlName(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ ''' <summary> ''' <{|RenameInComment:Program|}> </{|RenameInComment:Program|}> ''' </summary> Public Class [|$$Program|] End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment", "NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_XmlName2(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, False) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ ' Should not rename XmlName if not renaming in comments ''' <summary> ''' <Program> </Program> ''' </summary> Public Class [|$$Program|] End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) Assert.Equal(1, result.ConflictResolution.RelatedLocations.Count) End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_XmlName_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ /// <summary> /// <{|RenameInComment:Program|}> </{|RenameInComment:Program|}> /// </summary> public class [|$$Program|] { } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment", "NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInComments_XmlName_CSharp2(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, False) renamingOptions.Add(RenameOptions.RenameInComments, False) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ // Should not rename XmlName if not renaming in comments /// <summary> /// <Program> </Program> /// </summary> public class [|$$Program|] { } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) Assert.Equal(1, result.ConflictResolution.RelatedLocations.Count) End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = {|RenameInString:"Program Program!"|} {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// NewProgram PROGRAM! NewProgram!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_SmallerReplacementString(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = {|RenameInString:"Program Program!"|} {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """P P!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' P") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_SmallerReplacementString_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """P P!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// P PROGRAM! P!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherSourceFile(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module [|$$Program|] End Module ]]> </Document> <Document><![CDATA[ Class AnotherFile ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = {|RenameInString:"Program Program!"|} {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="P", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """P P!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' P PROGRAM! P!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' P") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherSourceFile_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { } ]]> </Document> <Document><![CDATA[ public class AnotherFile { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// NewProgram PROGRAM! NewProgram!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherProject(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Public Class [|$$Program|] End Class ]]> </Document> </Project> <Project Language="Visual Basic" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document><![CDATA[ ' Renames should occur in referencing projects where rename symbol is accessible. Class ReferencingProject ''' <summary> '''{|RenameInComment1: Program PROGRAM! Program!|} ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) {|RenameInComment2:' Program PROGRAM! Program!|} {|RenameInComment2:' Program PROGRAM! Program!|} Dim renamed = {|RenameInString:"Program Program!"|} {|RenameInComment3:' Program|} Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' NewProgram") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherProject_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ public class [|$$Program|] { } ]]> </Document> </Project> <Project Language="C#" AssemblyName="Project2" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document><![CDATA[ // Renames should occur in referencing projects where rename symbol is accessible. public class AnotherFile { /// <summary> ///{|RenameInComment1: Program PROGRAM! Program!|} /// </summary> public static void Main(string[] args) { {|RenameInComment2:// Program PROGRAM! Program!|} var renamed = {|RenameInString:"Program Program!"|}; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """NewProgram NewProgram!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", " NewProgram PROGRAM! NewProgram!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "// NewProgram PROGRAM! NewProgram!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherProject2(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Namespace N Private Class [|$$Program|] End Class End Namespace ]]> </Document> </Project> <Project Language="Visual Basic" AssemblyName="ReferencingProjectButSymbolNotVisible" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document><![CDATA[ ' Renames should not occur in referencing projects where rename symbol is not accessible. ' Type "Program" is not accessible in this project Imports N Class ReferencingProjectButSymbolNotVisible ''' <summary> ''' Program PROGRAM! Program! ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) ' Program PROGRAM! Program! ' Program PROGRAM! Program! Dim renamed = "Program Program!" ' Program Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Class ]]> </Document> </Project> <Project Language="Visual Basic" AssemblyName="NotReferencingProject" CommonReferences="true"> <Document><![CDATA[ ' Renames should not occur in non-referencing projects. ' Type "Program" is not visible in this project Imports N Class NotReferencingProject ''' <summary> ''' Program PROGRAM! Program! ''' </summary> ''' <param name="args"></param> Sub Main(args As String()) ' Program PROGRAM! Program! ' Program PROGRAM! Program! Dim renamed = "Program Program!" ' Program Dim notRenamed = "PROGRAM! Program1 ProgramProgram" End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) Assert.Equal(1, result.ConflictResolution.RelatedLocations.Count) End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_AnotherProject_CSharp2(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ namespace N { private class [|$$Program|] { } } ]]> </Document> </Project> <Project Language="C#" AssemblyName="ReferencingProjectButSymbolNotVisible" CommonReferences="true"> <ProjectReference>Project1</ProjectReference> <Document><![CDATA[ // Renames should not occur in referencing projects where rename symbol is not accessible. // Type "Program" is not accessible in this project using N; public class ReferencingProjectButSymbolNotVisible { /// <summary> /// Program PROGRAM! Program! /// </summary> public static void Main(string[] args) { // Program PROGRAM! Program! var renamed = "Program Program!"; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> <Project Language="C#" AssemblyName="NotReferencingProject" CommonReferences="true"> <Document><![CDATA[ // Renames should not occur in non-referencing projects. // Type "Program" is not visible in this project public class NotReferencingProject { /// <summary> /// Program PROGRAM! Program! /// </summary> public static void Main(string[] args) { // Program PROGRAM! Program! var renamed = "Program Program!"; var notRenamed = "PROGRAM! Program1 ProgramProgram"; } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="NewProgram", changedOptionSet:=renamingOptions) Assert.Equal(1, result.ConflictResolution.RelatedLocations.Count) End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_WithResolvableConflict(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Module M Public Sub [|$$Goo|](Of T)(ByVal x As T) {|RenameInComment1:' Rename Goo to Bar|} End Sub End Module Class C Public Sub Bar(ByVal x As String) End Sub Class M Public Shared Bar As Action(Of String) = Sub(ByVal x As String) End Sub End Class Public Sub Test() {|stmt1:Goo|}("1") {|RenameInComment2:' Goo GOO! Goo!|} Dim renamed = {|RenameInString:"Goo Goo!"|} {|RenameInComment3:' Goo|} Dim notRenamed = "GOO! Goo1 GooGoo" End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar", changedOptionSet:=renamingOptions) result.AssertLabeledSpansAre("stmt1", "Call Global.M.Bar(""1"")", RelatedLocationType.ResolvedReferenceConflict) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", "' Rename Bar to Bar") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """Bar Bar!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' Bar GOO! Bar!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment3", "' Bar") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_WithResolvableConflict_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class Goo { int goo; void Blah(int [|$$bar|]) { {|stmt2:goo|} = {|stmt1:bar|}; {|RenameInComment:// bar BAR! bar!|} var renamed = {|RenameInString:"bar bar!"|}; var notRenamed = "BAR! bar1 barbar"; } } End Sub End Class ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="goo", changedOptionSet:=renamingOptions) result.AssertLabeledSpansAre("stmt1", "this.goo = goo;", RelatedLocationType.NoConflict) result.AssertLabeledSpansAre("stmt2", "this.goo = goo;", RelatedLocationType.ResolvedNonReferenceConflict) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """goo goo!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment", "// goo BAR! goo!") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_WithUnresolvableConflict(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="Visual Basic" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ Option Explicit Off Module Program Function [|$$Goo|] {|Conflict:Bar|} = 1 {|RenameInComment1:' Goo GOO! Goo!|} Dim renamed = {|RenameInString:"Goo Goo!"|} {|RenameInComment2:' Goo|} Dim notRenamed = "GOO! Goo1 GooGoo" End Function End Module ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Bar", changedOptionSet:=renamingOptions) result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """Bar Bar!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment1", "' Bar GOO! Bar!") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment2", "' Bar") End Using End Sub <WorkItem(700923, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700923"), WorkItem(700925, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/700925")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameInStringsAndComments_WithUnresolvableConflict_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameInStrings, True) renamingOptions.Add(RenameOptions.RenameInComments, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class {|Conflict:goo|} { int [|$$bar|]; {|RenameInComment:// bar BAR! bar!|} var renamed = {|RenameInString:"bar bar!"|}; var notRenamed = "BAR! bar1 barbar"; } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="goo", changedOptionSet:=renamingOptions) result.AssertLabeledSpansAre("Conflict", type:=RelatedLocationType.UnresolvedConflict) result.AssertLabeledSpansInStringsAndCommentsAre("RenameInString", """goo goo!""") result.AssertLabeledSpansInStringsAndCommentsAre("RenameInComment", "// goo BAR! goo!") End Using End Sub #End Region #Region "Rename In NameOf" <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMethodWithNameof_NoOverloads_CSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class C { void [|$$M|]() { nameof([|M|]).ToString(); } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Mo") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMethodWithNameof_WithOverloads_CSharp(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class C { void [|$$M|]() { nameof(M).ToString(); } void M(int x) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Mo") End Using End Sub <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameMethodWithNameof_WithOverloads_WithRenameOverloadsOption_CSharp(host As RenameTestHost) Dim renamingOptions = New Dictionary(Of OptionKey, Object)() renamingOptions.Add(RenameOptions.RenameOverloads, True) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="Project1" CommonReferences="true"> <Document><![CDATA[ class C { void [|$$M|]() { nameof([|M|]).ToString(); } void [|M|](int x) { } } ]]> </Document> </Project> </Workspace>, host:=host, renameTo:="Mo", changedOptionSet:=renamingOptions) End Using End Sub #End Region <WpfTheory> <WorkItem(28474, "https://github.com/dotnet/roslyn/issues/28474")> <CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub HandleProjectsWithoutCompilations(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" AssemblyName="CSharpProject" CommonReferences="true"> <Document> public interface IGoo { void [|$$Goo|](); } public class C : IGoo { public void [|Goo|]() {} } </Document> </Project> <Project Language="NoCompilation" CommonReferences="false"> <ProjectReference>CSharpProject</ProjectReference> <Document> // a no-compilation document </Document> </Project> </Workspace>, host:=host, renameTo:="Cat") End Using End Sub <WorkItem(44070, "https://github.com/dotnet/roslyn/issues/44070")> <Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Rename)> Public Sub RenameTypeParameterFromCRef(host As RenameTestHost) Using result = RenameEngineResult.Create(_outputHelper, <Workspace> <Project Language="C#" CommonReferences="true"> <Document><![CDATA[ class C { /// <summary> /// <see cref="Goo{$${|Complex:{|unresolved:X|}|}}(X)"/> /// </summary> void Goo<T>(T t) { } }]]> </Document> </Project> </Workspace>, host:=host, renameTo:="D") result.AssertLabeledSpansAre("Complex", "C.Goo{D}(X)", RelatedLocationType.UnresolvedConflict) End Using End Sub End Class End Namespace
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.AbstractPriorityProcessor.cs
// 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 System; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Notification; using Microsoft.CodeAnalysis.Shared.TestHooks; namespace Microsoft.CodeAnalysis.SolutionCrawler { internal sealed partial class SolutionCrawlerRegistrationService { internal sealed partial class WorkCoordinator { private sealed partial class IncrementalAnalyzerProcessor { private abstract class AbstractPriorityProcessor : GlobalOperationAwareIdleProcessor { protected readonly IncrementalAnalyzerProcessor Processor; private readonly object _gate; private Lazy<ImmutableArray<IIncrementalAnalyzer>> _lazyAnalyzers; public AbstractPriorityProcessor( IAsynchronousOperationListener listener, IncrementalAnalyzerProcessor processor, Lazy<ImmutableArray<IIncrementalAnalyzer>> lazyAnalyzers, IGlobalOperationNotificationService globalOperationNotificationService, TimeSpan backOffTimeSpan, CancellationToken shutdownToken) : base(listener, globalOperationNotificationService, backOffTimeSpan, shutdownToken) { _gate = new object(); _lazyAnalyzers = lazyAnalyzers; Processor = processor; Processor._documentTracker.NonRoslynBufferTextChanged += OnNonRoslynBufferTextChanged; } public ImmutableArray<IIncrementalAnalyzer> Analyzers { get { lock (_gate) { return _lazyAnalyzers.Value; } } } public void AddAnalyzer(IIncrementalAnalyzer analyzer) { lock (_gate) { var analyzers = _lazyAnalyzers.Value; _lazyAnalyzers = new Lazy<ImmutableArray<IIncrementalAnalyzer>>(() => analyzers.Add(analyzer)); } } protected override void PauseOnGlobalOperation() => SolutionCrawlerLogger.LogGlobalOperation(Processor._logAggregator); protected abstract Task HigherQueueOperationTask { get; } protected abstract bool HigherQueueHasWorkItem { get; } protected async Task WaitForHigherPriorityOperationsAsync() { using (Logger.LogBlock(FunctionId.WorkCoordinator_WaitForHigherPriorityOperationsAsync, CancellationToken)) { do { // Host is shutting down if (CancellationToken.IsCancellationRequested) { return; } // we wait for global operation and higher queue operation if there is anything going on if (!GlobalOperationTask.IsCompleted || !HigherQueueOperationTask.IsCompleted) { await Task.WhenAll(GlobalOperationTask, HigherQueueOperationTask).ConfigureAwait(false); } // if there are no more work left for higher queue, then it is our time to go ahead if (!HigherQueueHasWorkItem) { return; } // back off and wait for next time slot. UpdateLastAccessTime(); await WaitForIdleAsync(Listener).ConfigureAwait(false); } while (true); } } public override void Shutdown() { base.Shutdown(); Processor._documentTracker.NonRoslynBufferTextChanged -= OnNonRoslynBufferTextChanged; } private void OnNonRoslynBufferTextChanged(object? sender, EventArgs e) { // There are 2 things incremental processor takes care of // // #1 is making sure we delay processing any work until there is enough idle (ex, typing) in host. // #2 is managing cancellation and pending works. // // we used to do #1 and #2 only for Roslyn files. and that is usually fine since most of time solution contains only roslyn files. // // but for mixed solution (ex, Roslyn files + HTML + JS + CSS), #2 still makes sense but #1 doesn't. We want // to pause any work while something is going on in other project types as well. // // we need to make sure we play nice with neighbors as well. // // now, we don't care where changes are coming from. if there is any change in host, we pause ourselves for a while. UpdateLastAccessTime(); } } } } } }
// 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 System; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Notification; using Microsoft.CodeAnalysis.Shared.TestHooks; namespace Microsoft.CodeAnalysis.SolutionCrawler { internal sealed partial class SolutionCrawlerRegistrationService { internal sealed partial class WorkCoordinator { private sealed partial class IncrementalAnalyzerProcessor { private abstract class AbstractPriorityProcessor : GlobalOperationAwareIdleProcessor { protected readonly IncrementalAnalyzerProcessor Processor; private readonly object _gate; private Lazy<ImmutableArray<IIncrementalAnalyzer>> _lazyAnalyzers; public AbstractPriorityProcessor( IAsynchronousOperationListener listener, IncrementalAnalyzerProcessor processor, Lazy<ImmutableArray<IIncrementalAnalyzer>> lazyAnalyzers, IGlobalOperationNotificationService globalOperationNotificationService, TimeSpan backOffTimeSpan, CancellationToken shutdownToken) : base(listener, globalOperationNotificationService, backOffTimeSpan, shutdownToken) { _gate = new object(); _lazyAnalyzers = lazyAnalyzers; Processor = processor; Processor._documentTracker.NonRoslynBufferTextChanged += OnNonRoslynBufferTextChanged; } public ImmutableArray<IIncrementalAnalyzer> Analyzers { get { lock (_gate) { return _lazyAnalyzers.Value; } } } public void AddAnalyzer(IIncrementalAnalyzer analyzer) { lock (_gate) { var analyzers = _lazyAnalyzers.Value; _lazyAnalyzers = new Lazy<ImmutableArray<IIncrementalAnalyzer>>(() => analyzers.Add(analyzer)); } } protected override void PauseOnGlobalOperation() => SolutionCrawlerLogger.LogGlobalOperation(Processor._logAggregator); protected abstract Task HigherQueueOperationTask { get; } protected abstract bool HigherQueueHasWorkItem { get; } protected async Task WaitForHigherPriorityOperationsAsync() { using (Logger.LogBlock(FunctionId.WorkCoordinator_WaitForHigherPriorityOperationsAsync, CancellationToken)) { do { // Host is shutting down if (CancellationToken.IsCancellationRequested) { return; } // we wait for global operation and higher queue operation if there is anything going on if (!GlobalOperationTask.IsCompleted || !HigherQueueOperationTask.IsCompleted) { await Task.WhenAll(GlobalOperationTask, HigherQueueOperationTask).ConfigureAwait(false); } // if there are no more work left for higher queue, then it is our time to go ahead if (!HigherQueueHasWorkItem) { return; } // back off and wait for next time slot. UpdateLastAccessTime(); await WaitForIdleAsync(Listener).ConfigureAwait(false); } while (true); } } public override void Shutdown() { base.Shutdown(); Processor._documentTracker.NonRoslynBufferTextChanged -= OnNonRoslynBufferTextChanged; } private void OnNonRoslynBufferTextChanged(object? sender, EventArgs e) { // There are 2 things incremental processor takes care of // // #1 is making sure we delay processing any work until there is enough idle (ex, typing) in host. // #2 is managing cancellation and pending works. // // we used to do #1 and #2 only for Roslyn files. and that is usually fine since most of time solution contains only roslyn files. // // but for mixed solution (ex, Roslyn files + HTML + JS + CSS), #2 still makes sense but #1 doesn't. We want // to pause any work while something is going on in other project types as well. // // we need to make sure we play nice with neighbors as well. // // now, we don't care where changes are coming from. if there is any change in host, we pause ourselves for a while. UpdateLastAccessTime(); } } } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Features/CSharp/Portable/Completion/KeywordRecommenders/EqualsKeywordRecommender.cs
// 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. #nullable disable using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class EqualsKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public EqualsKeywordRecommender() : base(SyntaxKind.EqualsKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { // cases: // join a in expr o1 | // join a in expr o1 e| var token = context.TargetToken; var join = token.GetAncestor<JoinClauseSyntax>(); if (join == null) { return false; } var lastToken = join.LeftExpression.GetLastToken(includeSkipped: true); // join a in expr | if (join.LeftExpression.Width() > 0 && token == lastToken) { return true; } return false; } } }
// 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. #nullable disable using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class EqualsKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public EqualsKeywordRecommender() : base(SyntaxKind.EqualsKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { // cases: // join a in expr o1 | // join a in expr o1 e| var token = context.TargetToken; var join = token.GetAncestor<JoinClauseSyntax>(); if (join == null) { return false; } var lastToken = join.LeftExpression.GetLastToken(includeSkipped: true); // join a in expr | if (join.LeftExpression.Width() > 0 && token == lastToken) { return true; } return false; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Tools/ExternalAccess/FSharp/PublicAPI.Shipped.txt
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Dependencies/CodeAnalysis.Debugging/CustomDebugInfoConstants.cs
// 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. #nullable disable namespace Microsoft.CodeAnalysis.Debugging { /// <summary> /// Constants for producing and consuming streams of binary custom debug info. /// </summary> internal static class CustomDebugInfoConstants { // The version number of the custom debug info binary format. // CDIVERSION in Dev10 internal const byte Version = 4; // The number of bytes at the beginning of the byte array that contain global header information. // start after header (version byte + size byte + dword padding) internal const int GlobalHeaderSize = 4; // The number of bytes at the beginning of each custom debug info record that contain header information // common to all record types (i.e. byte, kind, size). // version byte + kind byte + two bytes padding + size dword internal const int RecordHeaderSize = 8; } }
// 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. #nullable disable namespace Microsoft.CodeAnalysis.Debugging { /// <summary> /// Constants for producing and consuming streams of binary custom debug info. /// </summary> internal static class CustomDebugInfoConstants { // The version number of the custom debug info binary format. // CDIVERSION in Dev10 internal const byte Version = 4; // The number of bytes at the beginning of the byte array that contain global header information. // start after header (version byte + size byte + dword padding) internal const int GlobalHeaderSize = 4; // The number of bytes at the beginning of each custom debug info record that contain header information // common to all record types (i.e. byte, kind, size). // version byte + kind byte + two bytes padding + size dword internal const int RecordHeaderSize = 8; } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/CSharp/GoToDefinition/CSharpGoToDefinitionService.cs
// 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 System.Composition; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.GoToDefinition; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.CodeAnalysis.Editor.CSharp.GoToDefinition { [ExportLanguageService(typeof(IGoToDefinitionService), LanguageNames.CSharp), Shared] internal class CSharpGoToDefinitionService : AbstractGoToDefinitionService { [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")] public CSharpGoToDefinitionService( IThreadingContext threadingContext, IStreamingFindUsagesPresenter streamingPresenter) : base(threadingContext, streamingPresenter) { } } }
// 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 System.Composition; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.GoToDefinition; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; namespace Microsoft.CodeAnalysis.Editor.CSharp.GoToDefinition { [ExportLanguageService(typeof(IGoToDefinitionService), LanguageNames.CSharp), Shared] internal class CSharpGoToDefinitionService : AbstractGoToDefinitionService { [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")] public CSharpGoToDefinitionService( IThreadingContext threadingContext, IStreamingFindUsagesPresenter streamingPresenter) : base(threadingContext, streamingPresenter) { } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Tools/ExternalAccess/FSharp/Internal/FSharpGlyphHelpers.cs
// 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. #nullable disable using System; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal { internal static class FSharpGlyphHelpers { public static FSharpGlyph ConvertFrom(Microsoft.CodeAnalysis.Glyph glyph) { switch (glyph) { case Microsoft.CodeAnalysis.Glyph.None: { return FSharpGlyph.None; } case Microsoft.CodeAnalysis.Glyph.Assembly: { return FSharpGlyph.Assembly; } case Microsoft.CodeAnalysis.Glyph.BasicFile: { return FSharpGlyph.BasicFile; } case Microsoft.CodeAnalysis.Glyph.BasicProject: { return FSharpGlyph.BasicProject; } case Microsoft.CodeAnalysis.Glyph.ClassPublic: { return FSharpGlyph.ClassPublic; } case Microsoft.CodeAnalysis.Glyph.ClassProtected: { return FSharpGlyph.ClassProtected; } case Microsoft.CodeAnalysis.Glyph.ClassPrivate: { return FSharpGlyph.ClassPrivate; } case Microsoft.CodeAnalysis.Glyph.ClassInternal: { return FSharpGlyph.ClassInternal; } case Microsoft.CodeAnalysis.Glyph.CSharpFile: { return FSharpGlyph.CSharpFile; } case Microsoft.CodeAnalysis.Glyph.CSharpProject: { return FSharpGlyph.CSharpProject; } case Microsoft.CodeAnalysis.Glyph.ConstantPublic: { return FSharpGlyph.ConstantPublic; } case Microsoft.CodeAnalysis.Glyph.ConstantProtected: { return FSharpGlyph.ConstantProtected; } case Microsoft.CodeAnalysis.Glyph.ConstantPrivate: { return FSharpGlyph.ConstantPrivate; } case Microsoft.CodeAnalysis.Glyph.ConstantInternal: { return FSharpGlyph.ConstantInternal; } case Microsoft.CodeAnalysis.Glyph.DelegatePublic: { return FSharpGlyph.DelegatePublic; } case Microsoft.CodeAnalysis.Glyph.DelegateProtected: { return FSharpGlyph.DelegateProtected; } case Microsoft.CodeAnalysis.Glyph.DelegatePrivate: { return FSharpGlyph.DelegatePrivate; } case Microsoft.CodeAnalysis.Glyph.DelegateInternal: { return FSharpGlyph.DelegateInternal; } case Microsoft.CodeAnalysis.Glyph.EnumPublic: { return FSharpGlyph.EnumPublic; } case Microsoft.CodeAnalysis.Glyph.EnumProtected: { return FSharpGlyph.EnumProtected; } case Microsoft.CodeAnalysis.Glyph.EnumPrivate: { return FSharpGlyph.EnumPrivate; } case Microsoft.CodeAnalysis.Glyph.EnumInternal: { return FSharpGlyph.EnumInternal; } case Microsoft.CodeAnalysis.Glyph.EnumMemberPublic: { return FSharpGlyph.EnumMemberPublic; } case Microsoft.CodeAnalysis.Glyph.EnumMemberProtected: { return FSharpGlyph.EnumMemberProtected; } case Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate: { return FSharpGlyph.EnumMemberPrivate; } case Microsoft.CodeAnalysis.Glyph.EnumMemberInternal: { return FSharpGlyph.EnumMemberInternal; } case Microsoft.CodeAnalysis.Glyph.Error: { return FSharpGlyph.Error; } case Microsoft.CodeAnalysis.Glyph.StatusInformation: { return FSharpGlyph.StatusInformation; } case Microsoft.CodeAnalysis.Glyph.EventPublic: { return FSharpGlyph.EventPublic; } case Microsoft.CodeAnalysis.Glyph.EventProtected: { return FSharpGlyph.EventProtected; } case Microsoft.CodeAnalysis.Glyph.EventPrivate: { return FSharpGlyph.EventPrivate; } case Microsoft.CodeAnalysis.Glyph.EventInternal: { return FSharpGlyph.EventInternal; } case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic: { return FSharpGlyph.ExtensionMethodPublic; } case Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected: { return FSharpGlyph.ExtensionMethodProtected; } case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate: { return FSharpGlyph.ExtensionMethodPrivate; } case Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal: { return FSharpGlyph.ExtensionMethodInternal; } case Microsoft.CodeAnalysis.Glyph.FieldPublic: { return FSharpGlyph.FieldPublic; } case Microsoft.CodeAnalysis.Glyph.FieldProtected: { return FSharpGlyph.FieldProtected; } case Microsoft.CodeAnalysis.Glyph.FieldPrivate: { return FSharpGlyph.FieldPrivate; } case Microsoft.CodeAnalysis.Glyph.FieldInternal: { return FSharpGlyph.FieldInternal; } case Microsoft.CodeAnalysis.Glyph.InterfacePublic: { return FSharpGlyph.InterfacePublic; } case Microsoft.CodeAnalysis.Glyph.InterfaceProtected: { return FSharpGlyph.InterfaceProtected; } case Microsoft.CodeAnalysis.Glyph.InterfacePrivate: { return FSharpGlyph.InterfacePrivate; } case Microsoft.CodeAnalysis.Glyph.InterfaceInternal: { return FSharpGlyph.InterfaceInternal; } case Microsoft.CodeAnalysis.Glyph.Intrinsic: { return FSharpGlyph.Intrinsic; } case Microsoft.CodeAnalysis.Glyph.Keyword: { return FSharpGlyph.Keyword; } case Microsoft.CodeAnalysis.Glyph.Label: { return FSharpGlyph.Label; } case Microsoft.CodeAnalysis.Glyph.Local: { return FSharpGlyph.Local; } case Microsoft.CodeAnalysis.Glyph.Namespace: { return FSharpGlyph.Namespace; } case Microsoft.CodeAnalysis.Glyph.MethodPublic: { return FSharpGlyph.MethodPublic; } case Microsoft.CodeAnalysis.Glyph.MethodProtected: { return FSharpGlyph.MethodProtected; } case Microsoft.CodeAnalysis.Glyph.MethodPrivate: { return FSharpGlyph.MethodPrivate; } case Microsoft.CodeAnalysis.Glyph.MethodInternal: { return FSharpGlyph.MethodInternal; } case Microsoft.CodeAnalysis.Glyph.ModulePublic: { return FSharpGlyph.ModulePublic; } case Microsoft.CodeAnalysis.Glyph.ModuleProtected: { return FSharpGlyph.ModuleProtected; } case Microsoft.CodeAnalysis.Glyph.ModulePrivate: { return FSharpGlyph.ModulePrivate; } case Microsoft.CodeAnalysis.Glyph.ModuleInternal: { return FSharpGlyph.ModuleInternal; } case Microsoft.CodeAnalysis.Glyph.OpenFolder: { return FSharpGlyph.OpenFolder; } case Microsoft.CodeAnalysis.Glyph.Operator: { return FSharpGlyph.Operator; } case Microsoft.CodeAnalysis.Glyph.Parameter: { return FSharpGlyph.Parameter; } case Microsoft.CodeAnalysis.Glyph.PropertyPublic: { return FSharpGlyph.PropertyPublic; } case Microsoft.CodeAnalysis.Glyph.PropertyProtected: { return FSharpGlyph.PropertyProtected; } case Microsoft.CodeAnalysis.Glyph.PropertyPrivate: { return FSharpGlyph.PropertyPrivate; } case Microsoft.CodeAnalysis.Glyph.PropertyInternal: { return FSharpGlyph.PropertyInternal; } case Microsoft.CodeAnalysis.Glyph.RangeVariable: { return FSharpGlyph.RangeVariable; } case Microsoft.CodeAnalysis.Glyph.Reference: { return FSharpGlyph.Reference; } case Microsoft.CodeAnalysis.Glyph.StructurePublic: { return FSharpGlyph.StructurePublic; } case Microsoft.CodeAnalysis.Glyph.StructureProtected: { return FSharpGlyph.StructureProtected; } case Microsoft.CodeAnalysis.Glyph.StructurePrivate: { return FSharpGlyph.StructurePrivate; } case Microsoft.CodeAnalysis.Glyph.StructureInternal: { return FSharpGlyph.StructureInternal; } case Microsoft.CodeAnalysis.Glyph.TypeParameter: { return FSharpGlyph.TypeParameter; } case Microsoft.CodeAnalysis.Glyph.Snippet: { return FSharpGlyph.Snippet; } case Microsoft.CodeAnalysis.Glyph.CompletionWarning: { return FSharpGlyph.CompletionWarning; } case Microsoft.CodeAnalysis.Glyph.AddReference: { return FSharpGlyph.AddReference; } case Microsoft.CodeAnalysis.Glyph.NuGet: { return FSharpGlyph.NuGet; } case Microsoft.CodeAnalysis.Glyph.TargetTypeMatch: { return FSharpGlyph.TargetTypeMatch; } default: { throw ExceptionUtilities.UnexpectedValue(glyph); } } } public static Microsoft.CodeAnalysis.Glyph ConvertTo(FSharpGlyph glyph) { switch (glyph) { case FSharpGlyph.None: { return Microsoft.CodeAnalysis.Glyph.None; } case FSharpGlyph.Assembly: { return Microsoft.CodeAnalysis.Glyph.Assembly; } case FSharpGlyph.BasicFile: { return Microsoft.CodeAnalysis.Glyph.BasicFile; } case FSharpGlyph.BasicProject: { return Microsoft.CodeAnalysis.Glyph.BasicProject; } case FSharpGlyph.ClassPublic: { return Microsoft.CodeAnalysis.Glyph.ClassPublic; } case FSharpGlyph.ClassProtected: { return Microsoft.CodeAnalysis.Glyph.ClassProtected; } case FSharpGlyph.ClassPrivate: { return Microsoft.CodeAnalysis.Glyph.ClassPrivate; } case FSharpGlyph.ClassInternal: { return Microsoft.CodeAnalysis.Glyph.ClassInternal; } case FSharpGlyph.CSharpFile: { return Microsoft.CodeAnalysis.Glyph.CSharpFile; } case FSharpGlyph.CSharpProject: { return Microsoft.CodeAnalysis.Glyph.CSharpProject; } case FSharpGlyph.ConstantPublic: { return Microsoft.CodeAnalysis.Glyph.ConstantPublic; } case FSharpGlyph.ConstantProtected: { return Microsoft.CodeAnalysis.Glyph.ConstantProtected; } case FSharpGlyph.ConstantPrivate: { return Microsoft.CodeAnalysis.Glyph.ConstantPrivate; } case FSharpGlyph.ConstantInternal: { return Microsoft.CodeAnalysis.Glyph.ConstantInternal; } case FSharpGlyph.DelegatePublic: { return Microsoft.CodeAnalysis.Glyph.DelegatePublic; } case FSharpGlyph.DelegateProtected: { return Microsoft.CodeAnalysis.Glyph.DelegateProtected; } case FSharpGlyph.DelegatePrivate: { return Microsoft.CodeAnalysis.Glyph.DelegatePrivate; } case FSharpGlyph.DelegateInternal: { return Microsoft.CodeAnalysis.Glyph.DelegateInternal; } case FSharpGlyph.EnumPublic: { return Microsoft.CodeAnalysis.Glyph.EnumPublic; } case FSharpGlyph.EnumProtected: { return Microsoft.CodeAnalysis.Glyph.EnumProtected; } case FSharpGlyph.EnumPrivate: { return Microsoft.CodeAnalysis.Glyph.EnumPrivate; } case FSharpGlyph.EnumInternal: { return Microsoft.CodeAnalysis.Glyph.EnumInternal; } case FSharpGlyph.EnumMemberPublic: { return Microsoft.CodeAnalysis.Glyph.EnumMemberPublic; } case FSharpGlyph.EnumMemberProtected: { return Microsoft.CodeAnalysis.Glyph.EnumMemberProtected; } case FSharpGlyph.EnumMemberPrivate: { return Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate; } case FSharpGlyph.EnumMemberInternal: { return Microsoft.CodeAnalysis.Glyph.EnumMemberInternal; } case FSharpGlyph.Error: { return Microsoft.CodeAnalysis.Glyph.Error; } case FSharpGlyph.StatusInformation: { return Microsoft.CodeAnalysis.Glyph.StatusInformation; } case FSharpGlyph.EventPublic: { return Microsoft.CodeAnalysis.Glyph.EventPublic; } case FSharpGlyph.EventProtected: { return Microsoft.CodeAnalysis.Glyph.EventProtected; } case FSharpGlyph.EventPrivate: { return Microsoft.CodeAnalysis.Glyph.EventPrivate; } case FSharpGlyph.EventInternal: { return Microsoft.CodeAnalysis.Glyph.EventInternal; } case FSharpGlyph.ExtensionMethodPublic: { return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic; } case FSharpGlyph.ExtensionMethodProtected: { return Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected; } case FSharpGlyph.ExtensionMethodPrivate: { return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate; } case FSharpGlyph.ExtensionMethodInternal: { return Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal; } case FSharpGlyph.FieldPublic: { return Microsoft.CodeAnalysis.Glyph.FieldPublic; } case FSharpGlyph.FieldProtected: { return Microsoft.CodeAnalysis.Glyph.FieldProtected; } case FSharpGlyph.FieldPrivate: { return Microsoft.CodeAnalysis.Glyph.FieldPrivate; } case FSharpGlyph.FieldInternal: { return Microsoft.CodeAnalysis.Glyph.FieldInternal; } case FSharpGlyph.InterfacePublic: { return Microsoft.CodeAnalysis.Glyph.InterfacePublic; } case FSharpGlyph.InterfaceProtected: { return Microsoft.CodeAnalysis.Glyph.InterfaceProtected; } case FSharpGlyph.InterfacePrivate: { return Microsoft.CodeAnalysis.Glyph.InterfacePrivate; } case FSharpGlyph.InterfaceInternal: { return Microsoft.CodeAnalysis.Glyph.InterfaceInternal; } case FSharpGlyph.Intrinsic: { return Microsoft.CodeAnalysis.Glyph.Intrinsic; } case FSharpGlyph.Keyword: { return Microsoft.CodeAnalysis.Glyph.Keyword; } case FSharpGlyph.Label: { return Microsoft.CodeAnalysis.Glyph.Label; } case FSharpGlyph.Local: { return Microsoft.CodeAnalysis.Glyph.Local; } case FSharpGlyph.Namespace: { return Microsoft.CodeAnalysis.Glyph.Namespace; } case FSharpGlyph.MethodPublic: { return Microsoft.CodeAnalysis.Glyph.MethodPublic; } case FSharpGlyph.MethodProtected: { return Microsoft.CodeAnalysis.Glyph.MethodProtected; } case FSharpGlyph.MethodPrivate: { return Microsoft.CodeAnalysis.Glyph.MethodPrivate; } case FSharpGlyph.MethodInternal: { return Microsoft.CodeAnalysis.Glyph.MethodInternal; } case FSharpGlyph.ModulePublic: { return Microsoft.CodeAnalysis.Glyph.ModulePublic; } case FSharpGlyph.ModuleProtected: { return Microsoft.CodeAnalysis.Glyph.ModuleProtected; } case FSharpGlyph.ModulePrivate: { return Microsoft.CodeAnalysis.Glyph.ModulePrivate; } case FSharpGlyph.ModuleInternal: { return Microsoft.CodeAnalysis.Glyph.ModuleInternal; } case FSharpGlyph.OpenFolder: { return Microsoft.CodeAnalysis.Glyph.OpenFolder; } case FSharpGlyph.Operator: { return Microsoft.CodeAnalysis.Glyph.Operator; } case FSharpGlyph.Parameter: { return Microsoft.CodeAnalysis.Glyph.Parameter; } case FSharpGlyph.PropertyPublic: { return Microsoft.CodeAnalysis.Glyph.PropertyPublic; } case FSharpGlyph.PropertyProtected: { return Microsoft.CodeAnalysis.Glyph.PropertyProtected; } case FSharpGlyph.PropertyPrivate: { return Microsoft.CodeAnalysis.Glyph.PropertyPrivate; } case FSharpGlyph.PropertyInternal: { return Microsoft.CodeAnalysis.Glyph.PropertyInternal; } case FSharpGlyph.RangeVariable: { return Microsoft.CodeAnalysis.Glyph.RangeVariable; } case FSharpGlyph.Reference: { return Microsoft.CodeAnalysis.Glyph.Reference; } case FSharpGlyph.StructurePublic: { return Microsoft.CodeAnalysis.Glyph.StructurePublic; } case FSharpGlyph.StructureProtected: { return Microsoft.CodeAnalysis.Glyph.StructureProtected; } case FSharpGlyph.StructurePrivate: { return Microsoft.CodeAnalysis.Glyph.StructurePrivate; } case FSharpGlyph.StructureInternal: { return Microsoft.CodeAnalysis.Glyph.StructureInternal; } case FSharpGlyph.TypeParameter: { return Microsoft.CodeAnalysis.Glyph.TypeParameter; } case FSharpGlyph.Snippet: { return Microsoft.CodeAnalysis.Glyph.Snippet; } case FSharpGlyph.CompletionWarning: { return Microsoft.CodeAnalysis.Glyph.CompletionWarning; } case FSharpGlyph.AddReference: { return Microsoft.CodeAnalysis.Glyph.AddReference; } case FSharpGlyph.NuGet: { return Microsoft.CodeAnalysis.Glyph.NuGet; } case FSharpGlyph.TargetTypeMatch: { return Microsoft.CodeAnalysis.Glyph.TargetTypeMatch; } default: { throw ExceptionUtilities.UnexpectedValue(glyph); } } } } }
// 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. #nullable disable using System; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal { internal static class FSharpGlyphHelpers { public static FSharpGlyph ConvertFrom(Microsoft.CodeAnalysis.Glyph glyph) { switch (glyph) { case Microsoft.CodeAnalysis.Glyph.None: { return FSharpGlyph.None; } case Microsoft.CodeAnalysis.Glyph.Assembly: { return FSharpGlyph.Assembly; } case Microsoft.CodeAnalysis.Glyph.BasicFile: { return FSharpGlyph.BasicFile; } case Microsoft.CodeAnalysis.Glyph.BasicProject: { return FSharpGlyph.BasicProject; } case Microsoft.CodeAnalysis.Glyph.ClassPublic: { return FSharpGlyph.ClassPublic; } case Microsoft.CodeAnalysis.Glyph.ClassProtected: { return FSharpGlyph.ClassProtected; } case Microsoft.CodeAnalysis.Glyph.ClassPrivate: { return FSharpGlyph.ClassPrivate; } case Microsoft.CodeAnalysis.Glyph.ClassInternal: { return FSharpGlyph.ClassInternal; } case Microsoft.CodeAnalysis.Glyph.CSharpFile: { return FSharpGlyph.CSharpFile; } case Microsoft.CodeAnalysis.Glyph.CSharpProject: { return FSharpGlyph.CSharpProject; } case Microsoft.CodeAnalysis.Glyph.ConstantPublic: { return FSharpGlyph.ConstantPublic; } case Microsoft.CodeAnalysis.Glyph.ConstantProtected: { return FSharpGlyph.ConstantProtected; } case Microsoft.CodeAnalysis.Glyph.ConstantPrivate: { return FSharpGlyph.ConstantPrivate; } case Microsoft.CodeAnalysis.Glyph.ConstantInternal: { return FSharpGlyph.ConstantInternal; } case Microsoft.CodeAnalysis.Glyph.DelegatePublic: { return FSharpGlyph.DelegatePublic; } case Microsoft.CodeAnalysis.Glyph.DelegateProtected: { return FSharpGlyph.DelegateProtected; } case Microsoft.CodeAnalysis.Glyph.DelegatePrivate: { return FSharpGlyph.DelegatePrivate; } case Microsoft.CodeAnalysis.Glyph.DelegateInternal: { return FSharpGlyph.DelegateInternal; } case Microsoft.CodeAnalysis.Glyph.EnumPublic: { return FSharpGlyph.EnumPublic; } case Microsoft.CodeAnalysis.Glyph.EnumProtected: { return FSharpGlyph.EnumProtected; } case Microsoft.CodeAnalysis.Glyph.EnumPrivate: { return FSharpGlyph.EnumPrivate; } case Microsoft.CodeAnalysis.Glyph.EnumInternal: { return FSharpGlyph.EnumInternal; } case Microsoft.CodeAnalysis.Glyph.EnumMemberPublic: { return FSharpGlyph.EnumMemberPublic; } case Microsoft.CodeAnalysis.Glyph.EnumMemberProtected: { return FSharpGlyph.EnumMemberProtected; } case Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate: { return FSharpGlyph.EnumMemberPrivate; } case Microsoft.CodeAnalysis.Glyph.EnumMemberInternal: { return FSharpGlyph.EnumMemberInternal; } case Microsoft.CodeAnalysis.Glyph.Error: { return FSharpGlyph.Error; } case Microsoft.CodeAnalysis.Glyph.StatusInformation: { return FSharpGlyph.StatusInformation; } case Microsoft.CodeAnalysis.Glyph.EventPublic: { return FSharpGlyph.EventPublic; } case Microsoft.CodeAnalysis.Glyph.EventProtected: { return FSharpGlyph.EventProtected; } case Microsoft.CodeAnalysis.Glyph.EventPrivate: { return FSharpGlyph.EventPrivate; } case Microsoft.CodeAnalysis.Glyph.EventInternal: { return FSharpGlyph.EventInternal; } case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic: { return FSharpGlyph.ExtensionMethodPublic; } case Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected: { return FSharpGlyph.ExtensionMethodProtected; } case Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate: { return FSharpGlyph.ExtensionMethodPrivate; } case Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal: { return FSharpGlyph.ExtensionMethodInternal; } case Microsoft.CodeAnalysis.Glyph.FieldPublic: { return FSharpGlyph.FieldPublic; } case Microsoft.CodeAnalysis.Glyph.FieldProtected: { return FSharpGlyph.FieldProtected; } case Microsoft.CodeAnalysis.Glyph.FieldPrivate: { return FSharpGlyph.FieldPrivate; } case Microsoft.CodeAnalysis.Glyph.FieldInternal: { return FSharpGlyph.FieldInternal; } case Microsoft.CodeAnalysis.Glyph.InterfacePublic: { return FSharpGlyph.InterfacePublic; } case Microsoft.CodeAnalysis.Glyph.InterfaceProtected: { return FSharpGlyph.InterfaceProtected; } case Microsoft.CodeAnalysis.Glyph.InterfacePrivate: { return FSharpGlyph.InterfacePrivate; } case Microsoft.CodeAnalysis.Glyph.InterfaceInternal: { return FSharpGlyph.InterfaceInternal; } case Microsoft.CodeAnalysis.Glyph.Intrinsic: { return FSharpGlyph.Intrinsic; } case Microsoft.CodeAnalysis.Glyph.Keyword: { return FSharpGlyph.Keyword; } case Microsoft.CodeAnalysis.Glyph.Label: { return FSharpGlyph.Label; } case Microsoft.CodeAnalysis.Glyph.Local: { return FSharpGlyph.Local; } case Microsoft.CodeAnalysis.Glyph.Namespace: { return FSharpGlyph.Namespace; } case Microsoft.CodeAnalysis.Glyph.MethodPublic: { return FSharpGlyph.MethodPublic; } case Microsoft.CodeAnalysis.Glyph.MethodProtected: { return FSharpGlyph.MethodProtected; } case Microsoft.CodeAnalysis.Glyph.MethodPrivate: { return FSharpGlyph.MethodPrivate; } case Microsoft.CodeAnalysis.Glyph.MethodInternal: { return FSharpGlyph.MethodInternal; } case Microsoft.CodeAnalysis.Glyph.ModulePublic: { return FSharpGlyph.ModulePublic; } case Microsoft.CodeAnalysis.Glyph.ModuleProtected: { return FSharpGlyph.ModuleProtected; } case Microsoft.CodeAnalysis.Glyph.ModulePrivate: { return FSharpGlyph.ModulePrivate; } case Microsoft.CodeAnalysis.Glyph.ModuleInternal: { return FSharpGlyph.ModuleInternal; } case Microsoft.CodeAnalysis.Glyph.OpenFolder: { return FSharpGlyph.OpenFolder; } case Microsoft.CodeAnalysis.Glyph.Operator: { return FSharpGlyph.Operator; } case Microsoft.CodeAnalysis.Glyph.Parameter: { return FSharpGlyph.Parameter; } case Microsoft.CodeAnalysis.Glyph.PropertyPublic: { return FSharpGlyph.PropertyPublic; } case Microsoft.CodeAnalysis.Glyph.PropertyProtected: { return FSharpGlyph.PropertyProtected; } case Microsoft.CodeAnalysis.Glyph.PropertyPrivate: { return FSharpGlyph.PropertyPrivate; } case Microsoft.CodeAnalysis.Glyph.PropertyInternal: { return FSharpGlyph.PropertyInternal; } case Microsoft.CodeAnalysis.Glyph.RangeVariable: { return FSharpGlyph.RangeVariable; } case Microsoft.CodeAnalysis.Glyph.Reference: { return FSharpGlyph.Reference; } case Microsoft.CodeAnalysis.Glyph.StructurePublic: { return FSharpGlyph.StructurePublic; } case Microsoft.CodeAnalysis.Glyph.StructureProtected: { return FSharpGlyph.StructureProtected; } case Microsoft.CodeAnalysis.Glyph.StructurePrivate: { return FSharpGlyph.StructurePrivate; } case Microsoft.CodeAnalysis.Glyph.StructureInternal: { return FSharpGlyph.StructureInternal; } case Microsoft.CodeAnalysis.Glyph.TypeParameter: { return FSharpGlyph.TypeParameter; } case Microsoft.CodeAnalysis.Glyph.Snippet: { return FSharpGlyph.Snippet; } case Microsoft.CodeAnalysis.Glyph.CompletionWarning: { return FSharpGlyph.CompletionWarning; } case Microsoft.CodeAnalysis.Glyph.AddReference: { return FSharpGlyph.AddReference; } case Microsoft.CodeAnalysis.Glyph.NuGet: { return FSharpGlyph.NuGet; } case Microsoft.CodeAnalysis.Glyph.TargetTypeMatch: { return FSharpGlyph.TargetTypeMatch; } default: { throw ExceptionUtilities.UnexpectedValue(glyph); } } } public static Microsoft.CodeAnalysis.Glyph ConvertTo(FSharpGlyph glyph) { switch (glyph) { case FSharpGlyph.None: { return Microsoft.CodeAnalysis.Glyph.None; } case FSharpGlyph.Assembly: { return Microsoft.CodeAnalysis.Glyph.Assembly; } case FSharpGlyph.BasicFile: { return Microsoft.CodeAnalysis.Glyph.BasicFile; } case FSharpGlyph.BasicProject: { return Microsoft.CodeAnalysis.Glyph.BasicProject; } case FSharpGlyph.ClassPublic: { return Microsoft.CodeAnalysis.Glyph.ClassPublic; } case FSharpGlyph.ClassProtected: { return Microsoft.CodeAnalysis.Glyph.ClassProtected; } case FSharpGlyph.ClassPrivate: { return Microsoft.CodeAnalysis.Glyph.ClassPrivate; } case FSharpGlyph.ClassInternal: { return Microsoft.CodeAnalysis.Glyph.ClassInternal; } case FSharpGlyph.CSharpFile: { return Microsoft.CodeAnalysis.Glyph.CSharpFile; } case FSharpGlyph.CSharpProject: { return Microsoft.CodeAnalysis.Glyph.CSharpProject; } case FSharpGlyph.ConstantPublic: { return Microsoft.CodeAnalysis.Glyph.ConstantPublic; } case FSharpGlyph.ConstantProtected: { return Microsoft.CodeAnalysis.Glyph.ConstantProtected; } case FSharpGlyph.ConstantPrivate: { return Microsoft.CodeAnalysis.Glyph.ConstantPrivate; } case FSharpGlyph.ConstantInternal: { return Microsoft.CodeAnalysis.Glyph.ConstantInternal; } case FSharpGlyph.DelegatePublic: { return Microsoft.CodeAnalysis.Glyph.DelegatePublic; } case FSharpGlyph.DelegateProtected: { return Microsoft.CodeAnalysis.Glyph.DelegateProtected; } case FSharpGlyph.DelegatePrivate: { return Microsoft.CodeAnalysis.Glyph.DelegatePrivate; } case FSharpGlyph.DelegateInternal: { return Microsoft.CodeAnalysis.Glyph.DelegateInternal; } case FSharpGlyph.EnumPublic: { return Microsoft.CodeAnalysis.Glyph.EnumPublic; } case FSharpGlyph.EnumProtected: { return Microsoft.CodeAnalysis.Glyph.EnumProtected; } case FSharpGlyph.EnumPrivate: { return Microsoft.CodeAnalysis.Glyph.EnumPrivate; } case FSharpGlyph.EnumInternal: { return Microsoft.CodeAnalysis.Glyph.EnumInternal; } case FSharpGlyph.EnumMemberPublic: { return Microsoft.CodeAnalysis.Glyph.EnumMemberPublic; } case FSharpGlyph.EnumMemberProtected: { return Microsoft.CodeAnalysis.Glyph.EnumMemberProtected; } case FSharpGlyph.EnumMemberPrivate: { return Microsoft.CodeAnalysis.Glyph.EnumMemberPrivate; } case FSharpGlyph.EnumMemberInternal: { return Microsoft.CodeAnalysis.Glyph.EnumMemberInternal; } case FSharpGlyph.Error: { return Microsoft.CodeAnalysis.Glyph.Error; } case FSharpGlyph.StatusInformation: { return Microsoft.CodeAnalysis.Glyph.StatusInformation; } case FSharpGlyph.EventPublic: { return Microsoft.CodeAnalysis.Glyph.EventPublic; } case FSharpGlyph.EventProtected: { return Microsoft.CodeAnalysis.Glyph.EventProtected; } case FSharpGlyph.EventPrivate: { return Microsoft.CodeAnalysis.Glyph.EventPrivate; } case FSharpGlyph.EventInternal: { return Microsoft.CodeAnalysis.Glyph.EventInternal; } case FSharpGlyph.ExtensionMethodPublic: { return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPublic; } case FSharpGlyph.ExtensionMethodProtected: { return Microsoft.CodeAnalysis.Glyph.ExtensionMethodProtected; } case FSharpGlyph.ExtensionMethodPrivate: { return Microsoft.CodeAnalysis.Glyph.ExtensionMethodPrivate; } case FSharpGlyph.ExtensionMethodInternal: { return Microsoft.CodeAnalysis.Glyph.ExtensionMethodInternal; } case FSharpGlyph.FieldPublic: { return Microsoft.CodeAnalysis.Glyph.FieldPublic; } case FSharpGlyph.FieldProtected: { return Microsoft.CodeAnalysis.Glyph.FieldProtected; } case FSharpGlyph.FieldPrivate: { return Microsoft.CodeAnalysis.Glyph.FieldPrivate; } case FSharpGlyph.FieldInternal: { return Microsoft.CodeAnalysis.Glyph.FieldInternal; } case FSharpGlyph.InterfacePublic: { return Microsoft.CodeAnalysis.Glyph.InterfacePublic; } case FSharpGlyph.InterfaceProtected: { return Microsoft.CodeAnalysis.Glyph.InterfaceProtected; } case FSharpGlyph.InterfacePrivate: { return Microsoft.CodeAnalysis.Glyph.InterfacePrivate; } case FSharpGlyph.InterfaceInternal: { return Microsoft.CodeAnalysis.Glyph.InterfaceInternal; } case FSharpGlyph.Intrinsic: { return Microsoft.CodeAnalysis.Glyph.Intrinsic; } case FSharpGlyph.Keyword: { return Microsoft.CodeAnalysis.Glyph.Keyword; } case FSharpGlyph.Label: { return Microsoft.CodeAnalysis.Glyph.Label; } case FSharpGlyph.Local: { return Microsoft.CodeAnalysis.Glyph.Local; } case FSharpGlyph.Namespace: { return Microsoft.CodeAnalysis.Glyph.Namespace; } case FSharpGlyph.MethodPublic: { return Microsoft.CodeAnalysis.Glyph.MethodPublic; } case FSharpGlyph.MethodProtected: { return Microsoft.CodeAnalysis.Glyph.MethodProtected; } case FSharpGlyph.MethodPrivate: { return Microsoft.CodeAnalysis.Glyph.MethodPrivate; } case FSharpGlyph.MethodInternal: { return Microsoft.CodeAnalysis.Glyph.MethodInternal; } case FSharpGlyph.ModulePublic: { return Microsoft.CodeAnalysis.Glyph.ModulePublic; } case FSharpGlyph.ModuleProtected: { return Microsoft.CodeAnalysis.Glyph.ModuleProtected; } case FSharpGlyph.ModulePrivate: { return Microsoft.CodeAnalysis.Glyph.ModulePrivate; } case FSharpGlyph.ModuleInternal: { return Microsoft.CodeAnalysis.Glyph.ModuleInternal; } case FSharpGlyph.OpenFolder: { return Microsoft.CodeAnalysis.Glyph.OpenFolder; } case FSharpGlyph.Operator: { return Microsoft.CodeAnalysis.Glyph.Operator; } case FSharpGlyph.Parameter: { return Microsoft.CodeAnalysis.Glyph.Parameter; } case FSharpGlyph.PropertyPublic: { return Microsoft.CodeAnalysis.Glyph.PropertyPublic; } case FSharpGlyph.PropertyProtected: { return Microsoft.CodeAnalysis.Glyph.PropertyProtected; } case FSharpGlyph.PropertyPrivate: { return Microsoft.CodeAnalysis.Glyph.PropertyPrivate; } case FSharpGlyph.PropertyInternal: { return Microsoft.CodeAnalysis.Glyph.PropertyInternal; } case FSharpGlyph.RangeVariable: { return Microsoft.CodeAnalysis.Glyph.RangeVariable; } case FSharpGlyph.Reference: { return Microsoft.CodeAnalysis.Glyph.Reference; } case FSharpGlyph.StructurePublic: { return Microsoft.CodeAnalysis.Glyph.StructurePublic; } case FSharpGlyph.StructureProtected: { return Microsoft.CodeAnalysis.Glyph.StructureProtected; } case FSharpGlyph.StructurePrivate: { return Microsoft.CodeAnalysis.Glyph.StructurePrivate; } case FSharpGlyph.StructureInternal: { return Microsoft.CodeAnalysis.Glyph.StructureInternal; } case FSharpGlyph.TypeParameter: { return Microsoft.CodeAnalysis.Glyph.TypeParameter; } case FSharpGlyph.Snippet: { return Microsoft.CodeAnalysis.Glyph.Snippet; } case FSharpGlyph.CompletionWarning: { return Microsoft.CodeAnalysis.Glyph.CompletionWarning; } case FSharpGlyph.AddReference: { return Microsoft.CodeAnalysis.Glyph.AddReference; } case FSharpGlyph.NuGet: { return Microsoft.CodeAnalysis.Glyph.NuGet; } case FSharpGlyph.TargetTypeMatch: { return Microsoft.CodeAnalysis.Glyph.TargetTypeMatch; } default: { throw ExceptionUtilities.UnexpectedValue(glyph); } } } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/Core/Implementation/TextDiffing/EditorTextDifferencingService.cs
// 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. #nullable disable using System; using System.Collections.Immutable; using System.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Text.Shared.Extensions; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Differencing; namespace Microsoft.CodeAnalysis.Editor.Implementation.TextDiffing { [ExportWorkspaceService(typeof(IDocumentTextDifferencingService), ServiceLayer.Host), Shared] internal class EditorTextDifferencingService : IDocumentTextDifferencingService { private readonly ITextDifferencingSelectorService _differenceSelectorService; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public EditorTextDifferencingService(ITextDifferencingSelectorService differenceSelectorService) => _differenceSelectorService = differenceSelectorService; public Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken) => GetTextChangesAsync(oldDocument, newDocument, TextDifferenceTypes.Word, cancellationToken); public async Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken) { var oldText = await oldDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); var newText = await newDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); var diffService = _differenceSelectorService.GetTextDifferencingService(oldDocument.Project.LanguageServices.GetService<IContentTypeLanguageService>().GetDefaultContentType()) ?? _differenceSelectorService.DefaultTextDifferencingService; var differenceOptions = GetDifferenceOptions(preferredDifferenceType); var oldTextSnapshot = oldText.FindCorrespondingEditorTextSnapshot(); var newTextSnapshot = newText.FindCorrespondingEditorTextSnapshot(); var useSnapshots = oldTextSnapshot != null && newTextSnapshot != null; var diffResult = useSnapshots ? diffService.DiffSnapshotSpans(oldTextSnapshot.GetFullSpan(), newTextSnapshot.GetFullSpan(), differenceOptions) : diffService.DiffStrings(oldText.ToString(), newText.ToString(), differenceOptions); return diffResult.Differences.Select(d => new TextChange( diffResult.LeftDecomposition.GetSpanInOriginal(d.Left).ToTextSpan(), newText.GetSubText(diffResult.RightDecomposition.GetSpanInOriginal(d.Right).ToTextSpan()).ToString())).ToImmutableArray(); } private static StringDifferenceOptions GetDifferenceOptions(TextDifferenceTypes differenceTypes) { StringDifferenceTypes stringDifferenceTypes = default; if (differenceTypes.HasFlag(TextDifferenceTypes.Line)) { stringDifferenceTypes |= StringDifferenceTypes.Line; } if (differenceTypes.HasFlag(TextDifferenceTypes.Word)) { stringDifferenceTypes |= StringDifferenceTypes.Word; } if (differenceTypes.HasFlag(TextDifferenceTypes.Character)) { stringDifferenceTypes |= StringDifferenceTypes.Character; } return new StringDifferenceOptions() { DifferenceType = stringDifferenceTypes }; } } }
// 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. #nullable disable using System; using System.Collections.Immutable; using System.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Text.Shared.Extensions; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Differencing; namespace Microsoft.CodeAnalysis.Editor.Implementation.TextDiffing { [ExportWorkspaceService(typeof(IDocumentTextDifferencingService), ServiceLayer.Host), Shared] internal class EditorTextDifferencingService : IDocumentTextDifferencingService { private readonly ITextDifferencingSelectorService _differenceSelectorService; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public EditorTextDifferencingService(ITextDifferencingSelectorService differenceSelectorService) => _differenceSelectorService = differenceSelectorService; public Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken) => GetTextChangesAsync(oldDocument, newDocument, TextDifferenceTypes.Word, cancellationToken); public async Task<ImmutableArray<TextChange>> GetTextChangesAsync(Document oldDocument, Document newDocument, TextDifferenceTypes preferredDifferenceType, CancellationToken cancellationToken) { var oldText = await oldDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); var newText = await newDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); var diffService = _differenceSelectorService.GetTextDifferencingService(oldDocument.Project.LanguageServices.GetService<IContentTypeLanguageService>().GetDefaultContentType()) ?? _differenceSelectorService.DefaultTextDifferencingService; var differenceOptions = GetDifferenceOptions(preferredDifferenceType); var oldTextSnapshot = oldText.FindCorrespondingEditorTextSnapshot(); var newTextSnapshot = newText.FindCorrespondingEditorTextSnapshot(); var useSnapshots = oldTextSnapshot != null && newTextSnapshot != null; var diffResult = useSnapshots ? diffService.DiffSnapshotSpans(oldTextSnapshot.GetFullSpan(), newTextSnapshot.GetFullSpan(), differenceOptions) : diffService.DiffStrings(oldText.ToString(), newText.ToString(), differenceOptions); return diffResult.Differences.Select(d => new TextChange( diffResult.LeftDecomposition.GetSpanInOriginal(d.Left).ToTextSpan(), newText.GetSubText(diffResult.RightDecomposition.GetSpanInOriginal(d.Right).ToTextSpan()).ToString())).ToImmutableArray(); } private static StringDifferenceOptions GetDifferenceOptions(TextDifferenceTypes differenceTypes) { StringDifferenceTypes stringDifferenceTypes = default; if (differenceTypes.HasFlag(TextDifferenceTypes.Line)) { stringDifferenceTypes |= StringDifferenceTypes.Line; } if (differenceTypes.HasFlag(TextDifferenceTypes.Word)) { stringDifferenceTypes |= StringDifferenceTypes.Word; } if (differenceTypes.HasFlag(TextDifferenceTypes.Character)) { stringDifferenceTypes |= StringDifferenceTypes.Character; } return new StringDifferenceOptions() { DifferenceType = stringDifferenceTypes }; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/EditorFeatures/VisualBasicTest/KeywordHighlighting/PropertyDeclarationHighlighterTests.vb
' 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. Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting Public Class PropertyDeclarationHighlighterTests Inherits AbstractVisualBasicKeywordHighlighterTests Friend Overrides Function GetHighlighterType() As Type Return GetType(PropertyDeclarationHighlighter) End Function <Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)> Public Async Function TestAutoProperty1() As Task Await TestAsync(<Text> Class C {|Cursor:[|Public Property|]|} Goo As Integer [|Implements|] IGoo.Goo End Class</Text>) End Function <Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)> Public Async Function TestAutoProperty2() As Task Await TestAsync(<Text> Class C [|Public Property|] Goo As Integer {|Cursor:[|Implements|]|} IGoo.Goo End Class</Text>) End Function End Class End Namespace
' 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. Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting Public Class PropertyDeclarationHighlighterTests Inherits AbstractVisualBasicKeywordHighlighterTests Friend Overrides Function GetHighlighterType() As Type Return GetType(PropertyDeclarationHighlighter) End Function <Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)> Public Async Function TestAutoProperty1() As Task Await TestAsync(<Text> Class C {|Cursor:[|Public Property|]|} Goo As Integer [|Implements|] IGoo.Goo End Class</Text>) End Function <Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)> Public Async Function TestAutoProperty2() As Task Await TestAsync(<Text> Class C [|Public Property|] Goo As Integer {|Cursor:[|Implements|]|} IGoo.Goo End Class</Text>) End Function End Class End Namespace
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Workspaces/MSBuildTest/Resources/NetCoreApp2AndLibrary/Library.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netstandard2.0</TargetFrameworks> </PropertyGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netstandard2.0</TargetFrameworks> </PropertyGroup> </Project>
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/CSharp/Portable/Binder/SimpleLocalScopeBinder.cs
// 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. #nullable disable using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using System.Collections.Immutable; using System.Diagnostics; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp { internal sealed class SimpleLocalScopeBinder : LocalScopeBinder { private readonly ImmutableArray<LocalSymbol> _locals; public SimpleLocalScopeBinder(ImmutableArray<LocalSymbol> locals, Binder next) : base(next) { _locals = locals; } protected override ImmutableArray<LocalSymbol> BuildLocals() { return _locals; } internal override ImmutableArray<LocalSymbol> GetDeclaredLocalsForScope(SyntaxNode scopeDesignator) { throw ExceptionUtilities.Unreachable; } internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator) { throw ExceptionUtilities.Unreachable; } } }
// 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. #nullable disable using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Syntax; using System.Collections.Immutable; using System.Diagnostics; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp { internal sealed class SimpleLocalScopeBinder : LocalScopeBinder { private readonly ImmutableArray<LocalSymbol> _locals; public SimpleLocalScopeBinder(ImmutableArray<LocalSymbol> locals, Binder next) : base(next) { _locals = locals; } protected override ImmutableArray<LocalSymbol> BuildLocals() { return _locals; } internal override ImmutableArray<LocalSymbol> GetDeclaredLocalsForScope(SyntaxNode scopeDesignator) { throw ExceptionUtilities.Unreachable; } internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode scopeDesignator) { throw ExceptionUtilities.Unreachable; } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Core/Test/CodeModel/AbstractCodeEventTests.vb
' 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. Imports System.Threading.Tasks Imports EnvDTE80 Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Public MustInherit Class AbstractCodeEventTests Inherits AbstractCodeElementTests(Of EnvDTE80.CodeEvent) Protected Overrides Function GetStartPointFunc(codeElement As EnvDTE80.CodeEvent) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint) Return Function(part) codeElement.GetStartPoint(part) End Function Protected Overrides Function GetEndPointFunc(codeElement As EnvDTE80.CodeEvent) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint) Return Function(part) codeElement.GetEndPoint(part) End Function Protected Overrides Function GetAccess(codeElement As EnvDTE80.CodeEvent) As EnvDTE.vsCMAccess Return codeElement.Access End Function Protected Overrides Function GetAttributes(codeElement As EnvDTE80.CodeEvent) As EnvDTE.CodeElements Return codeElement.Attributes End Function Protected Overrides Function GetComment(codeElement As EnvDTE80.CodeEvent) As String Return codeElement.Comment End Function Protected Overrides Function GetDocComment(codeElement As EnvDTE80.CodeEvent) As String Return codeElement.DocComment End Function Protected Overrides Function GetFullName(codeElement As EnvDTE80.CodeEvent) As String Return codeElement.FullName End Function Protected Overrides Function GetIsShared(codeElement As EnvDTE80.CodeEvent) As Boolean Return codeElement.IsShared End Function Protected Overrides Function GetIsSharedSetter(codeElement As EnvDTE80.CodeEvent) As Action(Of Boolean) Return Sub(value) codeElement.IsShared = value End Function Protected Overrides Function GetKind(codeElement As EnvDTE80.CodeEvent) As EnvDTE.vsCMElement Return codeElement.Kind End Function Protected Overrides Function GetName(codeElement As EnvDTE80.CodeEvent) As String Return codeElement.Name End Function Protected Overrides Function GetNameSetter(codeElement As EnvDTE80.CodeEvent) As Action(Of String) Return Sub(name) codeElement.Name = name End Function Protected Overrides Function GetOverrideKind(codeElement As CodeEvent) As vsCMOverrideKind Return codeElement.OverrideKind End Function Protected Overrides Function GetParent(codeElement As EnvDTE80.CodeEvent) As Object Return codeElement.Parent End Function Protected Overrides Function GetPrototype(codeElement As EnvDTE80.CodeEvent, flags As EnvDTE.vsCMPrototype) As String Return codeElement.Prototype(flags) End Function Protected Overrides Function GetTypeProp(codeElement As EnvDTE80.CodeEvent) As EnvDTE.CodeTypeRef Return codeElement.Type End Function Protected Overrides Function GetTypePropSetter(codeElement As EnvDTE80.CodeEvent) As Action(Of EnvDTE.CodeTypeRef) Return Sub(value) codeElement.Type = value End Function Protected Overrides Function AddAttribute(codeElement As EnvDTE80.CodeEvent, data As AttributeData) As EnvDTE.CodeAttribute Return codeElement.AddAttribute(data.Name, data.Value, data.Position) End Function Protected Sub TestIsPropertyStyleEvent(code As XElement, expected As Boolean) TestElement(code, Sub(codeElement) Assert.Equal(expected, codeElement.IsPropertyStyleEvent) End Sub) End Sub End Class End Namespace
' 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. Imports System.Threading.Tasks Imports EnvDTE80 Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel Public MustInherit Class AbstractCodeEventTests Inherits AbstractCodeElementTests(Of EnvDTE80.CodeEvent) Protected Overrides Function GetStartPointFunc(codeElement As EnvDTE80.CodeEvent) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint) Return Function(part) codeElement.GetStartPoint(part) End Function Protected Overrides Function GetEndPointFunc(codeElement As EnvDTE80.CodeEvent) As Func(Of EnvDTE.vsCMPart, EnvDTE.TextPoint) Return Function(part) codeElement.GetEndPoint(part) End Function Protected Overrides Function GetAccess(codeElement As EnvDTE80.CodeEvent) As EnvDTE.vsCMAccess Return codeElement.Access End Function Protected Overrides Function GetAttributes(codeElement As EnvDTE80.CodeEvent) As EnvDTE.CodeElements Return codeElement.Attributes End Function Protected Overrides Function GetComment(codeElement As EnvDTE80.CodeEvent) As String Return codeElement.Comment End Function Protected Overrides Function GetDocComment(codeElement As EnvDTE80.CodeEvent) As String Return codeElement.DocComment End Function Protected Overrides Function GetFullName(codeElement As EnvDTE80.CodeEvent) As String Return codeElement.FullName End Function Protected Overrides Function GetIsShared(codeElement As EnvDTE80.CodeEvent) As Boolean Return codeElement.IsShared End Function Protected Overrides Function GetIsSharedSetter(codeElement As EnvDTE80.CodeEvent) As Action(Of Boolean) Return Sub(value) codeElement.IsShared = value End Function Protected Overrides Function GetKind(codeElement As EnvDTE80.CodeEvent) As EnvDTE.vsCMElement Return codeElement.Kind End Function Protected Overrides Function GetName(codeElement As EnvDTE80.CodeEvent) As String Return codeElement.Name End Function Protected Overrides Function GetNameSetter(codeElement As EnvDTE80.CodeEvent) As Action(Of String) Return Sub(name) codeElement.Name = name End Function Protected Overrides Function GetOverrideKind(codeElement As CodeEvent) As vsCMOverrideKind Return codeElement.OverrideKind End Function Protected Overrides Function GetParent(codeElement As EnvDTE80.CodeEvent) As Object Return codeElement.Parent End Function Protected Overrides Function GetPrototype(codeElement As EnvDTE80.CodeEvent, flags As EnvDTE.vsCMPrototype) As String Return codeElement.Prototype(flags) End Function Protected Overrides Function GetTypeProp(codeElement As EnvDTE80.CodeEvent) As EnvDTE.CodeTypeRef Return codeElement.Type End Function Protected Overrides Function GetTypePropSetter(codeElement As EnvDTE80.CodeEvent) As Action(Of EnvDTE.CodeTypeRef) Return Sub(value) codeElement.Type = value End Function Protected Overrides Function AddAttribute(codeElement As EnvDTE80.CodeEvent, data As AttributeData) As EnvDTE.CodeAttribute Return codeElement.AddAttribute(data.Name, data.Value, data.Position) End Function Protected Sub TestIsPropertyStyleEvent(code As XElement, expected As Boolean) TestElement(code, Sub(codeElement) Assert.Equal(expected, codeElement.IsPropertyStyleEvent) End Sub) End Sub End Class End Namespace
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./docs/wiki/Getting-Started-on-Visual-Studio-2015-CTP-6.md
1. Set up a box with Visual Studio 2015 CTP 6. Either [install Visual Studio 2015 CTP 6](https://www.visualstudio.com/en-us/downloads/visual-studio-2015-ctp-vs), or grab a [prebuilt Azure VM image](http://blogs.msdn.com/b/visualstudioalm/archive/2014/06/04/visual-studio-14-ctp-now-available-in-the-virtual-machine-azure-gallery.aspx). 2. Install the [Visual Studio 2015 CTP 6 SDK](http://go.microsoft.com/?linkid=9875738). You'll need to do this even if you're using the Azure VM image. 3. Install the [SDK Templates VSIX package](https://visualstudiogallery.msdn.microsoft.com/ecefb773-36a6-4316-98db-4a87ed8cf5dc) to get the Visual Studio project templates. 4. Install the [Syntax Visualizer VSIX package](https://visualstudiogallery.msdn.microsoft.com/0f18f8c3-ec79-468a-968f-a1a0ee65b388) to get a [Syntax Visualizer tool window](https://github.com/dotnet/roslyn/blob/main/docs/wiki/Syntax-Visualizer.md) to help explore the syntax trees you'll be analyzing.
1. Set up a box with Visual Studio 2015 CTP 6. Either [install Visual Studio 2015 CTP 6](https://www.visualstudio.com/en-us/downloads/visual-studio-2015-ctp-vs), or grab a [prebuilt Azure VM image](http://blogs.msdn.com/b/visualstudioalm/archive/2014/06/04/visual-studio-14-ctp-now-available-in-the-virtual-machine-azure-gallery.aspx). 2. Install the [Visual Studio 2015 CTP 6 SDK](http://go.microsoft.com/?linkid=9875738). You'll need to do this even if you're using the Azure VM image. 3. Install the [SDK Templates VSIX package](https://visualstudiogallery.msdn.microsoft.com/ecefb773-36a6-4316-98db-4a87ed8cf5dc) to get the Visual Studio project templates. 4. Install the [Syntax Visualizer VSIX package](https://visualstudiogallery.msdn.microsoft.com/0f18f8c3-ec79-468a-968f-a1a0ee65b388) to get a [Syntax Visualizer tool window](https://github.com/dotnet/roslyn/blob/main/docs/wiki/Syntax-Visualizer.md) to help explore the syntax trees you'll be analyzing.
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="pl" original="../VBResources.resx"> <body> <trans-unit id="ERR_AssignmentInitOnly"> <source>Init-only property '{0}' can only be assigned by an object member initializer, or on 'Me', 'MyClass` or 'MyBase' in an instance constructor.</source> <target state="translated">Właściwość tylko do inicjowania „{0}” może być przypisana tylko przez inicjatora składowej obiektu lub w elemencie „Me”, „MyClass” lub „MyBase” w konstruktorze wystąpień.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSwitchValue"> <source>Command-line syntax error: '{0}' is not a valid value for the '{1}' option. The value must be of the form '{2}'.</source> <target state="translated">Błąd składni wiersza polecenia: „{0}” nie jest prawidłową wartością dla opcji „{1}”. Wartość musi mieć postać „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CommentsAfterLineContinuationNotAvailable1"> <source>Please use language version {0} or greater to use comments after line continuation character.</source> <target state="translated">Użyj wersji języka {0} lub nowszej, aby stosować komentarze po znaku kontynuacji wiersza.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultInterfaceImplementationInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Nie można osadzić typu „{0}”, ponieważ ma nieabstrakcyjną składową. Rozważ ustawienie wartości false dla właściwości „Osadź typy międzyoperacyjne”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleAnalyzerConfigsInSameDir"> <source>Multiple analyzer config files cannot be in the same directory ('{0}').</source> <target state="translated">Wiele plików konfiguracji analizatora nie może znajdować się w tym samym katalogu („{0}”).</target> <note /> </trans-unit> <trans-unit id="ERR_OverridingInitOnlyProperty"> <source>'{0}' cannot override init-only '{1}'.</source> <target state="translated">Właściwość „{0}” nie może przesłonić właściwości tylko do inicjowania „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyDoesntImplementInitOnly"> <source>Init-only '{0}' cannot be implemented.</source> <target state="translated">Nie można zaimplementować właściwości tylko do inicjowania „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ReAbstractionInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a re-abstraction of a member from base interface. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Nie można osadzić typu „{0}”, ponieważ zawiera ponowną abstrakcję składowej z interfejsu podstawowego. Rozważ ustawienie właściwości „Osadź typy międzyoperacyjne” na wartość false.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation"> <source>Target runtime doesn't support default interface implementation.</source> <target state="translated">Docelowe środowisko uruchomieniowe nie obsługuje domyślnej implementacji interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportProtectedAccessForInterfaceMember"> <source>Target runtime doesn't support 'Protected', 'Protected Friend', or 'Private Protected' accessibility for a member of an interface.</source> <target state="translated">Docelowe środowisko uruchomieniowe nie obsługuje poziomu dostępu „Protected”, „Protected Friend” ani „Private Protected” dla składowej interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedEventNeedsHandlerInTheSameType"> <source>Events of shared WithEvents variables cannot be handled by methods in a different type.</source> <target state="translated">Zdarzenia udostępnionych zmiennych WithEvents nie mogą zostać obsłużone przez metody w innym typie.</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyNotSupported"> <source>'UnmanagedCallersOnly' attribute is not supported.</source> <target state="translated">Atrybut „UnmanagedCallersOnly” jest nieobsługiwany.</target> <note /> </trans-unit> <trans-unit id="FEATURE_CallerArgumentExpression"> <source>caller argument expression</source> <target state="new">caller argument expression</target> <note /> </trans-unit> <trans-unit id="FEATURE_CommentsAfterLineContinuation"> <source>comments after line continuation</source> <target state="translated">komentarze po kontynuacji wiersza</target> <note /> </trans-unit> <trans-unit id="FEATURE_InitOnlySettersUsage"> <source>assigning to or passing 'ByRef' properties with init-only setters</source> <target state="translated">przypisywanie lub przekazywanie właściwości „ByRef” za pomocą metod ustawiających tylko do inicjowania</target> <note /> </trans-unit> <trans-unit id="FEATURE_UnconstrainedTypeParameterInConditional"> <source>unconstrained type parameters in binary conditional expressions</source> <target state="translated">parametry typu bez ograniczeń w binarnych wyrażeniach warunkowych</target> <note /> </trans-unit> <trans-unit id="IDS_VBCHelp"> <source> Visual Basic Compiler Options - OUTPUT FILE - -out:&lt;file&gt; Specifies the output file name. -target:exe Create a console application (default). (Short form: -t) -target:winexe Create a Windows application. -target:library Create a library assembly. -target:module Create a module that can be added to an assembly. -target:appcontainerexe Create a Windows application that runs in AppContainer. -target:winmdobj Create a Windows Metadata intermediate file -doc[+|-] Generates XML documentation file. -doc:&lt;file&gt; Generates XML documentation file to &lt;file&gt;. -refout:&lt;file&gt; Reference assembly output to generate - INPUT FILES - -addmodule:&lt;file_list&gt; Reference metadata from the specified modules -link:&lt;file_list&gt; Embed metadata from the specified interop assembly. (Short form: -l) -recurse:&lt;wildcard&gt; Include all files in the current directory and subdirectories according to the wildcard specifications. -reference:&lt;file_list&gt; Reference metadata from the specified assembly. (Short form: -r) -analyzer:&lt;file_list&gt; Run the analyzers from this assembly (Short form: -a) -additionalfile:&lt;file list&gt; Additional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings. - RESOURCES - -linkresource:&lt;resinfo&gt; Links the specified file as an external assembly resource. resinfo:&lt;file&gt;[,&lt;name&gt;[,public|private]] (Short form: -linkres) -nowin32manifest The default manifest should not be embedded in the manifest section of the output PE. -resource:&lt;resinfo&gt; Adds the specified file as an embedded assembly resource. resinfo:&lt;file&gt;[,&lt;name&gt;[,public|private]] (Short form: -res) -win32icon:&lt;file&gt; Specifies a Win32 icon file (.ico) for the default Win32 resources. -win32manifest:&lt;file&gt; The provided file is embedded in the manifest section of the output PE. -win32resource:&lt;file&gt; Specifies a Win32 resource file (.res). - CODE GENERATION - -optimize[+|-] Enable optimizations. -removeintchecks[+|-] Remove integer checks. Default off. -debug[+|-] Emit debugging information. -debug:full Emit full debugging information (default). -debug:pdbonly Emit full debugging information. -debug:portable Emit cross-platform debugging information. -debug:embedded Emit cross-platform debugging information into the target .dll or .exe. -deterministic Produce a deterministic assembly (including module version GUID and timestamp) -refonly Produce a reference assembly in place of the main output -instrument:TestCoverage Produce an assembly instrumented to collect coverage information -sourcelink:&lt;file&gt; Source link info to embed into PDB. - ERRORS AND WARNINGS - -nowarn Disable all warnings. -nowarn:&lt;number_list&gt; Disable a list of individual warnings. -warnaserror[+|-] Treat all warnings as errors. -warnaserror[+|-]:&lt;number_list&gt; Treat a list of warnings as errors. -ruleset:&lt;file&gt; Specify a ruleset file that disables specific diagnostics. -errorlog:&lt;file&gt;[,version=&lt;sarif_version&gt;] Specify a file to log all compiler and analyzer diagnostics in SARIF format. sarif_version:{1|2|2.1} Default is 1. 2 and 2.1 both mean SARIF version 2.1.0. -reportanalyzer Report additional analyzer information, such as execution time. -skipanalyzers[+|-] Skip execution of diagnostic analyzers. - LANGUAGE - -define:&lt;symbol_list&gt; Declare global conditional compilation symbol(s). symbol_list:name=value,... (Short form: -d) -imports:&lt;import_list&gt; Declare global Imports for namespaces in referenced metadata files. import_list:namespace,... -langversion:? Display the allowed values for language version -langversion:&lt;string&gt; Specify language version such as `default` (latest major version), or `latest` (latest version, including minor versions), or specific versions like `14` or `15.3` -optionexplicit[+|-] Require explicit declaration of variables. -optioninfer[+|-] Allow type inference of variables. -rootnamespace:&lt;string&gt; Specifies the root Namespace for all type declarations. -optionstrict[+|-] Enforce strict language semantics. -optionstrict:custom Warn when strict language semantics are not respected. -optioncompare:binary Specifies binary-style string comparisons. This is the default. -optioncompare:text Specifies text-style string comparisons. - MISCELLANEOUS - -help Display this usage message. (Short form: -?) -noconfig Do not auto-include VBC.RSP file. -nologo Do not display compiler copyright banner. -quiet Quiet output mode. -verbose Display verbose messages. -parallel[+|-] Concurrent build. -version Display the compiler version number and exit. - ADVANCED - -baseaddress:&lt;number&gt; The base address for a library or module (hex). -checksumalgorithm:&lt;alg&gt; Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default). -codepage:&lt;number&gt; Specifies the codepage to use when opening source files. -delaysign[+|-] Delay-sign the assembly using only the public portion of the strong name key. -publicsign[+|-] Public-sign the assembly using only the public portion of the strong name key. -errorreport:&lt;string&gt; Specifies how to handle internal compiler errors; must be prompt, send, none, or queue (default). -filealign:&lt;number&gt; Specify the alignment used for output file sections. -highentropyva[+|-] Enable high-entropy ASLR. -keycontainer:&lt;string&gt; Specifies a strong name key container. -keyfile:&lt;file&gt; Specifies a strong name key file. -libpath:&lt;path_list&gt; List of directories to search for metadata references. (Semi-colon delimited.) -main:&lt;class&gt; Specifies the Class or Module that contains Sub Main. It can also be a Class that inherits from System.Windows.Forms.Form. (Short form: -m) -moduleassemblyname:&lt;string&gt; Name of the assembly which this module will be a part of. -netcf Target the .NET Compact Framework. -nostdlib Do not reference standard libraries (system.dll and VBC.RSP file). -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Specify a mapping for source path names output by the compiler. -platform:&lt;string&gt; Limit which platforms this code can run on; must be x86, x64, Itanium, arm, arm64 AnyCPU32BitPreferred or anycpu (default). -preferreduilang Specify the preferred output language name. -nosdkpath Disable searching the default SDK path for standard library assemblies. -sdkpath:&lt;path&gt; Location of the .NET Framework SDK directory (mscorlib.dll). -subsystemversion:&lt;version&gt; Specify subsystem version of the output PE. version:&lt;number&gt;[.&lt;number&gt;] -utf8output[+|-] Emit compiler output in UTF8 character encoding. @&lt;file&gt; Insert command-line settings from a text file -vbruntime[+|-|*] Compile with/without the default Visual Basic runtime. -vbruntime:&lt;file&gt; Compile with the alternate Visual Basic runtime in &lt;file&gt;. </source> <target state="translated"> Opcje kompilatora Visual Basic - PLIK WYJŚCIOWY - -out:&lt;plik&gt; Określa nazwę pliku wyjściowego. -target:exe Utwórz aplikację konsolową (domyślnie). (Krótka wersja: -t) -target:winexe Utwórz aplikację systemu Windows -target:library Utwórz zestaw biblioteki. -target:module Utwórz moduł, który można dodać do zestawu -target:appcontainerexe Utwórz aplikację systemu Windows uruchamianą w kontenerze aplikacji. -target:winmdobj Utwórz plik pośredni metadanych systemu Windows -doc[+|-] Generuje plik dokumentacji XML. -doc:&lt;file&gt; Generuje plik dokumentacji XML w pliku &lt;plik&gt;. -refout:&lt;plik&gt; Dane wyjściowe zestawu odwołania do wygenerowania - PLIKI WEJŚCIOWE - -addmodule:&lt;lista_plików&gt; Odwołuj się do metadanych z określonych modułów -link:&lt;lista_plików&gt; Osadź metadane z określonego zestawu międzyoperacyjnego. (Krótka wersja: -l) -recurse:&lt;symbol wieloznaczny&gt; Dołącz wszystkie pliki zawarte w bieżącym katalogu i jego podkatalogach zgodnie ze specyfikacją określoną przy użyciu symboli wieloznacznych. -reference:&lt;lista_plików&gt; Odwołuj się do metadanych z określonego zestawu. (Krótka wersja: -r) -analyzer:&lt;lista_plików&gt; Uruchom analizatory z tego zestawu (Krótka wersja: -a) -additionalfile:&lt;lista_plików&gt; Dodatkowe pliki, które nie mają bezpośredniego wpływu na generowanie kodu, ale mogą być używane przez analizatory w celu tworzenia komunikatów o błędach lub ostrzeżeń. - ZASOBY - -linkresource:&lt;informacje_o_zasobie&gt; Łączy określony plik jako zasób zewnętrzny zestawu. informacje_o_zasobie:&lt;plik&gt;[,&lt;nazwa&gt;[,public|private]] (Krótka wersja: -linkres) -nowin32manifest Manifest domyślny nie powinien być osadzony w sekcji manifestu w wyjściowym środowisku PE. -resource:&lt;informacje_o_zasobie&gt; Dodaje określony plik jako osadzony zasób zestawu. informacje_o_zasobie:&lt;plik&gt;[,&lt;nazwa&gt;[,public|private]] (Krótka wersja: -res) -win32icon:&lt;p&gt; Określa plik ikony środowiska Win32 (ico) dla domyślnych zasobów środowiska Win32. -win32manifest:&lt;plik&gt; Podany plik zostanie osadzony w sekcji manifestu wyjściowego środowiska PE. -win32resource:&lt;plik&gt; Określa plik zasobów środowiska Win32 (res). - GENEROWANIE KODU - -optimize[+|-] Włącz optymalizacje. -removeintchecks[+|-] Usuń kontrole liczb całkowitych. Domyślnie wyłączone. -debug[+|-] Emituj informacje o debugowaniu. -debug:full Emituj pełne informacje o debugowaniu (domyślnie). -debug:pdbonly Emituj pełne informacje o debugowaniu. -debug:portable Emituj informacje o debugowaniu międzyplatformowym. -debug:embedded Emituj informacje o debugowaniu międzyplatformowym do docelowego pliku DLL lub EXE. -deterministic Utwórz zestaw deterministyczny (w tym sygnaturę czasową i identyfikator GUID wersji modułu) -refonly Utwórz zestaw odwołania zamiast głównych danych wyjściowych -instrument:TestCoverage Utwórz zestaw instrumentowany w celu gromadzenia informacji o pokryciu -sourcelink:&lt;plik&gt; Informacje o linku źródłowym do wbudowania w pliku PDB. - BŁĘDY I OSTRZEŻENIA - -nowarn Wyłącz wszystkie ostrzeżenia. -nowarn:&lt;lista_numerów&gt; Wyłącz listę poszczególnych ostrzeżeń. -warnaserror[+|-] Traktuj wszystkie ostrzeżenia jako błędy. -warnaserror[+|-]:&lt;lista_numerów&gt; Traktuj ostrzeżenia z listy jako błędy. -ruleset:&lt;plik&gt; Określ plik zestawu reguł, który wyłącza określone opcje diagnostyczne. -errorlog:&lt;plik&gt;[,version=&lt;wersja_sarif&gt;] Określ plik, w którym mają zostać zarejestrowane dane diagnostyczne w formacie SARIF. wersja_sarif:{1|2|2.1} Domyślne wartości 1. 2 i 2.1 oznaczają format SARIF w wersji 2.1.0. -reportanalyzer Zgłoś dodatkowe informacje analizatora, takie jak czas wykonywania. -skipanalyzers[+|-] Pomiń wykonywanie analizatorów diagnostycznych. - JĘZYK - -define:&lt;lista_symboli&gt; Zadeklaruj globalne symbole kompilacji warunkowej. symbol_list:nazwa=wartość,... (Krótka wersja: -d) -imports:&lt;lista_importów&gt; Zadeklaruj globalne importy dla przestrzeni nazw w przywoływanych plikach metadanych. import_list:przestrzeń_nazw, ,... -langversion:? Wyświetl dozwolone wartości dla wersji języka -langversion:&lt;ciąg&gt; Określ wersję języka, taką jak „default” (najnowsza wersja główna) lub „latest” (najnowsza wersja, z uwzględnieniem wersji pomocniczych) albo konkretna wersja, na przykład „14” lub „15.3” -optionexplicit[+|-] Wymagaj jawnej deklaracji zmiennych. -optioninfer[+|-] Zezwalaj na wnioskowanie o typie zmiennych. -rootnamespace:&lt;ciąg&gt; Określa główną przestrzeń nazw dla wszystkich deklaracji typów. -optionstrict[+|-] Wymuszaj ścisłą semantykę języka. -optionstrict:custom Ostrzegaj, gdy ścisła semantyka języka nie jest przestrzegana. -optioncompare:binary Określa binarne porównywanie ciągów. Jest to opcja domyślna. -optioncompare:text Określa tekstowe porównywanie ciągów. - RÓŻNE - -help Wyświetl ten komunikat dotyczący użycia. (krótka wersja: -?) -noconfig Nie dołączaj automatycznie pliku VBC.RSP. -nologo Nie wyświetlaj baneru kompilatora z informacjami o prawach autorskich. -quiet Cichy tryb wyjściowy. -verbose Wyświetl pełne komunikaty -parallel[+|-] Współbieżna kompilacja. -version Wyświetl numer wersji kompilatora i wyjdź. - ZAAWANSOWANE - -baseaddress:&lt;numer&gt; Podstawowy adres biblioteki lub modułu (szesnastkowy). -checksumalgorithm:&lt;algorytm&gt; Określ algorytm obliczania sumy kontrolnej pliku źródłowego przechowywanej w pliku PDB. Obsługiwane wartości: SHA1 lub SHA256 (domyślnie). -codepage:&lt;numer&gt; Określa stronę kodową do użycia podczas otwierania plików źródłowych. -delaysign[+|-] Podpisz z opóźnieniem zestaw, używając tylko części publicznej klucza o silnej nazwie. -publicsign[+|-] Podpisz publicznie zestaw, używając tylko części publicznej klucza o silnej nazwie. -errorreport:&lt;ciąg&gt; Określa, w jaki sposób obsługiwać wewnętrzne błędy kompilatora: musi mieć wartość prompt, send, none lub queue (wartość domyślna). -filealign:&lt;numer&gt; Określ wyrównanie stosowane dla sekcji plików wyjściowych. -highentropyva[+|-] Włącz losowe generowanie układu przestrzeni adresowej o wysokiej entropii. -keycontainer:&lt;ciąg&gt; Określa kontener klucza o silnej nazwie. -keyfile:&lt;plik&gt; Określa plik klucza o silnej nazwie. -libpath:&lt;lista_ścieżek&gt; Lista katalogów, w których mają zostać wyszukane odwołania do metadanych (lista wartości oddzielonych średnikami). -main:&lt;klasa&gt; Określa klasę lub moduł zawierające element Sub Main. Może to również być klasa dziedzicząca po elemencie System.Windows.Forms.Form. (krótka wersja: -m) -moduleassemblyname:&lt;ciąg&gt; Nazwa zestawu, do którego będzie należeć ten moduł. -netcf Ustaw program .NET Compact Framework jako element docelowy. -nostdlib Nie odwołuj się do bibliotek standardowych (plików system.dll i VBC.RSP). -pathmap:&lt;K1&gt;=&lt;W1&gt;,&lt;K2&gt;=&lt;W2&gt;,... Określ mapowanie nazw ścieżek źródłowych wyprowadzanych przez kompilator. -platform:&lt;ciąg&gt; Ogranicz platformy, na jakich można uruchomić ten kod; dozwolone wartości: x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred lub anycpu (wartość domyślna). -preferreduilang Określ nazwę preferowanego języka wyjściowego. -nosdkpath Wyłącz wyszukiwanie ścieżki domyślnego zestawu SDK dla standardowych zestawów bibliotecznych. -sdkpath:&lt;ścieżka&gt; Lokalizacja katalogu zestawu .NET Framework SDK (mscorlib.dll). -subsystemversion:&lt;wersja&gt; Określ wersję podsystemu wyjściowego środowiska PE. version:&lt;numer&gt;[.&lt;numer&gt;] -utf8output[+|-] Emituj dane wyjściowe kompilatora przy użyciu kodowania znaków UTF8. @&lt;plik&gt; Wstaw ustawienia wiersza polecenia z pliku tekstowego -vbruntime[+|-|*] Wykonaj kompilację przy użyciu-bez użycia domyślnego środowiska uruchomieniowego języka Visual Basic. -vbruntime:&lt;plik&gt; Wykonaj kompilację przy użyciu alternatywnego środowiska uruchomieniowego języka Visual Basic w pliku &lt;plik&gt;. </target> <note /> </trans-unit> <trans-unit id="ThereAreNoFunctionPointerTypesInVB"> <source>There are no function pointer types in VB.</source> <target state="translated">W języku VB nie ma typów wskaźnikowych funkcji.</target> <note /> </trans-unit> <trans-unit id="ThereAreNoNativeIntegerTypesInVB"> <source>There are no native integer types in VB.</source> <target state="translated">Brak typów natywnej liczby całkowitej w języku Visual Basic.</target> <note /> </trans-unit> <trans-unit id="Trees0"> <source>trees({0})</source> <target state="translated">trees({0})</target> <note /> </trans-unit> <trans-unit id="TreesMustHaveRootNode"> <source>trees({0}) must have root node with SyntaxKind.CompilationUnit.</source> <target state="translated">Element trees({0}) musi mieć węzeł główny z elementem SyntaxKind.CompilationUnit.</target> <note /> </trans-unit> <trans-unit id="CannotAddCompilerSpecialTree"> <source>Cannot add compiler special tree</source> <target state="translated">Nie można dodać specjalnego drzewa kompilatora</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeAlreadyPresent"> <source>Syntax tree already present</source> <target state="translated">Drzewo składni już istnieje</target> <note /> </trans-unit> <trans-unit id="SubmissionCanHaveAtMostOneSyntaxTree"> <source>Submission can have at most one syntax tree.</source> <target state="translated">Przesłanie może mieć co najwyżej jedno drzewo składni.</target> <note /> </trans-unit> <trans-unit id="CannotRemoveCompilerSpecialTree"> <source>Cannot remove compiler special tree</source> <target state="translated">Nie można usunąć specjalnego drzewa kompilatora</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeNotFoundToRemove"> <source>SyntaxTree '{0}' not found to remove</source> <target state="translated">Nie znaleziono elementu SyntaxTree „{0}” do usunięcia</target> <note /> </trans-unit> <trans-unit id="TreeMustHaveARootNodeWithCompilationUnit"> <source>Tree must have a root node with SyntaxKind.CompilationUnit</source> <target state="translated">Drzewo musi mieć węzeł główny z elementem SyntaxKind.CompilationUnit</target> <note /> </trans-unit> <trans-unit id="CompilationVisualBasic"> <source>Compilation (Visual Basic): </source> <target state="translated">Kompilacja (Visual Basic): </target> <note /> </trans-unit> <trans-unit id="NodeIsNotWithinSyntaxTree"> <source>Node is not within syntax tree</source> <target state="translated">Węzeł nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="CantReferenceCompilationFromTypes"> <source>Can't reference compilation of type '{0}' from {1} compilation.</source> <target state="translated">Nie można odwołać się do kompilacji typu „{0}” z kompilacji {1}.</target> <note /> </trans-unit> <trans-unit id="PositionOfTypeParameterTooLarge"> <source>position of type parameter too large</source> <target state="translated">pozycja parametru typu jest zbyt duża</target> <note /> </trans-unit> <trans-unit id="AssociatedTypeDoesNotHaveTypeParameters"> <source>Associated type does not have type parameters</source> <target state="translated">Skojarzony typ nie zawiera parametrów typu</target> <note /> </trans-unit> <trans-unit id="IDS_FunctionReturnType"> <source>function return type</source> <target state="translated">zwracany typ funkcji</target> <note /> </trans-unit> <trans-unit id="TypeArgumentCannotBeNothing"> <source>Type argument cannot be Nothing</source> <target state="translated">Argument typu nie może mieć wartości Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework"> <source>The assembly '{0}' containing type '{1}' references .NET Framework, which is not supported.</source> <target state="translated">Zestaw „{0}” zawierający typ „{1}” odwołuje się do platformy .NET Framework, co nie jest obsługiwane.</target> <note>{1} is the type that was loaded, {0} is the containing assembly.</note> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework_Title"> <source>The loaded assembly references .NET Framework, which is not supported.</source> <target state="translated">Załadowany zestaw odwołuje się do platformy .NET Framework, co nie jest obsługiwane.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration"> <source>Generator '{0}' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Generator „{0}” nie mógł wygenerować źródła. W rezultacie nie będzie on współtworzyć danych wyjściowych i mogą wystąpić błędy kompilacji. Typ wyjątku: „{1}”, komunikat: „{2}”</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Generator zgłosił następujący wyjątek: „{0}”.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Title"> <source>Generator failed to generate source.</source> <target state="translated">Generator nie mógł wygenerować źródła.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization"> <source>Generator '{0}' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Generator „{0}” nie mógł przeprowadzić inicjalizacji. W rezultacie nie będzie on współtworzyć danych wyjściowych i mogą wystąpić błędy kompilacji. Typ wyjątku: „{1}”, komunikat: „{2}”</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Generator zgłosił następujący wyjątek: „{0}”.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Title"> <source>Generator failed to initialize.</source> <target state="translated">Generator nie mógł przeprowadzić inicjalizacji.</target> <note /> </trans-unit> <trans-unit id="WrongNumberOfTypeArguments"> <source>Wrong number of type arguments</source> <target state="translated">Nieprawidłowa liczba argumentów typu</target> <note /> </trans-unit> <trans-unit id="ERR_FileNotFound"> <source>file '{0}' could not be found</source> <target state="translated">nie znaleziono pliku „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_NoResponseFile"> <source>unable to open response file '{0}'</source> <target state="translated">nie można otworzyć pliku odpowiedzi „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentRequired"> <source>option '{0}' requires '{1}'</source> <target state="translated">opcja „{0}” wymaga argumentu „{1}”</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchNeedsBool"> <source>option '{0}' can be followed only by '+' or '-'</source> <target state="translated">po opcji „{0}” może występować tylko znak „+” lub „-”</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSwitchValue"> <source>the value '{1}' is invalid for option '{0}'</source> <target state="translated">wartość „{1}” jest nieprawidłowa dla opcji „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_MutuallyExclusiveOptions"> <source>Compilation options '{0}' and '{1}' can't both be specified at the same time.</source> <target state="translated">Nie można równocześnie określić opcji kompilacji „{0}” i „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang"> <source>The language name '{0}' is invalid.</source> <target state="translated">Nazwa języka „{0}” jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang_Title"> <source>The language name for /preferreduilang is invalid</source> <target state="translated">Nazwa języka dla parametru /preferreduilang jest nieprawidłowa</target> <note /> </trans-unit> <trans-unit id="ERR_VBCoreNetModuleConflict"> <source>The options /vbruntime* and /target:module cannot be combined.</source> <target state="translated">Nie można łączyć opcji /vbruntime* i /target:module.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatForGuidForOption"> <source>Command-line syntax error: Invalid Guid format '{0}' for option '{1}'</source> <target state="translated">Błąd składni wiersza polecenia: nieprawidłowy format identyfikatora GUID „{0}” dla opcji „{1}”</target> <note /> </trans-unit> <trans-unit id="ERR_MissingGuidForOption"> <source>Command-line syntax error: Missing Guid for option '{1}'</source> <target state="translated">Błąd składni wiersza polecenia: brak identyfikatora Guid dla opcji „{1}”</target> <note /> </trans-unit> <trans-unit id="ERR_BadChecksumAlgorithm"> <source>Algorithm '{0}' is not supported</source> <target state="translated">Algorytm „{0}” nie jest obsługiwany</target> <note /> </trans-unit> <trans-unit id="WRN_BadSwitch"> <source>unrecognized option '{0}'; ignored</source> <target state="translated">nierozpoznana opcja „{0}”; zignorowano</target> <note /> </trans-unit> <trans-unit id="WRN_BadSwitch_Title"> <source>Unrecognized command-line option</source> <target state="translated">Nierozpoznana opcja wiersza polecenia</target> <note /> </trans-unit> <trans-unit id="ERR_NoSources"> <source>no input sources specified</source> <target state="translated">nie określono źródeł wejściowych</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded"> <source>source file '{0}' specified multiple times</source> <target state="translated">plik źródłowy „{0}” został określony wiele razy</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded_Title"> <source>Source file specified multiple times</source> <target state="translated">Plik źródłowy został określony wiele razy</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenFileWrite"> <source>can't open '{0}' for writing: {1}</source> <target state="translated">nie można otworzyć elementu „{0}” do zapisu: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadCodepage"> <source>code page '{0}' is invalid or not installed</source> <target state="translated">strona kodowa „{0}” jest nieprawidłowa lub nie została zainstalowana</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryFile"> <source>the file '{0}' is not a text file</source> <target state="translated">plik „{0}” nie jest plikiem tekstowym</target> <note /> </trans-unit> <trans-unit id="ERR_LibNotFound"> <source>could not find library '{0}'</source> <target state="translated">nie można znaleźć biblioteki „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataReferencesNotSupported"> <source>Metadata references not supported.</source> <target state="translated">Odwołania do metadanych nie są obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_IconFileAndWin32ResFile"> <source>cannot specify both /win32icon and /win32resource</source> <target state="translated">nie można jednocześnie określić parametrów /win32icon i /win32resource</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigInResponseFile"> <source>ignoring /noconfig option because it was specified in a response file</source> <target state="translated">opcja /noconfig zostanie zignorowana, ponieważ została określona w pliku odpowiedzi</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigInResponseFile_Title"> <source>Ignoring /noconfig option because it was specified in a response file</source> <target state="translated">Opcja /noconfig zostanie zignorowana, ponieważ została określona w pliku odpowiedzi</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidWarningId"> <source>warning number '{0}' for the option '{1}' is either not configurable or not valid</source> <target state="translated">numeru ostrzeżenia „{0}” dla opcji „{1}” nie można skonfigurować lub jest on nieprawidłowy</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidWarningId_Title"> <source>Warning number is either not configurable or not valid</source> <target state="translated">Nie można skonfigurować numeru ostrzeżenia lub numer jest nieprawidłowy</target> <note /> </trans-unit> <trans-unit id="ERR_NoSourcesOut"> <source>cannot infer an output file name from resource only input files; provide the '/out' option</source> <target state="translated">nie można wywnioskować nazwy pliku wyjściowego na podstawie plików wejściowych zawierających tylko zasoby; podaj opcję „/out”</target> <note /> </trans-unit> <trans-unit id="ERR_NeedModule"> <source>the /moduleassemblyname option may only be specified when building a target of type 'module'</source> <target state="translated">opcję /moduleassemblyname można określić tylko w przypadku kompilowania elementu docelowego typu „module”</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyName"> <source>'{0}' is not a valid value for /moduleassemblyname</source> <target state="translated">'Wartość „{0}” nie jest prawidłowa dla parametru /moduleassemblyname</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingManifestSwitches"> <source>Error embedding Win32 manifest: Option /win32manifest conflicts with /nowin32manifest.</source> <target state="translated">Błąd podczas osadzania manifestu Win32: opcja /win32manifest powoduje konflikt z opcją /nowin32manifest.</target> <note /> </trans-unit> <trans-unit id="WRN_IgnoreModuleManifest"> <source>Option /win32manifest ignored. It can be specified only when the target is an assembly.</source> <target state="translated">Opcja /win32manifest została zignorowana. Można ją określić tylko wówczas, gdy element docelowy jest zestawem.</target> <note /> </trans-unit> <trans-unit id="WRN_IgnoreModuleManifest_Title"> <source>Option /win32manifest ignored</source> <target state="translated">Opcja /win32manifest została zignorowana</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInNamespace"> <source>Statement is not valid in a namespace.</source> <target state="translated">Instrukcja nie jest prawidłowa w przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedType1"> <source>Type '{0}' is not defined.</source> <target state="translated">Typ „{0}” nie został zdefiniowany.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNext"> <source>'Next' expected.</source> <target state="translated">'Oczekiwano elementu Next.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCharConstant"> <source>Character constant must contain exactly one character.</source> <target state="translated">Stała znakowa musi zawierać dokładnie jeden znak.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedAssemblyEvent3"> <source>Reference required to assembly '{0}' containing the definition for event '{1}'. Add one to your project.</source> <target state="translated">Wymagane odwołanie do zestawu „{0}” z definicją zdarzenia „{1}”. Dodaj je do projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedModuleEvent3"> <source>Reference required to module '{0}' containing the definition for event '{1}'. Add one to your project.</source> <target state="translated">Wymagane odwołanie do modułu „{0}” z definicją zdarzenia „{1}”. Dodaj je do projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_LbExpectedEndIf"> <source>'#If' block must end with a matching '#End If'.</source> <target state="translated">'Blok #If musi kończyć się instrukcją #End If.</target> <note /> </trans-unit> <trans-unit id="ERR_LbNoMatchingIf"> <source>'#ElseIf', '#Else', or '#End If' must be preceded by a matching '#If'.</source> <target state="translated">'Instrukcje #ElseIf, #Else i #End If muszą być poprzedzone odpowiadającą im instrukcją #If.</target> <note /> </trans-unit> <trans-unit id="ERR_LbBadElseif"> <source>'#ElseIf' must be preceded by a matching '#If' or '#ElseIf'.</source> <target state="translated">'Element „#ElseIf” musi być poprzedzony odpowiadającym mu elementem „#If” lub „#ElseIf”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromRestrictedType1"> <source>Inheriting from '{0}' is not valid.</source> <target state="translated">Dziedziczenie po typie „{0}” jest niepoprawne.</target> <note /> </trans-unit> <trans-unit id="ERR_InvOutsideProc"> <source>Labels are not valid outside methods.</source> <target state="translated">Etykiety nie są prawidłowe poza metodami.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateCantImplement"> <source>Delegates cannot implement interface methods.</source> <target state="translated">Obiekty delegatów nie mogą implementować metod interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateCantHandleEvents"> <source>Delegates cannot handle events.</source> <target state="translated">Obiekty delegatów nie mogą obsługiwać zdarzeń.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorRequiresReferenceTypes1"> <source>'Is' operator does not accept operands of type '{0}'. Operands must be reference or nullable types.</source> <target state="translated">'Operator „Is” nie akceptuje argumentów operacji typu „{0}”. Typem argumentu operacji musi być odwołanie lub typ dopuszczający wartość null.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOfRequiresReferenceType1"> <source>'TypeOf ... Is' requires its left operand to have a reference type, but this operand has the value type '{0}'.</source> <target state="translated">'Instrukcja „TypeOf ... Is” wymaga, aby argument operacji po lewej stronie miał typ referencyjny, a ten argument operacji ma typ wartości „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyHasSet"> <source>Properties declared 'ReadOnly' cannot have a 'Set'.</source> <target state="translated">Właściwości zadeklarowane jako ReadOnly nie mogą mieć procedury Set.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyHasGet"> <source>Properties declared 'WriteOnly' cannot have a 'Get'.</source> <target state="translated">Właściwości zadeklarowane jako WriteOnly nie mogą mieć procedury Get.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideProc"> <source>Statement is not valid inside a method.</source> <target state="translated">Instrukcja nie jest prawidłowa wewnątrz metody.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideBlock"> <source>Statement is not valid inside '{0}' block.</source> <target state="translated">Instrukcja nie jest prawidłowa w ramach bloku „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedExpressionStatement"> <source>Expression statement is only allowed at the end of an interactive submission.</source> <target state="translated">Instrukcja wyrażenia jest dozwolona tylko na końcu przesyłania interaktywnego.</target> <note /> </trans-unit> <trans-unit id="ERR_EndProp"> <source>Property missing 'End Property'.</source> <target state="translated">We właściwości brakuje instrukcji End Property.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSubExpected"> <source>'End Sub' expected.</source> <target state="translated">'Oczekiwano instrukcji End Sub.</target> <note /> </trans-unit> <trans-unit id="ERR_EndFunctionExpected"> <source>'End Function' expected.</source> <target state="translated">'Oczekiwano instrukcji End Function.</target> <note /> </trans-unit> <trans-unit id="ERR_LbElseNoMatchingIf"> <source>'#Else' must be preceded by a matching '#If' or '#ElseIf'.</source> <target state="translated">'Instrukcja #Else musi być poprzedzona odpowiadającą jej instrukcją #If lub #ElseIf.</target> <note /> </trans-unit> <trans-unit id="ERR_CantRaiseBaseEvent"> <source>Derived classes cannot raise base class events.</source> <target state="translated">Klasy pochodne nie mogą generować zdarzeń klasy bazowej.</target> <note /> </trans-unit> <trans-unit id="ERR_TryWithoutCatchOrFinally"> <source>Try must have at least one 'Catch' or a 'Finally'.</source> <target state="translated">Blok Try musi zawierać co najmniej jedną instrukcję Catch lub Finally.</target> <note /> </trans-unit> <trans-unit id="ERR_EventsCantBeFunctions"> <source>Events cannot have a return type.</source> <target state="translated">Zdarzenia nie mogą mieć zwracanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndBrack"> <source>Bracketed identifier is missing closing ']'.</source> <target state="translated">Identyfikator ujęty w nawiasy kwadratowe nie ma nawiasu zamykającego ].</target> <note /> </trans-unit> <trans-unit id="ERR_Syntax"> <source>Syntax error.</source> <target state="translated">Błąd składni.</target> <note /> </trans-unit> <trans-unit id="ERR_Overflow"> <source>Overflow.</source> <target state="translated">Przepełnienie.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalChar"> <source>Character is not valid.</source> <target state="translated">Znak jest nieprawidłowy.</target> <note /> </trans-unit> <trans-unit id="ERR_StdInOptionProvidedButConsoleInputIsNotRedirected"> <source>stdin argument '-' is specified, but input has not been redirected from the standard input stream.</source> <target state="translated">określono argument stdin „-”, ale dane wejściowe nie zostały przekierowane ze standardowego strumienia wejściowego.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsObjectOperand1"> <source>Option Strict On prohibits operands of type Object for operator '{0}'.</source> <target state="translated">Ustawienie Option Strict On nie zezwala na stosowanie argumentów typu Object dla operatora „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopControlMustNotBeProperty"> <source>Loop control variable cannot be a property or a late-bound indexed array.</source> <target state="translated">Zmienna sterująca pętli nie może być właściwością ani tablicą indeksowaną z późnym wiązaniem.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodBodyNotAtLineStart"> <source>First statement of a method body cannot be on the same line as the method declaration.</source> <target state="translated">Pierwsza instrukcja treści metody nie może znajdować się w tym samym wierszu co deklaracja metody.</target> <note /> </trans-unit> <trans-unit id="ERR_MaximumNumberOfErrors"> <source>Maximum number of errors has been exceeded.</source> <target state="translated">Przekroczono maksymalną liczbę błędów.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordNotInInstanceMethod1"> <source>'{0}' is valid only within an instance method.</source> <target state="translated">'Element „{0}” jest prawidłowy tylko wewnątrz metody wystąpienia.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordFromStructure1"> <source>'{0}' is not valid within a structure.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w ramach struktury.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeConstructor1"> <source>Attribute constructor has a parameter of type '{0}', which is not an integral, floating-point or Enum type or one of Object, Char, String, Boolean, System.Type or 1-dimensional array of these types.</source> <target state="translated">Konstruktor atrybutu ma parametr typu „{0}”, który nie jest typem całkowitym, zmiennoprzecinkowym ani wyliczeniowym, jak również żadnym z typów Object, Char, String, Boolean lub System.Type ani jednowymiarową tablicą składającą się z tych typów.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayWithOptArgs"> <source>Method cannot have both a ParamArray and Optional parameters.</source> <target state="translated">Metoda nie może mieć zarówno parametru ParamArray, jak i Optional.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedArray1"> <source>'{0}' statement requires an array.</source> <target state="translated">'Instrukcja „{0}” wymaga tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayNotArray"> <source>ParamArray parameter must be an array.</source> <target state="translated">Parametr ParamArray musi być tablicą.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayRank"> <source>ParamArray parameter must be a one-dimensional array.</source> <target state="translated">Parametr ParamArray musi być tablicą jednowymiarową.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayRankLimit"> <source>Array exceeds the limit of 32 dimensions.</source> <target state="translated">Liczba wymiarów tablicy przekracza 32.</target> <note /> </trans-unit> <trans-unit id="ERR_AsNewArray"> <source>Arrays cannot be declared with 'New'.</source> <target state="translated">Nie można deklarować tablic przy użyciu instrukcji New.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs1"> <source>Too many arguments to '{0}'.</source> <target state="translated">Za dużo argumentów elementu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedCase"> <source>Statements and labels are not valid between 'Select Case' and first 'Case'.</source> <target state="translated">Instrukcje i etykiety nie są prawidłowe między instrukcją Select Case a pierwszą instrukcją Case.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredConstExpr"> <source>Constant expression is required.</source> <target state="translated">Wymagane jest wyrażenie stałe.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredConstConversion2"> <source>Conversion from '{0}' to '{1}' cannot occur in a constant expression.</source> <target state="translated">Konwersja z „{0}” na „{1}” nie może wystąpić w wyrażeniu stałym.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMe"> <source>'Me' cannot be the target of an assignment.</source> <target state="translated">'Element Me nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyAssignment"> <source>'ReadOnly' variable cannot be the target of an assignment.</source> <target state="translated">'Zmienna typu ReadOnly nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitSubOfFunc"> <source>'Exit Sub' is not valid in a Function or Property.</source> <target state="translated">'Instrukcja Exit Sub nie jest prawidłowa w przypadku funkcji lub właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitPropNot"> <source>'Exit Property' is not valid in a Function or Sub.</source> <target state="translated">'Instrukcja Exit Property nie jest prawidłowa w przypadku funkcji lub procedury.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitFuncOfSub"> <source>'Exit Function' is not valid in a Sub or Property.</source> <target state="translated">'Instrukcja Exit Function nie jest prawidłowa w przypadku procedury lub właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_LValueRequired"> <source>Expression is a value and therefore cannot be the target of an assignment.</source> <target state="translated">Wyrażenie jest wartością i dlatego nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_ForIndexInUse1"> <source>For loop control variable '{0}' already in use by an enclosing For loop.</source> <target state="translated">Zmienna „{0}” sterująca pętlą For jest już używana przez otaczającą pętlę For.</target> <note /> </trans-unit> <trans-unit id="ERR_NextForMismatch1"> <source>Next control variable does not match For loop control variable '{0}'.</source> <target state="translated">Zmienna sterująca w instrukcji Next nie pasuje do zmiennej „{0}” sterującej pętlą For.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseElseNoSelect"> <source>'Case Else' can only appear inside a 'Select Case' statement.</source> <target state="translated">'Instrukcja Case Else może wystąpić tylko wewnątrz instrukcji Select Case.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseNoSelect"> <source>'Case' can only appear inside a 'Select Case' statement.</source> <target state="translated">'Instrukcja Case może wystąpić tylko wewnątrz instrukcji Select Case.</target> <note /> </trans-unit> <trans-unit id="ERR_CantAssignToConst"> <source>Constant cannot be the target of an assignment.</source> <target state="translated">Stała nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedSubscript"> <source>Named arguments are not valid as array subscripts.</source> <target state="translated">Nazwane argumenty nie są prawidłowe jako indeksy tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndIf"> <source>'If' must end with a matching 'End If'.</source> <target state="translated">'Instrukcja If musi być zakończona odpowiadającą jej instrukcją End If.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndWhile"> <source>'While' must end with a matching 'End While'.</source> <target state="translated">'Instrukcja While musi być zakończona odpowiadającą jej instrukcją End While.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLoop"> <source>'Do' must end with a matching 'Loop'.</source> <target state="translated">'Instrukcja Do musi być zakończona odpowiadającą jej instrukcją Loop.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNext"> <source>'For' must end with a matching 'Next'.</source> <target state="translated">'Instrukcja For musi być zakończona odpowiadającą jej instrukcją Next.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndWith"> <source>'With' must end with a matching 'End With'.</source> <target state="translated">'Instrukcja With musi być zakończona odpowiadającą jej instrukcją End With.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseNoMatchingIf"> <source>'Else' must be preceded by a matching 'If' or 'ElseIf'.</source> <target state="translated">'Element „Else” musi być poprzedzony odpowiadającym mu elementem „If” lub „ElseIf”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndIfNoMatchingIf"> <source>'End If' must be preceded by a matching 'If'.</source> <target state="translated">'Instrukcja End If musi być poprzedzona odpowiadającą jej instrukcją If.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSelectNoSelect"> <source>'End Select' must be preceded by a matching 'Select Case'.</source> <target state="translated">'Instrukcja „End Select” musi być poprzedzona odpowiadającą jej instrukcją „Select Case”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitDoNotWithinDo"> <source>'Exit Do' can only appear inside a 'Do' statement.</source> <target state="translated">'Instrukcja Exit Do może wystąpić tylko wewnątrz instrukcji Do.</target> <note /> </trans-unit> <trans-unit id="ERR_EndWhileNoWhile"> <source>'End While' must be preceded by a matching 'While'.</source> <target state="translated">'Instrukcja End While musi być poprzedzona odpowiadającą jej instrukcją While.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopNoMatchingDo"> <source>'Loop' must be preceded by a matching 'Do'.</source> <target state="translated">'Instrukcja Loop musi być poprzedzona odpowiadającą jej instrukcją Do.</target> <note /> </trans-unit> <trans-unit id="ERR_NextNoMatchingFor"> <source>'Next' must be preceded by a matching 'For'.</source> <target state="translated">'Instrukcja Next musi być poprzedzona odpowiadającą jej instrukcją For.</target> <note /> </trans-unit> <trans-unit id="ERR_EndWithWithoutWith"> <source>'End With' must be preceded by a matching 'With'.</source> <target state="translated">'Instrukcja End With musi być poprzedzona odpowiadającą jej instrukcją With.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefined1"> <source>Label '{0}' is already defined in the current method.</source> <target state="translated">Etykieta „{0}” jest już zdefiniowana w bieżącej metodzie.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndSelect"> <source>'Select Case' must end with a matching 'End Select'.</source> <target state="translated">'Instrukcja Select Case musi być zakończona odpowiadającą jej instrukcją End Select.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitForNotWithinFor"> <source>'Exit For' can only appear inside a 'For' statement.</source> <target state="translated">'Instrukcja Exit For może wystąpić tylko wewnątrz instrukcji For.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitWhileNotWithinWhile"> <source>'Exit While' can only appear inside a 'While' statement.</source> <target state="translated">'Instrukcja Exit While może wystąpić tylko wewnątrz instrukcji While.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyProperty1"> <source>'ReadOnly' property '{0}' cannot be the target of an assignment.</source> <target state="translated">'Właściwość „{0}” typu „ReadOnly” nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitSelectNotWithinSelect"> <source>'Exit Select' can only appear inside a 'Select' statement.</source> <target state="translated">'Instrukcja Exit Select może wystąpić tylko wewnątrz instrukcji Select.</target> <note /> </trans-unit> <trans-unit id="ERR_BranchOutOfFinally"> <source>Branching out of a 'Finally' is not valid.</source> <target state="translated">Rozgałęzianie poza blokiem „Finally” jest nieprawidłowe.</target> <note /> </trans-unit> <trans-unit id="ERR_QualNotObjectRecord1"> <source>'!' requires its left operand to have a type parameter, class or interface type, but this operand has the type '{0}'.</source> <target state="translated">'Element „!” wymaga, aby lewy argument operacji zawierał parametr typu, klasę lub typ interfejsu, ale ten argument operacji jest typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewIndices"> <source>Number of indices is less than the number of dimensions of the indexed array.</source> <target state="translated">Liczba indeksów jest mniejsza niż liczba wymiarów tablicy indeksowanej.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyIndices"> <source>Number of indices exceeds the number of dimensions of the indexed array.</source> <target state="translated">Liczba indeksów przekracza liczbę wymiarów tablicy indeksowanej.</target> <note /> </trans-unit> <trans-unit id="ERR_EnumNotExpression1"> <source>'{0}' is an Enum type and cannot be used as an expression.</source> <target state="translated">Typem elementu „{0}” jest typ wyliczeniowy i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeNotExpression1"> <source>'{0}' is a type and cannot be used as an expression.</source> <target state="translated">'Element „{0}” jest typem i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassNotExpression1"> <source>'{0}' is a class type and cannot be used as an expression.</source> <target state="translated">'Typem elementu „{0}” jest typ klasy i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureNotExpression1"> <source>'{0}' is a structure type and cannot be used as an expression.</source> <target state="translated">'Typem elementu „{0}” jest typ struktury i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNotExpression1"> <source>'{0}' is an interface type and cannot be used as an expression.</source> <target state="translated">'Typem elementu „{0}” jest typ interfejsu i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotExpression1"> <source>'{0}' is a namespace and cannot be used as an expression.</source> <target state="translated">'Element „{0}” jest przestrzenią nazw i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamespaceName1"> <source>'{0}' is not a valid name and cannot be used as the root namespace name.</source> <target state="translated">'Element „{0}” nie jest prawidłową nazwą i nie można go użyć jako nazwy głównej przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlPrefixNotExpression"> <source>'{0}' is an XML prefix and cannot be used as an expression. Use the GetXmlNamespace operator to create a namespace object.</source> <target state="translated">'Element „{0}” jest prefiksem XML i nie można go używać jako wyrażenia. Użyj operatora GetXmlNamespace, aby utworzyć obiekt przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleExtends"> <source>'Inherits' can appear only once within a 'Class' statement and can only specify one class.</source> <target state="translated">'Instrukcja Inherits może wystąpić tylko raz w instrukcji Class i może określać tylko jedną klasę.</target> <note /> </trans-unit> <trans-unit id="ERR_PropMustHaveGetSet"> <source>Property without a 'ReadOnly' or 'WriteOnly' specifier must provide both a 'Get' and a 'Set'.</source> <target state="translated">Właściwość bez specyfikatora „ReadOnly” lub „WriteOnly” musi udostępniać zarówno procedurę „Get”, jak i „Set”.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyHasNoWrite"> <source>'WriteOnly' property must provide a 'Set'.</source> <target state="translated">'Właściwość typu WriteOnly musi udostępniać procedurę Set.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyHasNoGet"> <source>'ReadOnly' property must provide a 'Get'.</source> <target state="translated">'Właściwość typu ReadOnly musi udostępniać procedurę Get.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttribute1"> <source>Attribute '{0}' is not valid: Incorrect argument value.</source> <target state="translated">Atrybut „{0}” jest niepoprawny: niepoprawna wartość argumentu.</target> <note /> </trans-unit> <trans-unit id="ERR_LabelNotDefined1"> <source>Label '{0}' is not defined.</source> <target state="translated">Etykieta „{0}” nie jest zdefiniowana.</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorCreatingWin32ResourceFile"> <source>Error creating Win32 resources: {0}</source> <target state="translated">Błąd podczas tworzenia zasobów Win32: {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToCreateTempFile"> <source>Cannot create temporary file: {0}</source> <target state="translated">Nie można utworzyć pliku tymczasowego: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNewCall2"> <source>First statement of this 'Sub New' must be a call to 'MyBase.New' or 'MyClass.New' because base class '{0}' of '{1}' does not have an accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">Pierwsza instrukcja w tym elemencie „Sub New” musi być wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ klasa bazowa „{0}” klasy „{1}” nie ma dostępnego elementu „Sub New”, który można wywoływać bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedMember3"> <source>{0} '{1}' must implement '{2}' for interface '{3}'.</source> <target state="translated">Element {0} „{1}” musi implementować element „{2}” dla interfejsu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWithRef"> <source>Leading '.' or '!' can only appear inside a 'With' statement.</source> <target state="translated">Wiodący znak . lub ! może wystąpić tylko wewnątrz instrukcji With.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAccessCategoryUsed"> <source>Only one of 'Public', 'Private', 'Protected', 'Friend', 'Protected Friend', or 'Private Protected' can be specified.</source> <target state="translated">Można określić tylko jeden z modyfikatorów: Public, Private, Protected, Friend, Protected Friend i Private Protected.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateModifierCategoryUsed"> <source>Only one of 'NotOverridable', 'MustOverride', or 'Overridable' can be specified.</source> <target state="translated">Można określić tylko jeden z modyfikatorów: NotOverridable, MustOverride lub Overridable.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateSpecifier"> <source>Specifier is duplicated.</source> <target state="translated">Specyfikator jest zduplikowany.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeConflict6"> <source>{0} '{1}' and {2} '{3}' conflict in {4} '{5}'.</source> <target state="translated">Element {0} „{1}” i {2} „{3}” powoduje konflikt w elemencie {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedTypeKeyword"> <source>Keyword does not name a type.</source> <target state="translated">Słowo kluczowe nie określa typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtraSpecifiers"> <source>Specifiers valid only at the beginning of a declaration.</source> <target state="translated">Specyfikatory są prawidłowe tylko na początku deklaracji.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedType"> <source>Type expected.</source> <target state="translated">Oczekiwano typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUseOfKeyword"> <source>Keyword is not valid as an identifier.</source> <target state="translated">Słowo kluczowe nie jest prawidłowe jako identyfikator.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndEnum"> <source>'End Enum' must be preceded by a matching 'Enum'.</source> <target state="translated">Instrukcja „End Enum” musi być poprzedzona odpowiadającą jej instrukcją „Enum”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndEnum"> <source>'Enum' must end with a matching 'End Enum'.</source> <target state="translated">Instrukcja Enum musi być zakończona odpowiadającą jej instrukcją End Enum.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDeclaration"> <source>Declaration expected.</source> <target state="translated">Oczekiwano deklaracji.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayMustBeLast"> <source>End of parameter list expected. Cannot define parameters after a paramarray parameter.</source> <target state="translated">Oczekiwano końca listy parametrów. Nie można zdefiniować parametrów po parametrze paramarray.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecifiersInvalidOnInheritsImplOpt"> <source>Specifiers and attributes are not valid on this statement.</source> <target state="translated">Specyfikatory i atrybuty nie są prawidłowe w tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSpecifier"> <source>Expected one of 'Dim', 'Const', 'Public', 'Private', 'Protected', 'Friend', 'Shadows', 'ReadOnly' or 'Shared'.</source> <target state="translated">Oczekiwano jednej z instrukcji: Dim, Const, Public, Private, Protected, Friend, Shadows, ReadOnly lub Shared.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedComma"> <source>Comma expected.</source> <target state="translated">Oczekiwano przecinka.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAs"> <source>'As' expected.</source> <target state="translated">'Oczekiwano klauzuli „As”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRparen"> <source>')' expected.</source> <target state="translated">'Oczekiwano znaku „)”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLparen"> <source>'(' expected.</source> <target state="translated">'Oczekiwano znaku „(”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNewInType"> <source>'New' is not valid in this context.</source> <target state="translated">'Instrukcja New nie jest prawidłowa w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedExpression"> <source>Expression expected.</source> <target state="translated">Oczekiwano wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOptional"> <source>'Optional' expected.</source> <target state="translated">'Oczekiwano instrukcji „Optional”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIdentifier"> <source>Identifier expected.</source> <target state="translated">Oczekiwano identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIntLiteral"> <source>Integer constant expected.</source> <target state="translated">Oczekiwano stałej całkowitej.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEOS"> <source>End of statement expected.</source> <target state="translated">Oczekiwano końca instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedForOptionStmt"> <source>'Option' must be followed by 'Compare', 'Explicit', 'Infer', or 'Strict'.</source> <target state="translated">'Po instrukcji „Option” musi znajdować się element „Compare”, „Explicit”, „Infer” lub „Strict”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionCompare"> <source>'Option Compare' must be followed by 'Text' or 'Binary'.</source> <target state="translated">'Po instrukcji Option Compare musi wystąpić element Text lub Binary.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOptionCompare"> <source>'Compare' expected.</source> <target state="translated">'Oczekiwano instrukcji „Compare”.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowImplicitObject"> <source>Option Strict On requires all variable declarations to have an 'As' clause.</source> <target state="translated">Ustawienie Option Strict On wymaga, aby wszystkie deklaracje zmiennych miały klauzulę „As”.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsImplicitProc"> <source>Option Strict On requires all Function, Property, and Operator declarations to have an 'As' clause.</source> <target state="translated">Ustawienie Option Strict On wymaga, aby wszystkie deklaracje funkcji, właściwości i operatorów miały klauzulę „As”.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsImplicitArgs"> <source>Option Strict On requires that all method parameters have an 'As' clause.</source> <target state="translated">Ustawienie Option Strict On wymaga, aby wszystkie parametry metody miały klauzulę „As”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidParameterSyntax"> <source>Comma or ')' expected.</source> <target state="translated">Oczekiwano przecinka lub znaku ).</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSubFunction"> <source>'Sub' or 'Function' expected.</source> <target state="translated">'Oczekiwano instrukcji Sub lub Function.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedStringLiteral"> <source>String constant expected.</source> <target state="translated">Oczekiwano stałej w postaci ciągu.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingLibInDeclare"> <source>'Lib' expected.</source> <target state="translated">'Oczekiwano instrukcji Lib.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateNoInvoke1"> <source>Delegate class '{0}' has no Invoke method, so an expression of this type cannot be the target of a method call.</source> <target state="translated">Klasa delegatu „{0}” nie ma metody Invoke, dlatego wyrażenie tego typu nie może być elementem docelowym wywołania metody.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingIsInTypeOf"> <source>'Is' expected.</source> <target state="translated">'Oczekiwano instrukcji „Is”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateOption1"> <source>'Option {0}' statement can only appear once per file.</source> <target state="translated">'Instrukcja „Option {0}” może wystąpić w pliku tylko raz.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantInherit"> <source>'Inherits' not valid in Modules.</source> <target state="translated">'Instrukcja Inherits nie jest prawidłowa w modułach.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantImplement"> <source>'Implements' not valid in Modules.</source> <target state="translated">'Instrukcja Implements nie jest prawidłowa w modułach.</target> <note /> </trans-unit> <trans-unit id="ERR_BadImplementsType"> <source>Implemented type must be an interface.</source> <target state="translated">Implementowany typ musi być interfejsem.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstFlags1"> <source>'{0}' is not valid on a constant declaration.</source> <target state="translated">'Element „{0}” nie jest poprawny w deklaracji stałej.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWithEventsFlags1"> <source>'{0}' is not valid on a WithEvents declaration.</source> <target state="translated">'Element „{0}” nie jest poprawny w deklaracji WithEvents.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDimFlags1"> <source>'{0}' is not valid on a member variable declaration.</source> <target state="translated">'Element „{0}” nie jest poprawny w deklaracji zmiennej składowej.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParamName1"> <source>Parameter already declared with name '{0}'.</source> <target state="translated">Zadeklarowano już parametr o nazwie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopDoubleCondition"> <source>'Loop' cannot have a condition if matching 'Do' has one.</source> <target state="translated">'Instrukcja Loop nie może zawierać warunku, jeśli zawiera go już odpowiadająca jej instrukcja Do.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRelational"> <source>Relational operator expected.</source> <target state="translated">Oczekiwano operatora relacyjnego.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedExitKind"> <source>'Exit' must be followed by 'Sub', 'Function', 'Property', 'Do', 'For', 'While', 'Select', or 'Try'.</source> <target state="translated">'Po instrukcji „Exit” musi występować instrukcja „Sub”, „Function”, „Property”, „Do”, „For”, „While”, „Select” lub „Try”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNamedArgumentInAttributeList"> <source>Named argument expected.</source> <target state="translated">Oczekiwano nazwanego argumentu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentSpecificationBeforeFixedArgumentInLateboundInvocation"> <source>Named argument specifications must appear after all fixed arguments have been specified in a late bound invocation.</source> <target state="translated">Specyfikacje argumentu nazwanego muszą występować po wszystkich stałych argumentach, które zostały określone w wywołaniu późnego wiązania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNamedArgument"> <source>Named argument expected. Please use language version {0} or greater to use non-trailing named arguments.</source> <target state="translated">Oczekiwano argumentu nazwanego. Użyj wersji języka {0} lub nowszej, aby używać argumentów nazwanych innych niż końcowe.</target> <note /> </trans-unit> <trans-unit id="ERR_BadMethodFlags1"> <source>'{0}' is not valid on a method declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji metody.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEventFlags1"> <source>'{0}' is not valid on an event declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDeclareFlags1"> <source>'{0}' is not valid on a Declare.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w elemencie Declare</target> <note /> </trans-unit> <trans-unit id="ERR_BadLocalConstFlags1"> <source>'{0}' is not valid on a local constant declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji stałej lokalnej.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLocalDimFlags1"> <source>'{0}' is not valid on a local variable declaration.</source> <target state="translated">'Element „{0}” nie jest poprawny w deklaracji zmiennej lokalnej.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedConditionalDirective"> <source>'If', 'ElseIf', 'Else', 'Const', 'Region', 'ExternalSource', 'ExternalChecksum', 'Enable', 'Disable', 'End' or 'R' expected.</source> <target state="translated">'Oczekiwano instrukcji „If”, „ElseIf”, „Else”, „Const”, „Region”, „ExternalSource”, „ExternalChecksum”, „Enable”, „Disable”, „End” lub „R”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEQ"> <source>'=' expected.</source> <target state="translated">'Oczekiwano znaku „=”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorNotFound1"> <source>Type '{0}' has no constructors.</source> <target state="translated">Typ „{0}” nie ma konstruktorów.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndInterface"> <source>'End Interface' must be preceded by a matching 'Interface'.</source> <target state="translated">'Instrukcja End Interface musi być poprzedzona odpowiadającą jej instrukcją Interface.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndInterface"> <source>'Interface' must end with a matching 'End Interface'.</source> <target state="translated">'Instrukcja Interface musi być zakończona odpowiadającą jej instrukcją End Interface.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFrom2"> <source> '{0}' inherits from '{1}'.</source> <target state="translated"> Element „{0}” dziedziczy po elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNestedIn2"> <source> '{0}' is nested in '{1}'.</source> <target state="translated"> Element „{0}” jest zagnieżdżony w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceCycle1"> <source>Class '{0}' cannot inherit from itself: {1}</source> <target state="translated">Klasa „{0}” nie może dziedziczyć po sobie samej: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromNonClass"> <source>Classes can inherit only from other classes.</source> <target state="translated">Klasy mogą dziedziczyć tylko po innych klasach.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefinedType3"> <source>'{0}' is already declared as '{1}' in this {2}.</source> <target state="translated">'Element „{0}” jest już zadeklarowany jako „{1}” w tym elemencie {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadOverrideAccess2"> <source>'{0}' cannot override '{1}' because they have different access levels.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ mają one różne poziomy dostępu.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNotOverridable2"> <source>'{0}' cannot override '{1}' because it is declared 'NotOverridable'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ jest on zadeklarowany jako „NotOverridable”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateProcDef1"> <source>'{0}' has multiple definitions with identical signatures.</source> <target state="translated">'Element „{0}” ma wiele definicji o identycznych sygnaturach.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateProcDefWithDifferentTupleNames2"> <source>'{0}' has multiple definitions with identical signatures with different tuple element names, including '{1}'.</source> <target state="translated">'Element „{0}” ma wiele definicji z identycznymi sygnaturami z różnymi nazwami elementów krotki, w tym „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceMethodFlags1"> <source>'{0}' is not valid on an interface method declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji metody interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound2"> <source>'{0}' is not a parameter of '{1}'.</source> <target state="translated">'Element „{0}” nie jest parametrem elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfacePropertyFlags1"> <source>'{0}' is not valid on an interface property declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji właściwości interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice2"> <source>Parameter '{0}' of '{1}' already has a matching argument.</source> <target state="translated">Parametr „{0}” („{1}”) ma już zgodny argument.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceCantUseEventSpecifier1"> <source>'{0}' is not valid on an interface event declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji zdarzenia interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypecharNoMatch2"> <source>Type character '{0}' does not match declared data type '{1}'.</source> <target state="translated">Znak typu „{0}” nie odpowiada zadeklarowanemu typowi danych „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSubOrFunction"> <source>'Sub' or 'Function' expected after 'Delegate'.</source> <target state="translated">'Oczekiwano instrukcji Sub lub Function po instrukcji Delegate.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmptyEnum1"> <source>Enum '{0}' must contain at least one member.</source> <target state="translated">Wyliczenie „{0}” musi zawierać co najmniej jedną składową.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidConstructorCall"> <source>Constructor call is valid only as the first statement in an instance constructor.</source> <target state="translated">Wywołanie konstruktora jest prawidłowe tylko jako pierwsza instrukcja w konstruktorze wystąpienia.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideConstructor"> <source>'Sub New' cannot be declared 'Overrides'.</source> <target state="translated">'Nie można zadeklarować elementu Sub New jako Overrides.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorCannotBeDeclaredPartial"> <source>'Sub New' cannot be declared 'Partial'.</source> <target state="translated">'Nie można zadeklarować elementu „Sub New” jako „Partial”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleEmitFailure"> <source>Failed to emit module '{0}': {1}</source> <target state="translated">Wyemitowanie modułu „{0}” nie powiodło się: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_EncUpdateFailedMissingAttribute"> <source>Cannot update '{0}'; attribute '{1}' is missing.</source> <target state="translated">Nie można zaktualizować elementu „{0}”. Brak atrybutu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideNotNeeded3"> <source>{0} '{1}' cannot be declared 'Overrides' because it does not override a {0} in a base class.</source> <target state="translated">Nie można zadeklarować elementu {0} „{1}” jako „Overrides”, ponieważ nie przesłania on elementu {0} w klasie bazowej.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDot"> <source>'.' expected.</source> <target state="translated">'Oczekiwano znaku „.”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocals1"> <source>Local variable '{0}' is already declared in the current block.</source> <target state="translated">Zmienna lokalna „{0}” jest już zadeklarowana w bieżącym bloku.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsProc"> <source>Statement cannot appear within a method body. End of method assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści metody. Założono koniec metody.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalSameAsFunc"> <source>Local variable cannot have the same name as the function containing it.</source> <target state="translated">Zmienna lokalna nie może mieć takiej samej nazwy jak zawierająca ją funkcja.</target> <note /> </trans-unit> <trans-unit id="ERR_RecordEmbeds2"> <source> '{0}' contains '{1}' (variable '{2}').</source> <target state="translated"> Element „{0}” zawiera element „{1}” (zmienna „{2}”).</target> <note /> </trans-unit> <trans-unit id="ERR_RecordCycle2"> <source>Structure '{0}' cannot contain an instance of itself: {1}</source> <target state="translated">Struktura „{0}” nie może zawierać wystąpienia samej siebie: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceCycle1"> <source>Interface '{0}' cannot inherit from itself: {1}</source> <target state="translated">Interfejs „{0}” nie może dziedziczyć po samym sobie: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SubNewCycle2"> <source> '{0}' calls '{1}'.</source> <target state="translated"> Element „{0}” wywołuje element „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SubNewCycle1"> <source>Constructor '{0}' cannot call itself: {1}</source> <target state="translated">Konstruktor „{0}” nie może wywoływać samego siebie: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromCantInherit3"> <source>'{0}' cannot inherit from {2} '{1}' because '{1}' is declared 'NotInheritable'.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {2} „{1}”, ponieważ element „{1}” jest zadeklarowany jako „NotInheritable”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithOptional2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by optional parameters.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie parametrami opcjonalnymi.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithReturnType2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by return types.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie zwracanymi typami.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharWithType1"> <source>Type character '{0}' cannot be used in a declaration with an explicit type.</source> <target state="translated">Nie można użyć znaku typu „{0}” w deklaracji z typem jawnym.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnSub"> <source>Type character cannot be used in a 'Sub' declaration because a 'Sub' doesn't return a value.</source> <target state="translated">Nie można użyć znaku typu w deklaracji Sub, ponieważ procedura Sub nie zwraca wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithDefault2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by the default values of optional parameters.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie wartościami domyślnymi parametrów opcjonalnych.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingSubscript"> <source>Array subscript expression missing.</source> <target state="translated">Brak wyrażenia indeksu tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithDefault2"> <source>'{0}' cannot override '{1}' because they differ by the default values of optional parameters.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się wartościami domyślnymi parametrów opcjonalnych.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithOptional2"> <source>'{0}' cannot override '{1}' because they differ by optional parameters.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się parametrami opcjonalnymi.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldOfValueFieldOfMarshalByRef3"> <source>Cannot refer to '{0}' because it is a member of the value-typed field '{1}' of class '{2}' which has 'System.MarshalByRefObject' as a base class.</source> <target state="translated">Nie można odwołać się do elementu „{0}”, ponieważ jest to element członkowski pola „{1}” o typie wartości klasy „{2}”, której klasą bazową jest „System.MarshalByRefObject”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMismatch2"> <source>Value of type '{0}' cannot be converted to '{1}'.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseAfterCaseElse"> <source>'Case' cannot follow a 'Case Else' in the same 'Select' statement.</source> <target state="translated">'Instrukcja Case nie może wystąpić po instrukcji Case Else w tej samej instrukcji Select.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertArrayMismatch4"> <source>Value of type '{0}' cannot be converted to '{1}' because '{2}' is not derived from '{3}'.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”, ponieważ element „{2}” nie pochodzi od elementu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertObjectArrayMismatch3"> <source>Value of type '{0}' cannot be converted to '{1}' because '{2}' is not a reference type.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”, ponieważ element „{2}” nie jest typem referencyjnym.</target> <note /> </trans-unit> <trans-unit id="ERR_ForLoopType1"> <source>'For' loop control variable cannot be of type '{0}' because the type does not support the required operators.</source> <target state="translated">'Zmienna sterująca pętli „For” nie może być zmienną typu „{0}”, ponieważ ten typ nie obsługuje wymaganych operatorów.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithByref2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by parameters declared 'ByRef' or 'ByVal'.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie parametrami zadeklarowanymi jako „ByRef” lub „ByVal”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromNonInterface"> <source>Interface can inherit only from another interface.</source> <target state="translated">Interfejs może dziedziczyć tylko po innym interfejsie.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceOrderOnInherits"> <source>'Inherits' statements must precede all declarations in an interface.</source> <target state="translated">'Instrukcje „Inherits” muszą znajdować się przed wszystkimi deklaracjami w interfejsie.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateDefaultProps1"> <source>'Default' can be applied to only one property name in a {0}.</source> <target state="translated">'Element „Default” można stosować tylko do jednej nazwy właściwości w elemencie {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMissingFromProperty2"> <source>'{0}' and '{1}' cannot overload each other because only one is declared 'Default'.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ tylko jeden z nich jest zadeklarowany jako „Default”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverridingPropertyKind2"> <source>'{0}' cannot override '{1}' because they differ by 'ReadOnly' or 'WriteOnly'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się ustawieniem „ReadOnly” lub „WriteOnly”.</target> <note /> </trans-unit> <trans-unit id="ERR_NewInInterface"> <source>'Sub New' cannot be declared in an interface.</source> <target state="translated">'Nie można zadeklarować elementu Sub New w interfejsie.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnNew1"> <source>'Sub New' cannot be declared '{0}'.</source> <target state="translated">'Nie można zadeklarować elementu „Sub New” jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadingPropertyKind2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by 'ReadOnly' or 'WriteOnly'.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie ustawieniem „ReadOnly” lub „WriteOnly”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDefaultNotExtend1"> <source>Class '{0}' cannot be indexed because it has no default property.</source> <target state="translated">Nie można zaindeksować klasy „{0}”, ponieważ nie ma ona właściwości domyślnej.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithArrayVsParamArray2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by parameters declared 'ParamArray'.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie parametrami zadeklarowanymi jako „ParamArray”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInstanceMemberAccess"> <source>Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.</source> <target state="translated">Nie można odwołać się do składowej wystąpienia klasy z wnętrza udostępnionej metody lub udostępnionego inicjatora składowej bez jawnego wystąpienia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRbrace"> <source>'}' expected.</source> <target state="translated">'Oczekiwano znaku „}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleAsType1"> <source>Module '{0}' cannot be used as a type.</source> <target state="translated">Nie można użyć modułu „{0}” jako typu.</target> <note /> </trans-unit> <trans-unit id="ERR_NewIfNullOnNonClass"> <source>'New' cannot be used on an interface.</source> <target state="translated">'Nie można użyć instrukcji New w interfejsie.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchAfterFinally"> <source>'Catch' cannot appear after 'Finally' within a 'Try' statement.</source> <target state="translated">'Instrukcja Catch nie może wystąpić po instrukcji Finally w instrukcji Try.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchNoMatchingTry"> <source>'Catch' cannot appear outside a 'Try' statement.</source> <target state="translated">'Instrukcja Catch nie może wystąpić poza instrukcją Try.</target> <note /> </trans-unit> <trans-unit id="ERR_FinallyAfterFinally"> <source>'Finally' can only appear once in a 'Try' statement.</source> <target state="translated">'Instrukcja Finally może wystąpić tylko raz w instrukcji Try.</target> <note /> </trans-unit> <trans-unit id="ERR_FinallyNoMatchingTry"> <source>'Finally' cannot appear outside a 'Try' statement.</source> <target state="translated">'Instrukcja Finally nie może wystąpić poza instrukcją Try.</target> <note /> </trans-unit> <trans-unit id="ERR_EndTryNoTry"> <source>'End Try' must be preceded by a matching 'Try'.</source> <target state="translated">'Instrukcja End Try musi być poprzedzona odpowiadającą jej instrukcją Try.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndTry"> <source>'Try' must end with a matching 'End Try'.</source> <target state="translated">'Instrukcja Try musi być zakończona odpowiadającą jej instrukcją End Try.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelegateFlags1"> <source>'{0}' is not valid on a Delegate declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji Delegate.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstructorOnBase2"> <source>Class '{0}' must declare a 'Sub New' because its base class '{1}' does not have an accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">Klasa „{0}” musi mieć deklarację elementu „Sub New”, ponieważ jej klasa bazowa „{1}” nie ma dostępnego elementu „Sub New”, który można wywołać bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleSymbol2"> <source>'{0}' is not accessible in this context because it is '{1}'.</source> <target state="translated">'Element „{0}” nie jest dostępny w tym kontekście, ponieważ jest to element „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleMember3"> <source>'{0}.{1}' is not accessible in this context because it is '{2}'.</source> <target state="translated">'Element „{0}.{1}” nie jest dostępny w tym kontekście, ponieważ jest to element „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchNotException1"> <source>'Catch' cannot catch type '{0}' because it is not 'System.Exception' or a class that inherits from 'System.Exception'.</source> <target state="translated">'Instrukcja „Catch” nie może przechwycić typu „{0}”, ponieważ nie jest to „System.Exception” ani klasa, która dziedziczy po „System.Exception”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitTryNotWithinTry"> <source>'Exit Try' can only appear inside a 'Try' statement.</source> <target state="translated">'Instrukcja Exit Try może wystąpić tylko wewnątrz instrukcji Try.</target> <note /> </trans-unit> <trans-unit id="ERR_BadRecordFlags1"> <source>'{0}' is not valid on a Structure declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji struktury.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEnumFlags1"> <source>'{0}' is not valid on an Enum declaration.</source> <target state="translated">Element „{0}” nie jest prawidłowy w deklaracji wyliczenia.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceFlags1"> <source>'{0}' is not valid on an Interface declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithByref2"> <source>'{0}' cannot override '{1}' because they differ by a parameter that is marked as 'ByRef' versus 'ByVal'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się parametrem oznaczonym jest jako „ByRef” lub „ByVal”.</target> <note /> </trans-unit> <trans-unit id="ERR_MyBaseAbstractCall1"> <source>'MyBase' cannot be used with method '{0}' because it is declared 'MustOverride'.</source> <target state="translated">'Instrukcja „MyBase” nie może być użyta z metodą „{0}”, ponieważ jest ona zadeklarowana jako „MustOverride”.</target> <note /> </trans-unit> <trans-unit id="ERR_IdentNotMemberOfInterface4"> <source>'{0}' cannot implement '{1}' because there is no matching {2} on interface '{3}'.</source> <target state="translated">'Element „{0}” nie może zaimplementować elementu „{1}”, ponieważ nie ma pasującego elementu {2} w interfejsie „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementingInterfaceWithDifferentTupleNames5"> <source>'{0}' cannot implement {1} '{2}' on interface '{3}' because the tuple element names in '{4}' do not match those in '{5}'.</source> <target state="translated">'Element „{0}” nie może implementować elementu {1} „{2}” w ramach interfejsu „{3}”, ponieważ nazwy elementów krotki w elemencie „{4}” nie pasują do nazw w elemencie „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_WithEventsRequiresClass"> <source>'WithEvents' variables must have an 'As' clause.</source> <target state="translated">'Zmienne WithEvents muszą mieć klauzulę As.</target> <note /> </trans-unit> <trans-unit id="ERR_WithEventsAsStruct"> <source>'WithEvents' variables can only be typed as classes, interfaces or type parameters with class constraints.</source> <target state="translated">'Zmienne „WithEvents” można określać tylko jako klasy, interfejsy lub parametry typu z ograniczeniami klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertArrayRankMismatch2"> <source>Value of type '{0}' cannot be converted to '{1}' because the array types have different numbers of dimensions.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”, ponieważ typy tablic mają różną liczbę wymiarów.</target> <note /> </trans-unit> <trans-unit id="ERR_RedimRankMismatch"> <source>'ReDim' cannot change the number of dimensions of an array.</source> <target state="translated">'Nie można zmienić liczby wymiarów tablicy przy użyciu instrukcji ReDim.</target> <note /> </trans-unit> <trans-unit id="ERR_StartupCodeNotFound1"> <source>'Sub Main' was not found in '{0}'.</source> <target state="translated">'Nie odnaleziono instrukcji „Sub Main” w elemencie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstAsNonConstant"> <source>Constants must be of an intrinsic or enumerated type, not a class, structure, type parameter, or array type.</source> <target state="translated">Stałe muszą być typu wewnętrznego lub wyliczeniowego, a nie typu klasy, struktury, parametru typu lub tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndSub"> <source>'End Sub' must be preceded by a matching 'Sub'.</source> <target state="translated">'Instrukcja End Sub musi być poprzedzona odpowiadającą jej instrukcją Sub.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndFunction"> <source>'End Function' must be preceded by a matching 'Function'.</source> <target state="translated">'Instrukcja End Function musi być poprzedzona odpowiadającą jej instrukcją Function.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndProperty"> <source>'End Property' must be preceded by a matching 'Property'.</source> <target state="translated">'Instrukcja End Property musi być poprzedzona odpowiadającą jej instrukcją Property.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseMethodSpecifier1"> <source>Methods in a Module cannot be declared '{0}'.</source> <target state="translated">Metody w module nie mogą być zadeklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseEventSpecifier1"> <source>Events in a Module cannot be declared '{0}'.</source> <target state="translated">Zdarzenia w module nie mogą być zadeklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantUseVarSpecifier1"> <source>Members in a Structure cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować składowych w strukturze jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOverrideDueToReturn2"> <source>'{0}' cannot override '{1}' because they differ by their return types.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ różnią się one zwracanym typem.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidOverrideDueToTupleNames2"> <source>'{0}' cannot override '{1}' because they differ by their tuple element names.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ różnią się nazwami elementów krotki.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidOverrideDueToTupleNames2_Title"> <source>Member cannot override because it differs by its tuple element names.</source> <target state="translated">Składowa nie może przesłaniać, ponieważ różni się nazwami elementów krotki.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantWithNoValue"> <source>Constants must have a value.</source> <target state="translated">Stałe muszą mieć wartość.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionOverflow1"> <source>Constant expression not representable in type '{0}'.</source> <target state="translated">Nieprawidłowa reprezentacja wyrażenia stałego w typie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertyGet"> <source>'Get' is already declared.</source> <target state="translated">'Element „Get” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertySet"> <source>'Set' is already declared.</source> <target state="translated">'Element „Set” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotDeclared1"> <source>'{0}' is not declared. It may be inaccessible due to its protection level.</source> <target state="translated">'Element „{0}” nie został zadeklarowany. Może on być niedostępny z powodu swojego poziomu ochrony.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryOperands3"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'.</source> <target state="translated">Operator „{0}” nie jest zdefiniowany dla typu „{1}” i „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedProcedure"> <source>Expression is not a method.</source> <target state="translated">Wyrażenie nie jest metodą.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument2"> <source>Argument not specified for parameter '{0}' of '{1}'.</source> <target state="translated">Nie określono argumentu dla parametru „{0}” elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotMember2"> <source>'{0}' is not a member of '{1}'.</source> <target state="translated">'Element „{0}” nie jest składową elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndClassNoClass"> <source>'End Class' must be preceded by a matching 'Class'.</source> <target state="translated">'Instrukcja End Class musi być poprzedzona odpowiadającą jej instrukcją Class.</target> <note /> </trans-unit> <trans-unit id="ERR_BadClassFlags1"> <source>Classes cannot be declared '{0}'.</source> <target state="translated">Klas nie można deklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportsMustBeFirst"> <source>'Imports' statements must precede any declarations.</source> <target state="translated">'Instrukcje Imports muszą znajdować się przed wszelkimi deklaracjami.</target> <note /> </trans-unit> <trans-unit id="ERR_NonNamespaceOrClassOnImport2"> <source>'{1}' for the Imports '{0}' does not refer to a Namespace, Class, Structure, Enum or Module.</source> <target state="translated">Element „{1}” dla operacji importu „{0}” nie odwołuje się do przestrzeni nazw, klasy, struktury, wyliczenia ani modułu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypecharNotallowed"> <source>Type declaration characters are not valid in this context.</source> <target state="translated">Znaki deklaracji typu nie są prawidłowe w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectReferenceNotSupplied"> <source>Reference to a non-shared member requires an object reference.</source> <target state="translated">Odwołanie do nieudostępnionej składowej wymaga odwołania do obiektu.</target> <note /> </trans-unit> <trans-unit id="ERR_MyClassNotInClass"> <source>'MyClass' cannot be used outside of a class.</source> <target state="translated">'Nie można użyć instrukcji MyClass poza klasą.</target> <note /> </trans-unit> <trans-unit id="ERR_IndexedNotArrayOrProc"> <source>Expression is not an array or a method, and cannot have an argument list.</source> <target state="translated">Wyrażenie nie jest tablicą ani metodą i nie może mieć listy argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_EventSourceIsArray"> <source>'WithEvents' variables cannot be typed as arrays.</source> <target state="translated">'Zmienne WithEvents nie mogą być zmiennymi typu tablicowego.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedConstructorWithParams"> <source>Shared 'Sub New' cannot have any parameters.</source> <target state="translated">Udostępniony element Sub New nie może mieć żadnych parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedConstructorIllegalSpec1"> <source>Shared 'Sub New' cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować udostępnianego elementu „Sub New” jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndClass"> <source>'Class' statement must end with a matching 'End Class'.</source> <target state="translated">'Instrukcja Class musi być zakończona odpowiadającą jej instrukcją End Class.</target> <note /> </trans-unit> <trans-unit id="ERR_UnaryOperand2"> <source>Operator '{0}' is not defined for type '{1}'.</source> <target state="translated">Operator „{0}” nie jest zdefiniowany dla typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsWithDefault1"> <source>'Default' cannot be combined with '{0}'.</source> <target state="translated">'Nie można łączyć instrukcji „Default” z elementem „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidValue"> <source>Expression does not produce a value.</source> <target state="translated">Wyrażenie nie zwraca wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorFunction"> <source>Constructor must be declared as a Sub, not as a Function.</source> <target state="translated">Konstruktor musi być zadeklarowany jako procedura, a nie funkcja.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLiteralExponent"> <source>Exponent is not valid.</source> <target state="translated">Wykładnik nie jest prawidłowy.</target> <note /> </trans-unit> <trans-unit id="ERR_NewCannotHandleEvents"> <source>'Sub New' cannot handle events.</source> <target state="translated">'Element Sub New nie może obsługiwać zdarzeń.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularEvaluation1"> <source>Constant '{0}' cannot depend on its own value.</source> <target state="translated">Stała „{0}” nie może zależeć od własnej wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnSharedMeth1"> <source>'Shared' cannot be combined with '{0}' on a method declaration.</source> <target state="translated">'Nie można łączyć instrukcji „Shared” z elementem „{0}” w deklaracji metody.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnSharedProperty1"> <source>'Shared' cannot be combined with '{0}' on a property declaration.</source> <target state="translated">'Nie można łączyć instrukcji „Shared” z elementem „{0}” w deklaracji właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnStdModuleProperty1"> <source>Properties in a Module cannot be declared '{0}'.</source> <target state="translated">Właściwości w module nie mogą być zadeklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedOnProcThatImpl"> <source>Methods or events that implement interface members cannot be declared 'Shared'.</source> <target state="translated">Metody lub zdarzenia, które implementują składowe interfejsu, nie mogą być zadeklarowane jako Shared.</target> <note /> </trans-unit> <trans-unit id="ERR_NoWithEventsVarOnHandlesList"> <source>Handles clause requires a WithEvents variable defined in the containing type or one of its base types.</source> <target state="translated">Klauzula Handles wymaga zmiennej WithEvents zdefiniowanej w zawierającym ją typie lub jednym z jej typów podstawowych.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceAccessMismatch5"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of the base {1} to {3} '{4}'.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {1} „{2}”, ponieważ rozszerza on dostęp podstawowego elementu {1} do {3} „{4}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NarrowingConversionDisallowed2"> <source>Option Strict On disallows implicit conversions from '{0}' to '{1}'.</source> <target state="translated">Ustawienie „Option Strict On” uniemożliwia niejawne konwersje z elementu „{0}” na „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoArgumentCountOverloadCandidates1"> <source>Overload resolution failed because no accessible '{0}' accepts this number of arguments.</source> <target state="translated">Rozpoznanie przeciążenia nie powiodło się, ponieważ żaden z dostępnych elementów „{0}” nie akceptuje tej liczby argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NoViableOverloadCandidates1"> <source>Overload resolution failed because no '{0}' is accessible.</source> <target state="translated">Rozpoznanie przeciążenia zakończyło się niepowodzeniem, ponieważ żaden z parametrów „{0}” nie jest dostępny.</target> <note /> </trans-unit> <trans-unit id="ERR_NoCallableOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called with these arguments:{1}</source> <target state="translated">Ustalanie przeciążenia nie powiodło się, ponieważ brak jest dostępnego elementu „{0}”, który można wywołać z tymi argumentami: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called:{1}</source> <target state="translated">Rozpoznanie przeciążenia nie powiodło się, ponieważ nie ma dostępnego elementu „{0}” do wywołania: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonNarrowingOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called without a narrowing conversion:{1}</source> <target state="translated">Ustalanie przeciążenia nie powiodło się, ponieważ brak jest dostępnego elementu „{0}”, którego można wywołać bez konwersji zawężającej: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNarrowing3"> <source>Argument matching parameter '{0}' narrows from '{1}' to '{2}'.</source> <target state="translated">Dopasowywanie argumentu dla parametru „{0}” powoduje zawężenie typu „{1}” do typu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoMostSpecificOverload2"> <source>Overload resolution failed because no accessible '{0}' is most specific for these arguments:{1}</source> <target state="translated">Ustalanie przeciążenia nie powiodło się, ponieważ brak jest dostępnego elementu „{0}”, który jest najbardziej konkretny dla tych argumentów: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_NotMostSpecificOverload"> <source>Not most specific.</source> <target state="translated">Brak specyficznego elementu.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadCandidate2"> <source> '{0}': {1}</source> <target state="translated"> „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NoGetProperty1"> <source>Property '{0}' is 'WriteOnly'.</source> <target state="translated">Właściwość „{0}” jest tylko do zapisu.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSetProperty1"> <source>Property '{0}' is 'ReadOnly'.</source> <target state="translated">Właściwość „{0}” jest tylko do odczytu.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamTypingInconsistency"> <source>All parameters must be explicitly typed if any of them are explicitly typed.</source> <target state="translated">Jeśli którekolwiek z parametrów mają jawnie określone typy, to wszystkie parametry muszą mieć jawnie określone typy.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamNameFunctionNameCollision"> <source>Parameter cannot have the same name as its defining function.</source> <target state="translated">Parametr nie może mieć takiej samej nazwy jak definiująca go funkcja.</target> <note /> </trans-unit> <trans-unit id="ERR_DateToDoubleConversion"> <source>Conversion from 'Date' to 'Double' requires calling the 'Date.ToOADate' method.</source> <target state="translated">Konwersja typu Date na typ Double wymaga wywołania metody Date.ToOADate.</target> <note /> </trans-unit> <trans-unit id="ERR_DoubleToDateConversion"> <source>Conversion from 'Double' to 'Date' requires calling the 'Date.FromOADate' method.</source> <target state="translated">Konwersja typu Double na typ Date wymaga wywołania metody Date.FromOADate.</target> <note /> </trans-unit> <trans-unit id="ERR_ZeroDivide"> <source>Division by zero occurred while evaluating this expression.</source> <target state="translated">Podczas obliczania tego wyrażenia wystąpiło dzielenie przez zero.</target> <note /> </trans-unit> <trans-unit id="ERR_TryAndOnErrorDoNotMix"> <source>Method cannot contain both a 'Try' statement and an 'On Error' or 'Resume' statement.</source> <target state="translated">Metoda nie może zawierać jednocześnie instrukcji Try i instrukcji On Error lub Resume.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyAccessIgnored"> <source>Property access must assign to the property or use its value.</source> <target state="translated">Operacja dostępu do właściwości musi przypisywać wartość właściwości lub używać jej wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNoDefault1"> <source>'{0}' cannot be indexed because it has no default property.</source> <target state="translated">'Nie można zaindeksować elementu „{0}”, ponieważ nie ma on domyślnej właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyAttribute1"> <source>Attribute '{0}' cannot be applied to an assembly.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidModuleAttribute1"> <source>Attribute '{0}' cannot be applied to a module.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do modułu.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInUnnamedNamespace1"> <source>'{0}' is ambiguous.</source> <target state="translated">'Element „{0}” jest niejednoznaczny.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMemberNotProperty1"> <source>Default member of '{0}' is not a property.</source> <target state="translated">Domyślna składowa elementu „{0}” nie jest właściwością.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInNamespace2"> <source>'{0}' is ambiguous in the namespace '{1}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny w przestrzeni nazw „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInImports2"> <source>'{0}' is ambiguous, imported from the namespaces or types '{1}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny. Element ten został zaimportowany z przestrzeni nazw lub typów: „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInModules2"> <source>'{0}' is ambiguous between declarations in Modules '{1}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny między deklaracjami w modułach „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInNamespaces2"> <source>'{0}' is ambiguous between declarations in namespaces '{1}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny między deklaracjami w przestrzeniach nazw „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerTooFewDimensions"> <source>Array initializer has too few dimensions.</source> <target state="translated">Inicjator tablicy ma za mało wymiarów.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerTooManyDimensions"> <source>Array initializer has too many dimensions.</source> <target state="translated">Inicjator tablicy ma za dużo wymiarów.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerTooFewElements1"> <source>Array initializer is missing {0} elements.</source> <target state="translated">W inicjatorze tablicy brak następującej liczby elementów: {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerTooManyElements1"> <source>Array initializer has {0} too many elements.</source> <target state="translated">Inicjator tablicy ma za dużo elementów (o {0}).</target> <note /> </trans-unit> <trans-unit id="ERR_NewOnAbstractClass"> <source>'New' cannot be used on a class that is declared 'MustInherit'.</source> <target state="translated">'Nie można użyć instrukcji „New” w klasie, która jest zadeklarowana jako „MustInherit”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNamedImportAlias1"> <source>Alias '{0}' is already declared.</source> <target state="translated">Alias „{0}” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePrefix"> <source>XML namespace prefix '{0}' is already declared.</source> <target state="translated">Prefiks przestrzeni nazw XML „{0}” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsLateBinding"> <source>Option Strict On disallows late binding.</source> <target state="translated">Ustawienie Option Strict On uniemożliwia późne wiązanie.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfOperandNotMethod"> <source>'AddressOf' operand must be the name of a method (without parentheses).</source> <target state="translated">'Argument operacji „AddressOf” musi być nazwą metody (bez nawiasów).</target> <note /> </trans-unit> <trans-unit id="ERR_EndExternalSource"> <source>'#End ExternalSource' must be preceded by a matching '#ExternalSource'.</source> <target state="translated">'Dyrektywa #End ExternalSource musi być poprzedzona odpowiadającą jej dyrektywą #ExternalSource.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndExternalSource"> <source>'#ExternalSource' statement must end with a matching '#End ExternalSource'.</source> <target state="translated">'Dyrektywa #ExternalSource musi być zakończona odpowiadającą jej dyrektywą #End ExternalSource.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedExternalSource"> <source>'#ExternalSource' directives cannot be nested.</source> <target state="translated">'Dyrektywy #ExternalSource nie mogą być zagnieżdżane.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNotDelegate1"> <source>'AddressOf' expression cannot be converted to '{0}' because '{0}' is not a delegate type.</source> <target state="translated">'Nie można przekonwertować wyrażenia „AddressOf” na typ „{0}”, ponieważ typ „{0}” nie jest typem delegowanym.</target> <note /> </trans-unit> <trans-unit id="ERR_SyncLockRequiresReferenceType1"> <source>'SyncLock' operand cannot be of type '{0}' because '{0}' is not a reference type.</source> <target state="translated">'Argument operacji „SyncLock” nie może być typu „{0}”, ponieważ „{0}” nie jest typem referencyjnym.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodAlreadyImplemented2"> <source>'{0}.{1}' cannot be implemented more than once.</source> <target state="translated">'Nie można zaimplementować elementu „{0}.{1}” więcej niż raz.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInInherits1"> <source>'{0}' cannot be inherited more than once.</source> <target state="translated">'Nie można dziedziczyć elementu „{0}” więcej niż raz.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamArrayArgument"> <source>Named argument cannot match a ParamArray parameter.</source> <target state="translated">Nie można dopasować nazwanego argumentu do parametru ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedParamArrayArgument"> <source>Omitted argument cannot match a ParamArray parameter.</source> <target state="translated">Nie można dopasować pominiętego argumentu do parametru ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayArgumentMismatch"> <source>Argument cannot match a ParamArray parameter.</source> <target state="translated">Argument nie jest zgodny z parametrem ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_EventNotFound1"> <source>Event '{0}' cannot be found.</source> <target state="translated">Nie można znaleźć zdarzenia „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseVariableSpecifier1"> <source>Variables in Modules cannot be declared '{0}'.</source> <target state="translated">Zmienne w modułach nie mogą być deklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedEventNeedsSharedHandler"> <source>Events of shared WithEvents variables cannot be handled by non-shared methods.</source> <target state="translated">Zdarzenia udostępnionych zmiennych WithEvents nie mogą zostać obsłużone przez metody nieudostępnione.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedMinus"> <source>'-' expected.</source> <target state="translated">'Oczekiwano znaku „-”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceMemberSyntax"> <source>Interface members must be methods, properties, events, or type definitions.</source> <target state="translated">Składowe interfejsu muszą być metodami, właściwościami, zdarzeniami lub definicjami typów.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideInterface"> <source>Statement cannot appear within an interface body.</source> <target state="translated">Instrukcja nie może wystąpić w treści interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsInterface"> <source>Statement cannot appear within an interface body. End of interface assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści interfejsu. Założono koniec interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsInNotInheritableClass1"> <source>'NotInheritable' classes cannot have members declared '{0}'.</source> <target state="translated">'Klasy „NotInheritable” nie mogą mieć składowych zadeklarowanych jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseOnlyClassesMustBeExplicit2"> <source>Class '{0}' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): {1}.</source> <target state="translated">Klasa „{0}” musi być zadeklarowana jako „MustInherit” lub przesłaniać następujące dziedziczone składowe „MustOverride”: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_MustInheritEventNotOverridden"> <source>'{0}' is a MustOverride event in the base class '{1}'. Visual Basic does not support event overriding. You must either provide an implementation for the event in the base class, or make class '{2}' MustInherit.</source> <target state="translated">„{0}” jest zdarzeniem MustOverride w klasie bazowej „{1}”. Język Visual Basic nie obsługuje przesłaniania zdarzeń. Musisz określić implementację zdarzenia w klasie bazowej lub ustawić klasę „{2}” jako zdarzenie MustInherit.</target> <note /> </trans-unit> <trans-unit id="ERR_NegativeArraySize"> <source>Array dimensions cannot have a negative size.</source> <target state="translated">Wymiary tablicy nie mogą mieć rozmiaru ujemnego.</target> <note /> </trans-unit> <trans-unit id="ERR_MyClassAbstractCall1"> <source>'MustOverride' method '{0}' cannot be called with 'MyClass'.</source> <target state="translated">Nie można wywołać metody „{0}” typu „MustOverride” przy użyciu elementu „MyClass”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndDisallowedInDllProjects"> <source>'End' statement cannot be used in class library projects.</source> <target state="translated">'Nie można użyć instrukcji End w projektach biblioteki klas.</target> <note /> </trans-unit> <trans-unit id="ERR_BlockLocalShadowing1"> <source>Variable '{0}' hides a variable in an enclosing block.</source> <target state="translated">Zmienna „{0}” ukrywa zmienną w otaczającym bloku.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleNotAtNamespace"> <source>'Module' statements can occur only at file or namespace level.</source> <target state="translated">'Instrukcje Module mogą wystąpić tylko na poziomie pliku lub przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAtNamespace"> <source>'Namespace' statements can occur only at file or namespace level.</source> <target state="translated">'Instrukcje Namespace mogą wystąpić tylko na poziomie pliku lub przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEnum"> <source>Statement cannot appear within an Enum body.</source> <target state="translated">Instrukcja nie może wystąpić w treści wyliczenia.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsEnum"> <source>Statement cannot appear within an Enum body. End of Enum assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści wyliczenia. Założono koniec wyliczenia.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionStrict"> <source>'Option Strict' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Po instrukcji Option Strict może wystąpić jedynie opcja On lub Off.</target> <note /> </trans-unit> <trans-unit id="ERR_EndStructureNoStructure"> <source>'End Structure' must be preceded by a matching 'Structure'.</source> <target state="translated">'Instrukcja End Structure musi być poprzedzona odpowiadającą jej instrukcją Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_EndModuleNoModule"> <source>'End Module' must be preceded by a matching 'Module'.</source> <target state="translated">'Instrukcja End Module musi być poprzedzona odpowiadającą jej instrukcją Module.</target> <note /> </trans-unit> <trans-unit id="ERR_EndNamespaceNoNamespace"> <source>'End Namespace' must be preceded by a matching 'Namespace'.</source> <target state="translated">'Instrukcja End Namespace musi być poprzedzona odpowiadającą jej instrukcją Namespace.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndStructure"> <source>'Structure' statement must end with a matching 'End Structure'.</source> <target state="translated">'Instrukcja Structure musi być zakończona odpowiadającą jej instrukcją End Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndModule"> <source>'Module' statement must end with a matching 'End Module'.</source> <target state="translated">'Instrukcja Module musi być zakończona odpowiadającą jej instrukcją End Module.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndNamespace"> <source>'Namespace' statement must end with a matching 'End Namespace'.</source> <target state="translated">'Instrukcja Namespace musi być zakończona odpowiadającą jej instrukcją End Namespace.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionStmtWrongOrder"> <source>'Option' statements must precede any declarations or 'Imports' statements.</source> <target state="translated">'Instrukcje Option muszą występować przed wszelkimi deklaracjami i instrukcjami Imports.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantInherit"> <source>Structures cannot have 'Inherits' statements.</source> <target state="translated">Struktury nie mogą mieć instrukcji Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_NewInStruct"> <source>Structures cannot declare a non-shared 'Sub New' with no parameters.</source> <target state="translated">Struktury nie mogą deklarować nieudostępnianych elementów „Sub New” bez parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndGet"> <source>'End Get' must be preceded by a matching 'Get'.</source> <target state="translated">'Instrukcja End Get musi być poprzedzona odpowiadającą jej instrukcją Get.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndGet"> <source>'Get' statement must end with a matching 'End Get'.</source> <target state="translated">'Instrukcja Get musi być zakończona odpowiadającą jej instrukcją End Get.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndSet"> <source>'End Set' must be preceded by a matching 'Set'.</source> <target state="translated">'Instrukcja End Set musi być poprzedzona odpowiadającą jej instrukcją Set.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndSet"> <source>'Set' statement must end with a matching 'End Set'.</source> <target state="translated">'Instrukcja Set musi być zakończona odpowiadającą jej instrukcją End Set.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsProperty"> <source>Statement cannot appear within a property body. End of property assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści właściwości. Założono koniec właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateWriteabilityCategoryUsed"> <source>'ReadOnly' and 'WriteOnly' cannot be combined.</source> <target state="translated">'Nie można łączyć elementów „ReadOnly” i „WriteOnly”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedGreater"> <source>'&gt;' expected.</source> <target state="translated">'Oczekiwano znaku „&gt;”.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeStmtWrongOrder"> <source>Assembly or Module attribute statements must precede any declarations in a file.</source> <target state="translated">Instrukcje atrybutu zestawu lub modułu muszą występować przed wszelkimi deklaracjami w pliku.</target> <note /> </trans-unit> <trans-unit id="ERR_NoExplicitArraySizes"> <source>Array bounds cannot appear in type specifiers.</source> <target state="translated">Granice tablicy nie mogą wystąpić w specyfikatorze typu.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyFlags1"> <source>Properties cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować właściwości jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionExplicit"> <source>'Option Explicit' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Po instrukcji Option Explicit może wystąpić jedynie opcja On lub Off.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleParameterSpecifiers"> <source>'ByVal' and 'ByRef' cannot be combined.</source> <target state="translated">'Nie można łączyć elementów „ByVal” i „ByRef”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleOptionalParameterSpecifiers"> <source>'Optional' and 'ParamArray' cannot be combined.</source> <target state="translated">'Nie można łączyć elementów „Optional” i „ParamArray”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedProperty1"> <source>Property '{0}' is of an unsupported type.</source> <target state="translated">Właściwość „{0}” jest nieobsługiwanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionalParameterUsage1"> <source>Attribute '{0}' cannot be applied to a method with optional parameters.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do metody z parametrami opcjonalnymi.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnFromNonFunction"> <source>'Return' statement in a Sub or a Set cannot return a value.</source> <target state="translated">'Instrukcja Return w bloku Sub lub Set nie może zwracać wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_UnterminatedStringLiteral"> <source>String constants must end with a double quote.</source> <target state="translated">Stałe w postaci ciągu muszą być zakończone znakiem podwójnego cudzysłowu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedType1"> <source>'{0}' is an unsupported type.</source> <target state="translated">'Element „{0}” jest nieobsługiwanym typem.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEnumBase"> <source>Enums must be declared as an integral type.</source> <target state="translated">Wyliczenia należy deklarować jako typ całkowity.</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefIllegal1"> <source>{0} parameters cannot be declared 'ByRef'.</source> <target state="translated">Parametrów {0} nie można deklarować jako „ByRef”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedAssembly3"> <source>Reference required to assembly '{0}' containing the type '{1}'. Add one to your project.</source> <target state="translated">Wymagane odwołanie do zestawu „{0}” z typem „{1}”. Dodaj je do projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedModule3"> <source>Reference required to module '{0}' containing the type '{1}'. Add one to your project.</source> <target state="translated">Wymagane odwołanie do modułu „{0}” z typem „{1}”. Dodaj je do projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnWithoutValue"> <source>'Return' statement in a Function, Get, or Operator must return a value.</source> <target state="translated">'Instrukcja Return w bloku Function, Get lub Operator musi zwracać wartość.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedField1"> <source>Field '{0}' is of an unsupported type.</source> <target state="translated">Pole „{0}” jest nieobsługiwanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedMethod1"> <source>'{0}' has a return type that is not supported or parameter types that are not supported.</source> <target state="translated">'Element „{0}” ma nieobsługiwany typ zwracany albo nieobsługiwane typy parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonIndexProperty1"> <source>Property '{0}' with no parameters cannot be found.</source> <target state="translated">Nie można odnaleźć właściwości „{0}” bez parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributePropertyType1"> <source>Property or field '{0}' does not have a valid attribute type.</source> <target state="translated">Właściwość lub pole „{0}” nie ma prawidłowego typu atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalsCannotHaveAttributes"> <source>Attributes cannot be applied to local variables.</source> <target state="translated">Nie można zastosować atrybutów do zmiennych lokalnych.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyOrFieldNotDefined1"> <source>Field or property '{0}' is not found.</source> <target state="translated">Nie odnaleziono pola lub właściwości „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeUsage2"> <source>Attribute '{0}' cannot be applied to '{1}' because the attribute is not valid on this declaration type.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do elementu „{1}”, ponieważ atrybut nie jest prawidłowy w tym typie deklaracji.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeUsageOnAccessor"> <source>Attribute '{0}' cannot be applied to '{1}' of '{2}' because the attribute is not valid on this declaration type.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do elementu „{1}” w „{2}”, ponieważ atrybut nie jest prawidłowy w tym typie deklaracji.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedTypeInInheritsClause2"> <source>Class '{0}' cannot reference its nested type '{1}' in Inherits clause.</source> <target state="translated">Klasa „{0}” nie może odwoływać się do swojego zagnieżdżonego typu „{1}” w klauzuli Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInItsInheritsClause1"> <source>Class '{0}' cannot reference itself in Inherits clause.</source> <target state="translated">Klasa „{0}” nie może odwoływać się siebie samej w klauzuli Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseTypeReferences2"> <source> Base type of '{0}' needs '{1}' to be resolved.</source> <target state="translated"> Typ podstawowy elementu „{0}” potrzebuje elementu „{1}”, aby mógł zostać rozpoznany.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalBaseTypeReferences3"> <source>Inherits clause of {0} '{1}' causes cyclic dependency: {2}</source> <target state="translated">Klauzula Inherits elementu {0} „{1}” powoduje wystąpienie zależności cyklicznej: {2}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMultipleAttributeUsage1"> <source>Attribute '{0}' cannot be applied multiple times.</source> <target state="translated">Nie można wielokrotnie zastosować atrybutu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMultipleAttributeUsageInNetModule2"> <source>Attribute '{0}' in '{1}' cannot be applied multiple times.</source> <target state="translated">Nie można wielokrotnie zastosować atrybutu „{0}” w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantThrowNonException"> <source>'Throw' operand must derive from 'System.Exception'.</source> <target state="translated">'Argument operacji „Throw” musi pochodzić od klasy „System.Exception”.</target> <note /> </trans-unit> <trans-unit id="ERR_MustBeInCatchToRethrow"> <source>'Throw' statement cannot omit operand outside a 'Catch' statement or inside a 'Finally' statement.</source> <target state="translated">'Instrukcja „Throw” nie może pomijać argumentu operacji poza instrukcją „Catch” lub wewnątrz instrukcji „Finally”.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayMustBeByVal"> <source>ParamArray parameters must be declared 'ByVal'.</source> <target state="translated">Parametry ParamArray muszą być zadeklarowane jako ByVal.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoleteSymbol2"> <source>'{0}' is obsolete: '{1}'.</source> <target state="translated">'Element „{0}” jest przestarzały: „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_RedimNoSizes"> <source>'ReDim' statements require a parenthesized list of the new bounds of each dimension of the array.</source> <target state="translated">'Instrukcja ReDim wymaga ujętej w nawiasy listy nowych granic dla każdego wymiaru tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_InitWithMultipleDeclarators"> <source>Explicit initialization is not permitted with multiple variables declared with a single type specifier.</source> <target state="translated">Jawne inicjowanie nie jest dozwolone, gdy wiele zmiennych zadeklarowano za pomocą jednego specyfikatora typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InitWithExplicitArraySizes"> <source>Explicit initialization is not permitted for arrays declared with explicit bounds.</source> <target state="translated">Jawne inicjowanie nie jest dozwolone w przypadku tablic zadeklarowanych z jawnymi granicami.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSyncLockNoSyncLock"> <source>'End SyncLock' must be preceded by a matching 'SyncLock'.</source> <target state="translated">'Instrukcja End SyncLock musi być poprzedzona odpowiadającą jej instrukcją SyncLock.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndSyncLock"> <source>'SyncLock' statement must end with a matching 'End SyncLock'.</source> <target state="translated">'Instrukcja SyncLock musi być zakończona odpowiadającą jej instrukcją End SyncLock.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotEvent2"> <source>'{0}' is not an event of '{1}'.</source> <target state="translated">'Element „{0}” nie jest zdarzeniem elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AddOrRemoveHandlerEvent"> <source>'AddHandler' or 'RemoveHandler' statement event operand must be a dot-qualified expression or a simple name.</source> <target state="translated">'Argument operacji zdarzenia dla instrukcji „AddHandler” lub „RemoveHandler” musi być wyrażeniem kwalifikowanym kropką lub nazwą prostą.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedEnd"> <source>'End' statement not valid.</source> <target state="translated">'Instrukcja End jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitForNonArray2"> <source>Array initializers are valid only for arrays, but the type of '{0}' is '{1}'.</source> <target state="translated">Inicjatory tablic są prawidłowe tylko dla tablic, ale typem elementu „{0}” jest „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndRegionNoRegion"> <source>'#End Region' must be preceded by a matching '#Region'.</source> <target state="translated">'Instrukcja #End Region musi być poprzedzona odpowiadającą jej instrukcją #Region.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndRegion"> <source>'#Region' statement must end with a matching '#End Region'.</source> <target state="translated">'Instrukcja #Region musi być zakończona odpowiadającą jej instrukcją #End Region.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsStmtWrongOrder"> <source>'Inherits' statement must precede all declarations in a class.</source> <target state="translated">'Instrukcja „Inherits” musi znajdować się przed wszystkimi deklaracjami w klasie.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousAcrossInterfaces3"> <source>'{0}' is ambiguous across the inherited interfaces '{1}' and '{2}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny w obrębie odziedziczonych interfejsów „{1}” i „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPropertyAmbiguousAcrossInterfaces4"> <source>Default property access is ambiguous between the inherited interface members '{0}' of interface '{1}' and '{2}' of interface '{3}'.</source> <target state="translated">Dostęp do właściwości domyślnej jest niejednoznaczny dla dziedziczonej składowej „{0}” interfejsu „{1}” i dziedziczonej składowej „{2}” interfejsu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceEventCantUse1"> <source>Events in interfaces cannot be declared '{0}'.</source> <target state="translated">Zdarzenia w interfejsach nie mogą być zadeklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExecutableAsDeclaration"> <source>Statement cannot appear outside of a method body.</source> <target state="translated">Instrukcja nie może wystąpić poza treścią metody.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureNoDefault1"> <source>Structure '{0}' cannot be indexed because it has no default property.</source> <target state="translated">Nie można indeksować struktury „{0}”, ponieważ nie ma ona domyślnej właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_MustShadow2"> <source>{0} '{1}' must be declared 'Shadows' because another member with this name is declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” musi być zadeklarowany jako „Shadows”, ponieważ inna składowa o tej samej nazwie jest zadeklarowana jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithOptionalTypes2"> <source>'{0}' cannot override '{1}' because they differ by the types of optional parameters.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się typami parametrów opcjonalnych.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndOfExpression"> <source>End of expression expected.</source> <target state="translated">Oczekiwano końca wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_StructsCannotHandleEvents"> <source>Methods declared in structures cannot have 'Handles' clauses.</source> <target state="translated">Metody zadeklarowane w strukturach nie mogą mieć klauzul Handles.</target> <note /> </trans-unit> <trans-unit id="ERR_OverridesImpliesOverridable"> <source>Methods declared 'Overrides' cannot be declared 'Overridable' because they are implicitly overridable.</source> <target state="translated">Metody zadeklarowane jako „Overrides” nie mogą być zadeklarowane jako „Overridable”, ponieważ niejawnie są one możliwe do przesłonięcia.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalNamedSameAsParam1"> <source>'{0}' is already declared as a parameter of this method.</source> <target state="translated">'Element „{0}” jest już zadeklarowany jako parametr tej metody.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalNamedSameAsParamInLambda1"> <source>Variable '{0}' is already declared as a parameter of this or an enclosing lambda expression.</source> <target state="translated">Zmienna „{0}” jest już zadeklarowana jako parametr tego lub otaczającego wyrażenia lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseTypeSpecifier1"> <source>Type in a Module cannot be declared '{0}'.</source> <target state="translated">Typ w module nie może być zadeklarowany jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InValidSubMainsFound1"> <source>No accessible 'Main' method with an appropriate signature was found in '{0}'.</source> <target state="translated">W elemencie „{0}” nie odnaleziono dostępnej metody „Main” z odpowiednią sygnaturą.</target> <note /> </trans-unit> <trans-unit id="ERR_MoreThanOneValidMainWasFound2"> <source>'Sub Main' is declared more than once in '{0}': {1}</source> <target state="translated">'Element „Sub Main” zadeklarowano więcej niż raz w elemencie „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_CannotConvertValue2"> <source>Value '{0}' cannot be converted to '{1}'.</source> <target state="translated">Wartości „{0}” nie można skonwertować na typ „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OnErrorInSyncLock"> <source>'On Error' statements are not valid within 'SyncLock' statements.</source> <target state="translated">'Instrukcje On Error nie są prawidłowe w instrukcjach SyncLock.</target> <note /> </trans-unit> <trans-unit id="ERR_NarrowingConversionCollection2"> <source>Option Strict On disallows implicit conversions from '{0}' to '{1}'; the Visual Basic 6.0 collection type is not compatible with the .NET Framework collection type.</source> <target state="translated">Ustawienie „Option Strict On” uniemożliwia niejawną konwersję z elementu „{0}” na „{1}”. Typ kolekcji języka Visual Basic 6.0 nie jest zgodny z typem kolekcji .NET Framework.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoTryHandler"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'Try', 'Catch' or 'Finally' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „Try”, „Catch” lub „Finally”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoSyncLock"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'SyncLock' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „SyncLock”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoWith"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'With' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „With”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoFor"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'For' or 'For Each' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „For” lub „For Each”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicConstructor"> <source>Attribute cannot be used because it does not have a Public constructor.</source> <target state="translated">Nie można użyć atrybutu, ponieważ nie ma on konstruktora Public.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultEventNotFound1"> <source>Event '{0}' specified by the 'DefaultEvent' attribute is not a publicly accessible event for this class.</source> <target state="translated">Zdarzenie „{0}” określane przez atrybut „DefaultEvent” nie jest zdarzeniem publicznie dostępnym dla tej klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNonSerializedUsage"> <source>'NonSerialized' attribute will not have any effect on this member because its containing class is not exposed as 'Serializable'.</source> <target state="translated">'Atrybut „NonSerialized” nie ma wpływu na tą składową, ponieważ zawierająca ją klasa nie jest ujawniona jako element Serializable.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContinueKind"> <source>'Continue' must be followed by 'Do', 'For' or 'While'.</source> <target state="translated">'Po instrukcji „Continue” musi następować element „Do”, „For” lub „While”.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueDoNotWithinDo"> <source>'Continue Do' can only appear inside a 'Do' statement.</source> <target state="translated">'Element Continue Do może się znajdować tylko w instrukcji Do.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueForNotWithinFor"> <source>'Continue For' can only appear inside a 'For' statement.</source> <target state="translated">'Element Continue For może się znajdować tylko w instrukcji For.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueWhileNotWithinWhile"> <source>'Continue While' can only appear inside a 'While' statement.</source> <target state="translated">'Element Continue While może się znajdować tylko w instrukcji While.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParameterSpecifier"> <source>Parameter specifier is duplicated.</source> <target state="translated">Specyfikator parametru jest zduplikowany.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseDLLDeclareSpecifier1"> <source>'Declare' statements in a Module cannot be declared '{0}'.</source> <target state="translated">'Instrukcji „Declare” w module nie można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantUseDLLDeclareSpecifier1"> <source>'Declare' statements in a structure cannot be declared '{0}'.</source> <target state="translated">'Instrukcji „Declare” w strukturze nie można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TryCastOfValueType1"> <source>'TryCast' operand must be reference type, but '{0}' is a value type.</source> <target state="translated">'Argument operacji „TryCast” musi być typem referencyjnym, ale element „{0}” to typ wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_TryCastOfUnconstrainedTypeParam1"> <source>'TryCast' operands must be class-constrained type parameter, but '{0}' has no class constraint.</source> <target state="translated">'Argumenty operacji „TryCast” muszą być parametrami typu z ograniczeniem klasy, ale element „{0}” nie ma ograniczenia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousDelegateBinding2"> <source>No accessible '{0}' is most specific: {1}</source> <target state="translated">Żaden z dostępnych elementów „{0}” nie jest bardziej konkretny od pozostałych: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SharedStructMemberCannotSpecifyNew"> <source>Non-shared members in a Structure cannot be declared 'New'.</source> <target state="translated">Nie można zadeklarować nieudostępnionych składowych w strukturze jako „New”.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericSubMainsFound1"> <source>None of the accessible 'Main' methods with the appropriate signatures found in '{0}' can be the startup method since they are all either generic or nested in generic types.</source> <target state="translated">Żadna z dostępnych metod „Main” z odpowiednią sygnaturą znalezionych w elemencie „{0}” nie może być metodą startową, ponieważ są one metodami ogólnymi lub zagnieżdżonymi w typach ogólnych.</target> <note /> </trans-unit> <trans-unit id="ERR_GeneralProjectImportsError3"> <source>Error in project-level import '{0}' at '{1}' : {2}</source> <target state="translated">Błąd w imporcie na poziomie projektu „{0}” pod adresem „{1}” : {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidTypeForAliasesImport2"> <source>'{1}' for the Imports alias to '{0}' does not refer to a Namespace, Class, Structure, Interface, Enum or Module.</source> <target state="translated">Element „{1}” dla aliasu Imports elementu „{0}” nie odwołuje się do elementu Namespace, Class, Structure, Interface, Enum lub Module.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedConstant2"> <source>Field '{0}.{1}' has an invalid constant value.</source> <target state="translated">Pole „{0}.{1}” ma nieprawidłową wartość stałej.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteArgumentsNeedParens"> <source>Method arguments must be enclosed in parentheses.</source> <target state="translated">Argumenty metod muszą być ujęte w nawiasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteLineNumbersAreLabels"> <source>Labels that are numbers must be followed by colons.</source> <target state="translated">Po etykietach, które są liczbami, muszą następować dwukropki.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteStructureNotType"> <source>'Type' statements are no longer supported; use 'Structure' statements instead.</source> <target state="translated">'Instrukcje „Type” nie są już obsługiwane. Zamiast nich używaj instrukcji „Structure”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteObjectNotVariant"> <source>'Variant' is no longer a supported type; use the 'Object' type instead.</source> <target state="translated">'Typ Variant nie jest już obsługiwany; zamiast niego użyj typu Object.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteLetSetNotNeeded"> <source>'Let' and 'Set' assignment statements are no longer supported.</source> <target state="translated">'Instrukcje przypisania Let i Set nie są już obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoletePropertyGetLetSet"> <source>Property Get/Let/Set are no longer supported; use the new Property declaration syntax.</source> <target state="translated">Instrukcje Get/Let/Set dotyczące właściwości nie są już obsługiwane; użyj nowej składni deklaracji właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteWhileWend"> <source>'Wend' statements are no longer supported; use 'End While' statements instead.</source> <target state="translated">'Instrukcje „Wend” nie są już obsługiwane. Zamiast nich używaj instrukcji „End While”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteRedimAs"> <source>'ReDim' statements can no longer be used to declare array variables.</source> <target state="translated">'Nie można już używać instrukcji ReDim do deklarowania zmiennych tablicowych.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteOptionalWithoutValue"> <source>Optional parameters must specify a default value.</source> <target state="translated">Parametry opcjonalne muszą określać wartość domyślną.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteGosub"> <source>'GoSub' statements are no longer supported.</source> <target state="translated">'Instrukcje GoSub nie są już obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteOnGotoGosub"> <source>'On GoTo' and 'On GoSub' statements are no longer supported.</source> <target state="translated">'Instrukcje On GoTo i On GoSub nie są już obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteEndIf"> <source>'EndIf' statements are no longer supported; use 'End If' instead.</source> <target state="translated">'Instrukcje „EndIf” nie są już obsługiwane; zamiast nich używaj instrukcji „End If”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteExponent"> <source>'D' can no longer be used to indicate an exponent, use 'E' instead.</source> <target state="translated">'Litery „D” nie można już używać do określenia wykładnika; zamiast niej użyj litery „E”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteAsAny"> <source>'As Any' is not supported in 'Declare' statements.</source> <target state="translated">'Element As Any nie jest obsługiwany w instrukcjach Declare.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteGetStatement"> <source>'Get' statements are no longer supported. File I/O functionality is available in the 'Microsoft.VisualBasic' namespace.</source> <target state="translated">'Instrukcje „Get” nie są już obsługiwane. Funkcje We/Wy dla plików są dostępne w przestrzeni nazw „Microsoft.VisualBasic”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithArrayVsParamArray2"> <source>'{0}' cannot override '{1}' because they differ by parameters declared 'ParamArray'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się parametrami zadeklarowanymi jako „ParamArray”.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularBaseDependencies4"> <source>This inheritance causes circular dependencies between {0} '{1}' and its nested or base type '{2}'.</source> <target state="translated">To dziedziczenie powoduje powstanie zależności cyklicznych między elementem {0} „{1}” a jego zagnieżdżonym lub podstawowym typem „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedBase2"> <source>{0} '{1}' cannot inherit from a type nested within it.</source> <target state="translated">Element {0} „{1}” nie może dziedziczyć po typie, który jest w nim zagnieżdżony.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchOutsideAssembly4"> <source>'{0}' cannot expose type '{1}' outside the project through {2} '{3}'.</source> <target state="translated">'Element „{0}” nie może ujawnić typu „{1}” poza projektem za pomocą elementu {2} „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceAccessMismatchOutside3"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of the base {1} outside the assembly.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {1} „{2}”, ponieważ rozszerza on dostęp podstawowego elementu {1} poza zestaw.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoletePropertyAccessor3"> <source>'{0}' accessor of '{1}' is obsolete: '{2}'.</source> <target state="translated">'Metoda dostępu „{0}” elementu „{1}” jest przestarzała: „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoletePropertyAccessor2"> <source>'{0}' accessor of '{1}' is obsolete.</source> <target state="translated">'Metoda dostępu „{0}” elementu „{1}” jest przestarzała.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchImplementedEvent6"> <source>'{0}' cannot expose the underlying delegate type '{1}' of the event it is implementing to {2} '{3}' through {4} '{5}'.</source> <target state="translated">'Element „{0}” nie może ujawnić podstawowego typu delegowanego „{1}” zdarzenia, które implementuje w elemencie {2} „{3}” za pomocą elementu {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchImplementedEvent4"> <source>'{0}' cannot expose the underlying delegate type '{1}' of the event it is implementing outside the project through {2} '{3}'.</source> <target state="translated">'Element „{0}” nie może ujawnić podstawowego typu delegowanego „{1}” zdarzenia, które implementuje poza projektem za pomocą elementu {2} „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceCycleInImportedType1"> <source>Type '{0}' is not supported because it either directly or indirectly inherits from itself.</source> <target state="translated">Typ „{0}” nie jest obsługiwany, ponieważ dziedziczy on pośrednio albo bezpośrednio po sobie samym.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonObsoleteConstructorOnBase3"> <source>Class '{0}' must declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete.</source> <target state="translated">Klasa „{0}” musi deklarować element „Sub New”, ponieważ element „{1}” w swojej klasie bazowej „{2}” jest oznaczony jako przestarzały.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonObsoleteConstructorOnBase4"> <source>Class '{0}' must declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete: '{3}'.</source> <target state="translated">Klasa „{0}” musi deklarować element „Sub New”, ponieważ element „{1}” w swojej klasie bazowej „{2}” jest oznaczony jako przestarzały: „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNonObsoleteNewCall3"> <source>First statement of this 'Sub New' must be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete.</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” musi być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ element „{0}” w klasie bazowej „{1}” klasy „{2}” jest oznaczony jako przestarzały.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNonObsoleteNewCall4"> <source>First statement of this 'Sub New' must be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete: '{3}'.</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” musi być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ element „{0}” w klasie bazowej „{1}” klasy „{2}” jest oznaczony jako przestarzały: „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsTypeArgAccessMismatch7"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of type '{3}' to {4} '{5}'.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {1} „{2}”, ponieważ rozszerza on dostęp do typu „{3}” do elementu {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsTypeArgAccessMismatchOutside5"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of type '{3}' outside the assembly.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {1} „{2}”, ponieważ rozszerza on dostęp do typu „{3}” poza zestaw.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeAccessMismatch3"> <source>Specified access '{0}' for '{1}' does not match the access '{2}' specified on one of its other partial types.</source> <target state="translated">Dostęp „{0}” określony dla elementu „{1}” nie jest zgodny z dostępem „{2}” określonym w jednym z jego innych typów częściowych.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeBadMustInherit1"> <source>'MustInherit' cannot be specified for partial type '{0}' because it cannot be combined with 'NotInheritable' specified for one of its other partial types.</source> <target state="translated">'Elementu „MustInherit” nie można określić dla typu częściowego „{0}”, ponieważ nie można go łączyć z elementem „NotInheritable” określonym dla jednego z jego innych typów częściowych.</target> <note /> </trans-unit> <trans-unit id="ERR_MustOverOnNotInheritPartClsMem1"> <source>'MustOverride' cannot be specified on this member because it is in a partial type that is declared 'NotInheritable' in another partial definition.</source> <target state="translated">'Elementu „MustOverride” nie można określić w tej składowej, ponieważ znajduje się ona w typie częściowym zadeklarowanym jako „NotInheritable” w innej definicji częściowej.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseMismatchForPartialClass3"> <source>Base class '{0}' specified for class '{1}' cannot be different from the base class '{2}' of one of its other partial types.</source> <target state="translated">Klasa bazowa „{0}” określona dla klasy „{1}” nie może się różnić od klasy bazowej „{2}” jednego z jej pozostałych typów częściowych.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeTypeParamNameMismatch3"> <source>Type parameter name '{0}' does not match the name '{1}' of the corresponding type parameter defined on one of the other partial types of '{2}'.</source> <target state="translated">Nazwa parametru typu „{0}” nie jest zgodna z nazwą „{1}” odpowiedniego parametru typu zdefiniowanego w jednym z innych typów częściowych elementu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeConstraintMismatch1"> <source>Constraints for this type parameter do not match the constraints on the corresponding type parameter defined on one of the other partial types of '{0}'.</source> <target state="translated">Ograniczenia dla tego parametru typu nie są zgodne z ograniczeniami w odpowiednim parametrze typu zdefiniowanym w jednym z innych typów częściowych elementu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_LateBoundOverloadInterfaceCall1"> <source>Late bound overload resolution cannot be applied to '{0}' because the accessing instance is an interface type.</source> <target state="translated">Ustalanie przeciążenia późnego wiązania nie może zostać zastosowane w elemencie „{0}”, ponieważ wystąpienie uzyskujące dostęp jest typem interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredAttributeConstConversion2"> <source>Conversion from '{0}' to '{1}' cannot occur in a constant expression used as an argument to an attribute.</source> <target state="translated">Konwersja z elementu „{0}” na element „{1}” nie może wystąpić w wyrażeniu stałym używanym jako argument atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousOverrides3"> <source>Member '{0}' that matches this signature cannot be overridden because the class '{1}' contains multiple members with this same name and signature: {2}</source> <target state="translated">Składowa „{0}” zgodna z sygnaturą nie może zostać przesłoniona, ponieważ klasa „{1}” zawiera wiele składowych o tej samej nazwie i sygnaturze: {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_OverriddenCandidate1"> <source> '{0}'</source> <target state="translated"> „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousImplements3"> <source>Member '{0}.{1}' that matches this signature cannot be implemented because the interface '{2}' contains multiple members with this same name and signature: '{3}' '{4}'</source> <target state="translated">Składowa „{0}.{1}” zgodna z tą sygnaturą nie może zostać zaimplementowana, ponieważ interfejs „{2}” zawiera wiele składowych o tej samej nazwie i sygnaturze: „{3}” „{4}”</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNotCreatableDelegate1"> <source>'AddressOf' expression cannot be converted to '{0}' because type '{0}' is declared 'MustInherit' and cannot be created.</source> <target state="translated">'Nie można przekonwertować wyrażenia „AddressOf” na typ „{0}”, ponieważ typ „{0}” został zadeklarowany jako „MustInherit” i nie można go utworzyć.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassGenericMethod"> <source>Generic methods cannot be exposed to COM.</source> <target state="translated">Metod ogólnych nie można ujawniać modelowi COM.</target> <note /> </trans-unit> <trans-unit id="ERR_SyntaxInCastOp"> <source>Syntax error in cast operator; two arguments separated by comma are required.</source> <target state="translated">Błąd składni w operatorze rzutowania. Wymagane są dwa argumenty rozdzielone przecinkiem.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerForNonConstDim"> <source>Array initializer cannot be specified for a non constant dimension; use the empty initializer '{}'.</source> <target state="translated">Inicjatora tablicy nie można określić dla niestałego wymiaru; użyj pustego inicjatora „{}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingFailure3"> <source>No accessible method '{0}' has a signature compatible with delegate '{1}':{2}</source> <target state="translated">Żadna z dostępnych metod „{0}” nie ma sygnatury zgodnej z delegatem „{1}”:{2}.</target> <note /> </trans-unit> <trans-unit id="ERR_StructLayoutAttributeNotAllowed"> <source>Attribute 'StructLayout' cannot be applied to a generic type.</source> <target state="translated">Nie można zastosować atrybutu „StructLayout” do typu ogólnego.</target> <note /> </trans-unit> <trans-unit id="ERR_IterationVariableShadowLocal1"> <source>Range variable '{0}' hides a variable in an enclosing block or a range variable previously defined in the query expression.</source> <target state="translated">Zmienna zakresu „{0}” ukrywa zmienną w otaczającym bloku lub zmiennej zakresu wcześniej zdefiniowanej w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionInfer"> <source>'Option Infer' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Po instrukcji „Option Infer” może wystąpić jedynie opcja „On” lub „Off”.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularInference1"> <source>Type of '{0}' cannot be inferred from an expression containing '{0}'.</source> <target state="translated">Nie można wywnioskować typu elementu „{0}” na podstawie wyrażenia zawierającego element „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InAccessibleOverridingMethod5"> <source>'{0}' in class '{1}' cannot override '{2}' in class '{3}' because an intermediate class '{4}' overrides '{2}' in class '{3}' but is not accessible.</source> <target state="translated">'Element „{0}” w klasie „{1}” nie może przesłonić elementu „{2}” w klasie „{3}”, ponieważ klasa pośrednicząca „{4}”, która przesłania element „{2}” w klasie „{3}”, jest niedostępna.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuitableWidestType1"> <source>Type of '{0}' cannot be inferred because the loop bounds and the step clause do not convert to the same type.</source> <target state="translated">Nie można wywnioskować typu elementu „{0}”, ponieważ granice pętli i klauzula step nie są konwertowane na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousWidestType3"> <source>Type of '{0}' is ambiguous because the loop bounds and the step clause do not convert to the same type.</source> <target state="translated">Typ „{0}” jest niejednoznaczny, ponieważ granice pętli i klauzula step nie są konwertowane na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAssignmentOperatorInInit"> <source>'=' expected (object initializer).</source> <target state="translated">'Oczekiwano znaku „=” (inicjator obiektów).</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQualifiedNameInInit"> <source>Name of field or property being initialized in an object initializer must start with '.'.</source> <target state="translated">Nazwa pola lub właściwości inicjowanej w inicjatorze obiektów musi zaczynać się od znaku „.”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLbrace"> <source>'{' expected.</source> <target state="translated">'Oczekiwano znaku „{”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedTypeOrWith"> <source>Type or 'With' expected.</source> <target state="translated">Oczekiwano typu lub instrukcji „With”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAggrMemberInit1"> <source>Multiple initializations of '{0}'. Fields and properties can be initialized only once in an object initializer expression.</source> <target state="translated">Wiele operacji inicjowania elementu „{0}”. W wyrażeniu inicjatora obiektów pola i właściwości mogą być inicjowane tylko raz.</target> <note /> </trans-unit> <trans-unit id="ERR_NonFieldPropertyAggrMemberInit1"> <source>Member '{0}' cannot be initialized in an object initializer expression because it is not a field or property.</source> <target state="translated">Nie można zainicjować składowej „{0}” w wyrażeniu inicjatora obiektów, ponieważ nie jest ona polem ani właściwością.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedMemberAggrMemberInit1"> <source>Member '{0}' cannot be initialized in an object initializer expression because it is shared.</source> <target state="translated">Nie można zainicjować składowej „{0}” w wyrażeniu inicjatora obiektów, ponieważ jest ona udostępniona.</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterizedPropertyInAggrInit1"> <source>Property '{0}' cannot be initialized in an object initializer expression because it requires arguments.</source> <target state="translated">Nie można zainicjować właściwości „{0}” w wyrażeniu inicjatora obiektów, ponieważ wymaga ona argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NoZeroCountArgumentInitCandidates1"> <source>Property '{0}' cannot be initialized in an object initializer expression because all accessible overloads require arguments.</source> <target state="translated">Nie można zainicjować właściwości „{0}” w wyrażeniu inicjatora obiektów, ponieważ wszystkie dostępne przeciążenia wymagają argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_AggrInitInvalidForObject"> <source>Object initializer syntax cannot be used to initialize an instance of 'System.Object'.</source> <target state="translated">Nie można użyć składni inicjatora obiektów do zainicjowania wystąpienia obiektu System.Object.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerExpected"> <source>Initializer expected.</source> <target state="translated">Oczekiwano inicjatora.</target> <note /> </trans-unit> <trans-unit id="ERR_LineContWithCommentOrNoPrecSpace"> <source>The line continuation character '_' must be preceded by at least one white space and it must be followed by a comment or the '_' must be the last character on the line.</source> <target state="translated">Znak kontynuacji wiersza „_” musi być poprzedzony co najmniej jednym białym znakiem i musi po nim następować komentarz lub znak „_” musi być ostatnim w wierszu.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleFile1"> <source>Unable to load module file '{0}': {1}</source> <target state="translated">Nie można załadować pliku modułu „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadRefLib1"> <source>Unable to load referenced library '{0}': {1}</source> <target state="translated">Nie można załadować określonej w odwołaniu biblioteki „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_EventHandlerSignatureIncompatible2"> <source>Method '{0}' cannot handle event '{1}' because they do not have a compatible signature.</source> <target state="translated">Metoda „{0}” nie może obsłużyć zdarzenia „{1}”, ponieważ metoda i zdarzenie nie mają zgodnej sygnatury.</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalCompilationConstantNotValid"> <source>Conditional compilation constant '{1}' is not valid: {0}</source> <target state="translated">Stała kompilacji warunkowej „{1}” jest nieprawidłowa: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwice1"> <source>Interface '{0}' can be implemented only once by this type.</source> <target state="translated">Interfejs „{0}” może być zaimplementowany przez ten typ tylko raz.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames2"> <source>Interface '{0}' can be implemented only once by this type, but already appears with different tuple element names, as '{1}'.</source> <target state="translated">Interfejs „{0}” można zaimplementować tylko raz według tego typu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames3"> <source>Interface '{0}' can be implemented only once by this type, but already appears with different tuple element names, as '{1}' (via '{2}').</source> <target state="translated">Interfejs „{0}” można zaimplementować tylko raz według tego typu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{1}” (poprzez „{2}”).</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNamesReverse3"> <source>Interface '{0}' (via '{1}') can be implemented only once by this type, but already appears with different tuple element names, as '{2}'.</source> <target state="translated">Interfejs „{0}” (poprzez „{1}”) można zaimplementować tylko raz według tego typu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames4"> <source>Interface '{0}' (via '{1}') can be implemented only once by this type, but already appears with different tuple element names, as '{2}' (via '{3}').</source> <target state="translated">Interfejs „{0}” (poprzez „{1}”) można zaimplementować tylko raz według tego typu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{2}” (poprzez „{3}”).</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames2"> <source>Interface '{0}' can be inherited only once by this interface, but already appears with different tuple element names, as '{1}'.</source> <target state="translated">Interfejs „{0}” można odziedziczyć tylko raz według tego interfejsu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames3"> <source>Interface '{0}' can be inherited only once by this interface, but already appears with different tuple element names, as '{1}' (via '{2}').</source> <target state="translated">Interfejs „{0}” można odziedziczyć tylko raz według tego interfejsu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{1}” (poprzez „{2}”).</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNamesReverse3"> <source>Interface '{0}' (via '{1}') can be inherited only once by this interface, but already appears with different tuple element names, as '{2}'.</source> <target state="translated">Interfejs „{0}” (poprzez „{1}”) można odziedziczyć tylko raz według tego interfejsu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames4"> <source>Interface '{0}' (via '{1}') can be inherited only once by this interface, but already appears with different tuple element names, as '{2}' (via '{3}').</source> <target state="translated">Interfejs „{0}” (poprzez „{1}”) można odziedziczyć tylko raz według tego interfejsu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{2}” (poprzez „{3}”).</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNotImplemented1"> <source>Interface '{0}' is not implemented by this class.</source> <target state="translated">Interfejs „{0}” nie jest implementowany przez tę klasę.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousImplementsMember3"> <source>'{0}' exists in multiple base interfaces. Use the name of the interface that declares '{0}' in the 'Implements' clause instead of the name of the derived interface.</source> <target state="translated">'Element „{0}” istnieje w wielu interfejsach podstawowych. Użyj nazwy interfejsu deklarującego element „{0}” w klauzuli „Implements” zamiast nazwy interfejsu pochodnego.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsOnNew"> <source>'Sub New' cannot implement interface members.</source> <target state="translated">'Element Sub New nie może implementować składowych interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitInStruct"> <source>Arrays declared as structure members cannot be declared with an initial size.</source> <target state="translated">Tablice deklarowane jako składowe struktur nie mogą być deklarowane z rozmiarem początkowym.</target> <note /> </trans-unit> <trans-unit id="ERR_EventTypeNotDelegate"> <source>Events declared with an 'As' clause must have a delegate type.</source> <target state="translated">Zdarzenia deklarowane z klauzulą „As” muszą mieć typ delegata.</target> <note /> </trans-unit> <trans-unit id="ERR_ProtectedTypeOutsideClass"> <source>Protected types can only be declared inside of a class.</source> <target state="translated">Typy chronione mogą być deklarowane tylko wewnątrz klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPropertyWithNoParams"> <source>Properties with no required parameters cannot be declared 'Default'.</source> <target state="translated">Właściwości bez żadnych wymaganych parametrów nie mogą być deklarowane jako Default.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerInStruct"> <source>Initializers on structure members are valid only for 'Shared' members and constants.</source> <target state="translated">Inicjatory w składowych struktur są prawidłowe tylko w przypadku wartości stałych i składowych „Shared”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateImport1"> <source>Namespace or type '{0}' has already been imported.</source> <target state="translated">Przestrzeń nazw lub typ „{0}” zostały już zaimportowane.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleFlags1"> <source>Modules cannot be declared '{0}'.</source> <target state="translated">Moduły nie mogą być deklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsStmtWrongOrder"> <source>'Implements' statements must follow any 'Inherits' statement and precede all declarations in a class.</source> <target state="translated">'Instrukcje „Implements” muszą występować po wszelkich instrukcjach „Inherits” i muszą znajdować się przed wszystkimi deklaracjami w klasie.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberClashesWithSynth7"> <source>{0} '{1}' implicitly defines '{2}', which conflicts with a member implicitly declared for {3} '{4}' in {5} '{6}'.</source> <target state="translated">Element {0} „{1}” niejawnie definiuje element „{2}”, który powoduje konflikt ze składową zadeklarowaną niejawnie dla elementu {3} „{4}” w elemencie {5} „{6}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberClashesWithMember5"> <source>{0} '{1}' implicitly defines '{2}', which conflicts with a member of the same name in {3} '{4}'.</source> <target state="translated">Element {0} „{1}” niejawnie definiuje element „{2}”, który powoduje konflikt ze składową o tej samej nazwie w elemencie {3} „{4}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MemberClashesWithSynth6"> <source>{0} '{1}' conflicts with a member implicitly declared for {2} '{3}' in {4} '{5}'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt ze składową zadeklarowaną niejawnie dla elementu {2} „{3}” w elemencie {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeClashesWithVbCoreType4"> <source>{0} '{1}' conflicts with a Visual Basic Runtime {2} '{3}'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt ze środowiskiem uruchomieniowym języka Visual Basic {2} „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeMissingAction"> <source>First argument to a security attribute must be a valid SecurityAction.</source> <target state="translated">Pierwszy argument atrybutu zabezpieczeń musi być poprawnym elementem SecurityAction.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidAction"> <source>Security attribute '{0}' has an invalid SecurityAction value '{1}'.</source> <target state="translated">Atrybut zabezpieczeń „{0}” ma nieprawidłową wartość SecurityAction: „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionAssembly"> <source>SecurityAction value '{0}' is invalid for security attributes applied to an assembly.</source> <target state="translated">Wartość SecurityAction „{0}” jest niepoprawna dla atrybutów zabezpieczeń zastosowanych względem zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionTypeOrMethod"> <source>SecurityAction value '{0}' is invalid for security attributes applied to a type or a method.</source> <target state="translated">Wartość SecurityAction „{0}” jest niepoprawna dla atrybutów zabezpieczeń zastosowanych względem typu lub metody.</target> <note /> </trans-unit> <trans-unit id="ERR_PrincipalPermissionInvalidAction"> <source>SecurityAction value '{0}' is invalid for PrincipalPermission attribute.</source> <target state="translated">Wartość SecurityAction „{0}” jest niepoprawna dla atrybutu PrincipalPermission.</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeInvalidFile"> <source>Unable to resolve file path '{0}' specified for the named argument '{1}' for PermissionSet attribute.</source> <target state="translated">Nie można rozpoznać ścieżki do pliku „{0}” określonej dla nazwanego argumentu „{1}” dla atrybutu PermissionSet.</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeFileReadError"> <source>Error reading file '{0}' specified for the named argument '{1}' for PermissionSet attribute: '{2}'.</source> <target state="translated">Błąd podczas odczytu pliku „{0}” określonego dla nazwanego argumentu „{1}” dla atrybutu PermissionSet: „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SetHasOnlyOneParam"> <source>'Set' method cannot have more than one parameter.</source> <target state="translated">'Metoda „Set” nie może mieć więcej parametrów niż jeden.</target> <note /> </trans-unit> <trans-unit id="ERR_SetValueNotPropertyType"> <source>'Set' parameter must have the same type as the containing property.</source> <target state="translated">'Parametr Set musi mieć taki sam typ jak zawierająca go właściwość.</target> <note /> </trans-unit> <trans-unit id="ERR_SetHasToBeByVal1"> <source>'Set' parameter cannot be declared '{0}'.</source> <target state="translated">'Nie można zadeklarować parametru „Set” jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureCantUseProtected"> <source>Method in a structure cannot be declared 'Protected', 'Protected Friend', or 'Private Protected'.</source> <target state="translated">Nie można zadeklarować metody w strukturze jako Protected, Protected Friend lub Private Protected.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceDelegateSpecifier1"> <source>Delegate in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować delegatu w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceEnumSpecifier1"> <source>Enum in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować wyliczenia w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceClassSpecifier1"> <source>Class in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować klasy w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceStructSpecifier1"> <source>Structure in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować struktury w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceInterfaceSpecifier1"> <source>Interface in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować interfejsu w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoleteSymbolNoMessage1"> <source>'{0}' is obsolete.</source> <target state="translated">'Element „{0}” jest przestarzały.</target> <note /> </trans-unit> <trans-unit id="ERR_MetaDataIsNotAssembly"> <source>'{0}' is a module and cannot be referenced as an assembly.</source> <target state="translated">'Element „{0}” jest modułem i nie można się do niego odwoływać jako do zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_MetaDataIsNotModule"> <source>'{0}' is an assembly and cannot be referenced as a module.</source> <target state="translated">'Element „{0}” jest zestawem i nie można się do niego odwoływać jako do modułu.</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceComparison3"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'. Use 'Is' operator to compare two reference types.</source> <target state="translated">Operator „{0}” nie jest zdefiniowany dla typów „{1}” i „{2}”. Użyj operatora „Is”, aby porównać dwa typy referencyjne.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchVariableNotLocal1"> <source>'{0}' is not a local variable or parameter, and so cannot be used as a 'Catch' variable.</source> <target state="translated">'Element „{0}” nie jest zmienną lokalną ani parametrem i w związku z tym nie można go użyć jako zmiennej instrukcji „Catch”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleMemberCantImplement"> <source>Members in a Module cannot implement interface members.</source> <target state="translated">Składowe w module nie mogą implementować składowych interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_EventDelegatesCantBeFunctions"> <source>Events cannot be declared with a delegate type that has a return type.</source> <target state="translated">Zdarzenia nie mogą być zadeklarowane z typem delegata, który ma zwracany typ.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDate"> <source>Date constant is not valid.</source> <target state="translated">Stała daty jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverride4"> <source>'{0}' cannot override '{1}' because it is not declared 'Overridable'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ nie jest on zadeklarowany jako „Overridable”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyArraysOnBoth"> <source>Array modifiers cannot be specified on both a variable and its type.</source> <target state="translated">Modyfikatory tablicy nie mogą być określone jednocześnie w zmiennej i jej typie.</target> <note /> </trans-unit> <trans-unit id="ERR_NotOverridableRequiresOverrides"> <source>'NotOverridable' cannot be specified for methods that do not override another method.</source> <target state="translated">'Dla metod, które nie przesłaniają innej metody, nie można określić słowa kluczowego „NotOverridable”.</target> <note /> </trans-unit> <trans-unit id="ERR_PrivateTypeOutsideType"> <source>Types declared 'Private' must be inside another type.</source> <target state="translated">Typy zadeklarowane jako Private muszą znajdować się wewnątrz innego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeRefResolutionError3"> <source>Import of type '{0}' from assembly or module '{1}' failed.</source> <target state="translated">Importowanie typu „{0}” z zestawu lub modułu „{1}” nie powiodło się.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTupleTypeRefResolutionError1"> <source>Predefined type '{0}' is not defined or imported.</source> <target state="translated">Wstępnie zdefiniowany typ „{0}” nie jest zdefiniowany ani zaimportowany.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayWrongType"> <source>ParamArray parameters must have an array type.</source> <target state="translated">Parametry ParamArray muszą być typu tablicowego.</target> <note /> </trans-unit> <trans-unit id="ERR_CoClassMissing2"> <source>Implementing class '{0}' for interface '{1}' cannot be found.</source> <target state="translated">Nie można znaleźć implementującej klasy „{0}” dla interfejsu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidCoClass1"> <source>Type '{0}' cannot be used as an implementing class.</source> <target state="translated">Typ „{0}” nie może być używany jako klasa implementująca.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMeReference"> <source>Reference to object under construction is not valid when calling another constructor.</source> <target state="translated">Odwołanie do właśnie konstruowanego obiektu nie jest prawidłowe podczas wywoływania innego konstruktora.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplicitMeReference"> <source>Implicit reference to object under construction is not valid when calling another constructor.</source> <target state="translated">Niejawne odwołanie do właśnie konstruowanego obiektu nie jest prawidłowe podczas wywoływania innego konstruktora.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeMemberNotFound2"> <source>Member '{0}' cannot be found in class '{1}'. This condition is usually the result of a mismatched 'Microsoft.VisualBasic.dll'.</source> <target state="translated">Nie można odnaleźć składowej „{0}” w klasie „{1}”. Ta sytuacja jest zazwyczaj wynikiem niedopasowania biblioteki „Microsoft.VisualBasic.dll”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags"> <source>Property accessors cannot be declared '{0}'.</source> <target state="translated">Metod dostępu do właściwości nie można deklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlagsRestrict"> <source>Access modifier '{0}' is not valid. The access modifier of 'Get' and 'Set' should be more restrictive than the property access level.</source> <target state="translated">Modyfikator dostępu „{0}” jest nieprawidłowy. Modyfikator dostępu elementu „Get” i „Set” powinien być bardziej restrykcyjny niż poziom dostępu do właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOneAccessorForGetSet"> <source>Access modifier can only be applied to either 'Get' or 'Set', but not both.</source> <target state="translated">Modyfikator dostępu można stosować do elementu „Get” lub elementu „Set”, ale nie do obu elementów naraz.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleSet"> <source>'Set' accessor of property '{0}' is not accessible.</source> <target state="translated">'Metoda dostępu „Set” właściwości „{0}” jest niedostępna.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleGet"> <source>'Get' accessor of property '{0}' is not accessible.</source> <target state="translated">'Metoda dostępu „Get” właściwości „{0}” jest niedostępna.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyNoAccessorFlag"> <source>'WriteOnly' properties cannot have an access modifier on 'Set'.</source> <target state="translated">'Właściwości „WriteOnly” nie mogą mieć modyfikatora dostępu w elemencie „Set”.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyNoAccessorFlag"> <source>'ReadOnly' properties cannot have an access modifier on 'Get'.</source> <target state="translated">'Właściwości „ReadOnly” nie mogą mieć modyfikatora dostępu w elemencie „Get”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags1"> <source>Property accessors cannot be declared '{0}' in a 'NotOverridable' property.</source> <target state="translated">Metod dostępu do właściwości nie można deklarować jako „{0}” we właściwości „NotOverridable”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags2"> <source>Property accessors cannot be declared '{0}' in a 'Default' property.</source> <target state="translated">Metod dostępu do właściwości nie można deklarować jako „{0}” we właściwości „Default”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags3"> <source>Property cannot be declared '{0}' because it contains a 'Private' accessor.</source> <target state="translated">Właściwość nie może być zadeklarowana jako „{0}”, ponieważ zawiera metodę dostępu „Private”.</target> <note /> </trans-unit> <trans-unit id="ERR_InAccessibleCoClass3"> <source>Implementing class '{0}' for interface '{1}' is not accessible in this context because it is '{2}'.</source> <target state="translated">Implementująca klasa „{0}” dla interfejsu „{1}” jest niedostępna w tym kontekście, ponieważ jest to element „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingValuesForArraysInApplAttrs"> <source>Arrays used as attribute arguments are required to explicitly specify values for all elements.</source> <target state="translated">Tablice używane jako argumenty atrybutów są wymagane do jawnego określenia wartości dla wszystkich elementów.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitEventMemberNotInvalid"> <source>'Exit AddHandler', 'Exit RemoveHandler' and 'Exit RaiseEvent' are not valid. Use 'Return' to exit from event members.</source> <target state="translated">'Elementy „Exit AddHandler”, „Exit RemoveHandler” i „Exit RaiseEvent” są nieprawidłowe. Użyj elementu „Return”, aby wyjść ze składowych zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsEvent"> <source>Statement cannot appear within an event body. End of event assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści zdarzenia. Założono koniec zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndEvent"> <source>'Custom Event' must end with a matching 'End Event'.</source> <target state="translated">'Element „Custom Event” musi być zakończony odpowiadającym mu elementem „End Event”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndAddHandler"> <source>'AddHandler' declaration must end with a matching 'End AddHandler'.</source> <target state="translated">'Deklaracja „AddHandler” musi być zakończona odpowiadającym jej elementem „End AddHandler”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndRemoveHandler"> <source>'RemoveHandler' declaration must end with a matching 'End RemoveHandler'.</source> <target state="translated">'Deklaracja „RemoveHandler” musi być zakończona odpowiadającym jej elementem „End RemoveHandler”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndRaiseEvent"> <source>'RaiseEvent' declaration must end with a matching 'End RaiseEvent'.</source> <target state="translated">'Deklaracja „RaiseEvent” musi być zakończona odpowiadającym jej elementem „End RaiseEvent”.</target> <note /> </trans-unit> <trans-unit id="ERR_CustomEventInvInInterface"> <source>'Custom' modifier is not valid on events declared in interfaces.</source> <target state="translated">'Modyfikator „Custom” jest nieprawidłowy w zdarzeniach deklarowanych w interfejsach.</target> <note /> </trans-unit> <trans-unit id="ERR_CustomEventRequiresAs"> <source>'Custom' modifier is not valid on events declared without explicit delegate types.</source> <target state="translated">'Modyfikator „Custom” jest nieprawidłowy w zdarzeniach deklarowanych bez jawnych typów delegata.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndEvent"> <source>'End Event' must be preceded by a matching 'Custom Event'.</source> <target state="translated">'Element „End Event” musi być poprzedzony odpowiadającym mu elementem „Custom Event”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndAddHandler"> <source>'End AddHandler' must be preceded by a matching 'AddHandler' declaration.</source> <target state="translated">'Element „End AddHandler” musi być poprzedzony odpowiadającą mu deklaracją „AddHandler”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndRemoveHandler"> <source>'End RemoveHandler' must be preceded by a matching 'RemoveHandler' declaration.</source> <target state="translated">'Element „End RemoveHandler” musi być poprzedzony odpowiadającą mu deklaracją „RemoveHandler”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndRaiseEvent"> <source>'End RaiseEvent' must be preceded by a matching 'RaiseEvent' declaration.</source> <target state="translated">'Element „End RaiseEvent” musi być poprzedzony odpowiadającą mu deklaracją „RaiseEvent”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAddHandlerDef"> <source>'AddHandler' is already declared.</source> <target state="translated">'Element „AddHandler” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRemoveHandlerDef"> <source>'RemoveHandler' is already declared.</source> <target state="translated">'Element „RemoveHandler” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRaiseEventDef"> <source>'RaiseEvent' is already declared.</source> <target state="translated">'Element „RaiseEvent” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingAddHandlerDef1"> <source>'AddHandler' definition missing for event '{0}'.</source> <target state="translated">'Brak definicji elementu „AddHandler” dla zdarzenia „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRemoveHandlerDef1"> <source>'RemoveHandler' definition missing for event '{0}'.</source> <target state="translated">'Brak definicji elementu „RemoveHandler” dla zdarzenia „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRaiseEventDef1"> <source>'RaiseEvent' definition missing for event '{0}'.</source> <target state="translated">'Brak definicji elementu „RaiseEvent” dla zdarzenia „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EventAddRemoveHasOnlyOneParam"> <source>'AddHandler' and 'RemoveHandler' methods must have exactly one parameter.</source> <target state="translated">'Metody „AddHandler” i „RemoveHandler” muszą mieć dokładnie jeden parametr.</target> <note /> </trans-unit> <trans-unit id="ERR_EventAddRemoveByrefParamIllegal"> <source>'AddHandler' and 'RemoveHandler' method parameters cannot be declared 'ByRef'.</source> <target state="translated">'Parametrów metody „AddHandler” i „RemoveHandler” nie można deklarować jako „ByRef”.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecifiersInvOnEventMethod"> <source>Specifiers are not valid on 'AddHandler', 'RemoveHandler' and 'RaiseEvent' methods.</source> <target state="translated">Specyfikatory w metodach „AddHandler”, „RemoveHandler” i „RaiseEvent” są nieprawidłowe.</target> <note /> </trans-unit> <trans-unit id="ERR_AddRemoveParamNotEventType"> <source>'AddHandler' and 'RemoveHandler' method parameters must have the same delegate type as the containing event.</source> <target state="translated">'Parametry metody „AddHandler” i „RemoveHandler” muszą mieć ten sam typ delegata co zawierające je zdarzenie.</target> <note /> </trans-unit> <trans-unit id="ERR_RaiseEventShapeMismatch1"> <source>'RaiseEvent' method must have the same signature as the containing event's delegate type '{0}'.</source> <target state="translated">'Metoda „RaiseEvent” musi mieć taką samą sygnaturę jak typ delegowany „{0}” zdarzenia zawierającego.</target> <note /> </trans-unit> <trans-unit id="ERR_EventMethodOptionalParamIllegal1"> <source>'AddHandler', 'RemoveHandler' and 'RaiseEvent' method parameters cannot be declared '{0}'.</source> <target state="translated">'Parametrów metod „AddHandler”, „RemoveHandler” i „RaiseEvent” nie można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantReferToMyGroupInsideGroupType1"> <source>'{0}' cannot refer to itself through its default instance; use 'Me' instead.</source> <target state="translated">'Element „{0}” nie może odwoływać się do siebie samego za pomocą domyślnego wystąpienia; zamiast tego użyj konstrukcji „Me”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUseOfCustomModifier"> <source>'Custom' modifier can only be used immediately before an 'Event' declaration.</source> <target state="translated">'Modyfikatora „Custom” można używać tylko bezpośrednio przed deklaracją „Event”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionStrictCustom"> <source>Option Strict Custom can only be used as an option to the command-line compiler (vbc.exe).</source> <target state="translated">Elementu Option Strict Custom można użyć tylko jako opcji dla kompilatora wiersza polecenia (vbc.exe).</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteInvalidOnEventMember"> <source>'{0}' cannot be applied to the 'AddHandler', 'RemoveHandler', or 'RaiseEvent' definitions. If required, apply the attribute directly to the event.</source> <target state="translated">'Elementu „{0}” nie można stosować do definicji „AddHandler”, „RemoveHandler” ani „RaiseEvent”. Jeśli jest to wymagane, zastosuj atrybut bezpośrednio do zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingIncompatible2"> <source>Method '{0}' does not have a signature compatible with delegate '{1}'.</source> <target state="translated">Metoda „{0}” nie ma sygnatury zgodnej z delegatem „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlName"> <source>XML name expected.</source> <target state="translated">Oczekiwano nazwy XML.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedXmlPrefix"> <source>XML namespace prefix '{0}' is not defined.</source> <target state="translated">Nie zdefiniowano prefiksu przestrzeni nazw XML „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateXmlAttribute"> <source>Duplicate XML attribute '{0}'.</source> <target state="translated">Zduplikowany atrybut XML „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MismatchedXmlEndTag"> <source>End tag &lt;/{0}{1}{2}&gt; expected.</source> <target state="translated">Oczekiwano tagu końcowego &lt;/{0}{1}{2}&gt;.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingXmlEndTag"> <source>Element is missing an end tag.</source> <target state="translated">Brak tagu końcowego w elemencie.</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedXmlPrefix"> <source>XML namespace prefix '{0}' is reserved for use by XML and the namespace URI cannot be changed.</source> <target state="translated">Prefiks przestrzeni nazw XML „{0}” jest zastrzeżony do użytku przez kod XML i nie można zmienić identyfikatora URI przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingVersionInXmlDecl"> <source>Required attribute 'version' missing from XML declaration.</source> <target state="translated">Brak wymaganego atrybutu „version” w deklaracji XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalAttributeInXmlDecl"> <source>XML declaration does not allow attribute '{0}{1}{2}'.</source> <target state="translated">Deklaracja XML nie zezwala na użycie atrybutu „{0}{1}{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_QuotedEmbeddedExpression"> <source>Embedded expression cannot appear inside a quoted attribute value. Try removing quotes.</source> <target state="translated">Wyrażenie osadzone nie może występować wewnątrz wartości atrybutu umieszczonej w cudzysłowie. Spróbuj usunąć znaki cudzysłowu.</target> <note /> </trans-unit> <trans-unit id="ERR_VersionMustBeFirstInXmlDecl"> <source>XML attribute 'version' must be the first attribute in XML declaration.</source> <target state="translated">Atrybut XML „version” musi być pierwszym atrybutem w deklaracji XML.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOrder"> <source>XML attribute '{0}' must appear before XML attribute '{1}'.</source> <target state="translated">Atrybut XML „{0}” musi występować przed atrybutem XML „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndEmbedded"> <source>Expected closing '%&gt;' for embedded expression.</source> <target state="translated">Oczekiwano zamykających znaków „%&gt;” dla wyrażenia osadzonego.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndPI"> <source>Expected closing '?&gt;' for XML processor instruction.</source> <target state="translated">Oczekiwano zamykających znaków „?&gt;” dla instrukcji procesora XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndComment"> <source>Expected closing '--&gt;' for XML comment.</source> <target state="translated">Oczekiwano zamykających znaków „--&gt;” dla komentarza XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndCData"> <source>Expected closing ']]&gt;' for XML CDATA section.</source> <target state="translated">Oczekiwano zamykających znaków „]]&gt;” dla sekcji CDATA XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSQuote"> <source>Expected matching closing single quote for XML attribute value.</source> <target state="translated">Oczekiwano zgodnego pojedynczego cudzysłowu zamykającego dla wartości atrybutu XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQuote"> <source>Expected matching closing double quote for XML attribute value.</source> <target state="translated">Oczekiwano zgodnego podwójnego cudzysłowu zamykającego dla wartości atrybutu XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLT"> <source>Expected beginning '&lt;' for an XML tag.</source> <target state="translated">Oczekiwano rozpoczynającego znaku „&lt;” dla tagu XML.</target> <note /> </trans-unit> <trans-unit id="ERR_StartAttributeValue"> <source>Expected quoted XML attribute value or embedded expression.</source> <target state="translated">Oczekiwano umieszczonej w cudzysłowie wartości atrybutu XML lub wyrażenia osadzonego.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDiv"> <source>Expected '/' for XML end tag.</source> <target state="translated">Oczekiwano znaku „/” dla tagu końcowego XML.</target> <note /> </trans-unit> <trans-unit id="ERR_NoXmlAxesLateBinding"> <source>XML axis properties do not support late binding.</source> <target state="translated">Właściwości osi XML nie obsługują późnego wiązania.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlStartNameChar"> <source>Character '{0}' ({1}) is not allowed at the beginning of an XML name.</source> <target state="translated">Znak „{0}” ({1}) jest niedozwolony na początku nazwy XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlNameChar"> <source>Character '{0}' ({1}) is not allowed in an XML name.</source> <target state="translated">Znak „{0}” ({1}) jest niedozwolony w nazwie XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlCommentChar"> <source>Character sequence '--' is not allowed in an XML comment.</source> <target state="translated">Sekwencja znaków „--” jest niedozwolona w komentarzu XML.</target> <note /> </trans-unit> <trans-unit id="ERR_EmbeddedExpression"> <source>An embedded expression cannot be used here.</source> <target state="translated">Tutaj nie można użyć wyrażenia osadzonego.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlWhiteSpace"> <source>Missing required white space.</source> <target state="translated">Brak wymaganych białych znaków.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalProcessingInstructionName"> <source>XML processing instruction name '{0}' is not valid.</source> <target state="translated">Nazwa „{0}” instrukcji przetwarzającej kod XML jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="ERR_DTDNotSupported"> <source>XML DTDs are not supported.</source> <target state="translated">Definicje DTD XML nie są obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlWhiteSpace"> <source>White space cannot appear here.</source> <target state="translated">Tutaj nie mogą występować białe znaki.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSColon"> <source>Expected closing ';' for XML entity.</source> <target state="translated">Oczekiwano zamykającego znaku „;” dla jednostki XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlBeginEmbedded"> <source>Expected '%=' at start of an embedded expression.</source> <target state="translated">Oczekiwano znaków „%=” na początku wyrażenia osadzonego.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEntityReference"> <source>XML entity references are not supported.</source> <target state="translated">Odwołania do jednostek XML nie są obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeValue1"> <source>Attribute value is not valid; expecting '{0}'.</source> <target state="translated">Wartość atrybutu jest nieprawidłowa, oczekiwano „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeValue2"> <source>Attribute value is not valid; expecting '{0}' or '{1}'.</source> <target state="translated">Wartość atrybutu jest nieprawidłowa, oczekiwano „{0}” lub „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedXmlNamespace"> <source>Prefix '{0}' cannot be bound to namespace name reserved for '{1}'.</source> <target state="translated">Nie można powiązać prefiksu „{0}” z nazwą przestrzeni nazw zastrzeżoną dla elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalDefaultNamespace"> <source>Namespace declaration with prefix cannot have an empty value inside an XML literal.</source> <target state="translated">Deklaracja przestrzeni nazw z prefiksem nie może mieć wartości pustej wewnątrz literału XML.</target> <note /> </trans-unit> <trans-unit id="ERR_QualifiedNameNotAllowed"> <source>':' is not allowed. XML qualified names cannot be used in this context.</source> <target state="translated">'Znak „:” jest niedozwolony. Nie można używać kwalifikowanych nazw XML w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlns"> <source>Namespace declaration must start with 'xmlns'.</source> <target state="translated">Deklaracja przestrzeni nazw musi zaczynać się elementem „xmlns”.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlnsPrefix"> <source>Element names cannot use the 'xmlns' prefix.</source> <target state="translated">W nazwach elementów nie można używać prefiksu „xmlns”.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlFeaturesNotAvailable"> <source>XML literals and XML axis properties are not available. Add references to System.Xml, System.Xml.Linq, and System.Core or other assemblies declaring System.Linq.Enumerable, System.Xml.Linq.XElement, System.Xml.Linq.XName, System.Xml.Linq.XAttribute and System.Xml.Linq.XNamespace types.</source> <target state="translated">Literały XML i właściwości osi XML są niedostępne. Dodaj odwołania do zestawów System.Xml, System.Xml.Linq i System.Core lub innych zestawów deklarujących typy System.Linq.Enumerable, System.Xml.Linq.XElement, System.Xml.Linq.XName, System.Xml.Linq.XAttribute i System.Xml.Linq.XNamespace.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToReadUacManifest2"> <source>Unable to open Win32 manifest file '{0}' : {1}</source> <target state="translated">Nie można otworzyć pliku manifestu Win32 „{0}”: {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_UseValueForXmlExpression3"> <source>Cannot convert '{0}' to '{1}'. You can use the 'Value' property to get the string value of the first element of '{2}'.</source> <target state="translated">Nie można przekonwertować elementu „{0}” na „{1}”. Przy użyciu właściwości „Value” można uzyskać wartość ciągu pierwszego elementu obiektu „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UseValueForXmlExpression3_Title"> <source>Cannot convert IEnumerable(Of XElement) to String</source> <target state="translated">Nie można przekonwertować interfejsu IEnumerable(Of XElement) na ciąg</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMismatchForXml3"> <source>Value of type '{0}' cannot be converted to '{1}'. You can use the 'Value' property to get the string value of the first element of '{2}'.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”. Przy użyciu właściwości „Value” można uzyskać wartość ciągu pierwszego elementu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryOperandsForXml4"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'. You can use the 'Value' property to get the string value of the first element of '{3}'.</source> <target state="translated">Operator „{0}” nie jest zdefiniowany dla typów „{1}” i „{2}”. Przy użyciu właściwości „Value” można uzyskać wartość ciągu pierwszego elementu obiektu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_FullWidthAsXmlDelimiter"> <source>Full width characters are not valid as XML delimiters.</source> <target state="translated">Znaki o pełnej szerokości nie mogą być ogranicznikami XML.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSubsystemVersion"> <source>The value '{0}' is not a valid subsystem version. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise.</source> <target state="translated">Wartość „{0}” nie jest prawidłową wersją podsystemu. Wersja musi mieć wartość 6.02 lub wyższą dla elementu ARM lub AppContainerExe oraz 4.00 lub wyższą w innych przypadkach.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFileAlignment"> <source>Invalid file section alignment '{0}'</source> <target state="translated">Nieprawidłowe wyrównanie sekcji pliku „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOutputName"> <source>Invalid output name: {0}</source> <target state="translated">Nieprawidłowa nazwa wyjścia: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInformationFormat"> <source>Invalid debug information format: {0}</source> <target state="translated">Nieprawidłowy format informacji debugowania: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_LibAnycpu32bitPreferredConflict"> <source>/platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe.</source> <target state="translated">Polecenia /platform:anycpu32bitpreferred można używać tylko z przełącznikami /t:exe, /t:winexe i /t:appcontainerexe.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedAccess"> <source>Expression has the type '{0}' which is a restricted type and cannot be used to access members inherited from 'Object' or 'ValueType'.</source> <target state="translated">Wyrażenie zawiera typ „{0}”, który jest typem ograniczonym i nie można go używać do uzyskiwania dostępu do składowych dziedziczonych po elemencie „Object” lub „ValueType”.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedConversion1"> <source>Expression of type '{0}' cannot be converted to 'Object' or 'ValueType'.</source> <target state="translated">Wyrażenia typu „{0}” nie można przekonwertować na element „Object” ani „ValueType”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypecharInLabel"> <source>Type characters are not allowed in label identifiers.</source> <target state="translated">Znaki typu są niedozwolone w identyfikatorach etykiet.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedType1"> <source>'{0}' cannot be made nullable, and cannot be used as the data type of an array element, field, anonymous type member, type argument, 'ByRef' parameter, or return statement.</source> <target state="translated">'Typ „{0}” nie może być typem dopuszczającym wartość null i nie można go używać jako typu danych elementu tablicy, pola, składowej typu anonimowego, argumentu typu, parametru „ByRef” ani instrukcji return.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypecharInAlias"> <source>Type characters are not allowed on Imports aliases.</source> <target state="translated">Znaki typu są niedozwolone w aliasach Imports.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleConstructorOnBase"> <source>Class '{0}' has no accessible 'Sub New' and cannot be inherited.</source> <target state="translated">Klasa „{0}” nie ma dostępnego elementu „Sub New” i nie może być dziedziczona.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticLocalInStruct"> <source>Local variables within methods of structures cannot be declared 'Static'.</source> <target state="translated">W metodach struktur nie można deklarować zmiennych lokalnych jako „Static”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocalStatic1"> <source>Static local variable '{0}' is already declared.</source> <target state="translated">Statyczna zmienna lokalna „{0}” jest już zadeklarowana.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportAliasConflictsWithType2"> <source>Imports alias '{0}' conflicts with '{1}' declared in the root namespace.</source> <target state="translated">Alias instrukcji Imports „{0}” powoduje konflikt z elementem „{1}” zadeklarowanym w głównej przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_CantShadowAMustOverride1"> <source>'{0}' cannot shadow a method declared 'MustOverride'.</source> <target state="translated">'Element „{0}” nie może zasłaniać metody zadeklarowanej jako „MustOverride”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleEventImplMismatch3"> <source>Event '{0}' cannot implement event '{2}.{1}' because its delegate type does not match the delegate type of another event implemented by '{0}'.</source> <target state="translated">Zdarzenie „{0}” nie może implementować zdarzenia „{2}.{1}”, ponieważ jego typ delegowany nie pasuje do typu delegowanego innego zdarzenia implementowanego przez zdarzenie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSpecifierCombo2"> <source>'{0}' and '{1}' cannot be combined.</source> <target state="translated">'Nie można połączyć elementów „{0}” i „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MustBeOverloads2"> <source>{0} '{1}' must be declared 'Overloads' because another '{1}' is declared 'Overloads' or 'Overrides'.</source> <target state="translated">Element {0} „{1}” musi być zadeklarowany jako „Overloads”, ponieważ inny element „{1}” jest zadeklarowany jako „Overloads” lub „Overrides”.</target> <note /> </trans-unit> <trans-unit id="ERR_MustOverridesInClass1"> <source>'{0}' must be declared 'MustInherit' because it contains methods declared 'MustOverride'.</source> <target state="translated">'Element „{0}” musi być zadeklarowany jako „MustInherit”, ponieważ zawiera metody zadeklarowane jako „MustOverride”.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesSyntaxInClass"> <source>'Handles' in classes must specify a 'WithEvents' variable, 'MyBase', 'MyClass' or 'Me' qualified with a single identifier.</source> <target state="translated">'Element „Handles” w klasach musi określać zmienną „WithEvents”, „MyBase”, „MyClass” lub „Me” kwalifikowaną za pomocą pojedynczego identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberShadowsMustOverride5"> <source>'{0}', implicitly declared for {1} '{2}', cannot shadow a 'MustOverride' method in the base {3} '{4}'.</source> <target state="translated">'Element „{0}” niejawnie zadeklarowany dla elementu {1} „{2}” nie może zasłonić metody „MustOverride” w podstawowym elemencie {3} „{4}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotOverrideInAccessibleMember"> <source>'{0}' cannot override '{1}' because it is not accessible in this context.</source> <target state="translated">'Element „{0}” nie może przesłaniać elementu „{1}”, ponieważ nie jest on dostępny w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesSyntaxInModule"> <source>'Handles' in modules must specify a 'WithEvents' variable qualified with a single identifier.</source> <target state="translated">'Elementy „Handles” w module muszą określać zmienną „WithEvents” kwalifikowaną za pomocą pojedynczego identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOpRequiresReferenceTypes1"> <source>'IsNot' requires operands that have reference types, but this operand has the value type '{0}'.</source> <target state="translated">'Element „IsNot” wymaga argumentów operacji, które mają typ referencyjny, ale ten argument operacji ma typ wartości „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ClashWithReservedEnumMember1"> <source>'{0}' conflicts with the reserved member by this name that is implicitly declared in all enums.</source> <target state="translated">Element „{0}” powoduje konflikt z zastrzeżoną składową o tej nazwie, która została niejawnie zadeklarowana we wszystkich wyliczeniach.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefinedEnumMember2"> <source>'{0}' is already declared in this {1}.</source> <target state="translated">'Element „{0}” jest już zadeklarowany w tym elemencie {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadUseOfVoid"> <source>'System.Void' can only be used in a GetType expression.</source> <target state="translated">'Elementu „System.Void” można użyć tylko w wyrażeniu GetType.</target> <note /> </trans-unit> <trans-unit id="ERR_EventImplMismatch5"> <source>Event '{0}' cannot implement event '{1}' on interface '{2}' because their delegate types '{3}' and '{4}' do not match.</source> <target state="translated">Zdarzenie „{0}” nie może implementować zdarzenia „{1}” w interfejsie „{2}”, ponieważ ich typy delegowane „{3}” i „{4}” są niezgodne.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeUnavailable3"> <source>Type '{0}' in assembly '{1}' has been forwarded to assembly '{2}'. Either a reference to '{2}' is missing from your project or the type '{0}' is missing from assembly '{2}'.</source> <target state="translated">Typ „{0}” w zestawie „{1}” został przekazany do zestawu „{2}”. Brak odwołania do zestawu „{2}” w projekcie lub typu „{0}” w zestawie „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeFwdCycle2"> <source>'{0}' in assembly '{1}' has been forwarded to itself and so is an unsupported type.</source> <target state="translated">'Element „{0}” w zestawie „{1}” został przesłany dalej do samego siebie, i dlatego jest nieobsługiwanym typem.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeInCCExpression"> <source>Non-intrinsic type names are not allowed in conditional compilation expressions.</source> <target state="translated">Nazwy typu niewewnętrznego nie są dozwolone w wyrażeniach kompilacji warunkowej.</target> <note /> </trans-unit> <trans-unit id="ERR_BadCCExpression"> <source>Syntax error in conditional compilation expression.</source> <target state="translated">Błąd składni w wyrażeniu kompilacji warunkowej.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidArrayDisallowed"> <source>Arrays of type 'System.Void' are not allowed in this expression.</source> <target state="translated">Tablice typu „System.Void” są niedozwolone w tym wyrażeniu.</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataMembersAmbiguous3"> <source>'{0}' is ambiguous because multiple kinds of members with this name exist in {1} '{2}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny, ponieważ wiele rodzajów składowych o tej nazwie istnieje w elemencie {1} „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOfExprAlwaysFalse2"> <source>Expression of type '{0}' can never be of type '{1}'.</source> <target state="translated">Wyrażenie typu „{0}” nigdy nie może być typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyPrivatePartialMethods1"> <source>Partial methods must be declared 'Private' instead of '{0}'.</source> <target state="translated">Metody częściowe muszą być zadeklarowane jako „Private” zamiast „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustBePrivate"> <source>Partial methods must be declared 'Private'.</source> <target state="translated">Metody częściowe muszą być zadeklarowane jako „Private”.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOnePartialMethodAllowed2"> <source>Method '{0}' cannot be declared 'Partial' because only one method '{1}' can be marked 'Partial'.</source> <target state="translated">Metody „{0}” nie można zadeklarować jako „Partial”, ponieważ tylko jedną metodę „{1}” można oznaczyć jako „Partial”.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOneImplementingMethodAllowed3"> <source>Method '{0}' cannot implement partial method '{1}' because '{2}' already implements it. Only one method can implement a partial method.</source> <target state="translated">Metoda „{0}” nie może implementować metody częściowej „{1}”, ponieważ już implementuje ją metoda „{2}”. Tylko jedna metoda może implementować metodę częściową.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodMustBeEmpty"> <source>Partial methods must have empty method bodies.</source> <target state="translated">Metody częściowe muszą mieć pustą treść metody.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustBeSub1"> <source>'{0}' cannot be declared 'Partial' because partial methods must be Subs.</source> <target state="translated">'Nie można zadeklarować metody „{0}” jako „Partial”, ponieważ metody częściowe muszą być typu Sub.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodGenericConstraints2"> <source>Method '{0}' does not have the same generic constraints as the partial method '{1}'.</source> <target state="translated">Metoda „{0}” nie ma takich samych ograniczeń ogólnych jak metoda częściowa „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialDeclarationImplements1"> <source>Partial method '{0}' cannot use the 'Implements' keyword.</source> <target state="translated">W metodzie częściowej „{0}” nie można używać słowa kluczowego „Implements”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPartialMethodInAddressOf1"> <source>'AddressOf' cannot be applied to '{0}' because '{0}' is a partial method without an implementation.</source> <target state="translated">'Nie można zastosować wyrażenia „AddressOf” do metody „{0}”, ponieważ „{0}” jest metodą częściową bez implementacji.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementationMustBePrivate2"> <source>Method '{0}' must be declared 'Private' in order to implement partial method '{1}'.</source> <target state="translated">Metoda „{0}” musi być zadeklarowana jako „Private”, aby mogła implementować metodę częściową „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamNamesMustMatch3"> <source>Parameter name '{0}' does not match the name of the corresponding parameter, '{1}', defined on the partial method declaration '{2}'.</source> <target state="translated">Nazwa parametru „{0}” nie jest zgodna z nazwą odpowiadającego mu parametru „{1}” zdefiniowanego w deklaracji metody częściowej „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodTypeParamNameMismatch3"> <source>Name of type parameter '{0}' does not match '{1}', the corresponding type parameter defined on the partial method declaration '{2}'.</source> <target state="translated">Nazwa parametru typu „{0}” nie jest zgodna z odpowiadającym mu parametrem typu „{1}” zdefiniowanego w deklaracji metody częściowej „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeSharedProperty1"> <source>'Shared' attribute property '{0}' cannot be the target of an assignment.</source> <target state="translated">'Właściwość „{0}” atrybutu „Shared” nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeReadOnlyProperty1"> <source>'ReadOnly' attribute property '{0}' cannot be the target of an assignment.</source> <target state="translated">'Właściwość „{0}” atrybutu „ReadOnly” nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateResourceName1"> <source>Resource name '{0}' cannot be used more than once.</source> <target state="translated">Nie można użyć nazwy zasobu „{0}” więcej niż raz.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateResourceFileName1"> <source>Each linked resource and module must have a unique filename. Filename '{0}' is specified more than once in this assembly.</source> <target state="translated">Każdy połączony zasób oraz moduł muszą mieć unikatową nazwę pliku. Nazwa pliku „{0}” jest określona więcej niż jeden raz w tym zestawie.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeMustBeClassNotStruct1"> <source>'{0}' cannot be used as an attribute because it is not a class.</source> <target state="translated">'Nie można użyć elementu „{0}” jako atrybutu, ponieważ nie jest on klasą.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeMustInheritSysAttr"> <source>'{0}' cannot be used as an attribute because it does not inherit from 'System.Attribute'.</source> <target state="translated">'Nie można użyć elementu „{0}” jako atrybutu, ponieważ nie dziedziczy on po klasie „System.Attribute”.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeCannotBeAbstract"> <source>'{0}' cannot be used as an attribute because it is declared 'MustInherit'.</source> <target state="translated">'Nie można użyć elementu „{0}” jako atrybutu, ponieważ jest on zadeklarowany jako „MustInherit”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToOpenResourceFile1"> <source>Unable to open resource file '{0}': {1}</source> <target state="translated">Nie można otworzyć pliku zasobów „{0}”: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicProperty1"> <source>Attribute member '{0}' cannot be the target of an assignment because it is not declared 'Public'.</source> <target state="translated">Składowa atrybutu „{0}” nie może być elementem docelowym przypisania, ponieważ nie jest zadeklarowana jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_STAThreadAndMTAThread0"> <source>'System.STAThreadAttribute' and 'System.MTAThreadAttribute' cannot both be applied to the same method.</source> <target state="translated">'Nie można zastosować elementów System.STAThreadAttribute i System.MTAThreadAttribute do tej samej metody.</target> <note /> </trans-unit> <trans-unit id="ERR_IndirectUnreferencedAssembly4"> <source>Project '{0}' makes an indirect reference to assembly '{1}', which contains '{2}'. Add a file reference to '{3}' to your project.</source> <target state="translated">Projekt „{0}” wykonuje pośrednie odwołanie do zestawu „{1}”, który zawiera element „{2}”. Dodaj do projektu odwołanie pliku do elementu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicType1"> <source>Type '{0}' cannot be used in an attribute because it is not declared 'Public'.</source> <target state="translated">Nie można użyć typu „{0}” w atrybucie, ponieważ nie jest on zadeklarowany jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicContType2"> <source>Type '{0}' cannot be used in an attribute because its container '{1}' is not declared 'Public'.</source> <target state="translated">Nie można użyć typu „{0}” w atrybucie, ponieważ jego kontener „{1}” nie jest zadeklarowany jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnNonEmptySubOrFunction"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Sub, Function, or Operator with a non-empty body.</source> <target state="translated">'Elementu „System.Runtime.InteropServices.DllImportAttribute” nie można zastosować do elementu Sub, Function lub Operator z niepustą treścią.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnDeclare"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Declare.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DllImportAttribute” do elementu Declare.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnGetOrSet"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Get or Set.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DllImportAttribute” do elementu Get ani Set.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnGenericSubOrFunction"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a method that is generic or contained in a generic type.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DllImportAttribute” do metody ogólnej lub zawartej w typie ogólnym.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassOnGeneric"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to a class that is generic or contained inside a generic type.</source> <target state="translated">'Nie można zastosować elementu „Microsoft.VisualBasic.ComClassAttribute” do klasy ogólnej lub zawartej w typie ogólnym.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInstanceMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to instance method.</source> <target state="translated">'Elementu System.Runtime.InteropServices.DllImportAttribute nie można zastosować do metody wystąpienia.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInterfaceMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to interface methods.</source> <target state="translated">'Elementu „System.Runtime.InteropServices.DllImportAttribute” nie można zastosować do metod interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnEventMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to 'AddHandler', 'RemoveHandler' or 'RaiseEvent' method.</source> <target state="translated">'Elementu System.Runtime.InteropServices.DllImportAttribute nie można zastosować do metody AddHandler, RemoveHandler ani RaiseEvent.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadArguments"> <source>Friend assembly reference '{0}' is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.</source> <target state="translated">Odwołanie do przyjaznego zestawu „{0}” jest nieprawidłowe. Deklaracje InternalsVisibleTo nie mogą mieć określonej wersji, kultury, tokena klucza publicznego ani architektury procesora.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyStrongNameRequired"> <source>Friend assembly reference '{0}' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.</source> <target state="translated">Odwołanie do przyjaznego zestawu „{0}” jest nieprawidłowe. Zestawy podpisane silnymi nazwami muszą określać klucz publiczny w swoich deklaracjach InternalsVisibleTo.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyNameInvalid"> <source>Friend declaration '{0}' is invalid and cannot be resolved.</source> <target state="translated">Deklaracja elementu zaprzyjaźnionego „{0}” jest nieprawidłowa i nie można jej rozpoznać.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadAccessOverride2"> <source>Member '{0}' cannot override member '{1}' defined in another assembly/project because the access modifier 'Protected Friend' expands accessibility. Use 'Protected' instead.</source> <target state="translated">Składowa „{0}” nie może przesłaniać składowej „{1}” zdefiniowanej w innym zestawie/projekcie, ponieważ modyfikator dostępu „Protected Friend” rozszerza dostępność. Zamiast niego użyj modyfikatora „Protected”.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfLocalBeforeDeclaration1"> <source>Local variable '{0}' cannot be referred to before it is declared.</source> <target state="translated">Nie można odwołać się do zmiennej lokalnej „{0}” przed jej zadeklarowaniem.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordFromModule1"> <source>'{0}' is not valid within a Module.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w ramach modułu.</target> <note /> </trans-unit> <trans-unit id="ERR_BogusWithinLineIf"> <source>Statement cannot end a block outside of a line 'If' statement.</source> <target state="translated">Instrukcja nie może kończyć bloku poza instrukcją If wiersza.</target> <note /> </trans-unit> <trans-unit id="ERR_CharToIntegralTypeMismatch1"> <source>'Char' values cannot be converted to '{0}'. Use 'Microsoft.VisualBasic.AscW' to interpret a character as a Unicode value or 'Microsoft.VisualBasic.Val' to interpret it as a digit.</source> <target state="translated">'Nie można konwertować wartości „Char” na elementy „{0}”. Użyj elementu „Microsoft.VisualBasic.AscW”, aby zinterpretować znak jako wartość Unicode, lub elementu „Microsoft.VisualBasic.Val”, aby zinterpretować go jako cyfrę.</target> <note /> </trans-unit> <trans-unit id="ERR_IntegralToCharTypeMismatch1"> <source>'{0}' values cannot be converted to 'Char'. Use 'Microsoft.VisualBasic.ChrW' to interpret a numeric value as a Unicode character or first convert it to 'String' to produce a digit.</source> <target state="translated">'Nie można konwertować wartości „{0}” na elementy „Char”. Użyj elementu „Microsoft.VisualBasic.ChrW”, aby zinterpretować wartość numeryczną jako znak Unicode, lub najpierw przekonwertuj ją na typ „String”, aby otrzymać cyfrę.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDirectDelegateConstruction1"> <source>Delegate '{0}' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor.</source> <target state="translated">Delegat „{0}” wymaga wyrażenia „AddressOf” lub wyrażenia lambda jako jedynego argumentu dla jego konstruktora.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodMustBeFirstStatementOnLine"> <source>Method declaration statements must be the first statement on a logical line.</source> <target state="translated">Instrukcja deklaracji metody musi być pierwszą instrukcją w wierszu logicznym.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrAssignmentNotFieldOrProp1"> <source>'{0}' cannot be named as a parameter in an attribute specifier because it is not a field or property.</source> <target state="translated">'Nie można użyć elementu „{0}” jako parametru w specyfikatorze atrybutu, ponieważ nie jest to pole ani właściwość.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsObjectComparison1"> <source>Option Strict On disallows operands of type Object for operator '{0}'. Use the 'Is' operator to test for object identity.</source> <target state="translated">Ustawienie „Option Strict On” uniemożliwia stosowanie argumentów operacji typu Object dla operatora „{0}”. Użyj operatora „Is” w celu zbadania tożsamości obiektu.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstituentArraySizes"> <source>Bounds can be specified only for the top-level array when initializing an array of arrays.</source> <target state="translated">Granice można określić tylko dla tablicy najwyższego poziomu podczas inicjowania tablicy tablic.</target> <note /> </trans-unit> <trans-unit id="ERR_FileAttributeNotAssemblyOrModule"> <source>'Assembly' or 'Module' expected.</source> <target state="translated">'Oczekiwano instrukcji Assembly lub Module.</target> <note /> </trans-unit> <trans-unit id="ERR_FunctionResultCannotBeIndexed1"> <source>'{0}' has no parameters and its return type cannot be indexed.</source> <target state="translated">'Element „{0}” nie ma parametrów, a jego typ zwracany nie może być indeksowany.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentSyntax"> <source>Comma, ')', or a valid expression continuation expected.</source> <target state="translated">Oczekiwano przecinka, znaku ) lub prawidłowej kontynuacji wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedResumeOrGoto"> <source>'Resume' or 'GoTo' expected.</source> <target state="translated">'Oczekiwano instrukcji Resume lub GoTo.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAssignmentOperator"> <source>'=' expected.</source> <target state="translated">'Oczekiwano znaku „=”.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted2"> <source>Parameter '{0}' in '{1}' already has a matching omitted argument.</source> <target state="translated">Parametr „{0}” w elemencie „{1}” ma już pasujący pominięty argument.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotCallEvent1"> <source>'{0}' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.</source> <target state="translated">Element „{0}” jest zdarzeniem i nie można go wywołać bezpośrednio. Użyj instrukcji „RaiseEvent”, aby wywołać zdarzenie.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachCollectionDesignPattern1"> <source>Expression is of type '{0}', which is not a collection type.</source> <target state="translated">Wyrażenie jest typu „{0}”, który nie jest typem kolekcji.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueForNonOptionalParam"> <source>Default values cannot be supplied for parameters that are not declared 'Optional'.</source> <target state="translated">Nie można podać wartości domyślnych dla parametrów, które nie są zadeklarowane jako Optional.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterMyBase"> <source>'MyBase' must be followed by '.' and an identifier.</source> <target state="translated">'Po elemencie „MyBase” musi wystąpić znak „.” i identyfikator.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterMyClass"> <source>'MyClass' must be followed by '.' and an identifier.</source> <target state="translated">'Po elemencie „MyClass” musi wystąpić znak „.” i identyfikator.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictArgumentCopyBackNarrowing3"> <source>Option Strict On disallows narrowing from type '{1}' to type '{2}' in copying the value of 'ByRef' parameter '{0}' back to the matching argument.</source> <target state="translated">Ustawienie „Option Strict On” uniemożliwia zawężanie z typu „{1}” do typu „{2}” podczas kopiowania wartości parametru „ByRef” „{0}” z powrotem do pasującego argumentu.</target> <note /> </trans-unit> <trans-unit id="ERR_LbElseifAfterElse"> <source>'#ElseIf' cannot follow '#Else' as part of a '#If' block.</source> <target state="translated">'Instrukcja „#ElseIf” nie może wystąpić po instrukcji „#Else” jako część bloku „#If”.</target> <note /> </trans-unit> <trans-unit id="ERR_StandaloneAttribute"> <source>Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.</source> <target state="translated">Specyfikator atrybutu nie jest kompletną instrukcją. Użyj kontynuacji wiersza, aby zastosować atrybut do następnej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_NoUniqueConstructorOnBase2"> <source>Class '{0}' must declare a 'Sub New' because its base class '{1}' has more than one accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">Klasa „{0}” musi mieć deklarację elementu „Sub New”, ponieważ jej klasa bazowa „{1}” ma więcej niż jeden dostępny element „Sub New”, który można wywołać bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtraNextVariable"> <source>'Next' statement names more variables than there are matching 'For' statements.</source> <target state="translated">'Instrukcja „Next” zawiera więcej zmiennych, niż istnieje odpowiadających jej instrukcji „For”.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNewCallTooMany2"> <source>First statement of this 'Sub New' must be a call to 'MyBase.New' or 'MyClass.New' because base class '{0}' of '{1}' has more than one accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">Pierwszą instrukcją w tym bloku „Sub New” musi być wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ klasa bazowa „{0}” klasy „{1}” ma więcej niż jeden dostępny element „Sub New”, który można wywołać bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_ForCtlVarArraySizesSpecified"> <source>Array declared as for loop control variable cannot be declared with an initial size.</source> <target state="translated">Tablica zadeklarowana jako zmienna sterująca pętli for nie może być zadeklarowana z rozmiarem początkowym.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnNewOverloads"> <source>The '{0}' keyword is used to overload inherited members; do not use the '{0}' keyword when overloading 'Sub New'.</source> <target state="translated">Słowo kluczowe „{0}” służy do przeciążania dziedziczonych składowych; nie należy używać słowa kluczowego „{0}” do przeciążania elementu „Sub New”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnGenericParam"> <source>Type character cannot be used in a type parameter declaration.</source> <target state="translated">Znaku typu nie można użyć w deklaracji parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewGenericArguments1"> <source>Too few type arguments to '{0}'.</source> <target state="translated">Za mało argumentów typu dla elementu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyGenericArguments1"> <source>Too many type arguments to '{0}'.</source> <target state="translated">Za dużo argumentów typu elementu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfied2"> <source>Type argument '{0}' does not inherit from or implement the constraint type '{1}'.</source> <target state="translated">Argument typu „{0}” nie dziedziczy po typie ograniczenia „{1}” ani nie implementuje go.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOrMemberNotGeneric1"> <source>'{0}' has no type parameters and so cannot have type arguments.</source> <target state="translated">'Element „{0}” nie ma parametrów typu i dlatego nie może mieć argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_NewIfNullOnGenericParam"> <source>'New' cannot be used on a type parameter that does not have a 'New' constraint.</source> <target state="translated">'Elementu New nie można używać w parametrze typu, który nie ma ograniczenia New.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleClassConstraints1"> <source>Type parameter '{0}' can only have one constraint that is a class.</source> <target state="translated">Parametr typu „{0}” może mieć tylko jedno ograniczenie, które jest klasą.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstNotClassInterfaceOrTypeParam1"> <source>Type constraint '{0}' must be either a class, interface or type parameter.</source> <target state="translated">Ograniczenie typu „{0}” musi być klasą, interfejsem lub parametrem typu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateTypeParamName1"> <source>Type parameter already declared with name '{0}'.</source> <target state="translated">Zadeklarowano już parametr typu o nazwie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam2"> <source>Type parameter '{0}' for '{1}' cannot be inferred.</source> <target state="translated">Nie można wywnioskować parametru typu „{0}” dla elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorGenericParam1"> <source>'Is' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a type parameter with no class constraint.</source> <target state="translated">'Argument operacji „Is” typu „{0}” można porównać tylko z elementem „Nothing”, ponieważ element „{0}” jest parametrem typu bez ograniczenia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentCopyBackNarrowing3"> <source>Copying the value of 'ByRef' parameter '{0}' back to the matching argument narrows from type '{1}' to type '{2}'.</source> <target state="translated">Kopiowanie wartości parametru „ByRef” „{0}” z powrotem do pasującego argumentu powoduje zawężenie z typu „{1}” do typu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ShadowingGenericParamWithMember1"> <source>'{0}' has the same name as a type parameter.</source> <target state="translated">'Element „{0}” ma taką samą nazwę jak parametr typu.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericParamBase2"> <source>{0} '{1}' cannot inherit from a type parameter.</source> <target state="translated">Element {0} „{1}” nie może dziedziczyć po parametrze typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsGenericParam"> <source>Type parameter not allowed in 'Implements' clause.</source> <target state="translated">Parametr typu niedozwolony w klauzuli Implements.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyNullLowerBound"> <source>Array lower bounds can be only '0'.</source> <target state="translated">Dolne granice tablicy mogą mieć tylko wartość „0”.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassConstraintNotInheritable1"> <source>Type constraint cannot be a 'NotInheritable' class.</source> <target state="translated">Ograniczenie typu nie może być klasą NotInheritable.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintIsRestrictedType1"> <source>'{0}' cannot be used as a type constraint.</source> <target state="translated">'Elementu „{0}” nie można użyć jako ograniczenia typu.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericParamsOnInvalidMember"> <source>Type parameters cannot be specified on this declaration.</source> <target state="translated">W tej deklaracji nie można określić parametrów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericArgsOnAttributeSpecifier"> <source>Type arguments are not valid because attributes cannot be generic.</source> <target state="translated">Argumenty typu są nieprawidłowe, ponieważ atrybuty nie mogą być ogólne.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrCannotBeGenerics"> <source>Type parameters, generic types or types contained in generic types cannot be used as attributes.</source> <target state="translated">Parametrów typu, typów ogólnych lub typów zawartych w typach ogólnych nie można używać jako atrybutów.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticLocalInGenericMethod"> <source>Local variables within generic methods cannot be declared 'Static'.</source> <target state="translated">Zmienne lokalne z metodami ogólnymi nie mogą być deklarowane jako Static.</target> <note /> </trans-unit> <trans-unit id="ERR_SyntMemberShadowsGenericParam3"> <source>{0} '{1}' implicitly defines a member '{2}' which has the same name as a type parameter.</source> <target state="translated">Element {0} „{1}” niejawnie definiuje składową „{2}”, która ma taką samą nazwę jak parametr typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintAlreadyExists1"> <source>Constraint type '{0}' already specified for this type parameter.</source> <target state="translated">Typ ograniczenia „{0}” jest już określony dla tego parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacePossiblyImplTwice2"> <source>Cannot implement interface '{0}' because its implementation could conflict with the implementation of another implemented interface '{1}' for some type arguments.</source> <target state="translated">Nie można zaimplementować interfejsu „{0}”, ponieważ jego implementacja może powodować konflikt z implementacją innego zaimplementowanego interfejsu „{1}” w przypadku niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ModulesCannotBeGeneric"> <source>Modules cannot be generic.</source> <target state="translated">Moduły nie mogą być ogólne.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericClassCannotInheritAttr"> <source>Classes that are generic or contained in a generic type cannot inherit from an attribute class.</source> <target state="translated">Klasy, które są ogólne lub są zawarte w typie ogólnym, nie mogą dziedziczyć po klasie atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_DeclaresCantBeInGeneric"> <source>'Declare' statements are not allowed in generic types or types contained in generic types.</source> <target state="translated">'Instrukcje „Declare” nie są dozwolone w typach ogólnych ani typach zawartych w typach ogólnych.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithConstraintMismatch2"> <source>'{0}' cannot override '{1}' because they differ by type parameter constraints.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się ograniczeniami parametrów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsWithConstraintMismatch3"> <source>'{0}' cannot implement '{1}.{2}' because they differ by type parameter constraints.</source> <target state="translated">'Element „{0}” nie może implementować elementu „{1}.{2}”, ponieważ różnią się one ograniczeniami parametrów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_OpenTypeDisallowed"> <source>Type parameters or types constructed with type parameters are not allowed in attribute arguments.</source> <target state="translated">Parametry typu lub typy utworzone za pomocą parametrów typu są niedozwolone w argumentach atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesInvalidOnGenericMethod"> <source>Generic methods cannot use 'Handles' clause.</source> <target state="translated">Metody ogólne nie mogą używać klauzuli Handles.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleNewConstraints"> <source>'New' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'Ograniczenie New nie może być określone wiele razy dla tego samego parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_MustInheritForNewConstraint2"> <source>Type argument '{0}' is declared 'MustInherit' and does not satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">Argument typu „{0}” jest deklarowany jako „MustInherit” i nie spełnia ograniczenia „New” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuitableNewForNewConstraint2"> <source>Type argument '{0}' must have a public parameterless instance constructor to satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">Argument typu „{0}” musi mieć publiczny konstruktor wystąpienia bez parametrów, aby spełniać ograniczenie „New” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGenericParamForNewConstraint2"> <source>Type parameter '{0}' must have either a 'New' constraint or a 'Structure' constraint to satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">Parametr typu „{0}” musi mieć ograniczenie „New” lub „Structure”, aby spełniać ograniczenie „New” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NewArgsDisallowedForTypeParam"> <source>Arguments cannot be passed to a 'New' used on a type parameter.</source> <target state="translated">Argumentów nie można przekazać do elementu „New” używanego w parametrze typu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRawGenericTypeImport1"> <source>Generic type '{0}' cannot be imported more than once.</source> <target state="translated">Typ ogólny „{0}” nie może zostać zaimportowany więcej niż raz.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypeArgumentCountOverloadCand1"> <source>Overload resolution failed because no accessible '{0}' accepts this number of type arguments.</source> <target state="translated">Rozpoznanie przeciążenia nie powiodło się, ponieważ żaden z dostępnych elementów „{0}” nie akceptuje tej liczby argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeArgsUnexpected"> <source>Type arguments unexpected.</source> <target state="translated">Nieoczekiwane argumenty typu.</target> <note /> </trans-unit> <trans-unit id="ERR_NameSameAsMethodTypeParam1"> <source>'{0}' is already declared as a type parameter of this method.</source> <target state="translated">'Element „{0}” jest już zadeklarowany jako parametr typu tej metody.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamNameFunctionNameCollision"> <source>Type parameter cannot have the same name as its defining function.</source> <target state="translated">Parametr typu nie może mieć nazwy takiej samej jak definiująca go funkcja.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstraintSyntax"> <source>Type or 'New' expected.</source> <target state="translated">Oczekiwano typu lub elementu „New”.</target> <note /> </trans-unit> <trans-unit id="ERR_OfExpected"> <source>'Of' required when specifying type arguments for a generic type or method.</source> <target state="translated">'Wymagany element „Of” podczas określania argumentów typu dla typu ogólnego lub metody ogólnej.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayOfRawGenericInvalid"> <source>'(' unexpected. Arrays of uninstantiated generic types are not allowed.</source> <target state="translated">'Nieoczekiwany znak „(”. Tablice typów ogólnych bez wystąpień nie są dozwolone.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachAmbiguousIEnumerable1"> <source>'For Each' on type '{0}' is ambiguous because the type implements multiple instantiations of 'System.Collections.Generic.IEnumerable(Of T)'.</source> <target state="translated">Element „For Each” w typie „{0}” jest niejednoznaczny, ponieważ typ implementuje wiele wystąpień elementu „System.Collections.Generic.IEnumerable(Of T)”.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOperatorGenericParam1"> <source>'IsNot' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a type parameter with no class constraint.</source> <target state="translated">'Argument operacji „IsNot” typu „{0}” można porównać tylko z elementem „Nothing”, ponieważ element „{0}” jest parametrem typu bez ograniczenia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamQualifierDisallowed"> <source>Type parameters cannot be used as qualifiers.</source> <target state="translated">Parametrów typu nie można używać jako kwalifikatorów.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMissingCommaOrRParen"> <source>Comma or ')' expected.</source> <target state="translated">Oczekiwano przecinka lub znaku ).</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMissingAsCommaOrRParen"> <source>'As', comma or ')' expected.</source> <target state="translated">'Oczekiwano elementu „As”, przecinka lub znaku „)”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleReferenceConstraints"> <source>'Class' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'Ograniczenie elementu Class nie może być określone wiele razy dla tego samego parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleValueConstraints"> <source>'Structure' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'Ograniczenie elementu Structure nie może być określone wiele razy dla tego samego parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_NewAndValueConstraintsCombined"> <source>'New' constraint and 'Structure' constraint cannot be combined.</source> <target state="translated">'Nie można łączyć ograniczeń New i Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAndValueConstraintsCombined"> <source>'Class' constraint and 'Structure' constraint cannot be combined.</source> <target state="translated">'Nie można łączyć ograniczeń Class i Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForStructConstraint2"> <source>Type argument '{0}' does not satisfy the 'Structure' constraint for type parameter '{1}'.</source> <target state="translated">Argument typu „{0}” nie spełnia warunków ograniczenia „Structure” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForRefConstraint2"> <source>Type argument '{0}' does not satisfy the 'Class' constraint for type parameter '{1}'.</source> <target state="translated">Argument typu „{0}” nie spełnia warunków ograniczenia „Class” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAndClassTypeConstrCombined"> <source>'Class' constraint and a specific class type constraint cannot be combined.</source> <target state="translated">'Nie można łączyć ograniczenia Class i określonego ograniczenia typu klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueAndClassTypeConstrCombined"> <source>'Structure' constraint and a specific class type constraint cannot be combined.</source> <target state="translated">'Nie można łączyć ograniczenia Structure i określonego ograniczenia typu klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashIndirectIndirect4"> <source>Indirect constraint '{0}' obtained from the type parameter constraint '{1}' conflicts with the indirect constraint '{2}' obtained from the type parameter constraint '{3}'.</source> <target state="translated">Ograniczenie pośrednie „{0}” uzyskane z ograniczenia parametru typu „{1}” powoduje konflikt z ograniczeniem pośrednim „{2}” uzyskanym z ograniczenia parametru typu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashDirectIndirect3"> <source>Constraint '{0}' conflicts with the indirect constraint '{1}' obtained from the type parameter constraint '{2}'.</source> <target state="translated">Ograniczenie „{0}” powoduje konflikt z ograniczeniem pośrednim „{1}” uzyskanym z ograniczenia parametru typu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashIndirectDirect3"> <source>Indirect constraint '{0}' obtained from the type parameter constraint '{1}' conflicts with the constraint '{2}'.</source> <target state="translated">Ograniczenie pośrednie „{0}” uzyskane z ograniczenia parametru typu „{1}” powoduje konflikt z ograniczeniem „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintCycleLink2"> <source> '{0}' is constrained to '{1}'.</source> <target state="translated"> Element „{0}” jest ograniczony do elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintCycle2"> <source>Type parameter '{0}' cannot be constrained to itself: {1}</source> <target state="translated">Parametru typu „{0}” nie można ograniczyć do niego samego: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamWithStructConstAsConst"> <source>Type parameter with a 'Structure' constraint cannot be used as a constraint.</source> <target state="translated">Parametru typu z ograniczeniem „Structure” nie można używać jako ograniczenia.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableDisallowedForStructConstr1"> <source>'System.Nullable' does not satisfy the 'Structure' constraint for type parameter '{0}'. Only non-nullable 'Structure' types are allowed.</source> <target state="translated">Element „System.Nullable” nie spełnia warunków ograniczenia „Structure” dla parametru typu „{0}”. Dozwolone są tylko nienullowalne typy „Structure”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingDirectConstraints3"> <source>Constraint '{0}' conflicts with the constraint '{1}' already specified for type parameter '{2}'.</source> <target state="translated">Ograniczenie „{0}” powoduje konflikt z ograniczeniem „{1}” już określonym dla parametru typu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceUnifiesWithInterface2"> <source>Cannot inherit interface '{0}' because it could be identical to interface '{1}' for some type arguments.</source> <target state="translated">Nie można dziedziczyć interfejsu „{0}”, ponieważ może być on taki sam jak interfejs „{1}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseUnifiesWithInterfaces3"> <source>Cannot inherit interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' for some type arguments.</source> <target state="translated">Nie można dziedziczyć interfejsu „{0}”, ponieważ interfejs „{1}”, po którym ten interfejs dziedziczy, może być taki sam jak interfejs „{2}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceBaseUnifiesWithBase4"> <source>Cannot inherit interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' from which the interface '{3}' inherits for some type arguments.</source> <target state="translated">Nie można dziedziczyć interfejsu „{0}”, ponieważ interfejs „{1}”, po którym ten interfejs dziedziczy, może być taki sam jak interfejs „{2}”, po którym dziedziczy interfejs „{3}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceUnifiesWithBase3"> <source>Cannot inherit interface '{0}' because it could be identical to interface '{1}' from which the interface '{2}' inherits for some type arguments.</source> <target state="translated">Nie można dziedziczyć interfejsu „{0}”, ponieważ może on być taki sam jak interfejs „{1}”, po którym dziedziczy interfejs „{2}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsBaseUnifiesWithInterfaces3"> <source>Cannot implement interface '{0}' because the interface '{1}' from which it inherits could be identical to implemented interface '{2}' for some type arguments.</source> <target state="translated">Nie można zaimplementować interfejsu „{0}”, ponieważ interfejs „{1}”, po którym ten interfejs dziedziczy, może być taki sam jak zaimplementowany interfejs „{2}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsInterfaceBaseUnifiesWithBase4"> <source>Cannot implement interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' from which the implemented interface '{3}' inherits for some type arguments.</source> <target state="translated">Nie można zaimplementować interfejsu „{0}”, ponieważ interfejs „{1}”, po którym ten interfejs dziedziczy, może być taki sam jak interfejs „{2}”, po którym dziedziczy zaimplementowany interfejs „{3}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsInterfaceUnifiesWithBase3"> <source>Cannot implement interface '{0}' because it could be identical to interface '{1}' from which the implemented interface '{2}' inherits for some type arguments.</source> <target state="translated">Nie można zaimplementować interfejsu „{0}”, ponieważ może on być taki sam jak interfejs „{1}”, po którym dziedziczy zaimplementowany interfejs „{2}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionalsCantBeStructGenericParams"> <source>Generic parameters used as optional parameter types must be class constrained.</source> <target state="translated">Parametry ogólne używane jako opcjonalne typy parametrów muszą mieć ograniczenia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNullableMethod"> <source>Methods of 'System.Nullable(Of T)' cannot be used as operands of the 'AddressOf' operator.</source> <target state="translated">Nie można używać metod typu „System.Nullable(Of T)” jako argumentów operatora „AddressOf”.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorNullable1"> <source>'Is' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a nullable type.</source> <target state="translated">'Argument operacji „Is” typu „{0}” można porównać tylko z elementem „Nothing”, ponieważ typ „{0}” jest typem dopuszczającym wartość null.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOperatorNullable1"> <source>'IsNot' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a nullable type.</source> <target state="translated">'Argument operacji „IsNot” typu „{0}” można porównać tylko z elementem „Nothing”, ponieważ typ „{0}” jest typem dopuszczającym wartość null.</target> <note /> </trans-unit> <trans-unit id="ERR_ShadowingTypeOutsideClass1"> <source>'{0}' cannot be declared 'Shadows' outside of a class, structure, or interface.</source> <target state="translated">'Nie można zadeklarować elementu „{0}” jako „Shadows” poza klasą, strukturą lub interfejsem.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertySetParamCollisionWithValue"> <source>Property parameters cannot have the name 'Value'.</source> <target state="translated">Parametry właściwości nie mogą mieć nazwy Value.</target> <note /> </trans-unit> <trans-unit id="ERR_SxSIndirectRefHigherThanDirectRef3"> <source>The project currently contains references to more than one version of '{0}', a direct reference to version {2} and an indirect reference to version {1}. Change the direct reference to use version {1} (or higher) of {0}.</source> <target state="translated">Projekt obecnie zawiera odwołania do więcej niż jednej wersji elementu {0}, bezpośrednie odwołanie do wersji {2} i pośrednie odwołanie do wersji {1}. Zmień odwołanie bezpośrednie tak, aby używana w nim była wersja {1} (lub wyższa) elementu {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateReferenceStrong"> <source>Multiple assemblies with equivalent identity have been imported: '{0}' and '{1}'. Remove one of the duplicate references.</source> <target state="translated">Zostało zaimportowanych wiele zestawów o równoważnej tożsamości: „{0}” i „{1}”. Usuń jedno ze zduplikowanych odwołań.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateReference2"> <source>Project already has a reference to assembly '{0}'. A second reference to '{1}' cannot be added.</source> <target state="translated">Projekt już ma odwołanie do zestawu {0}. Nie można dodać drugiego odwołania do elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCallOrIndex"> <source>Illegal call expression or index expression.</source> <target state="translated">Niedozwolone wyrażenie wywołania lub indeksu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictDefaultPropertyAttribute"> <source>Conflict between the default property and the 'DefaultMemberAttribute' defined on '{0}'.</source> <target state="translated">Konflikt między właściwością domyślną a elementem „DefaultMemberAttribute” zdefiniowanym w elemencie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeUuid2"> <source>'{0}' cannot be applied because the format of the GUID '{1}' is not correct.</source> <target state="translated">'Nie można zastosować elementu „{0}”, ponieważ format identyfikatora GUID „{1}” jest niepoprawny.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassAndReservedAttribute1"> <source>'Microsoft.VisualBasic.ComClassAttribute' and '{0}' cannot both be applied to the same class.</source> <target state="translated">'Nie można zastosować elementów „Microsoft.VisualBasic.ComClassAttribute” i „{0}” w tej samej klasie.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassRequiresPublicClass2"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to '{0}' because its container '{1}' is not declared 'Public'.</source> <target state="translated">'Nie można zastosować elementu „Microsoft.VisualBasic.ComClassAttribute” do elementu „{0}”, ponieważ jego kontener „{1}” nie jest zadeklarowany jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassReservedDispIdZero1"> <source>'System.Runtime.InteropServices.DispIdAttribute' cannot be applied to '{0}' because 'Microsoft.VisualBasic.ComClassAttribute' reserves zero for the default property.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DispIdAttribute” do elementu „{0}”, ponieważ element „Microsoft.VisualBasic.ComClassAttribute” rezerwuje zero jako właściwość domyślną.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassReservedDispId1"> <source>'System.Runtime.InteropServices.DispIdAttribute' cannot be applied to '{0}' because 'Microsoft.VisualBasic.ComClassAttribute' reserves values less than zero.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DispIdAttribute” do elementu „{0}”, ponieważ element „Microsoft.VisualBasic.ComClassAttribute” rezerwuje wartości mniejsze od zera.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassDuplicateGuids1"> <source>'InterfaceId' and 'EventsId' parameters for 'Microsoft.VisualBasic.ComClassAttribute' on '{0}' cannot have the same value.</source> <target state="translated">'Parametry „InterfaceId” i „EventsId” dla elementu „Microsoft.VisualBasic.ComClassAttribute” w elemencie „{0}” nie mogą mieć tej samej wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassCantBeAbstract0"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to a class that is declared 'MustInherit'.</source> <target state="translated">'Nie można zastosować elementu „Microsoft.VisualBasic.ComClassAttribute” do klasy, która jest zadeklarowana jako „MustInherit”.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassRequiresPublicClass1"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to '{0}' because it is not declared 'Public'.</source> <target state="translated">'Nie można zastosować elementu „Microsoft.VisualBasic.ComClassAttribute” do elementu „{0}”, ponieważ nie jest on zadeklarowany jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnknownOperator"> <source>Operator declaration must be one of: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</source> <target state="translated">Deklaracja operatora musi mieć jedną z następujących wartości: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateConversionCategoryUsed"> <source>'Widening' and 'Narrowing' cannot be combined.</source> <target state="translated">'Nie można łączyć elementów Widening i Narrowing.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorNotOverloadable"> <source>Operator is not overloadable. Operator declaration must be one of: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</source> <target state="translated">Operatora nie można przeciążyć. Deklaracja operatora musi mieć jedną z następujących wartości: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHandles"> <source>'Handles' is not valid on operator declarations.</source> <target state="translated">'Element Handles nie jest prawidłowy w deklaracjach operatora.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplements"> <source>'Implements' is not valid on operator declarations.</source> <target state="translated">'Element Implements nie jest prawidłowy w deklaracjach operatora.</target> <note /> </trans-unit> <trans-unit id="ERR_EndOperatorExpected"> <source>'End Operator' expected.</source> <target state="translated">'Oczekiwano elementu „End Operator”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndOperatorNotAtLineStart"> <source>'End Operator' must be the first statement on a line.</source> <target state="translated">'Element End Operator musi być pierwszą instrukcją w wierszu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndOperator"> <source>'End Operator' must be preceded by a matching 'Operator'.</source> <target state="translated">'Element „End Operator” musi być poprzedzony odpowiadającym mu elementem „Operator”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitOperatorNotValid"> <source>'Exit Operator' is not valid. Use 'Return' to exit an operator.</source> <target state="translated">'Element Exit Operator jest nieprawidłowy. Użyj elementu Return, aby wyjść z operatora.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayIllegal1"> <source>'{0}' parameters cannot be declared 'ParamArray'.</source> <target state="translated">'Parametrów „{0}” nie można zadeklarować jako „ParamArray”.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionalIllegal1"> <source>'{0}' parameters cannot be declared 'Optional'.</source> <target state="translated">'Parametrów „{0}” nie można zadeklarować jako „Optional”.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorMustBePublic"> <source>Operators must be declared 'Public'.</source> <target state="translated">Operatory należy zadeklarować jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorMustBeShared"> <source>Operators must be declared 'Shared'.</source> <target state="translated">Operatory należy zadeklarować jako „Shared”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadOperatorFlags1"> <source>Operators cannot be declared '{0}'.</source> <target state="translated">Operatorów nie można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OneParameterRequired1"> <source>Operator '{0}' must have one parameter.</source> <target state="translated">Operator „{0}” musi mieć jeden parametr.</target> <note /> </trans-unit> <trans-unit id="ERR_TwoParametersRequired1"> <source>Operator '{0}' must have two parameters.</source> <target state="translated">Operator „{0}” musi mieć dwa parametry.</target> <note /> </trans-unit> <trans-unit id="ERR_OneOrTwoParametersRequired1"> <source>Operator '{0}' must have either one or two parameters.</source> <target state="translated">Operator „{0}” musi mieć jeden lub dwa parametry.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvMustBeWideningOrNarrowing"> <source>Conversion operators must be declared either 'Widening' or 'Narrowing'.</source> <target state="translated">Operatory konwersji muszą być zadeklarowane jako Widening lub Narrowing.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorDeclaredInModule"> <source>Operators cannot be declared in modules.</source> <target state="translated">Nie można zadeklarować operatorów w modułach.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSpecifierOnNonConversion1"> <source>Only conversion operators can be declared '{0}'.</source> <target state="translated">Tylko operatory konwersji można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnaryParamMustBeContainingType1"> <source>Parameter of this unary operator must be of the containing type '{0}'.</source> <target state="translated">Parametr tego operatora jednoargumentowego musi być typu zawierającego „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryParamMustBeContainingType1"> <source>At least one parameter of this binary operator must be of the containing type '{0}'.</source> <target state="translated">Co najmniej jeden parametr tego operatora binarnego musi być typu zawierającego „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvParamMustBeContainingType1"> <source>Either the parameter type or the return type of this conversion operator must be of the containing type '{0}'.</source> <target state="translated">Typ parametru lub typ zwracany tego operatora konwersji muszą być typu zawierającego „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorRequiresBoolReturnType1"> <source>Operator '{0}' must have a return type of Boolean.</source> <target state="translated">Operator „{0}” musi mieć typ zwracany Boolean.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToSameType"> <source>Conversion operators cannot convert from a type to the same type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToInterfaceType"> <source>Conversion operators cannot convert to an interface type.</source> <target state="translated">Operatory konwersji nie mogą konwertować na typ interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToBaseType"> <source>Conversion operators cannot convert from a type to its base type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu na jego typ podstawowy.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToDerivedType"> <source>Conversion operators cannot convert from a type to its derived type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu na typ, który od niego pochodzi.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToObject"> <source>Conversion operators cannot convert to Object.</source> <target state="translated">Operatory konwersji nie mogą konwertować na element Object.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromInterfaceType"> <source>Conversion operators cannot convert from an interface type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromBaseType"> <source>Conversion operators cannot convert from a base type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu podstawowego.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromDerivedType"> <source>Conversion operators cannot convert from a derived type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu pochodnego.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromObject"> <source>Conversion operators cannot convert from Object.</source> <target state="translated">Operatory konwersji nie mogą konwertować z elementu Object.</target> <note /> </trans-unit> <trans-unit id="ERR_MatchingOperatorExpected2"> <source>Matching '{0}' operator is required for '{1}'.</source> <target state="translated">Wymagany pasujący operator „{0}” dla elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableLogicalOperator3"> <source>Return and parameter types of '{0}' must be '{1}' to be used in a '{2}' expression.</source> <target state="translated">Typy zwracane i typy parametrów „{0}” muszą być typu „{1}”, aby można było ich używać w wyrażeniu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionOperatorRequired3"> <source>Type '{0}' must define operator '{1}' to be used in a '{2}' expression.</source> <target state="translated">Typ „{0}” musi definiować operator „{1}”, aby mógł zostać użyty w wyrażeniu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CopyBackTypeMismatch3"> <source>Cannot copy the value of 'ByRef' parameter '{0}' back to the matching argument because type '{1}' cannot be converted to type '{2}'.</source> <target state="translated">Nie można skopiować wartości parametru „ByRef” „{0}” z powrotem do zgodnego argumentu, ponieważ typu „{1}” nie można przekonwertować na typ „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ForLoopOperatorRequired2"> <source>Type '{0}' must define operator '{1}' to be used in a 'For' statement.</source> <target state="translated">Typ „{0}” musi definiować operator „{1}”, aby można było go używać w instrukcji „For”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableForLoopOperator2"> <source>Return and parameter types of '{0}' must be '{1}' to be used in a 'For' statement.</source> <target state="translated">Typy zwracane i typy parametrów „{0}” muszą być typu „{1}”, aby można było używać ich w instrukcji „For”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableForLoopRelOperator2"> <source>Parameter types of '{0}' must be '{1}' to be used in a 'For' statement.</source> <target state="translated">Typy parametru „{0}” muszą być typu „{1}”, aby można było ich użyć w instrukcji 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorRequiresIntegerParameter1"> <source>Operator '{0}' must have a second parameter of type 'Integer' or 'Integer?'.</source> <target state="translated">Operator „{0}” musi mieć drugi parametr typu „Integer” lub „Integer?”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyNullableOnBoth"> <source>Nullable modifier cannot be specified on both a variable and its type.</source> <target state="translated">Modyfikator dopuszczający wartość null nie może być określony jednocześnie w zmiennej i jej typie.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForStructConstraintNull"> <source>Type '{0}' must be a value type or a type argument constrained to 'Structure' in order to be used with 'Nullable' or nullable modifier '?'.</source> <target state="translated">Typ „{0}” musi być typem wartości lub typem argumentu ograniczonym do elementu „Structure”, aby można go było używać z modyfikatorem „Nullable” lub modyfikatorem dopuszczającym wartość null „?”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyArrayAndNullableOnBoth"> <source>Nullable modifier '?' and array modifiers '(' and ')' cannot be specified on both a variable and its type.</source> <target state="translated">Modyfikator dopuszczający wartość null „?” oraz modyfikatory tablicy „(” i „)” nie mogą być określone jednocześnie w zmiennej i jej typie.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyTypeCharacterOnIIF"> <source>Expressions used with an 'If' expression cannot contain type characters.</source> <target state="translated">Wyrażenia używane w wyrażeniu „If” nie mogą zawierać znaków typu.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFName"> <source>'If' operands cannot be named arguments.</source> <target state="translated">'Argumenty operatora „If” nie mogą być nazwanymi argumentami.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFConversion"> <source>Cannot infer a common type for the second and third operands of the 'If' operator. One must have a widening conversion to the other.</source> <target state="translated">Nie można wywnioskować wspólnego typu dla drugiego i trzeciego argumentu operacji operatora „If”. Jeden musi umożliwiać konwersję rozszerzającą do drugiego.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCondTypeInIIF"> <source>First operand in a binary 'If' expression must be a nullable value type, a reference type, or an unconstrained generic type.</source> <target state="translated">Pierwszy operand w binarnym wyrażeniu „If” musi być typem wartości dopuszczającym wartość null, typem referencyjnym lub typem ogólnym bez ograniczeń.</target> <note /> </trans-unit> <trans-unit id="ERR_CantCallIIF"> <source>'If' operator cannot be used in a 'Call' statement.</source> <target state="translated">Operatora „If” nie można użyć w instrukcji „Call”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyAsNewAndNullable"> <source>Nullable modifier cannot be specified in variable declarations with 'As New'.</source> <target state="translated">Modyfikator dopuszczający wartość null nie może być określany w deklaracjach zmiennych za pomocą instrukcji „As New”.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFConversion2"> <source>Cannot infer a common type for the first and second operands of the binary 'If' operator. One must have a widening conversion to the other.</source> <target state="translated">Nie można wywnioskować wspólnego typu dla pierwszego i drugiego argumentu operacji binarnego operatora „If”. Jeden musi umożliwiać konwersję rozszerzającą do drugiego.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNullTypeInCCExpression"> <source>Nullable types are not allowed in conditional compilation expressions.</source> <target state="translated">Typy dopuszczające wartości null nie są dozwolone w wyrażeniach kompilacji warunkowej.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableImplicit"> <source>Nullable modifier cannot be used with a variable whose implicit type is 'Object'.</source> <target state="translated">Modyfikator dopuszczający wartość null nie może być używany ze zmienną, której typem niejawnym jest „Object”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRuntimeHelper"> <source>Requested operation is not available because the runtime library function '{0}' is not defined.</source> <target state="translated">Żądana operacja jest niedostępna, ponieważ funkcja biblioteki uruchomieniowej „{0}” nie jest zdefiniowana.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterGlobalNameSpace"> <source>'Global' must be followed by '.' and an identifier.</source> <target state="translated">'Po elemencie „Global” musi wystąpić znak „.” i identyfikator.</target> <note /> </trans-unit> <trans-unit id="ERR_NoGlobalExpectedIdentifier"> <source>'Global' not allowed in this context; identifier expected.</source> <target state="translated">'Element „Global” jest niedozwolony w tym kontekście; oczekiwano identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_NoGlobalInHandles"> <source>'Global' not allowed in handles; local name expected.</source> <target state="translated">'Element „Global” jest niedozwolony w elementach Handles; oczekiwano nazwy lokalnej.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseIfNoMatchingIf"> <source>'ElseIf' must be preceded by a matching 'If' or 'ElseIf'.</source> <target state="translated">'Element „ElseIf” musi być poprzedzony odpowiadającym mu elementem „If” lub „ElseIf”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeConstructor2"> <source>Attribute constructor has a 'ByRef' parameter of type '{0}'; cannot use constructors with byref parameters to apply the attribute.</source> <target state="translated">Konstruktor atrybutu ma parametr „ByRef” typu „{0}”; konstruktorów z parametrami byref nie można używać do zastosowania atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_EndUsingWithoutUsing"> <source>'End Using' must be preceded by a matching 'Using'.</source> <target state="translated">'Element „End Using” musi być poprzedzony odpowiadającym mu elementem „Using”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndUsing"> <source>'Using' must end with a matching 'End Using'.</source> <target state="translated">'Element „Using” musi być zakończony odpowiadającym mu elementem „End Using”.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoUsing"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'Using' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „Using”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingRequiresDisposePattern"> <source>'Using' operand of type '{0}' must implement 'System.IDisposable'.</source> <target state="translated">'Argument operacji „Using” typu „{0}” musi implementować interfejs „System.IDisposable”.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingResourceVarNeedsInitializer"> <source>'Using' resource variable must have an explicit initialization.</source> <target state="translated">'Zmienna zasobu Using musi być jawnie inicjowana.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingResourceVarCantBeArray"> <source>'Using' resource variable type can not be array type.</source> <target state="translated">'Typ zmiennej zasobu „Using” nie może być typem tablicowym.</target> <note /> </trans-unit> <trans-unit id="ERR_OnErrorInUsing"> <source>'On Error' statements are not valid within 'Using' statements.</source> <target state="translated">'Instrukcje On Error nie są prawidłowe w instrukcjach Using.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyNameConflictInMyCollection"> <source>'{0}' has the same name as a member used for type '{1}' exposed in a 'My' group. Rename the type or its enclosing namespace.</source> <target state="translated">'Element „{0}” ma taką samą nazwę jak składowa użyta dla typu „{1}” ujawniona w grupie „My”. Zmień nazwę typu lub obejmującej go przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplicitVar"> <source>Implicit variable '{0}' is invalid because of '{1}'.</source> <target state="translated">Zmienna niejawna „{0}” jest nieprawidłowa z powodu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectInitializerRequiresFieldName"> <source>Object initializers require a field name to initialize.</source> <target state="translated">Inicjatory obiektów wymagają nazwy pola do zainicjowania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedFrom"> <source>'From' expected.</source> <target state="translated">'Oczekiwano instrukcji „From”.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaBindingMismatch1"> <source>Nested function does not have the same signature as delegate '{0}'.</source> <target state="translated">Funkcja zagnieżdżona nie ma takiej samej sygnatury jak obiekt delegowany „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaBindingMismatch2"> <source>Nested sub does not have a signature that is compatible with delegate '{0}'.</source> <target state="translated">Zagnieżdżony element sub nie ma sygnatury zgodnej z obiektem delegowanym „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftByRefParamQuery1"> <source>'ByRef' parameter '{0}' cannot be used in a query expression.</source> <target state="translated">'Nie można użyć parametru ByRef „{0}” w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeNotSupported"> <source>Expression cannot be converted into an expression tree.</source> <target state="translated">Nie można przekonwertować wyrażenia na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftStructureMeQuery"> <source>Instance members and 'Me' cannot be used within query expressions in structures.</source> <target state="translated">Nie można używać składowych wystąpień i elementu „Me” w wyrażeniach zapytań w strukturach.</target> <note /> </trans-unit> <trans-unit id="ERR_InferringNonArrayType1"> <source>Variable cannot be initialized with non-array type '{0}'.</source> <target state="translated">Nie można zainicjować zmiennej przy użyciu typu nietablicowego „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefParamInExpressionTree"> <source>References to 'ByRef' parameters cannot be converted to an expression tree.</source> <target state="translated">Nie można przekonwertować odwołań do parametrów „ByRef” na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAnonTypeMemberName1"> <source>Anonymous type member or property '{0}' is already declared.</source> <target state="translated">Składowa lub właściwość typu anonimowego „{0}” jest już zadeklarowana.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAnonymousTypeForExprTree"> <source>Cannot convert anonymous type to an expression tree because a property of the type is used to initialize another property.</source> <target state="translated">Nie można przekonwertować typu anonimowego na drzewo wyrażenia, ponieważ właściwość typu jest używana do inicjowania innej właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftAnonymousType1"> <source>Anonymous type property '{0}' cannot be used in the definition of a lambda expression within the same initialization list.</source> <target state="translated">Nie można użyć właściwości typu anonimowego „{0}” w definicji wyrażenia lambda w obrębie tej samej listy inicjowania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionOnlyAllowedOnModuleSubOrFunction"> <source>'Extension' attribute can be applied only to 'Module', 'Sub', or 'Function' declarations.</source> <target state="translated">'Atrybut „Extension” można stosować tylko w deklaracjach „Module”, „Sub” lub „Function”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodNotInModule"> <source>Extension methods can be defined only in modules.</source> <target state="translated">Metody rozszerzenia można definiować tylko w modułach.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodNoParams"> <source>Extension methods must declare at least one parameter. The first parameter specifies which type to extend.</source> <target state="translated">Metody rozszerzenia muszą deklarować co najmniej jeden parametr. Pierwszy parametr określa typ do rozszerzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOptionalFirstArg"> <source>'Optional' cannot be applied to the first parameter of an extension method. The first parameter specifies which type to extend.</source> <target state="translated">'Nie można zastosować elementu „Optional” do pierwszego parametru metody rozszerzenia. Pierwszy parametr określa typ do rozszerzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodParamArrayFirstArg"> <source>'ParamArray' cannot be applied to the first parameter of an extension method. The first parameter specifies which type to extend.</source> <target state="translated">'Nie można zastosować elementu „ParamArray” do pierwszego parametru metody rozszerzenia. Pierwszy parametr określa typ do rozszerzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeFieldNameInference"> <source>Anonymous type member name can be inferred only from a simple or qualified name with no arguments.</source> <target state="translated">Nazwę składowej typu anonimowego można wywnioskować tylko na podstawie prostej lub kwalifikowanej nazwy bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotMemberOfAnonymousType2"> <source>'{0}' is not a member of '{1}'; it does not exist in the current context.</source> <target state="translated">'Element „{0}” nie jest składową elementu „{1}”. Nie istnieje on w bieżącym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionAttributeInvalid"> <source>The custom-designed version of 'System.Runtime.CompilerServices.ExtensionAttribute' found by the compiler is not valid. Its attribute usage flags must be set to allow assemblies, classes, and methods.</source> <target state="translated">Niestandardowo zaprojektowana wersja klasy „System.Runtime.CompilerServices.ExtensionAttribute” odnaleziona przez kompilator jest nieprawidłowa. Jej flagi użycia atrybutów należy ustawić tak, aby zezwalały na zestawy, klasy i metody.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypePropertyOutOfOrder1"> <source>Anonymous type member property '{0}' cannot be used to infer the type of another member property because the type of '{0}' is not yet established.</source> <target state="translated">Nie można użyć właściwości składowej typu anonimowego „{0}” do wywnioskowania typu innej właściwości składowej, ponieważ typ elementu „{0}” nie jest jeszcze ustalony.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeDisallowsTypeChar"> <source>Type characters cannot be used in anonymous type declarations.</source> <target state="translated">Nie można używać znaków typu w deklaracjach typów anonimowych.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleLiteralDisallowsTypeChar"> <source>Type characters cannot be used in tuple literals.</source> <target state="translated">Znaki typu nie mogą być używane w literałach krotek.</target> <note /> </trans-unit> <trans-unit id="ERR_NewWithTupleTypeSyntax"> <source>'New' cannot be used with tuple type. Use a tuple literal expression instead.</source> <target state="translated">'Instrukcji „new” nie można użyć dla typu krotki. Użyj zamiast tego wyrażenia literału krotki.</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeMustBeStruct"> <source>Predefined type '{0}' must be a structure.</source> <target state="translated">Wstępnie zdefiniowany typ „{0}” musi być strukturą.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodUncallable1"> <source>Extension method '{0}' has type constraints that can never be satisfied.</source> <target state="translated">Metoda rozszerzenia „{0}” ma ograniczenia typu, których nie będzie można nigdy spełnić.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOverloadCandidate3"> <source> Extension method '{0}' defined in '{1}': {2}</source> <target state="translated"> Metoda rozszerzenia „{0}” zdefiniowana w elemencie „{1}”: {2}</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatch"> <source>Method does not have a signature compatible with the delegate.</source> <target state="translated">Metoda nie ma sygnatury zgodnej z delegatem.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingTypeInferenceFails"> <source>Type arguments could not be inferred from the delegate.</source> <target state="translated">Nie można wywnioskować argumentów typu na podstawie delegata.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs"> <source>Too many arguments.</source> <target state="translated">Za dużo argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted1"> <source>Parameter '{0}' already has a matching omitted argument.</source> <target state="translated">Parametr „{0}” ma już pasujący pominięty argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice1"> <source>Parameter '{0}' already has a matching argument.</source> <target state="translated">Parametr „{0}” ma już pasujący argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound1"> <source>'{0}' is not a method parameter.</source> <target state="translated">'Element „{0}” nie jest parametrem metody.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument1"> <source>Argument not specified for parameter '{0}'.</source> <target state="translated">Nie określono parametru dla argumentu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam1"> <source>Type parameter '{0}' cannot be inferred.</source> <target state="translated">Nie można wywnioskować parametru typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOverloadCandidate2"> <source> Extension method '{0}' defined in '{1}'.</source> <target state="translated"> Metoda rozszerzenia „{0}” zdefiniowana w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNeedField"> <source>Anonymous type must contain at least one member.</source> <target state="translated">Typ anonimowy musi zawierać co najmniej jedną składową.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNameWithoutPeriod"> <source>Anonymous type member name must be preceded by a period.</source> <target state="translated">Nazwa składowej typu anonimowego musi być poprzedzona kropką.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeExpectedIdentifier"> <source>Identifier expected, preceded with a period.</source> <target state="translated">Oczekiwano identyfikatora poprzedzonego kropką.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs2"> <source>Too many arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Za dużo argumentów dla metody rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted3"> <source>Parameter '{0}' in extension method '{1}' defined in '{2}' already has a matching omitted argument.</source> <target state="translated">Parametr „{0}” metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}” ma już pasujący pominięty argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice3"> <source>Parameter '{0}' of extension method '{1}' defined in '{2}' already has a matching argument.</source> <target state="translated">Parametr „{0}” metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}” ma już pasujący argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound3"> <source>'{0}' is not a parameter of extension method '{1}' defined in '{2}'.</source> <target state="translated">'Element „{0}” nie jest parametrem metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument3"> <source>Argument not specified for parameter '{0}' of extension method '{1}' defined in '{2}'.</source> <target state="translated">Nie określono argumentu dla parametru „{0}” metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam3"> <source>Type parameter '{0}' for extension method '{1}' defined in '{2}' cannot be inferred.</source> <target state="translated">Nie można wywnioskować parametru typu „{0}” metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewGenericArguments2"> <source>Too few type arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Za mało argumentów typu dla metody rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyGenericArguments2"> <source>Too many type arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Za dużo argumentów typu dla metody rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedInOrEq"> <source>'In' or '=' expected.</source> <target state="translated">'Oczekiwano elementu „In” lub znaku „=”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQueryableSource"> <source>Expression of type '{0}' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.</source> <target state="translated">Wyrażenie typu „{0}” nie umożliwia formułowania zapytań. Upewnij się, że nie brakuje odwołania do zestawu i/lub importu przestrzeni nazw dla dostawcy LINQ.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryOperatorNotFound"> <source>Definition of method '{0}' is not accessible in this context.</source> <target state="translated">Definicja metody „{0}” jest niedostępna w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseOnErrorGotoWithClosure"> <source>Method cannot contain both a '{0}' statement and a definition of a variable that is used in a lambda or query expression.</source> <target state="translated">Metoda nie może zawierać zarówno instrukcji „{0}”, jak i definicji zmiennej użytej w wyrażeniu lambda lub wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotGotoNonScopeBlocksWithClosure"> <source>'{0}{1}' is not valid because '{2}' is inside a scope that defines a variable that is used in a lambda or query expression.</source> <target state="translated">'Instrukcja „{0}{1}” jest nieprawidłowa, ponieważ element „{2}” znajduje się wewnątrz zakresu, który definiuje zmienną używaną w wyrażeniu lambda lub wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeQuery"> <source>Instance of restricted type '{0}' cannot be used in a query expression.</source> <target state="translated">Nie można użyć wystąpienia typu ograniczonego „{0}” w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonymousTypeFieldNameInference"> <source>Range variable name can be inferred only from a simple or qualified name with no arguments.</source> <target state="translated">Nazwę zmiennej zakresu można wywnioskować tylko na podstawie prostej lub kwalifikowanej nazwy bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryDuplicateAnonTypeMemberName1"> <source>Range variable '{0}' is already declared.</source> <target state="translated">Zmienna zakresu „{0}” jest już zadeklarowana.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonymousTypeDisallowsTypeChar"> <source>Type characters cannot be used in range variable declarations.</source> <target state="translated">Nie można używać znaków typu w deklaracjach zmiennych zakresu.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyInClosure"> <source>'ReadOnly' variable cannot be the target of an assignment in a lambda expression inside a constructor.</source> <target state="translated">'Zmienna ReadOnly nie może być elementem docelowym przypisania w wyrażeniu lambda wewnątrz konstruktora.</target> <note /> </trans-unit> <trans-unit id="ERR_ExprTreeNoMultiDimArrayCreation"> <source>Multi-dimensional array cannot be converted to an expression tree.</source> <target state="translated">Nie można przekonwertować tablicy wielowymiarowej na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExprTreeNoLateBind"> <source>Late binding operations cannot be converted to an expression tree.</source> <target state="translated">Nie można przekonwertować operacji późnego wiązania na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedBy"> <source>'By' expected.</source> <target state="translated">'Oczekiwano elementu „By”.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryInvalidControlVariableName1"> <source>Range variable name cannot match the name of a member of the 'Object' class.</source> <target state="translated">Nazwa zmiennej zakresu nie może być zgodna z nazwą składowej klasy „Object”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIn"> <source>'In' expected.</source> <target state="translated">'Oczekiwano elementu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNameNotDeclared"> <source>Name '{0}' is either not declared or not in the current scope.</source> <target state="translated">Nazwa „{0}” nie jest zadeklarowana lub nie znajduje się w bieżącym zakresie.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedFunctionArgumentNarrowing3"> <source>Return type of nested function matching parameter '{0}' narrows from '{1}' to '{2}'.</source> <target state="translated">Typ zwracany funkcji zagnieżdżonej pasującej do parametru „{0}” zawęża się od „{1}” do „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonTypeFieldXMLNameInference"> <source>Anonymous type member name cannot be inferred from an XML identifier that is not a valid Visual Basic identifier.</source> <target state="translated">Nie można wywnioskować nazwy składowej typu anonimowego na podstawie identyfikatora XML, który nie jest prawidłowym identyfikatorem języka Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonTypeFieldXMLNameInference"> <source>Range variable name cannot be inferred from an XML identifier that is not a valid Visual Basic identifier.</source> <target state="translated">Nie można wywnioskować nazwy zmiennej zakresu na podstawie identyfikatora XML, który nie jest prawidłowym identyfikatorem języka Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedInto"> <source>'Into' expected.</source> <target state="translated">'Oczekiwano operatora „Into”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnAggregation"> <source>Aggregate function name cannot be used with a type character.</source> <target state="translated">Nazwy funkcji agregowania nie można używać ze znakiem typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOn"> <source>'On' expected.</source> <target state="translated">'Oczekiwano operatora „On”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEquals"> <source>'Equals' expected.</source> <target state="translated">'Oczekiwano operatora „Equals”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAnd"> <source>'And' expected.</source> <target state="translated">'Oczekiwano operatora „And”.</target> <note /> </trans-unit> <trans-unit id="ERR_EqualsTypeMismatch"> <source>'Equals' cannot compare a value of type '{0}' with a value of type '{1}'.</source> <target state="translated">'Operator „Equals” nie umożliwia porównania wartości typu „{0}” z wartością typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EqualsOperandIsBad"> <source>You must reference at least one range variable on both sides of the 'Equals' operator. Range variable(s) {0} must appear on one side of the 'Equals' operator, and range variable(s) {1} must appear on the other.</source> <target state="translated">Po obu stronach operatora „Equals” musi znajdować się odwołanie do co najmniej jednej zmiennej zakresu. Zmienne zakresu {0} muszą znajdować się po jednej, a zmienne zakresu {1} po drugiej stronie operatora „Equals”.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNotDelegate1"> <source>Lambda expression cannot be converted to '{0}' because '{0}' is not a delegate type.</source> <target state="translated">Wyrażenia lambda nie można przekonwertować na typ „{0}”, ponieważ typ „{0}” nie jest typem delegowanym.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNotCreatableDelegate1"> <source>Lambda expression cannot be converted to '{0}' because type '{0}' is declared 'MustInherit' and cannot be created.</source> <target state="translated">Wyrażenia lambda nie można przekonwertować na typ „{0}”, ponieważ typ „{0}” jest zadeklarowany jako „MustInherit” i nie można go utworzyć.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotInferNullableForVariable1"> <source>A nullable type cannot be inferred for variable '{0}'.</source> <target state="translated">Nie można wywnioskować typu dopuszczającego wartość null dla zmiennej „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableTypeInferenceNotSupported"> <source>Nullable type inference is not supported in this context.</source> <target state="translated">Wnioskowanie typu dopuszczającego wartość null nie jest obsługiwane w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedJoin"> <source>'Join' expected.</source> <target state="translated">'Oczekiwano operatora „Join”.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableParameterMustSpecifyType"> <source>Nullable parameters must specify a type.</source> <target state="translated">Parametry dopuszczające wartości null muszą określać typ.</target> <note /> </trans-unit> <trans-unit id="ERR_IterationVariableShadowLocal2"> <source>Range variable '{0}' hides a variable in an enclosing block, a previously defined range variable, or an implicitly declared variable in a query expression.</source> <target state="translated">Zmienna zakresu „{0}” ukrywa zmienną w otaczającym bloku, w uprzednio zdefiniowanej zmiennej zakresu lub w niejawnie zadeklarowanej zmiennej w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdasCannotHaveAttributes"> <source>Attributes cannot be applied to parameters of lambda expressions.</source> <target state="translated">Nie można zastosować atrybutów do parametrów wyrażeń lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaInSelectCaseExpr"> <source>Lambda expressions are not valid in the first expression of a 'Select Case' statement.</source> <target state="translated">Wyrażenia lambda nie są prawidłowe w pierwszym wyrażeniu instrukcji Select Case.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfInSelectCaseExpr"> <source>'AddressOf' expressions are not valid in the first expression of a 'Select Case' statement.</source> <target state="translated">'Wyrażenia „AddressOf” nie są prawidłowe w pierwszym wyrażeniu instrukcji „Select Case”.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableCharNotSupported"> <source>The '?' character cannot be used here.</source> <target state="translated">Tutaj nie można użyć znaku „?”.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftStructureMeLambda"> <source>Instance members and 'Me' cannot be used within a lambda expression in structures.</source> <target state="translated">Nie można używać składowych wystąpień i elementu „Me” w wyrażeniach lambda w strukturach.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftByRefParamLambda1"> <source>'ByRef' parameter '{0}' cannot be used in a lambda expression.</source> <target state="translated">'Nie można użyć parametru ByRef „{0}” w wyrażeniu lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeLambda"> <source>Instance of restricted type '{0}' cannot be used in a lambda expression.</source> <target state="translated">Nie można użyć wystąpienia typu ograniczonego „{0}” w wyrażeniu lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaParamShadowLocal1"> <source>Lambda parameter '{0}' hides a variable in an enclosing block, a previously defined range variable, or an implicitly declared variable in a query expression.</source> <target state="translated">Parametr lambda „{0}” ukrywa zmienną w otaczającym bloku, w uprzednio zdefiniowanej zmiennej zakresu lub w niejawnie zadeklarowanej zmiennej w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowImplicitObjectLambda"> <source>Option Strict On requires each lambda expression parameter to be declared with an 'As' clause if its type cannot be inferred.</source> <target state="translated">Ustawienie Option Strict On wymaga zadeklarowania każdego parametru wyrażenia lambda za pomocą klauzuli „As”, jeśli nie można wywnioskować ich typu.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyParamsOnLambdaParamNoType"> <source>Array modifiers cannot be specified on lambda expression parameter name. They must be specified on its type.</source> <target state="translated">Nie można określić modyfikatorów tablicy w nazwie parametru wyrażenia lambda. Muszą być one określone w jego typie.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu, ponieważ jest możliwy więcej niż jeden typ. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”, ponieważ możliwe jest użycie więcej niż jednego typu. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”, ponieważ możliwe jest użycie więcej niż jednego typu. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu, ponieważ jest możliwy więcej niż jeden typ.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”, ponieważ możliwe jest użycie więcej niż jednego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”, ponieważ możliwe jest użycie więcej niż jednego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu, ponieważ nie można konwertować ich na jeden typ. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”, ponieważ nie można konwertować ich na ten sam typ. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”, ponieważ nie można konwertować ich na ten sam typ. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu, ponieważ nie można konwertować ich na jeden typ.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”, ponieważ nie można konwertować ich na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”, ponieważ nie można konwertować ich na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatchStrictOff2"> <source>Option Strict On does not allow narrowing in implicit type conversions between method '{0}' and delegate '{1}'.</source> <target state="translated">Ustawienie Option Strict On nie zezwala na zawężanie w niejawnych konwersjach typów między metodą „{0}” a delegatem „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleReturnTypeOfMember2"> <source>'{0}' is not accessible in this context because the return type is not accessible.</source> <target state="translated">'Element „{0}” nie jest dostępny w tym kontekście, ponieważ typ zwracany jest niedostępny.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIdentifierOrGroup"> <source>'Group' or an identifier expected.</source> <target state="translated">'Oczekiwano elementu „Group” lub identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedGroup"> <source>'Group' not allowed in this context; identifier expected.</source> <target state="translated">'Element „Group” jest niedozwolony w tym kontekście; oczekiwano identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatchStrictOff3"> <source>Option Strict On does not allow narrowing in implicit type conversions between extension method '{0}' defined in '{2}' and delegate '{1}'.</source> <target state="translated">Ustawienie Option Strict On nie zezwala na zawężanie w niejawnych konwersjach typów między metodą rozszerzenia „{0}” zdefiniowaną w elemencie „{2}” a delegatem „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingIncompatible3"> <source>Extension Method '{0}' defined in '{2}' does not have a signature compatible with delegate '{1}'.</source> <target state="translated">Metoda rozszerzenia „{0}” zdefiniowana w elemencie „{2}” nie ma sygnatury zgodnej z delegatem „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNarrowing2"> <source>Argument matching parameter '{0}' narrows to '{1}'.</source> <target state="translated">Dopasowywanie argumentu dla parametru „{0}” powoduje zawężenie do typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadCandidate1"> <source> {0}</source> <target state="translated"> {0}</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyInitializedInStructure"> <source>Auto-implemented Properties contained in Structures cannot have initializers unless they are marked 'Shared'.</source> <target state="translated">Automatycznie implementowany obiekt Properties zawarty w obiekcie Structures nie może mieć inicjatorów, chyba że są oznaczone jako „Shared”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsElements"> <source>XML elements cannot be selected from type '{0}'.</source> <target state="translated">Nie można wybierać elementów XML z typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsAttributes"> <source>XML attributes cannot be selected from type '{0}'.</source> <target state="translated">Nie można wybierać atrybutów XML z typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsDescendants"> <source>XML descendant elements cannot be selected from type '{0}'.</source> <target state="translated">Nie można wybierać podrzędnych elementów XML z typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOrMemberNotGeneric2"> <source>Extension method '{0}' defined in '{1}' is not generic (or has no free type parameters) and so cannot have type arguments.</source> <target state="translated">Metoda rozszerzenia „{0}” zdefiniowana w elemencie „{1}” nie jest ogólna (lub nie ma parametrów typu dowolnego) i dlatego nie może mieć argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodCannotBeLateBound"> <source>Late-bound extension methods are not supported.</source> <target state="translated">Metody rozszerzenia z późnym wiązaniem nie są obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceArrayRankMismatch1"> <source>Cannot infer a data type for '{0}' because the array dimensions do not match.</source> <target state="translated">Nie można wywnioskować typu danych dla elementu „{0}”, ponieważ wymiary tablicy nie są zgodne.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryStrictDisallowImplicitObject"> <source>Type of the range variable cannot be inferred, and late binding is not allowed with Option Strict on. Use an 'As' clause to specify the type.</source> <target state="translated">Nie można wywnioskować typu zmiennej zakresu, a późne wiązanie nie jest dozwolone z ustawieniem Option Strict on. Użyj klauzuli „As”, aby określić typ.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedInterfaceWithGeneric"> <source>Type '{0}' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.</source> <target state="translated">Typ „{0}” nie może zostać osadzony, ponieważ ma argument ogólny. Rozważ wyłączenie osadzania typów międzyoperacyjnych.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseGenericTypeAcrossAssemblyBoundaries"> <source>Type '{0}' cannot be used across assembly boundaries because it has a generic type argument that is an embedded interop type.</source> <target state="translated">Typ „{0}” nie może być używany między granicami zestawu, ponieważ ma argument typu ogólnego, który jest osadzonym typem międzyoperacyjnym.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbol2"> <source>'{0}' is obsolete: '{1}'.</source> <target state="translated">'Element „{0}” jest przestarzały: „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbol2_Title"> <source>Type or member is obsolete</source> <target state="translated">Typ lub składowa jest przestarzała</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverloadBase4"> <source>{0} '{1}' shadows an overloadable member declared in the base {2} '{3}'. If you want to overload the base method, this method must be declared 'Overloads'.</source> <target state="translated">Element {0} „{1}” zasłania składową, która może zostać przeciążona i jest zadeklarowana w bazowym elemencie {2} „{3}”. Aby można było przeciążyć metodę bazową, ta metoda musi być zadeklarowana jako „Overloads”.</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverloadBase4_Title"> <source>Member shadows an overloadable member declared in the base type</source> <target state="translated">Składowa zasłania składową z możliwością przeciążenia zadeklarowaną w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_OverrideType5"> <source>{0} '{1}' conflicts with {2} '{1}' in the base {3} '{4}' and should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt z elementem {2} „{1}” w podstawowym elemencie {3} „{4}” i powinien być zadeklarowany jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_OverrideType5_Title"> <source>Member conflicts with member in the base type and should be declared 'Shadows'</source> <target state="translated">Wystąpił konflikt składowej ze składową w typie podstawowym — należy zadeklarować element „Shadows”</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverride2"> <source>{0} '{1}' shadows an overridable method in the base {2} '{3}'. To override the base method, this method must be declared 'Overrides'.</source> <target state="translated">Element {0} „{1}” zasłania w podstawowym elemencie {2} „{3}” metodę, którą można przesłonić. Aby można było przesłonić metodę podstawową, metoda ta musi być zadeklarowana jako „Overrides”.</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverride2_Title"> <source>Member shadows an overridable method in the base type</source> <target state="translated">Składowa zasłania metodę z możliwością przeciążenia zadeklarowaną w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultnessShadowed4"> <source>Default property '{0}' conflicts with the default property '{1}' in the base {2} '{3}'. '{0}' will be the default property. '{0}' should be declared 'Shadows'.</source> <target state="translated">Właściwość domyślna „{0}” powoduje konflikt z właściwością domyślną „{1}” w podstawowym elemencie {2} „{3}”. Właściwość „{0}” będzie domyślna. Właściwość „{0}” powinna zostać zadeklarowana jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultnessShadowed4_Title"> <source>Default property conflicts with the default property in the base type</source> <target state="translated">Wystąpił konflikt właściwości domyślnej z właściwością domyślną w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbolNoMessage1"> <source>'{0}' is obsolete.</source> <target state="translated">'Element „{0}” jest przestarzały.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbolNoMessage1_Title"> <source>Type or member is obsolete</source> <target state="translated">Typ lub składowa jest przestarzała</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration0"> <source>Possible problem detected while building assembly: {0}</source> <target state="translated">Wykryto potencjalny problem podczas kompilowania zestawu: {0}.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration0_Title"> <source>Possible problem detected while building assembly</source> <target state="translated">Wykryto potencjalny problem podczas kompilowania zestawu</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration1"> <source>Possible problem detected while building assembly '{0}': {1}</source> <target state="translated">Wykryto potencjalny problem podczas kompilowania zestawu „{0}”: {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration1_Title"> <source>Possible problem detected while building assembly</source> <target state="translated">Wykryto potencjalny problem podczas kompilowania zestawu</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassNoMembers1"> <source>'Microsoft.VisualBasic.ComClassAttribute' is specified for class '{0}' but '{0}' has no public members that can be exposed to COM; therefore, no COM interfaces are generated.</source> <target state="translated">'Element „Microsoft.VisualBasic.ComClassAttribute” jest określony dla klasy „{0}”, ale klasa „{0}” nie ma publicznych składowych, których można ujawnić w modelu COM. Z tego powodu nie wygenerowano interfejsów modelu COM.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassNoMembers1_Title"> <source>'Microsoft.VisualBasic.ComClassAttribute' is specified for class but class has no public members that can be exposed to COM</source> <target state="translated">'Atrybut „Microsoft.VisualBasic.ComClassAttribute” został określony dla klasy, ale klasa nie zawiera publicznych składowych, które można ujawnić modelowi COM</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsMember5"> <source>{0} '{1}' implicitly declares '{2}', which conflicts with a member in the base {3} '{4}', and so the {0} should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” niejawnie deklaruje element „{2}”, który powoduje konflikt ze składową w bazowym elemencie {3} „{4}” i dlatego element {0} powinien być zadeklarowany jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsMember5_Title"> <source>Property or event implicitly declares type or member that conflicts with a member in the base type</source> <target state="translated">Właściwość lub zdarzenie niejawnie deklaruje typ lub składową powodującą konflikt ze składową w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_MemberShadowsSynthMember6"> <source>{0} '{1}' conflicts with a member implicitly declared for {2} '{3}' in the base {4} '{5}' and should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt ze składową niejawnie zadeklarowaną dla elementu {2} „{3}” w bazowym elemencie {4} „{5}” i dlatego powinien być zadeklarowany jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberShadowsSynthMember6_Title"> <source>Member conflicts with a member implicitly declared for property or event in the base type</source> <target state="translated">Wystąpił konflikt składowej ze składową niejawnie zadeklarowaną dla właściwości lub zdarzenia w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsSynthMember7"> <source>{0} '{1}' implicitly declares '{2}', which conflicts with a member implicitly declared for {3} '{4}' in the base {5} '{6}'. {0} should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” deklaruje niejawnie element „{2}”, który powoduje konflikt ze składową niejawnie zadeklarowaną dla elementu {3} „{4}” w bazowym elemencie {5} „{6}”. Element {0} należy zadeklarować jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsSynthMember7_Title"> <source>Property or event implicitly declares member, which conflicts with a member implicitly declared for property or event in the base type</source> <target state="translated">Właściwość lub zdarzenie niejawnie deklaruje składową powodującą konflikt ze składową niejawnie zadeklarowaną dla właściwości lub zdarzenia w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor3"> <source>'{0}' accessor of '{1}' is obsolete: '{2}'.</source> <target state="translated">'Metoda dostępu „{0}” elementu „{1}” jest przestarzała: „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor3_Title"> <source>Property accessor is obsolete</source> <target state="translated">Metoda dostępu do właściwości jest przestarzała</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor2"> <source>'{0}' accessor of '{1}' is obsolete.</source> <target state="translated">'Metoda dostępu „{0}” elementu „{1}” jest przestarzała.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor2_Title"> <source>Property accessor is obsolete</source> <target state="translated">Metoda dostępu do właściwości jest przestarzała</target> <note /> </trans-unit> <trans-unit id="WRN_FieldNotCLSCompliant1"> <source>Type of member '{0}' is not CLS-compliant.</source> <target state="translated">Typ składowej „{0}” nie jest zgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_FieldNotCLSCompliant1_Title"> <source>Type of member is not CLS-compliant</source> <target state="translated">Typ składowej jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_BaseClassNotCLSCompliant2"> <source>'{0}' is not CLS-compliant because it derives from '{1}', which is not CLS-compliant.</source> <target state="translated">'Element „{0}” jest niezgodny ze specyfikacją CLS, ponieważ dziedziczy po elemencie „{1}”, który jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_BaseClassNotCLSCompliant2_Title"> <source>Type is not CLS-compliant because it derives from base type that is not CLS-compliant</source> <target state="translated">Typ jest niezgodny ze specyfikacją CLS, ponieważ pochodzi od typu podstawowego, który jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ProcTypeNotCLSCompliant1"> <source>Return type of function '{0}' is not CLS-compliant.</source> <target state="translated">Zwracany typ funkcji „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_ProcTypeNotCLSCompliant1_Title"> <source>Return type of function is not CLS-compliant</source> <target state="translated">Zwracany typ funkcji jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ParamNotCLSCompliant1"> <source>Type of parameter '{0}' is not CLS-compliant.</source> <target state="translated">Typ parametru „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_ParamNotCLSCompliant1_Title"> <source>Type of parameter is not CLS-compliant</source> <target state="translated">Typ parametru jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_InheritedInterfaceNotCLSCompliant2"> <source>'{0}' is not CLS-compliant because the interface '{1}' it inherits from is not CLS-compliant.</source> <target state="translated">'Element „{0}” jest niezgodny ze specyfikacją CLS, ponieważ interfejs „{1}”, po którym dziedziczy, jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_InheritedInterfaceNotCLSCompliant2_Title"> <source>Type is not CLS-compliant because the interface it inherits from is not CLS-compliant</source> <target state="translated">Typ jest niezgodny ze specyfikacją CLS, ponieważ interfejs, po którym on dziedziczy, jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLSMemberInNonCLSType3"> <source>{0} '{1}' cannot be marked CLS-compliant because its containing type '{2}' is not CLS-compliant.</source> <target state="translated">Elementu {0} „{1}” nie można oznaczyć jako zgodnego ze specyfikacją CLS, ponieważ jego zawierający typ „{2}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSMemberInNonCLSType3_Title"> <source>Member cannot be marked CLS-compliant because its containing type is not CLS-compliant</source> <target state="translated">Nie można oznaczyć składowej jako zgodnej ze specyfikacją CLS, ponieważ jej typ zawierający jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NameNotCLSCompliant1"> <source>Name '{0}' is not CLS-compliant.</source> <target state="translated">Nazwa „{0}” jest niezgodna ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NameNotCLSCompliant1_Title"> <source>Name is not CLS-compliant</source> <target state="translated">Nazwa jest niezgodna ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_EnumUnderlyingTypeNotCLS1"> <source>Underlying type '{0}' of Enum is not CLS-compliant.</source> <target state="translated">Typ bazowy „{0}” wyliczenia jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_EnumUnderlyingTypeNotCLS1_Title"> <source>Underlying type of Enum is not CLS-compliant</source> <target state="translated">Typ podstawowy wyliczenia jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMemberInCLSInterface1"> <source>Non CLS-compliant '{0}' is not allowed in a CLS-compliant interface.</source> <target state="translated">Element „{0}” niezgodny ze specyfikacją CLS jest niedozwolony w interfejsie zgodnym ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMemberInCLSInterface1_Title"> <source>Non CLS-compliant member is not allowed in a CLS-compliant interface</source> <target state="translated">Niezgodna ze specyfikacją CLS składowa jest niedozwolona w interfejsie zgodnym ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMustOverrideInCLSType1"> <source>Non CLS-compliant 'MustOverride' member is not allowed in CLS-compliant type '{0}'.</source> <target state="translated">Składowa „MustOverride” niezgodna ze specyfikacją CLS nie jest dozwolona w elementach „{0}” zgodnych ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMustOverrideInCLSType1_Title"> <source>Non CLS-compliant 'MustOverride' member is not allowed in CLS-compliant type</source> <target state="translated">Niezgodna ze specyfikacją CLS składowa „MustOverride” jest niedozwolona w typie zgodnym ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayOverloadsNonCLS2"> <source>'{0}' is not CLS-compliant because it overloads '{1}' which differs from it only by array of array parameter types or by the rank of the array parameter types.</source> <target state="translated">Element „{0}” nie jest zgodny ze specyfikacją CLS, ponieważ przeciąża element „{1}”, który różni się od niego tylko tablicą typów parametrów tablicowych lub rangą typów parametrów tablicowych.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayOverloadsNonCLS2_Title"> <source>Method is not CLS-compliant because it overloads method which differs from it only by array of array parameter types or by the rank of the array parameter types</source> <target state="translated">Metoda jest niezgodna ze specyfikacją CLS, ponieważ przeciąża metodę, która różni się od niej tylko tablicą typów parametrów tablicowych lub rangą typów parametrów tablicowych</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant1"> <source>Root namespace '{0}' is not CLS-compliant.</source> <target state="translated">Główna przestrzeń nazw „{0}” jest niezgodna ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant1_Title"> <source>Root namespace is not CLS-compliant</source> <target state="translated">Główna przestrzeń nazw jest niezgodna ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant2"> <source>Name '{0}' in the root namespace '{1}' is not CLS-compliant.</source> <target state="translated">Nazwa „{0}” w głównej przestrzeni nazw „{1}” jest niezgodna ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant2_Title"> <source>Part of the root namespace is not CLS-compliant</source> <target state="translated">Część głównej przestrzeni nazw jest niezgodna ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_GenericConstraintNotCLSCompliant1"> <source>Generic parameter constraint type '{0}' is not CLS-compliant.</source> <target state="translated">Typ ograniczenia parametru ogólnego „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_GenericConstraintNotCLSCompliant1_Title"> <source>Generic parameter constraint type is not CLS-compliant</source> <target state="translated">Typ ograniczenia parametru ogólnego jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_TypeNotCLSCompliant1"> <source>Type '{0}' is not CLS-compliant.</source> <target state="translated">Typ „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeNotCLSCompliant1_Title"> <source>Type is not CLS-compliant</source> <target state="translated">Typ nie jest zgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_OptionalValueNotCLSCompliant1"> <source>Type of optional value for optional parameter '{0}' is not CLS-compliant.</source> <target state="translated">Typ wartości opcjonalnej dla parametru opcjonalnego „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_OptionalValueNotCLSCompliant1_Title"> <source>Type of optional value for optional parameter is not CLS-compliant</source> <target state="translated">Typ opcjonalnej wartości parametru opcjonalnego jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLSAttrInvalidOnGetSet"> <source>System.CLSCompliantAttribute cannot be applied to property 'Get' or 'Set'.</source> <target state="translated">Nie można zastosować elementu System.CLSCompliantAttribute do właściwości „Get” lub „Set”.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSAttrInvalidOnGetSet_Title"> <source>System.CLSCompliantAttribute cannot be applied to property 'Get' or 'Set'</source> <target state="translated">Nie można zastosować elementu System.CLSCompliantAttribute do właściwości „Get” lub „Set”</target> <note /> </trans-unit> <trans-unit id="WRN_TypeConflictButMerged6"> <source>{0} '{1}' and partial {2} '{3}' conflict in {4} '{5}', but are being merged because one of them is declared partial.</source> <target state="translated">Element {0} „{1}” i częściowy element {2} „{3}” powodują konflikt w elemencie {4} „{5}”, ale są scalane, ponieważ jeden z nich jest zadeklarowany jako częściowy.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeConflictButMerged6_Title"> <source>Type and partial type conflict, but are being merged because one of them is declared partial</source> <target state="translated">Wystąpił konflikt typu i typu częściowego, ale trwa ich scalanie, ponieważ jeden z nich został zadeklarowany jako częściowy</target> <note /> </trans-unit> <trans-unit id="WRN_ShadowingGenericParamWithParam1"> <source>Type parameter '{0}' has the same name as a type parameter of an enclosing type. Enclosing type's type parameter will be shadowed.</source> <target state="translated">Parametr typu „{0}” ma taką samą nazwę jak parametr typu zamykającego. Parametr typu zamykającego zostanie zasłonięty.</target> <note /> </trans-unit> <trans-unit id="WRN_ShadowingGenericParamWithParam1_Title"> <source>Type parameter has the same name as a type parameter of an enclosing type</source> <target state="translated">Parametr typu ma taką samą nazwę jak parametr typu otaczającego</target> <note /> </trans-unit> <trans-unit id="WRN_CannotFindStandardLibrary1"> <source>Could not find standard library '{0}'.</source> <target state="translated">Nie można odnaleźć biblioteki standardowej „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_CannotFindStandardLibrary1_Title"> <source>Could not find standard library</source> <target state="translated">Nie można odnaleźć biblioteki standardowej</target> <note /> </trans-unit> <trans-unit id="WRN_EventDelegateTypeNotCLSCompliant2"> <source>Delegate type '{0}' of event '{1}' is not CLS-compliant.</source> <target state="translated">Typ delegowany „{0}” zdarzenia „{1}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_EventDelegateTypeNotCLSCompliant2_Title"> <source>Delegate type of event is not CLS-compliant</source> <target state="translated">Typ delegowania zdarzenia jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_DebuggerHiddenIgnoredOnProperties"> <source>System.Diagnostics.DebuggerHiddenAttribute does not affect 'Get' or 'Set' when applied to the Property definition. Apply the attribute directly to the 'Get' and 'Set' procedures as appropriate.</source> <target state="translated">Atrybut System.Diagnostics.DebuggerHiddenAttribute nie ma wpływu na elementy „Get” ani „Set”, gdy jest stosowany do definicji Property. Zastosuj atrybut bezpośrednio do odpowiednich procedur „Get” i „Set”.</target> <note /> </trans-unit> <trans-unit id="WRN_DebuggerHiddenIgnoredOnProperties_Title"> <source>System.Diagnostics.DebuggerHiddenAttribute does not affect 'Get' or 'Set' when applied to the Property definition</source> <target state="translated">Atrybut System.Diagnostics.DebuggerHiddenAttribute zastosowany dla definicji właściwości nie ma wpływu na właściwości „Get” lub „Set”</target> <note /> </trans-unit> <trans-unit id="WRN_SelectCaseInvalidRange"> <source>Range specified for 'Case' statement is not valid. Make sure that the lower bound is less than or equal to the upper bound.</source> <target state="translated">Zakres określony dla instrukcji „Case” jest nieprawidłowy. Upewnij się, że dolna granica jest mniejsza lub równa górnej granicy.</target> <note /> </trans-unit> <trans-unit id="WRN_SelectCaseInvalidRange_Title"> <source>Range specified for 'Case' statement is not valid</source> <target state="translated">Zakres określony dla instrukcji „Case” jest nieprawidłowy</target> <note /> </trans-unit> <trans-unit id="WRN_CLSEventMethodInNonCLSType3"> <source>'{0}' method for event '{1}' cannot be marked CLS compliant because its containing type '{2}' is not CLS compliant.</source> <target state="translated">'Metody „{0}” dla zdarzenia „{1}” nie można oznaczyć jako zgodnej ze specyfikacją CLS, ponieważ jej typ zawierający „{2}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSEventMethodInNonCLSType3_Title"> <source>AddHandler or RemoveHandler method for event cannot be marked CLS compliant because its containing type is not CLS compliant</source> <target state="translated">Nie można oznaczyć metody AddHandler lub RemoveHandler dla zdarzenia jako zgodnej ze specyfikacją CLS, ponieważ jej typ zawierający jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ExpectedInitComponentCall2"> <source>'{0}' in designer-generated type '{1}' should call InitializeComponent method.</source> <target state="translated">Element „{0}” w typie wygenerowanym przez projektanta „{1}” powinien wywoływać metodę InitializeComponent.</target> <note /> </trans-unit> <trans-unit id="WRN_ExpectedInitComponentCall2_Title"> <source>Constructor in designer-generated type should call InitializeComponent method</source> <target state="translated">Konstruktor w typie wygenerowanym przez projektanta powinien wywoływać metodę InitializeComponent</target> <note /> </trans-unit> <trans-unit id="WRN_NamespaceCaseMismatch3"> <source>Casing of namespace name '{0}' does not match casing of namespace name '{1}' in '{2}'.</source> <target state="translated">Wielkość liter nazwy przestrzeni nazw „{0}” nie pasuje do wielkości liter nazwy przestrzeni nazw „{1}” w pliku „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_NamespaceCaseMismatch3_Title"> <source>Casing of namespace name does not match</source> <target state="translated">Niezgodna wielkość liter w nazwie przestrzeni nazw</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyNamespaceOrClass1"> <source>Namespace or type specified in the Imports '{0}' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.</source> <target state="translated">Przestrzeń nazw lub typ określony w elemencie Imports „{0}” nie zawiera żadnej publicznej składowej lub nie można jej znaleźć. Upewnij się, że przestrzeń nazw lub typ są zdefiniowane i zawierają co najmniej jedną publiczną składową. Upewnij się, że w nazwie importowanego elementu nie są używane aliasy.</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyNamespaceOrClass1_Title"> <source>Namespace or type specified in Imports statement doesn't contain any public member or cannot be found</source> <target state="translated">Przestrzeń nazw lub typ określony w instrukcji Imports nie zawiera żadnej publicznej składowej lub nie można jej znaleźć</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyProjectNamespaceOrClass1"> <source>Namespace or type specified in the project-level Imports '{0}' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.</source> <target state="translated">Przestrzeń nazw lub typ określony w elemencie Imports „{0}” na poziomie projektu nie zawiera żadnej publicznej składowej lub nie można jej znaleźć. Upewnij się, że przestrzeń nazw lub typ zostały zdefiniowane i zawierają co najmniej jedną publiczną składową. Upewnij się, że w nazwie importowanego elementu nie są używane aliasy.</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyProjectNamespaceOrClass1_Title"> <source>Namespace or type imported at project level doesn't contain any public member or cannot be found</source> <target state="translated">Przestrzeń nazw lub typ zaimportowany na poziomie projektu nie zawiera żadnej publicznej składowej lub nie można jej znaleźć</target> <note /> </trans-unit> <trans-unit id="WRN_IndirectRefToLinkedAssembly2"> <source>A reference was created to embedded interop assembly '{0}' because of an indirect reference to that assembly from assembly '{1}'. Consider changing the 'Embed Interop Types' property on either assembly.</source> <target state="translated">Utworzono odwołanie do osadzonego zestawu międzyoperacyjnego „{0}” z powodu pośredniego odwołania do tego zestawu z zestawu „{1}”. Rozważ zmianę właściwości osadzania typów międzyoperacyjnych w jednym z zestawów.</target> <note /> </trans-unit> <trans-unit id="WRN_IndirectRefToLinkedAssembly2_Title"> <source>A reference was created to embedded interop assembly because of an indirect reference to that assembly</source> <target state="translated">Utworzono odwołanie do osadzonego zestawu międzyoperacyjnego z powodu pośredniego odwołania do tego zestawu</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase3"> <source>Class '{0}' should declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete.</source> <target state="translated">Klasa „{0}” powinna deklarować element „Sub New”, ponieważ element „{1}” w swojej klasie bazowej „{2}” jest oznaczony jako przestarzały.</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase3_Title"> <source>Class should declare a 'Sub New' because the constructor in its base class is marked obsolete</source> <target state="translated">Należy zadeklarować element „Sub New” w klasie, ponieważ konstruktor w klasie bazowej został oznaczony jako przestarzały</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase4"> <source>Class '{0}' should declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete: '{3}'.</source> <target state="translated">Klasa „{0}” powinna deklarować element „Sub New”, ponieważ element „{1}” w swojej klasie bazowej „{2}” jest oznaczony jako przestarzały: „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase4_Title"> <source>Class should declare a 'Sub New' because the constructor in its base class is marked obsolete</source> <target state="translated">Należy zadeklarować element „Sub New” w klasie, ponieważ konstruktor w klasie bazowej został oznaczony jako przestarzały</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall3"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete.</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” powinna być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ element „{0}” w klasie bazowej „{1}” elementu „{2}” jest oznaczony jako przestarzały.</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall3_Title"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the constructor in the base class is marked obsolete</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” powinna być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ konstruktor w klasie bazowej został oznaczony jako przestarzały</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall4"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete: '{3}'</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” powinna być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ element „{0}” w klasie bazowej „{1}” elementu „{2}” jest oznaczony jako przestarzały: „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall4_Title"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the constructor in the base class is marked obsolete</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” powinna być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ konstruktor w klasie bazowej został oznaczony jako przestarzały</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinOperator"> <source>Operator without an 'As' clause; type of Object assumed.</source> <target state="translated">Operator bez klauzuli As; przyjęto typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinOperator_Title"> <source>Operator without an 'As' clause</source> <target state="translated">Operator bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_ConstraintsFailedForInferredArgs2"> <source>Type arguments inferred for method '{0}' result in the following warnings :{1}</source> <target state="translated">Argumenty typu wywnioskowane dla metody „{0}” powodują wystąpienie następujących ostrzeżeń: {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_ConstraintsFailedForInferredArgs2_Title"> <source>Type arguments inferred for method result in warnings</source> <target state="translated">Argumenty typu wywnioskowane dla metody powodują ostrzeżenia</target> <note /> </trans-unit> <trans-unit id="WRN_ConditionalNotValidOnFunction"> <source>Attribute 'Conditional' is only valid on 'Sub' declarations.</source> <target state="translated">Atrybut „Conditional” jest prawidłowy tylko w deklaracjach „Sub”.</target> <note /> </trans-unit> <trans-unit id="WRN_ConditionalNotValidOnFunction_Title"> <source>Attribute 'Conditional' is only valid on 'Sub' declarations</source> <target state="translated">Atrybut „Conditional” jest prawidłowy tylko w deklaracjach „Sub”</target> <note /> </trans-unit> <trans-unit id="WRN_UseSwitchInsteadOfAttribute"> <source>Use command-line option '{0}' or appropriate project settings instead of '{1}'.</source> <target state="translated">Użyj opcji wiersza polecenia „{0}” lub odpowiednich ustawień projektu zamiast elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UseSwitchInsteadOfAttribute_Title"> <source>Use command-line option /keyfile, /keycontainer, or /delaysign instead of AssemblyKeyFileAttribute, AssemblyKeyNameAttribute, or AssemblyDelaySignAttribute</source> <target state="translated">Użyj opcji wiersza polecenia /keyfile, /keycontainer lub /delaysign zamiast AssemblyKeyFileAttribute, AssemblyKeyNameAttribute lub AssemblyDelaySignAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveAddHandlerCall"> <source>Statement recursively calls the containing '{0}' for event '{1}'.</source> <target state="translated">Instrukcja cyklicznie wywołuje zawierający ją element „{0}” dla zdarzenia „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveAddHandlerCall_Title"> <source>Statement recursively calls the event's containing AddHandler</source> <target state="translated">Instrukcja rekursywnie wywołuje zawierający ją element AddHandler dla zdarzenia</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionCopyBack"> <source>Implicit conversion from '{1}' to '{2}' in copying the value of 'ByRef' parameter '{0}' back to the matching argument.</source> <target state="translated">Niejawna konwersja z „{1}” na „{2}” podczas kopiowania wartości parametru „ByRef” „{0}” z powrotem do pasującego argumentu.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionCopyBack_Title"> <source>Implicit conversion in copying the value of 'ByRef' parameter back to the matching argument</source> <target state="translated">Niejawna konwersja podczas kopiowania wartości parametru „ByRef” z powrotem do pasującego argumentu</target> <note /> </trans-unit> <trans-unit id="WRN_MustShadowOnMultipleInheritance2"> <source>{0} '{1}' conflicts with other members of the same name across the inheritance hierarchy and so should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt z innymi składowymi o tej samej nazwie w hierarchii dziedziczenia i dlatego powinien być zadeklarowany jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_MustShadowOnMultipleInheritance2_Title"> <source>Method conflicts with other members of the same name across the inheritance hierarchy and so should be declared 'Shadows'</source> <target state="translated">Wystąpił konflikt metody z innymi składowymi o tej samej nazwie w hierarchii dziedziczenia — należy zadeklarować element „Shadows”</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveOperatorCall"> <source>Expression recursively calls the containing Operator '{0}'.</source> <target state="translated">Wyrażenie cyklicznie wywołuje zawierający je operator „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveOperatorCall_Title"> <source>Expression recursively calls the containing Operator</source> <target state="translated">Wyrażenie rekursywnie wywołuje zawierający je operator</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversion2"> <source>Implicit conversion from '{0}' to '{1}'.</source> <target state="translated">Niejawna konwersja z „{0}” na „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversion2_Title"> <source>Implicit conversion</source> <target state="translated">Niejawna konwersja</target> <note /> </trans-unit> <trans-unit id="WRN_MutableStructureInUsing"> <source>Local variable '{0}' is read-only and its type is a structure. Invoking its members or passing it ByRef does not change its content and might lead to unexpected results. Consider declaring this variable outside of the 'Using' block.</source> <target state="translated">Zmienna lokalna „{0}” jest tylko do odczytu i jej typ jest strukturą. Wywoływanie jej składowych lub przekazywanie jej przez odwołanie (ByRef) nie zmienia jej zawartości i może prowadzić do nieoczekiwanych wyników. Rozważ zadeklarowanie tej zmiennej poza blokiem „Using”.</target> <note /> </trans-unit> <trans-unit id="WRN_MutableStructureInUsing_Title"> <source>Local variable declared by Using statement is read-only and its type is a structure</source> <target state="translated">Zmienna lokalna zadeklarowana przez instrukcję Using jest przeznaczona tylko do odczytu i jej typem jest struktura</target> <note /> </trans-unit> <trans-unit id="WRN_MutableGenericStructureInUsing"> <source>Local variable '{0}' is read-only. When its type is a structure, invoking its members or passing it ByRef does not change its content and might lead to unexpected results. Consider declaring this variable outside of the 'Using' block.</source> <target state="translated">Zmienna lokalna „{0}” jest tylko do odczytu. Gdy jej typ jest strukturą, wywoływanie jej składowych lub przekazywanie jej przez odwołanie (ByRef) nie zmienia jej zawartości i może prowadzić do nieoczekiwanych wyników. Rozważ zadeklarowanie tej zmiennej poza blokiem „Using”.</target> <note /> </trans-unit> <trans-unit id="WRN_MutableGenericStructureInUsing_Title"> <source>Local variable declared by Using statement is read-only and its type may be a structure</source> <target state="translated">Zmienna lokalna zadeklarowana przez instrukcję Using jest przeznaczona tylko do odczytu i jej typem może być struktura</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionSubst1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionSubst1_Title"> <source>Implicit conversion</source> <target state="translated">Niejawna konwersja</target> <note /> </trans-unit> <trans-unit id="WRN_LateBindingResolution"> <source>Late bound resolution; runtime errors could occur.</source> <target state="translated">Rozpoznanie późnego wiązania; mogą wystąpić błędy w czasie wykonywania.</target> <note /> </trans-unit> <trans-unit id="WRN_LateBindingResolution_Title"> <source>Late bound resolution</source> <target state="translated">Rozpoznawanie późnego wiązania</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1"> <source>Operands of type Object used for operator '{0}'; use the 'Is' operator to test object identity.</source> <target state="translated">Argumenty operacji typu Object użyte dla operatora „{0}”; użyj operatora „Is”, aby sprawdzić tożsamość obiektu.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1_Title"> <source>Operands of type Object used for operator</source> <target state="translated">Dla operatora użyto argumentów operacji typu Object</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath2"> <source>Operands of type Object used for operator '{0}'; runtime errors could occur.</source> <target state="translated">Argumenty operacji typu Object użyte dla operatora „{0}”; mogą wystąpić błędy podczas wykonywania.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath2_Title"> <source>Operands of type Object used for operator</source> <target state="translated">Dla operatora użyto argumentów operacji typu Object</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedVar1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedVar1_Title"> <source>Variable declaration without an 'As' clause</source> <target state="translated">Deklaracja zmiennej bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumed1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumed1_Title"> <source>Function without an 'As' clause</source> <target state="translated">Funkcja bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedProperty1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedProperty1_Title"> <source>Property without an 'As' clause</source> <target state="translated">Właściwość bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinVarDecl"> <source>Variable declaration without an 'As' clause; type of Object assumed.</source> <target state="translated">Deklaracja zmiennej bez klauzuli „As”; przyjęto typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinVarDecl_Title"> <source>Variable declaration without an 'As' clause</source> <target state="translated">Deklaracja zmiennej bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinFunction"> <source>Function without an 'As' clause; return type of Object assumed.</source> <target state="translated">Funkcja bez klauzuli „As”; przyjęto zwracany typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinFunction_Title"> <source>Function without an 'As' clause</source> <target state="translated">Funkcja bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinProperty"> <source>Property without an 'As' clause; type of Object assumed.</source> <target state="translated">Właściwość bez klauzuli „As”; przyjęto typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinProperty_Title"> <source>Property without an 'As' clause</source> <target state="translated">Właściwość bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocal"> <source>Unused local variable: '{0}'.</source> <target state="translated">Nieużywana zmienna lokalna: „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocal_Title"> <source>Unused local variable</source> <target state="translated">Nieużyta zmienna lokalna</target> <note /> </trans-unit> <trans-unit id="WRN_SharedMemberThroughInstance"> <source>Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.</source> <target state="translated">Dostęp przez wystąpienie do udostępnionej składowej, stałej składowej, składowej wyliczenia lub typu zagnieżdżonego; wyrażenie kwalifikujące nie zostanie obliczone.</target> <note /> </trans-unit> <trans-unit id="WRN_SharedMemberThroughInstance_Title"> <source>Access of shared member, constant member, enum member or nested type through an instance</source> <target state="translated">Dostęp przez wystąpienie do udostępnionej składowej, stałej składowej, składowej wyliczenia lub typu zagnieżdżonego</target> <note /> </trans-unit> <trans-unit id="WRN_RecursivePropertyCall"> <source>Expression recursively calls the containing property '{0}'.</source> <target state="translated">Wyrażenie cyklicznie wywołuje zawierającą je właściwość „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursivePropertyCall_Title"> <source>Expression recursively calls the containing property</source> <target state="translated">Wyrażenie rekursywnie wywołuje zawierającą je właściwość</target> <note /> </trans-unit> <trans-unit id="WRN_OverlappingCatch"> <source>'Catch' block never reached, because '{0}' inherits from '{1}'.</source> <target state="translated">'Blok „Catch” nigdy nie został osiągnięty, ponieważ element „{0}” dziedziczy po elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_OverlappingCatch_Title"> <source>'Catch' block never reached; exception type's base type handled above in the same Try statement</source> <target state="translated">'Blok „Catch” nie jest nigdy osiągany; typ podstawowy typu wyjątku jest obsługiwany powyżej w tej samej instrukcji Try</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRef"> <source>Variable '{0}' is passed by reference before it has been assigned a value. A null reference exception could result at runtime.</source> <target state="translated">Zmienna „{0}” jest przekazywana przez referencję, zanim zostanie do niej przypisana wartość. W czasie wykonania może wystąpić wyjątek referencji o wartości null.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRef_Title"> <source>Variable is passed by reference before it has been assigned a value</source> <target state="translated">Zmienna została przekazana przez referencję przed przypisaniem do niej wartości</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateCatch"> <source>'Catch' block never reached; '{0}' handled above in the same Try statement.</source> <target state="translated">'Blok „Catch” nie został nigdy osiągnięty; element „{0}” został obsłużony powyżej w tej samej instrukcji Try.</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateCatch_Title"> <source>'Catch' block never reached; exception type handled above in the same Try statement</source> <target state="translated">'Blok „Catch” nie jest nigdy osiągany; typ wyjątku jest obsługiwany powyżej w tej samej instrukcji Try</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1Not"> <source>Operands of type Object used for operator '{0}'; use the 'IsNot' operator to test object identity.</source> <target state="translated">Argumenty operacji typu Object użyte dla operatora „{0}”; użyj operatora „IsNot”, aby sprawdzić tożsamość obiektu.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1Not_Title"> <source>Operands of type Object used for operator &lt;&gt;</source> <target state="translated">Dla operatora &lt;&gt; użyto argumentów operacji typu Object</target> <note /> </trans-unit> <trans-unit id="WRN_BadChecksumValExtChecksum"> <source>Bad checksum value, non hex digits or odd number of hex digits.</source> <target state="translated">Nieprawidłowa wartość sumy kontrolnej, cyfry nieszesnastkowe lub nieparzysta liczba cyfr szesnastkowych.</target> <note /> </trans-unit> <trans-unit id="WRN_BadChecksumValExtChecksum_Title"> <source>Bad checksum value, non hex digits or odd number of hex digits</source> <target state="translated">Nieprawidłowa wartość sumy kontrolnej, cyfry nieszesnastkowe lub nieparzysta liczba cyfr szesnastkowych</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleDeclFileExtChecksum"> <source>File name already declared with a different GUID and checksum value.</source> <target state="translated">Nazwa pliku została już zadeklarowana z innym identyfikatorem GUID i wartością sumy kontrolnej.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleDeclFileExtChecksum_Title"> <source>File name already declared with a different GUID and checksum value</source> <target state="translated">Nazwa pliku została już zadeklarowana z innym identyfikatorem GUID i inną wartością sumy kontrolnej</target> <note /> </trans-unit> <trans-unit id="WRN_BadGUIDFormatExtChecksum"> <source>Bad GUID format.</source> <target state="translated">Nieprawidłowy format identyfikatora GUID.</target> <note /> </trans-unit> <trans-unit id="WRN_BadGUIDFormatExtChecksum_Title"> <source>Bad GUID format</source> <target state="translated">Nieprawidłowy format identyfikatora GUID</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMathSelectCase"> <source>Operands of type Object used in expressions for 'Select', 'Case' statements; runtime errors could occur.</source> <target state="translated">Argumenty operacji typu Object używane w wyrażeniach dla instrukcji Select, Case; mogą wystąpić błędy czasu wykonania.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMathSelectCase_Title"> <source>Operands of type Object used in expressions for 'Select', 'Case' statements</source> <target state="translated">W wyrażeniach dla instrukcji „Select” i „Case” użyto argumentów operacji typu Object</target> <note /> </trans-unit> <trans-unit id="WRN_EqualToLiteralNothing"> <source>This expression will always evaluate to Nothing (due to null propagation from the equals operator). To check if the value is null consider using 'Is Nothing'.</source> <target state="translated">Wartością tego wyrażenia zawsze będzie Nothing (z powodu propagacji wartości null z operatora równości). Aby sprawdzać, czy wartość jest równa null, rozważ użycie warunku „Is Nothing”.</target> <note /> </trans-unit> <trans-unit id="WRN_EqualToLiteralNothing_Title"> <source>This expression will always evaluate to Nothing</source> <target state="translated">To wyrażenie zawsze da wynik Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_NotEqualToLiteralNothing"> <source>This expression will always evaluate to Nothing (due to null propagation from the equals operator). To check if the value is not null consider using 'IsNot Nothing'.</source> <target state="translated">Wartością tego wyrażenia zawsze będzie Nothing (z powodu propagacji wartości null z operatora równości). Aby sprawdzać, czy wartość nie jest równa null, rozważ użycie warunku „IsNot Nothing”.</target> <note /> </trans-unit> <trans-unit id="WRN_NotEqualToLiteralNothing_Title"> <source>This expression will always evaluate to Nothing</source> <target state="translated">To wyrażenie zawsze da wynik Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocalConst"> <source>Unused local constant: '{0}'.</source> <target state="translated">Nieużywana stała lokalna: „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocalConst_Title"> <source>Unused local constant</source> <target state="translated">Nieużywana stała lokalna</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassInterfaceShadows5"> <source>'Microsoft.VisualBasic.ComClassAttribute' on class '{0}' implicitly declares {1} '{2}', which conflicts with a member of the same name in {3} '{4}'. Use 'Microsoft.VisualBasic.ComClassAttribute(InterfaceShadows:=True)' if you want to hide the name on the base {4}.</source> <target state="translated">'Element „Microsoft.VisualBasic.ComClassAttribute” w klasie „{0}” niejawnie deklaruje element {1} „{2}”, który powoduje konflikt ze składową o tej samej nazwie w elemencie {3} „{4}”. Użyj elementu „Microsoft.VisualBasic.ComClassAttribute(InterfaceShadows:=True)”, jeśli chcesz ukryć nazwę w bazie {4}.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassInterfaceShadows5_Title"> <source>'Microsoft.VisualBasic.ComClassAttribute' on class implicitly declares member, which conflicts with a member of the same name</source> <target state="translated">'Atrybut „Microsoft.VisualBasic.ComClassAttribute” klasy niejawnie deklaruje składową pozostającą w konflikcie ze składową o tej samej nazwie</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassPropertySetObject1"> <source>'{0}' cannot be exposed to COM as a property 'Let'. You will not be able to assign non-object values (such as numbers or strings) to this property from Visual Basic 6.0 using a 'Let' statement.</source> <target state="translated">'Element „{0}” nie może być ujawniony dla modelu COM jako instrukcja „Let” właściwości. Przy użyciu instrukcji „Let” nie będzie można przypisać do tej właściwości wartości niebędących obiektami (takich jak liczby czy ciągi) w języku Visual Basic 6.0.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassPropertySetObject1_Title"> <source>Property cannot be exposed to COM as a property 'Let'</source> <target state="translated">Nie można ujawnić właściwości modelowi COM jako właściwości „Let”</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRef"> <source>Variable '{0}' is used before it has been assigned a value. A null reference exception could result at runtime.</source> <target state="translated">Zmienna „{0}” jest używana, zanim zostanie do niej przypisana wartość. Podczas wykonywania może wystąpić wyjątek pustej referencji.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRef_Title"> <source>Variable is used before it has been assigned a value</source> <target state="translated">Zmienna została użyta przed przypisaniem do niej wartości</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncRef1"> <source>Function '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">Funkcja „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Podczas wykonywania może wystąpić wyjątek pustej referencji, gdy zostanie użyty wynik.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncRef1_Title"> <source>Function doesn't return a value on all code paths</source> <target state="translated">Funkcja nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpRef1"> <source>Operator '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">Operator „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Podczas wykonywania może wystąpić wyjątek pustej referencji, gdy zostanie użyty wynik.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpRef1_Title"> <source>Operator doesn't return a value on all code paths</source> <target state="translated">Operator nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropRef1"> <source>Property '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">Właściwość „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Podczas wykonywania może wystąpić wyjątek pustej referencji, gdy zostanie użyty wynik.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropRef1_Title"> <source>Property doesn't return a value on all code paths</source> <target state="translated">Właściwość nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRefStr"> <source>Variable '{0}' is passed by reference before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use</source> <target state="translated">Zmienna „{0}” jest przekazywana przez referencję, zanim zostanie do niej przypisana wartość. Podczas wykonywania może wystąpić wyjątek referencji o wartości null. Upewnij się, że struktura lub wszystkie składowe odwołania są zainicjowane przed użyciem</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRefStr_Title"> <source>Variable is passed by reference before it has been assigned a value</source> <target state="translated">Zmienna została przekazana przez referencję przed przypisaniem do niej wartości</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefStr"> <source>Variable '{0}' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use</source> <target state="translated">Zmienna „{0}” jest używana, zanim zostanie do niej przypisana wartość. Podczas wykonywania może wystąpić wyjątek pustej referencji. Upewnij się, że struktura lub wszystkie składowe odwołania są zainicjowane przed użyciem.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefStr_Title"> <source>Variable is used before it has been assigned a value</source> <target state="translated">Zmienna została użyta przed przypisaniem do niej wartości</target> <note /> </trans-unit> <trans-unit id="WRN_StaticLocalNoInference"> <source>Static variable declared without an 'As' clause; type of Object assumed.</source> <target state="translated">Zmienna statyczna zadeklarowana bez klauzuli „As”; przyjęto typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_StaticLocalNoInference_Title"> <source>Static variable declared without an 'As' clause</source> <target state="translated">Zmienna statyczna zadeklarowana bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName"> <source>Assembly reference '{0}' is invalid and cannot be resolved.</source> <target state="translated">Odwołanie do zestawu „{0}” jest nieprawidłowe i nie można go rozpoznać.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName_Title"> <source>Assembly reference is invalid and cannot be resolved</source> <target state="translated">Odwołanie do zestawu jest nieprawidłowe i nie można go rozpoznać</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadXMLLine"> <source>XML comment block must immediately precede the language element to which it applies. XML comment will be ignored.</source> <target state="translated">Blok komentarza XML musi bezpośrednio poprzedzać element języka, do którego jest stosowany. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadXMLLine_Title"> <source>XML comment block must immediately precede the language element to which it applies</source> <target state="translated">Blok komentarza XML musi bezpośrednio poprzedzać element języka, do którego jest stosowany</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocMoreThanOneCommentBlock"> <source>Only one XML comment block is allowed per language element.</source> <target state="translated">Tylko jeden blok komentarza XML może przypadać na element języka.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocMoreThanOneCommentBlock_Title"> <source>Only one XML comment block is allowed per language element</source> <target state="translated">Dozwolony jest tylko jeden blok komentarza XML na element języka</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocNotFirstOnLine"> <source>XML comment must be the first statement on a line. XML comment will be ignored.</source> <target state="translated">Komentarz XML musi być pierwszą instrukcją w wierszu. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocNotFirstOnLine_Title"> <source>XML comment must be the first statement on a line</source> <target state="translated">Komentarz XML musi być pierwszą instrukcją w wierszu</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInsideMethod"> <source>XML comment cannot appear within a method or a property. XML comment will be ignored.</source> <target state="translated">Komentarz XML nie może występować w metodzie ani właściwości. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInsideMethod_Title"> <source>XML comment cannot appear within a method or a property</source> <target state="translated">Komentarz XML nie może występować w metodzie ani właściwości</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParseError1"> <source>XML documentation parse error: {0} XML comment will be ignored.</source> <target state="translated">Błąd analizowania dokumentacji XML: komentarz XML {0} zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParseError1_Title"> <source>XML documentation parse error</source> <target state="translated">Błąd analizowania dokumentacji XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocDuplicateXMLNode1"> <source>XML comment tag '{0}' appears with identical attributes more than once in the same XML comment block.</source> <target state="translated">Tag komentarza XML „{0}” występuje z identycznymi atrybutami więcej niż raz w tym samym bloku komentarza XML.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocDuplicateXMLNode1_Title"> <source>XML comment tag appears with identical attributes more than once in the same XML comment block</source> <target state="translated">Tag komentarza XML występuje z identycznymi atrybutami więcej niż raz w tym samym bloku komentarza XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocIllegalTagOnElement2"> <source>XML comment tag '{0}' is not permitted on a '{1}' language element.</source> <target state="translated">Tag komentarza XML „{0}” nie jest dozwolony w elemencie języka „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocIllegalTagOnElement2_Title"> <source>XML comment tag is not permitted on language element</source> <target state="translated">Tag komentarza XML nie jest dozwolony w elemencie języka</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadParamTag2"> <source>XML comment parameter '{0}' does not match a parameter on the corresponding '{1}' statement.</source> <target state="translated">Parametr komentarza XML „{0}” nie jest zgodny z parametrem w odpowiedniej instrukcji „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadParamTag2_Title"> <source>XML comment parameter does not match a parameter on the corresponding declaration statement</source> <target state="translated">Parametr komentarza XML jest niezgodny z parametrem w odpowiedniej instrukcji deklaracji</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParamTagWithoutName"> <source>XML comment parameter must have a 'name' attribute.</source> <target state="translated">Parametr komentarza XML musi mieć atrybut „name”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParamTagWithoutName_Title"> <source>XML comment parameter must have a 'name' attribute</source> <target state="translated">Parametr komentarza XML musi mieć atrybut „name”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefAttributeNotFound1"> <source>XML comment has a tag with a 'cref' attribute '{0}' that could not be resolved.</source> <target state="translated">Komentarz XML ma tag z atrybutem „cref” „{0}”, którego nie można rozpoznać.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefAttributeNotFound1_Title"> <source>XML comment has a tag with a 'cref' attribute that could not be resolved</source> <target state="translated">Komentarz XML ma tag z atrybutem „cref”, którego nie można rozpoznać</target> <note /> </trans-unit> <trans-unit id="WRN_XMLMissingFileOrPathAttribute1"> <source>XML comment tag 'include' must have a '{0}' attribute. XML comment will be ignored.</source> <target state="translated">Tag komentarza XML „include” musi mieć atrybut „{0}”. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLMissingFileOrPathAttribute1_Title"> <source>XML comment tag 'include' must have 'file' and 'path' attributes</source> <target state="translated">Tag komentarza XML „include” musi mieć atrybuty „file” i „path”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLCannotWriteToXMLDocFile2"> <source>Unable to create XML documentation file '{0}': {1}</source> <target state="translated">Nie można utworzyć pliku XML dokumentacji „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLCannotWriteToXMLDocFile2_Title"> <source>Unable to create XML documentation file</source> <target state="translated">Nie można utworzyć pliku XML dokumentacji</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocWithoutLanguageElement"> <source>XML documentation comments must precede member or type declarations.</source> <target state="translated">Komentarze dokumentacji XML muszą występować przed deklaracjami składowej lub typu.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocWithoutLanguageElement_Title"> <source>XML documentation comments must precede member or type declarations</source> <target state="translated">Komentarze dokumentacji XML muszą występować przed deklaracjami składowej lub typu</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnWriteOnlyProperty"> <source>XML comment tag 'returns' is not permitted on a 'WriteOnly' Property.</source> <target state="translated">Tag komentarza XML „returns” jest niedozwolony we właściwości „WriteOnly”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnWriteOnlyProperty_Title"> <source>XML comment tag 'returns' is not permitted on a 'WriteOnly' Property</source> <target state="translated">Tag komentarza XML „returns” jest niedozwolony we właściwości „WriteOnly”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocOnAPartialType"> <source>XML comment cannot be applied more than once on a partial {0}. XML comments for this {0} will be ignored.</source> <target state="translated">Komentarza XML nie można zastosować więcej niż raz w częściowym elemencie {0}. Komentarze XML dla tego elementu {0} zostaną zignorowane.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocOnAPartialType_Title"> <source>XML comment cannot be applied more than once on a partial type</source> <target state="translated">Nie można zastosować komentarza XML więcej niż raz w typie częściowym</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnADeclareSub"> <source>XML comment tag 'returns' is not permitted on a 'declare sub' language element.</source> <target state="translated">Tag komentarza XML „returns” jest niedozwolony w elemencie języka „declare sub”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnADeclareSub_Title"> <source>XML comment tag 'returns' is not permitted on a 'declare sub' language element</source> <target state="translated">Tag komentarza XML „returns” jest niedozwolony w elemencie języka „declare sub”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocStartTagWithNoEndTag"> <source>XML documentation parse error: Start tag '{0}' doesn't have a matching end tag. XML comment will be ignored.</source> <target state="translated">Błąd analizowania dokumentacji XML: tag początkowy „{0}” nie ma zgodnego tagu końcowego. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocStartTagWithNoEndTag_Title"> <source>XML documentation parse error: Start tag doesn't have a matching end tag</source> <target state="translated">Błąd analizowania dokumentacji XML: tag początkowy nie ma zgodnego tagu końcowego</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadGenericParamTag2"> <source>XML comment type parameter '{0}' does not match a type parameter on the corresponding '{1}' statement.</source> <target state="translated">Parametr typu komentarza XML „{0}” nie jest zgodny z parametrem typu w odpowiedniej instrukcji „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadGenericParamTag2_Title"> <source>XML comment type parameter does not match a type parameter on the corresponding declaration statement</source> <target state="translated">Parametr typu komentarza XML jest niezgodny z parametrem typu w odpowiedniej instrukcji deklaracji</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocGenericParamTagWithoutName"> <source>XML comment type parameter must have a 'name' attribute.</source> <target state="translated">Parametr typu komentarza XML musi mieć atrybut „name”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocGenericParamTagWithoutName_Title"> <source>XML comment type parameter must have a 'name' attribute</source> <target state="translated">Parametr typu komentarza XML musi mieć atrybut „name”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocExceptionTagWithoutCRef"> <source>XML comment exception must have a 'cref' attribute.</source> <target state="translated">Wyjątek komentarza XML musi mieć atrybut „cref”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocExceptionTagWithoutCRef_Title"> <source>XML comment exception must have a 'cref' attribute</source> <target state="translated">Wyjątek komentarza XML musi mieć atrybut „cref”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInvalidXMLFragment"> <source>Unable to include XML fragment '{0}' of file '{1}'.</source> <target state="translated">Nie można dołączyć fragmentu XML „{0}” pliku „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInvalidXMLFragment_Title"> <source>Unable to include XML fragment</source> <target state="translated">Nie można dołączyć fragmentu XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadFormedXML"> <source>Unable to include XML fragment '{1}' of file '{0}'. {2}</source> <target state="translated">Nie można dołączyć fragmentu XML „{0}” pliku „{1}”. {2}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadFormedXML_Title"> <source>Unable to include XML fragment</source> <target state="translated">Nie można dołączyć fragmentu XML</target> <note /> </trans-unit> <trans-unit id="WRN_InterfaceConversion2"> <source>Runtime errors might occur when converting '{0}' to '{1}'.</source> <target state="translated">Podczas konwertowania elementu „{0}” na „{1}” mogą wystąpić błędy czasu wykonywania.</target> <note /> </trans-unit> <trans-unit id="WRN_InterfaceConversion2_Title"> <source>Runtime errors might occur when converting to or from interface type</source> <target state="translated">Błędy w czasie wykonywania mogą występować podczas konwertowania na typ interfejsu lub z tego typu</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableLambda"> <source>Using the iteration variable in a lambda expression may have unexpected results. Instead, create a local variable within the loop and assign it the value of the iteration variable.</source> <target state="translated">Użycie zmiennej iteracyjnej w wyrażeniu lambda może spowodować nieoczekiwane wyniki. Zamiast tego utwórz zmienną lokalną w pętli i przypisz jej wartość zmiennej iteracyjnej.</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableLambda_Title"> <source>Using the iteration variable in a lambda expression may have unexpected results</source> <target state="translated">Użycie zmiennej iteracji w wyrażeniu lambda może mieć nieoczekiwane skutki</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaPassedToRemoveHandler"> <source>Lambda expression will not be removed from this event handler. Assign the lambda expression to a variable and use the variable to add and remove the event.</source> <target state="translated">Wyrażenie lambda nie zostanie usunięte z tej procedury obsługi zdarzeń. Przypisz wyrażenie lambda do zmiennej i używaj jej do dodawania i usuwania zdarzenia.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaPassedToRemoveHandler_Title"> <source>Lambda expression will not be removed from this event handler</source> <target state="translated">Wyrażenie lambda nie zostanie usunięte z tej procedury obsługi zdarzeń</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableQuery"> <source>Using the iteration variable in a query expression may have unexpected results. Instead, create a local variable within the loop and assign it the value of the iteration variable.</source> <target state="translated">Użycie zmiennej iteracyjnej w wyrażeniu zapytania może spowodować nieoczekiwane wyniki. Zamiast tego utwórz zmienną lokalną w pętli i przypisz jej wartość zmiennej iteracyjnej.</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableQuery_Title"> <source>Using the iteration variable in a query expression may have unexpected results</source> <target state="translated">Użycie zmiennej iteracji w wyrażeniu zapytania może mieć nieoczekiwane skutki</target> <note /> </trans-unit> <trans-unit id="WRN_RelDelegatePassedToRemoveHandler"> <source>The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event. Assign the 'AddressOf' expression to a variable, and use the variable to add or remove the method as the handler.</source> <target state="translated">Wyrażenie „AddressOf” nie przynosi efektów w tym kontekście, ponieważ argument metody dla wyrażenia „AddressOf” wymaga swobodnej konwersji na typ delegata zdarzenia. Przypisz wyrażenie „AddressOf” do zmiennej i używaj jej do dodawania lub usuwania metody jako procedury obsługi.</target> <note /> </trans-unit> <trans-unit id="WRN_RelDelegatePassedToRemoveHandler_Title"> <source>The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event</source> <target state="translated">Wyrażenie „AddressOf” nie przynosi efektów w tym kontekście, ponieważ argument metody dla wyrażenia „AddressOf” wymaga swobodnej konwersji na typ delegata zdarzenia</target> <note /> </trans-unit> <trans-unit id="WRN_QueryMissingAsClauseinVarDecl"> <source>Range variable is assumed to be of type Object because its type cannot be inferred. Use an 'As' clause to specify a different type.</source> <target state="translated">Przyjęto, że zmienna zakresu będzie typu Object, ponieważ nie można wywnioskować jej typu. Użyj klauzuli „As”, aby określić inny typ.</target> <note /> </trans-unit> <trans-unit id="WRN_QueryMissingAsClauseinVarDecl_Title"> <source>Range variable is assumed to be of type Object because its type cannot be inferred</source> <target state="translated">Przyjęto, że zmienna zakresu będzie typu Object, ponieważ nie można wywnioskować jej typu</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdaMissingFunction"> <source>Multiline lambda expression is missing 'End Function'.</source> <target state="translated">W wielowierszowym wyrażeniu lambda brakuje instrukcji „End Function”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdaMissingSub"> <source>Multiline lambda expression is missing 'End Sub'.</source> <target state="translated">W wielowierszowym wyrażeniu lambda brakuje instrukcji „End Sub”.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOnLambdaReturnType"> <source>Attributes cannot be applied to return types of lambda expressions.</source> <target state="translated">Nie można stosować atrybutów do zwracanych typów wyrażeń lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_SubDisallowsStatement"> <source>Statement is not valid inside a single-line statement lambda.</source> <target state="translated">Instrukcja wewnątrz jednowierszowej instrukcji lambda jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesBang"> <source>This single-line statement lambda must be enclosed in parentheses. For example: (Sub() &lt;statement&gt;)!key</source> <target state="translated">Jednowierszowa instrukcja lambda musi być ujęta w nawiasy. Na przykład: (Sub() &lt;instrukcja&gt;)!key</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesDot"> <source>This single-line statement lambda must be enclosed in parentheses. For example: (Sub() &lt;statement&gt;).Invoke()</source> <target state="translated">Jednowierszowa instrukcja lambda musi być ujęta w nawiasy. Na przykład: (Sub() &lt;instrukcja&gt;).Invoke()</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesLParen"> <source>This single-line statement lambda must be enclosed in parentheses. For example: Call (Sub() &lt;statement&gt;) ()</source> <target state="translated">Jednowierszowa instrukcja lambda musi być ujęta w nawiasy. Na przykład: Call (Sub() &lt;instrukcja&gt;) ()</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresSingleStatement"> <source>Single-line statement lambdas must include exactly one statement.</source> <target state="translated">Jednowierszowe instrukcje lambda muszą zawierać dokładnie jedną instrukcję.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticInLambda"> <source>Static local variables cannot be declared inside lambda expressions.</source> <target state="translated">Nie można deklarować statycznych zmiennych lokalnych wewnątrz wyrażeń lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializedExpandedProperty"> <source>Expanded Properties cannot be initialized.</source> <target state="translated">Rozszerzone właściwości nie mogą być zainicjowane.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCantHaveParams"> <source>Auto-implemented properties cannot have parameters.</source> <target state="translated">Właściwości zaimplementowane automatycznie nie mogą mieć parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCantBeWriteOnly"> <source>Auto-implemented properties cannot be WriteOnly.</source> <target state="translated">Właściwości implementowane automatycznie nie mogą mieć określonego ustawienia WriteOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFCount"> <source>'If' operator requires either two or three operands.</source> <target state="translated">'Operator „If” wymaga dwóch lub trzech argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NotACollection1"> <source>Cannot initialize the type '{0}' with a collection initializer because it is not a collection type.</source> <target state="translated">Nie można zainicjować typu „{0}” za pomocą inicjatora kolekcji, ponieważ to nie jest typ kolekcji.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAddMethod1"> <source>Cannot initialize the type '{0}' with a collection initializer because it does not have an accessible 'Add' method.</source> <target state="translated">Nie można zainicjować typu „{0}” za pomocą inicjatora kolekcji, ponieważ nie ma on dostępnej metody „Add”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantCombineInitializers"> <source>An Object Initializer and a Collection Initializer cannot be combined in the same initialization.</source> <target state="translated">Nie można łączyć inicjatora obiektu i inicjatora kolekcji w tej samej inicjacji.</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyAggregateInitializer"> <source>An aggregate collection initializer entry must contain at least one element.</source> <target state="translated">Wpis inicjatora kolekcji zagregowanej musi zawierać co najmniej jeden element.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEndElementNoMatchingStart"> <source>XML end element must be preceded by a matching start element.</source> <target state="translated">Końcowy element XML musi być poprzedzony zgodnym elementem początkowym.</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdasCannotContainOnError"> <source>'On Error' and 'Resume' cannot appear inside a lambda expression.</source> <target state="translated">'Instrukcje „On Error” i „Resume” nie mogą wystąpić wewnątrz wyrażenia lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceDisallowedHere"> <source>Keywords 'Out' and 'In' can only be used in interface and delegate declarations.</source> <target state="translated">Słów kluczowych „Out” oraz „In” można używać tylko w deklaracjach interfejsu i delegata.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEndCDataNotAllowedInContent"> <source>The literal string ']]&gt;' is not allowed in element content.</source> <target state="translated">Ciąg literału „]]&gt;” jest niedozwolony w zawartości elementu.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadsModifierInModule"> <source>Inappropriate use of '{0}' keyword in a module.</source> <target state="translated">Nieodpowiednie użycie słowa kluczowego „{0}” w module.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedTypeOrNamespace1"> <source>Type or namespace '{0}' is not defined.</source> <target state="translated">Nie zdefiniowano typu lub przestrzeni nazw „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IdentityDirectCastForFloat"> <source>Using DirectCast operator to cast a floating-point value to the same type is not supported.</source> <target state="translated">Używanie operatora DirectCast do rzutowania wartości zmiennoprzecinkowych do tego samego typu nie jest obsługiwane.</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteIdentityDirectCastForValueType"> <source>Using DirectCast operator to cast a value-type to the same type is obsolete.</source> <target state="translated">Użycie operatora DirectCast do rzutowania typu wartości na ten sam typ jest przestarzałe.</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteIdentityDirectCastForValueType_Title"> <source>Using DirectCast operator to cast a value-type to the same type is obsolete</source> <target state="translated">Użycie operatora DirectCast do rzutowania typu wartości na ten sam typ jest przestarzałe</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode"> <source>Unreachable code detected.</source> <target state="translated">Wykryto nieosiągalny kod.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode_Title"> <source>Unreachable code detected</source> <target state="translated">Wykryto nieosiągalny kod</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncVal1"> <source>Function '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">Funkcja „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Czy nie brakuje instrukcji „Return”?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncVal1_Title"> <source>Function doesn't return a value on all code paths</source> <target state="translated">Funkcja nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpVal1"> <source>Operator '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">Operator „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Czy nie brakuje instrukcji „Return”?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpVal1_Title"> <source>Operator doesn't return a value on all code paths</source> <target state="translated">Operator nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropVal1"> <source>Property '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">Właściwość „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Czy nie brakuje instrukcji „Return”?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropVal1_Title"> <source>Property doesn't return a value on all code paths</source> <target state="translated">Właściwość nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="ERR_NestedGlobalNamespace"> <source>Global namespace may not be nested in another namespace.</source> <target state="translated">Globalna przestrzeń nazw nie może być zagnieżdżona w innej przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatch6"> <source>'{0}' cannot expose type '{1}' in {2} '{3}' through {4} '{5}'.</source> <target state="translated">'Element „{0}” nie może ujawnić typu „{1}” w zakresie od {2} „{3}” do {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadMetaDataReference1"> <source>'{0}' cannot be referenced because it is not a valid assembly.</source> <target state="translated">'Nie można odwołać się do elementu „{0}”, ponieważ nie jest to poprawny zestaw.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyDoesntImplementAllAccessors"> <source>'{0}' cannot be implemented by a {1} property.</source> <target state="translated">'Elementy „{0}” nie mogą zostać zaimplementowane przez właściwość {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedMustOverride"> <source> {0}: {1}</source> <target state="translated"> {0}: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_IfTooManyTypesObjectDisallowed"> <source>Cannot infer a common type because more than one type is possible.</source> <target state="translated">Nie można wywnioskować wspólnego typu, ponieważ jest możliwy więcej niż jeden typ.</target> <note /> </trans-unit> <trans-unit id="WRN_IfTooManyTypesObjectAssumed"> <source>Cannot infer a common type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować wspólnego typu, ponieważ jest możliwy więcej niż jeden typ; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_IfTooManyTypesObjectAssumed_Title"> <source>Cannot infer a common type because more than one type is possible</source> <target state="translated">Nie można wywnioskować wspólnego typu, ponieważ jest możliwy więcej niż jeden typ</target> <note /> </trans-unit> <trans-unit id="ERR_IfNoTypeObjectDisallowed"> <source>Cannot infer a common type, and Option Strict On does not allow 'Object' to be assumed.</source> <target state="translated">Nie można wywnioskować wspólnego typu, a ustawienie Option Strict On nie pozwala przyjąć obiektu „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_IfNoTypeObjectAssumed"> <source>Cannot infer a common type; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować wspólnego typu; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_IfNoTypeObjectAssumed_Title"> <source>Cannot infer a common type</source> <target state="translated">Nie można wywnioskować wspólnego typu</target> <note /> </trans-unit> <trans-unit id="ERR_IfNoType"> <source>Cannot infer a common type.</source> <target state="translated">Nie można wywnioskować wspólnego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyFileFailure"> <source>Error extracting public key from file '{0}': {1}</source> <target state="translated">Błąd podczas wyodrębniania klucza publicznego z pliku „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyContainerFailure"> <source>Error extracting public key from container '{0}': {1}</source> <target state="translated">Błąd podczas wyodrębniania klucza publicznego z kontenera „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefNotEqualToThis"> <source>Friend access was granted by '{0}', but the public key of the output assembly does not match that specified by the attribute in the granting assembly.</source> <target state="translated">Dostęp do przyjaznego zestawu został udzielony przez „{0}”, ale klucz publiczny zestawu wyjściowego nie jest zgodny z kluczem określonym przez atrybut w zestawie udzielającym dostępu.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefSigningMismatch"> <source>Friend access was granted by '{0}', but the strong name signing state of the output assembly does not match that of the granting assembly.</source> <target state="translated">Dostęp do przyjaznego zestawu został udzielony przez „{0}”, ale silna nazwa stanu podpisywania zestawu wyjściowego nie jest zgodna z nazwą określoną przez atrybut w zestawie udzielającym dostępu.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNoKey"> <source>Public sign was specified and requires a public key, but no public key was specified</source> <target state="translated">Wybrano podpisywanie publiczne, co wymaga klucza publicznego, ale żaden taki klucz nie został określony</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNetModule"> <source>Public signing is not supported for netmodules.</source> <target state="translated">Publiczne podpisywanie nie jest obsługiwane w przypadku modułów sieciowych.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning"> <source>Attribute '{0}' is ignored when public signing is specified.</source> <target state="translated">Atrybut „{0}” jest ignorowany w przypadku określenia podpisywania publicznego.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning_Title"> <source>Attribute is ignored when public signing is specified.</source> <target state="translated">Atrybut jest ignorowany w przypadku określenia podpisywania publicznego.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey"> <source>Delay signing was specified and requires a public key, but no public key was specified.</source> <target state="translated">Określono podpisywanie opóźnione, które wymaga klucza publicznego. Nie określono jednak żadnego klucza publicznego.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey_Title"> <source>Delay signing was specified and requires a public key, but no public key was specified</source> <target state="translated">Określono podpisywanie opóźnione wymagające klucza publicznego, ale nie określono klucza publicznego</target> <note /> </trans-unit> <trans-unit id="ERR_SignButNoPrivateKey"> <source>Key file '{0}' is missing the private key needed for signing.</source> <target state="translated">W pliku klucza „{0}” brak klucza prywatnego wymaganego do podpisu</target> <note /> </trans-unit> <trans-unit id="ERR_FailureSigningAssembly"> <source>Error signing assembly '{0}': {1}</source> <target state="translated">Wystąpił błąd podczas podpisywania zestawu „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat"> <source>The specified version string does not conform to the required format - major[.minor[.build|*[.revision|*]]]</source> <target state="translated">Określony ciąg wersji nie jest zgodny z wymaganym formatem: wersja_główna[.wersja_podrzędna[.kompilacja|*[.poprawka|*]]].</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">Określony ciąg wersji nie jest zgodny z zalecanym formatem — wersja_główna.wersja_pomocnicza.kompilacja.poprawka</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat_Title"> <source>The specified version string does not conform to the recommended format</source> <target state="translated">Określony ciąg wersji jest niezgodny z zalecanym formatem</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat2"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">Określony ciąg wersji nie jest zgodny z zalecanym formatem — wersja_główna.wersja_pomocnicza.kompilacja.poprawka</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCultureForExe"> <source>Executables cannot be satellite assemblies; culture should always be empty</source> <target state="translated">Pliki wykonywalne nie mogą być zestawami satelity, element Culture powinien zawsze być pusty</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored"> <source>The entry point of the program is global script code; ignoring '{0}' entry point.</source> <target state="translated">Punkt wejścia programu to kod skryptu globalnego. Punkt wejścia „{0}” został zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored_Title"> <source>The entry point of the program is global script code; ignoring entry point</source> <target state="translated">Punkt wejścia programu to kod skryptu globalnego. Punkt wejścia został zignorowany</target> <note /> </trans-unit> <trans-unit id="WRN_EmptyPrefixAndXmlnsLocalName"> <source>The xmlns attribute has special meaning and should not be written with a prefix.</source> <target state="translated">Atrybut xmlns ma specjalne znaczenie i nie powinien być zapisywany z prefiksem.</target> <note /> </trans-unit> <trans-unit id="WRN_EmptyPrefixAndXmlnsLocalName_Title"> <source>The xmlns attribute has special meaning and should not be written with a prefix</source> <target state="translated">Atrybut xmlns ma specjalne znaczenie i nie powinien być zapisywany z prefiksem</target> <note /> </trans-unit> <trans-unit id="WRN_PrefixAndXmlnsLocalName"> <source>It is not recommended to have attributes named xmlns. Did you mean to write 'xmlns:{0}' to define a prefix named '{0}'?</source> <target state="translated">Zaleca się, aby atrybuty nie miały nazwy xmlns. Czy w celu zdefiniowania prefiksu o nazwie „{0}” nie miał zostać wprowadzony ciąg „xmlns:{0}”?</target> <note /> </trans-unit> <trans-unit id="WRN_PrefixAndXmlnsLocalName_Title"> <source>It is not recommended to have attributes named xmlns</source> <target state="translated">Zaleca się, aby atrybuty nie miały nazwy xmlns</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSingleScript"> <source>Expected a single script (.vbx file)</source> <target state="translated">Oczekiwano pojedynczego skryptu (plik VBX)</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedAssemblyName"> <source>The assembly name '{0}' is reserved and cannot be used as a reference in an interactive session</source> <target state="translated">Nazwa zestawu „{0}” jest zarezerwowana i nie można jej użyć jako odwołania w sesji interaktywnej</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceDirectiveOnlyAllowedInScripts"> <source>#R is only allowed in scripts</source> <target state="translated">Element #R jest dozwolony tylko w skryptach</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAllowedInScript"> <source>You cannot declare Namespace in script code</source> <target state="translated">W kodzie skryptu nie można zadeklarować przestrzeni nazw</target> <note /> </trans-unit> <trans-unit id="ERR_KeywordNotAllowedInScript"> <source>You cannot use '{0}' in top-level script code</source> <target state="translated">Nie można używać słowa kluczowego „{0}” w kodzie skryptu najwyższego poziomu</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNoType"> <source>Cannot infer a return type. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Nie można wywnioskować zwracanego typu. Rozważ dodanie klauzuli „As” w celu określenia zwracanego typu.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaNoTypeObjectAssumed"> <source>Cannot infer a return type; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować zwracanego typu; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaNoTypeObjectAssumed_Title"> <source>Cannot infer a return type</source> <target state="translated">Nie można wywnioskować zwracanego typu</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaTooManyTypesObjectAssumed"> <source>Cannot infer a return type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować zwracanego typu, ponieważ jest możliwy więcej niż jeden typ; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaTooManyTypesObjectAssumed_Title"> <source>Cannot infer a return type because more than one type is possible</source> <target state="translated">Nie można wywnioskować zwracanego typu, ponieważ możliwe jest użycie więcej niż jednego typu</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNoTypeObjectDisallowed"> <source>Cannot infer a return type. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Nie można wywnioskować zwracanego typu. Rozważ dodanie klauzuli „As” w celu określenia zwracanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaTooManyTypesObjectDisallowed"> <source>Cannot infer a return type because more than one type is possible. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Nie można wywnioskować zwracanego typu, ponieważ jest możliwy więcej niż jeden typ. Rozważ dodanie klauzuli „As” w celu określenia zwracanego typu.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch"> <source>The command line switch '{0}' is not yet implemented and was ignored.</source> <target state="translated">Przełącznik wiersza polecenia „{0}” nie został jeszcze wdrożony i został zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch_Title"> <source>Command line switch is not yet implemented</source> <target state="translated">Przełącznik wiersza polecenia nie jest jeszcze zaimplementowany</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitNoTypeObjectDisallowed"> <source>Cannot infer an element type, and Option Strict On does not allow 'Object' to be assumed. Specifying the type of the array might correct this error.</source> <target state="translated">Nie można wywnioskować typu elementu, a ustawienie Option Strict On nie pozwala przyjąć typu „Object”. Określenie typu tablicy może poprawić ten błąd.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitNoType"> <source>Cannot infer an element type. Specifying the type of the array might correct this error.</source> <target state="translated">Nie można wywnioskować typu elementu. Określenie typu tablicy może poprawić ten błąd.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitTooManyTypesObjectDisallowed"> <source>Cannot infer an element type because more than one type is possible. Specifying the type of the array might correct this error.</source> <target state="translated">Nie można wywnioskować typu elementu, ponieważ jest możliwy więcej niż jeden typ. Określenie typu tablicy może poprawić ten błąd.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitNoTypeObjectAssumed"> <source>Cannot infer an element type; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować typu elementu; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitNoTypeObjectAssumed_Title"> <source>Cannot infer an element type</source> <target state="translated">Nie można wywnioskować typu elementu</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitTooManyTypesObjectAssumed"> <source>Cannot infer an element type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować typu elementu, ponieważ jest możliwy więcej niż jeden typ; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitTooManyTypesObjectAssumed_Title"> <source>Cannot infer an element type because more than one type is possible</source> <target state="translated">Nie można wywnioskować typu elementu, ponieważ możliwe jest użycie więcej niż jednego typu</target> <note /> </trans-unit> <trans-unit id="WRN_TypeInferenceAssumed3"> <source>Data type of '{0}' in '{1}' could not be inferred. '{2}' assumed.</source> <target state="translated">Nie można wywnioskować typu danych „{0}” w „{1}”. Przyjęto „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeInferenceAssumed3_Title"> <source>Data type could not be inferred</source> <target state="translated">Nie można wywnioskować typu danych</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousCastConversion2"> <source>Option Strict On does not allow implicit conversions from '{0}' to '{1}' because the conversion is ambiguous.</source> <target state="translated">Ustawienie Option Strict On nie zezwala na niejawne konwersje z elementu „{0}” na „{1}”, ponieważ konwersja jest niejednoznaczna.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousCastConversion2"> <source>Conversion from '{0}' to '{1}' may be ambiguous.</source> <target state="translated">Konwersja z „{0}” na „{1}” może być niejednoznaczna.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousCastConversion2_Title"> <source>Conversion may be ambiguous</source> <target state="translated">Konwersja może być niejednoznaczna</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceIEnumerableSuggestion3"> <source>'{0}' cannot be converted to '{1}'. Consider using '{2}' instead.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ użycie zamiast tego elementu „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceIEnumerableSuggestion3"> <source>'{0}' cannot be converted to '{1}'. Consider using '{2}' instead.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ użycie zamiast tego elementu „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceIEnumerableSuggestion3_Title"> <source>Type cannot be converted to target collection type</source> <target state="translated">Nie można przekonwertować typu na docelowy typ kolekcji</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedIn6"> <source>'{4}' cannot be converted to '{5}' because '{0}' is not derived from '{1}', as required for the 'In' generic parameter '{2}' in '{3}'.</source> <target state="translated">'Element „{4}” nie może zostać skonwertowany na „{5}”, ponieważ element „{0}” nie dziedziczy od „{1}”, co jest wymagane dla parametru ogólnego „In” „{2}” w „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedOut6"> <source>'{4}' cannot be converted to '{5}' because '{0}' is not derived from '{1}', as required for the 'Out' generic parameter '{2}' in '{3}'.</source> <target state="translated">'Element „{4}” nie może zostać skonwertowany na „{5}”, ponieważ element „{0}” nie dziedziczy od „{1}”, co jest wymagane dla parametru ogólnego „Out” „{2}” w „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedIn6"> <source>Implicit conversion from '{4}' to '{5}'; this conversion may fail because '{0}' is not derived from '{1}', as required for the 'In' generic parameter '{2}' in '{3}'.</source> <target state="translated">Niejawna konwersja z „{4}” na „{5}”; ta konwersja może się nie powieść, ponieważ „{0}” nie dziedziczy od „{1}”, co jest wymagane dla parametru ogólnego „In” „{2}” w „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedIn6_Title"> <source>Implicit conversion; this conversion may fail because the target type is not derived from the source type, as required for 'In' generic parameter</source> <target state="translated">Niejawna konwersja; ta konwersja może się nie powieść, ponieważ typ docelowy nie pochodzi od typu źródłowego, co jest wymagane dla parametru ogólnego „In”</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedOut6"> <source>Implicit conversion from '{4}' to '{5}'; this conversion may fail because '{0}' is not derived from '{1}', as required for the 'Out' generic parameter '{2}' in '{3}'.</source> <target state="translated">Niejawna konwersja z „{4}” na „{5}”; ta konwersja może się nie powieść, ponieważ „{0}” nie dziedziczy od „{1}”, co jest wymagane dla parametru ogólnego „Out” „{2}” w „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedOut6_Title"> <source>Implicit conversion; this conversion may fail because the target type is not derived from the source type, as required for 'Out' generic parameter</source> <target state="translated">Niejawna konwersja; ta konwersja może się nie powieść, ponieważ typ docelowy nie pochodzi od typu źródłowego, co jest wymagane dla parametru ogólnego „Out”</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedTryIn4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an In type parameter, 'In {2}'.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ zmianę elementu „{2}” w definicji „{3}” na parametr typu In, „In {2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedTryOut4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an Out type parameter, 'Out {2}'.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ zmianę elementu „{2}” w definicji „{3}” na parametr typu Out, „Out {2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryIn4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an In type parameter, 'In {2}'.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ zmianę elementu „{2}” w definicji „{3}” na parametr typu In, „In {2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryIn4_Title"> <source>Type cannot be converted to target type</source> <target state="translated">Nie można przekonwertować typu na typ docelowy</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryOut4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an Out type parameter, 'Out {2}'.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ zmianę elementu „{2}” w definicji „{3}” na parametr typu Out, „Out {2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryOut4_Title"> <source>Type cannot be converted to target type</source> <target state="translated">Nie można przekonwertować typu na typ docelowy</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceDeclarationAmbiguous3"> <source>Interface '{0}' is ambiguous with another implemented interface '{1}' due to the 'In' and 'Out' parameters in '{2}'.</source> <target state="translated">Interfejs „{0}” jest niejednoznaczny z innym zaimplementowanym interfejsem „{1}” ze względu na parametry „In” i „Out” w „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceDeclarationAmbiguous3_Title"> <source>Interface is ambiguous with another implemented interface due to 'In' and 'Out' parameters</source> <target state="translated">Interfejs jest niejednoznaczny z innym zaimplementowanym interfejsem ze względu na parametry „In” i „Out”</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInterfaceNesting"> <source>Enumerations, classes, and structures cannot be declared in an interface that has an 'In' or 'Out' type parameter.</source> <target state="translated">Wyliczenia, klasy i struktury nie mogą być deklarowane w interfejsie mającym parametr typu „In” lub „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VariancePreventsSynthesizedEvents2"> <source>Event definitions with parameters are not allowed in an interface such as '{0}' that has 'In' or 'Out' type parameters. Consider declaring the event by using a delegate type which is not defined within '{0}'. For example, 'Event {1} As Action(Of ...)'.</source> <target state="translated">Definicje zdarzeń z parametrami nie są dozwolone w interfejsie takim jak „{0}”, który ma parametry typu „In” lub „Out”. Rozważ zadeklarowanie zdarzenia przy użyciu typu delegowanego, który nie jest zdefiniowany w obrębie elementu „{0}”. Na przykład „Event {1} As Action(Of ...)”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInByRefDisallowed1"> <source>Type '{0}' cannot be used in this context because 'In' and 'Out' type parameters cannot be used for ByRef parameter types, and '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany w tym kontekście, ponieważ parametry typu „In” i „Out” nie mogą być używane dla typów parametrów ByRef, a „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInNullableDisallowed2"> <source>Type '{0}' cannot be used in '{1}' because 'In' and 'Out' type parameters cannot be made nullable, and '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany w elemencie „{1}”, ponieważ parametry typu „In” i „Out” nie mogą dopuszczać wartości null, a „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowed1"> <source>Type '{0}' cannot be used in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty w tym kontekście, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedForGeneric3"> <source>Type '{0}' cannot be used for the '{1}' in '{2}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{1}” w „{2}” w tym kontekście, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedHere2"> <source>Type '{0}' cannot be used in '{1}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty w elemencie „{1}” w tym kontekście, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedHereForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' of '{3}' in '{1}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{2}” należącego do „{3}” w elemencie „{1}” w tym kontekście, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInPropertyDisallowed1"> <source>Type '{0}' cannot be used as a property type in this context because '{0}' is an 'In' type parameter and the property is not marked WriteOnly.</source> <target state="translated">Typ „{0}” nie może być używany jako typ właściwości w tym kontekście, ponieważ „{0}” jest parametrem typu „In”, a właściwość nie jest oznaczona jako WriteOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInReadOnlyPropertyDisallowed1"> <source>Type '{0}' cannot be used as a ReadOnly property type because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako typ właściwości ReadOnly, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInReturnDisallowed1"> <source>Type '{0}' cannot be used as a return type because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako typ zwracany, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutByRefDisallowed1"> <source>Type '{0}' cannot be used in this context because 'In' and 'Out' type parameters cannot be used for ByRef parameter types, and '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany w tym kontekście, ponieważ parametry typu „In” i „Out” nie mogą być używane dla typów parametrów ByRef, a „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutByValDisallowed1"> <source>Type '{0}' cannot be used as a ByVal parameter type because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako parametr typu ByVal, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutConstraintDisallowed1"> <source>Type '{0}' cannot be used as a generic type constraint because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako ograniczenie typu ogólnego, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutNullableDisallowed2"> <source>Type '{0}' cannot be used in '{1}' because 'In' and 'Out' type parameters cannot be made nullable, and '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany w elemencie „{1}”, ponieważ parametry typu „In” i „Out” nie mogą dopuszczać wartości null, a „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowed1"> <source>Type '{0}' cannot be used in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedForGeneric3"> <source>Type '{0}' cannot be used for the '{1}' in '{2}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{1}” w „{2}” w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedHere2"> <source>Type '{0}' cannot be used in '{1}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty w elemencie „{1}” w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedHereForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' of '{3}' in '{1}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{2}” należącego do elementu „{3}” w „{1}” w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutPropertyDisallowed1"> <source>Type '{0}' cannot be used as a property type in this context because '{0}' is an 'Out' type parameter and the property is not marked ReadOnly.</source> <target state="translated">Typ „{0}” nie może być używany jako typ właściwości w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”, a ta właściwość nie jest oznaczona jako ReadOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutWriteOnlyPropertyDisallowed1"> <source>Type '{0}' cannot be used as a WriteOnly property type because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako typ właściwości WriteOnly, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowed2"> <source>Type '{0}' cannot be used in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Typ „{0}” nie może zostać użyty w tym kontekście, ponieważ zarówno kontekst, jak i definicja „{0}” są zagnieżdżone w obrębie interfejsu „{1}”, a „{1}” ma parametry typu „In” lub „Out”. Rozważ przeniesienie definicji „{0}” poza interfejs „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' in '{3}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{2}” w „{3}” w tym kontekście, ponieważ zarówno kontekst, jak i definicja elementu „{0}” są zagnieżdżone w obrębie interfejsu „{1}”, a „{1}” ma parametry typu „In” lub „Out”. Rozważ przeniesienie definicji „{0}” poza interfejs „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedHere3"> <source>Type '{0}' cannot be used in '{2}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Typ „{0}” nie może zostać użyty w elemencie „{2}” w tym kontekście, ponieważ zarówno kontekst, jak i definicja „{0}” są zagnieżdżone w obrębie interfejsu „{1}”, a „{1}” ma parametry typu „In” lub „Out”. Rozważ przeniesienie definicji „{0}” poza interfejs „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedHereForGeneric5"> <source>Type '{0}' cannot be used for the '{3}' of '{4}' in '{2}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{3}” należącego do elementu „{4}” w „{2}” w tym kontekście, ponieważ zarówno kontekst, jak i definicja „{0}” są zagnieżdżone w obrębie interfejsu „{1}”, a „{1}” ma parametry typu „In” lub „Out”. Rozważ przeniesienie definicji „{0}” poza interfejs „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterNotValidForType"> <source>Parameter not valid for the specified unmanaged type.</source> <target state="translated">Parametr jest nieprawidłowy dla określonego niezarządzanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeNotValidForFields"> <source>Unmanaged type '{0}' not valid for fields.</source> <target state="translated">Niezarządzany typ „{0}” jest nieprawidłowy dla pól.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeOnlyValidForFields"> <source>Unmanaged type '{0}' is only valid for fields.</source> <target state="translated">Niezarządzany typ „{0}” jest prawidłowy tylko dla pól.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired1"> <source>Attribute parameter '{0}' must be specified.</source> <target state="translated">Należy podać parametr atrybutu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired2"> <source>Attribute parameter '{0}' or '{1}' must be specified.</source> <target state="translated">Należy podać parametr atrybutu „{0}” lub „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MemberConflictWithSynth4"> <source>Conflicts with '{0}', which is implicitly declared for '{1}' in {2} '{3}'.</source> <target state="translated">Powoduje konflikt z elementem „{0}”, zadeklarowanym niejawnie dla elementu „{1}” w elemencie {2} „{3}”.</target> <note /> </trans-unit> <trans-unit id="IDS_ProjectSettingsLocationName"> <source>&lt;project settings&gt;</source> <target state="translated">&lt;ustawienia projektu&gt;</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeAttributeOnWriteOnlyProperty"> <source>Attributes applied on a return type of a WriteOnly Property have no effect.</source> <target state="translated">Zastosowanie atrybutów w typie zwracanym właściwości WriteOnly nie przyniosło żadnego skutku.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeAttributeOnWriteOnlyProperty_Title"> <source>Attributes applied on a return type of a WriteOnly Property have no effect</source> <target state="translated">Zastosowanie atrybutów w typie zwracanym właściwości WriteOnly nie przyniosło żadnego skutku</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidTarget"> <source>Security attribute '{0}' is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations.</source> <target state="translated">Atrybut zabezpieczeń „{0}” jest nieprawidłowy w tym typie deklaracji. Atrybuty zabezpieczeń są prawidłowe tylko dla deklaracji zestawu, typu i metody.</target> <note /> </trans-unit> <trans-unit id="ERR_AbsentReferenceToPIA1"> <source>Cannot find the interop type that matches the embedded type '{0}'. Are you missing an assembly reference?</source> <target state="translated">Nie można znaleźć typu międzyoperacyjnego zgodnego z osadzonym typem „{0}”. Czy nie brakuje odwołania do zestawu?</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLinkClassWithNoPIA1"> <source>Reference to class '{0}' is not allowed when its assembly is configured to embed interop types.</source> <target state="translated">Odwołanie do klasy „{0}” jest niedozwolone, gdy jej zestaw jest skonfigurowany do osadzania typów międzyoperacyjnych.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidStructMemberNoPIA1"> <source>Embedded interop structure '{0}' can contain only public instance fields.</source> <target state="translated">Osadzona struktura międzyoperacyjna „{0}” może zawierać tylko publiczne pola wystąpień.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIAAttributeMissing2"> <source>Interop type '{0}' cannot be embedded because it is missing the required '{1}' attribute.</source> <target state="translated">Nie można osadzić typu międzyoperacyjnego „{0}”, ponieważ brakuje w nim wymaganego atrybutu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PIAHasNoAssemblyGuid1"> <source>Cannot embed interop types from assembly '{0}' because it is missing the '{1}' attribute.</source> <target state="translated">Nie można osadzić typów międzyoperacyjnych z zestawu „{0}”, ponieważ brakuje atrybutu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocalTypes3"> <source>Cannot embed interop type '{0}' found in both assembly '{1}' and '{2}'. Consider disabling the embedding of interop types.</source> <target state="translated">Nie można osadzić typu międzyoperacyjnego „{0}” znalezionego w zestawie „{1}” i „{2}”. Rozważ wyłączenie osadzenia typów międzyoperacyjnych.</target> <note /> </trans-unit> <trans-unit id="ERR_PIAHasNoTypeLibAttribute1"> <source>Cannot embed interop types from assembly '{0}' because it is missing either the '{1}' attribute or the '{2}' attribute.</source> <target state="translated">Nie można osadzić typów międzyoperacyjnych z zestawu „{0}”, ponieważ brakuje atrybutu „{1}” lub „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceInterfaceMustBeInterface"> <source>Interface '{0}' has an invalid source interface which is required to embed event '{1}'.</source> <target state="translated">Interfejs „{0}” zawiera nieprawidłowy interfejs źródłowy wymagany do osadzenia zdarzenia „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EventNoPIANoBackingMember"> <source>Source interface '{0}' is missing method '{1}', which is required to embed event '{2}'.</source> <target state="translated">W interfejsie źródłowym „{0}” brak metody „{1}” wymaganej do osadzenia zdarzenia „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedInteropType"> <source>Nested type '{0}' cannot be embedded.</source> <target state="translated">Typ zagnieżdżony „{0}” nie może zostać osadzony.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalTypeNameClash2"> <source>Embedding the interop type '{0}' from assembly '{1}' causes a name clash in the current assembly. Consider disabling the embedding of interop types.</source> <target state="translated">Osadzenie typu międzyoperacyjnego „{0}” z zestawu „{1}” spowoduje konflikt nazw w bieżącym zestawie. Rozważ wyłączenie osadzania typów międzyoperacyjnych.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropMethodWithBody1"> <source>Embedded interop method '{0}' contains a body.</source> <target state="translated">Osadzona metoda międzyoperacyjna „{0}” zawiera treść.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncInQuery"> <source>'Await' may only be used in a query expression within the first collection expression of the initial 'From' clause or within the collection expression of a 'Join' clause.</source> <target state="translated">'Operatora „Await” można użyć tylko w wyrażeniu zapytania w pierwszym wyrażeniu kolekcji początkowej klauzuli „From” albo w wyrażeniu kolekcji klauzuli „Join”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGetAwaiterMethod1"> <source>'Await' requires that the type '{0}' have a suitable GetAwaiter method.</source> <target state="translated">'Element „Await” wymaga, aby typ „{0}” miał odpowiednią metodę GetAwaiter.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIsCompletedOnCompletedGetResult2"> <source>'Await' requires that the return type '{0}' of '{1}.GetAwaiter()' have suitable IsCompleted, OnCompleted and GetResult members, and implement INotifyCompletion or ICriticalNotifyCompletion.</source> <target state="translated">'Element „Await” wymaga, aby zwracany typ „{0}” metody „{1}.GetAwaiter()” miał odpowiednie składowe IsCompleted, OnCompleted i GetResult oraz implementował interfejs INotifyCompletion lub ICriticalNotifyCompletion.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesntImplementAwaitInterface2"> <source>'{0}' does not implement '{1}'.</source> <target state="translated">'Element „{0}” nie implementuje interfejsu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitNothing"> <source>Cannot await Nothing. Consider awaiting 'Task.Yield()' instead.</source> <target state="translated">Nie można zdefiniować oczekiwania na wartość Nothing. Zamiast tego rozważ zdefiniowanie oczekiwania na funkcję „Task.Yield()”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncByRefParam"> <source>Async methods cannot have ByRef parameters.</source> <target state="translated">Metody asynchroniczne nie mogą mieć parametrów ByRef.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAsyncIteratorModifiers"> <source>'Async' and 'Iterator' modifiers cannot be used together.</source> <target state="translated">'Modyfikatory „Async” i „Iterator” nie mogą być używane razem.</target> <note /> </trans-unit> <trans-unit id="ERR_BadResumableAccessReturnVariable"> <source>The implicit return variable of an Iterator or Async method cannot be accessed.</source> <target state="translated">Nie można uzyskać dostępu do niejawnie zwracanej zmiennej metody iteracyjnej lub asynchronicznej.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnFromNonGenericTaskAsync"> <source>'Return' statements in this Async method cannot return a value since the return type of the function is 'Task'. Consider changing the function's return type to 'Task(Of T)'.</source> <target state="translated">'Instrukcje „Return” w tej metodzie asynchronicznej nie mogą zwracać wartości, ponieważ funkcja zwraca typ „Task”. Rozważ zmianę typu zwracanego przez funkcję na „Task(Of T)”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturnOperand1"> <source>Since this is an async method, the return expression must be of type '{0}' rather than 'Task(Of {0})'.</source> <target state="translated">Ze względu na to, że jest to metoda asynchroniczna, zwracane wyrażenie musi być typu „{0}”, a nie typu „Task(Of {0})”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturn"> <source>The 'Async' modifier can only be used on Subs, or on Functions that return Task or Task(Of T).</source> <target state="translated">Modyfikatora „Async” można używać tylko dla procedur albo funkcji zwracających typ Task lub Task(Of T).</target> <note /> </trans-unit> <trans-unit id="ERR_CantAwaitAsyncSub1"> <source>'{0}' does not return a Task and cannot be awaited. Consider changing it to an Async Function.</source> <target state="translated">'Element „{0}” nie zwraca zadania i nie jest możliwe oczekiwanie na niego. Rozważ zmianę tego elementu na funkcję asynchroniczną.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLambdaModifier"> <source>'Only the 'Async' or 'Iterator' modifier is valid on a lambda.</source> <target state="translated">'Tylko modyfikator „Async” lub „Iterator” jest poprawny w przypadku wyrażenia lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncMethod"> <source>'Await' can only be used within an Async method. Consider marking this method with the 'Async' modifier and changing its return type to 'Task(Of {0})'.</source> <target state="translated">'Słowo kluczowe „Await” może zostać użyte tylko wewnątrz metody asynchronicznej. Rozważ oznaczenie tej metody za pomocą modyfikatora „Async” i zmianę zwracanego przez nią typu na „Task(Of {0})”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncVoidMethod"> <source>'Await' can only be used within an Async method. Consider marking this method with the 'Async' modifier and changing its return type to 'Task'.</source> <target state="translated">'Słowo kluczowe „Await” może zostać użyte tylko wewnątrz metody asynchronicznej. Rozważ oznaczenie tej metody za pomocą modyfikatora „Async” i zmianę zwracanego przez nią typu na „Task”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncLambda"> <source>'Await' can only be used within an Async lambda expression. Consider marking this lambda expression with the 'Async' modifier.</source> <target state="translated">'Słowo kluczowe „Await” może zostać użyte tylko wewnątrz wyrażenia lambda. Rozważ oznaczenie tego wyrażenia lambda za pomocą modyfikatora „Async”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitNotInAsyncMethodOrLambda"> <source>'Await' can only be used when contained within a method or lambda expression marked with the 'Async' modifier.</source> <target state="translated">'Słowo kluczowe „Await” może zostać użyte tylko wewnątrz metody lub wyrażenia lambda oznaczonego modyfikatorem „Async”.</target> <note /> </trans-unit> <trans-unit id="ERR_StatementLambdaInExpressionTree"> <source>Statement lambdas cannot be converted to expression trees.</source> <target state="translated">Instrukcji lambda nie można konwertować na drzewa wyrażeń.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression"> <source>Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the Await operator to the result of the call.</source> <target state="translated">Ponieważ to wywołanie nie jest oczekiwane, wykonywanie bieżącej metody będzie kontynuowane do czasu ukończenia wywołania. Rozważ zastosowanie operatora Await do wyniku wywołania.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression_Title"> <source>Because this call is not awaited, execution of the current method continues before the call is completed</source> <target state="translated">To wywołanie nie jest oczekiwane, dlatego wykonywanie bieżącej metody będzie kontynuowane do czasu ukończenia wywołania</target> <note /> </trans-unit> <trans-unit id="ERR_LoopControlMustNotAwait"> <source>Loop control variable cannot include an 'Await'.</source> <target state="translated">Zmienna sterująca pętli nie może zawierać słowa kluczowego „Await”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticInitializerInResumable"> <source>Static variables cannot appear inside Async or Iterator methods.</source> <target state="translated">Zmienne statyczne nie mogą być używane w metodach Async lub Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedResumableType1"> <source>'{0}' cannot be used as a parameter type for an Iterator or Async method.</source> <target state="translated">'Typ „{0}” nie może być używany jako parametr typu dla metody Iterator lub Async.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorAsync"> <source>Constructor must not have the 'Async' modifier.</source> <target state="translated">Konstruktor nie może zawierać modyfikatora „Async”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustNotBeAsync1"> <source>'{0}' cannot be declared 'Partial' because it has the 'Async' modifier.</source> <target state="translated">'Nie można zadeklarować metody „{0}” jako „Partial”, ponieważ ma ona modyfikator „Async”.</target> <note /> </trans-unit> <trans-unit id="ERR_ResumablesCannotContainOnError"> <source>'On Error' and 'Resume' cannot appear inside async or iterator methods.</source> <target state="translated">'W metodach asynchronicznych i iteracyjnych nie mogą występować instrukcje „On Error” ani „Resume”.</target> <note /> </trans-unit> <trans-unit id="ERR_ResumableLambdaInExpressionTree"> <source>Lambdas with the 'Async' or 'Iterator' modifiers cannot be converted to expression trees.</source> <target state="translated">Wyrażeń lambda z modyfikatorami „Async” i „Iterator” nie można konwertować na drzewa wyrażeń.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeResumable1"> <source>Variable of restricted type '{0}' cannot be declared in an Async or Iterator method.</source> <target state="translated">Zmienna ograniczonego typu „{0}” nie może zostać zadeklarowana w metodzie asynchronicznej lub iteratora.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInTryHandler"> <source>'Await' cannot be used inside a 'Catch' statement, a 'Finally' statement, or a 'SyncLock' statement.</source> <target state="translated">'Operator „Await” nie może być używany wewnątrz instrukcji „Catch”, „Finally” ani „SyncLock”.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits"> <source>This async method lacks 'Await' operators and so will run synchronously. Consider using the 'Await' operator to await non-blocking API calls, or 'Await Task.Run(...)' to do CPU-bound work on a background thread.</source> <target state="translated">W tej metodzie asynchronicznej brakuje operatorów „Await”, dlatego będzie wykonywana synchronicznie. Rozważ użycie operatora „Await” w celu zdefiniowania oczekiwania na nieblokujące wywołania interfejsów API albo wyrażenia „Await Task.Run(...)” w celu przeniesienia wykonywania zadań intensywnie angażujących procesor do wątku w tle.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits_Title"> <source>This async method lacks 'Await' operators and so will run synchronously</source> <target state="translated">W tej metodzie asynchronicznej brakuje operatorów „Await” — zostanie ona uruchomiona synchronicznie</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableDelegate"> <source>The Task returned from this Async Function will be dropped, and any exceptions in it ignored. Consider changing it to an Async Sub so its exceptions are propagated.</source> <target state="translated">Zadanie zwrócone z tej funkcji asynchronicznej zostanie porzucone i wszelkie zawarte w nim wyjątki zostaną zignorowane. Rozważ zmianę tej funkcji na procedurę asynchroniczną, tak aby jej wyjątki były propagowane.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableDelegate_Title"> <source>The Task returned from this Async Function will be dropped, and any exceptions in it ignored</source> <target state="translated">Zadanie zwrócone przez tę funkcję asynchroniczną zostanie porzucone, a powiązane z nim wyjątki zostaną zignorowane</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalAsyncInClassOrStruct"> <source>Async and Iterator methods are not allowed in a [Class|Structure|Interface|Module] that has the 'SecurityCritical' or 'SecuritySafeCritical' attribute.</source> <target state="translated">Metody Async i Iterator nie są dozwolone w klasie, strukturze, interfejsie lub module, który ma atrybut „SecurityCritical” lub „SecuritySafeCritical”.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalAsync"> <source>Security attribute '{0}' cannot be applied to an Async or Iterator method.</source> <target state="translated">Nie można zastosować atrybutu zabezpieczeń „{0}” do metody Async lub Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnResumableMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to an Async or Iterator method.</source> <target state="translated">'Atrybutu „System.Runtime.InteropServices.DllImportAttribute” nie można zastosować do metody asynchronicznej ani iteracyjnej.</target> <note /> </trans-unit> <trans-unit id="ERR_SynchronizedAsyncMethod"> <source>'MethodImplOptions.Synchronized' cannot be applied to an Async method.</source> <target state="translated">'Atrybutu „MethodImplOptions.Synchronized” nie można zastosować do metody asynchronicznej.</target> <note /> </trans-unit> <trans-unit id="ERR_AsyncSubMain"> <source>The 'Main' method cannot be marked 'Async'.</source> <target state="translated">Metoda „Main” nie może być oznaczona atrybutem „Async”.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncSubCouldBeFunction"> <source>Some overloads here take an Async Function rather than an Async Sub. Consider either using an Async Function, or casting this Async Sub explicitly to the desired type.</source> <target state="translated">Niektóre widoczne tu przeciążenia korzystają z funkcji asynchronicznych, a nie procedur asynchronicznych. Rozważ użycie funkcji asynchronicznej albo rzutowanie tej procedury asynchronicznej jawnie na żądany typ.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncSubCouldBeFunction_Title"> <source>Some overloads here take an Async Function rather than an Async Sub</source> <target state="translated">Niektóre widoczne tu przeciążenia korzystają z funkcji asynchronicznych, a nie procedur asynchronicznych</target> <note /> </trans-unit> <trans-unit id="ERR_MyGroupCollectionAttributeCycle"> <source>MyGroupCollectionAttribute cannot be applied to itself.</source> <target state="translated">Atrybut MyGroupCollectionAttribute nie może zostać zastosowany do siebie samego.</target> <note /> </trans-unit> <trans-unit id="ERR_LiteralExpected"> <source>Literal expected.</source> <target state="translated">Oczekiwano literału.</target> <note /> </trans-unit> <trans-unit id="ERR_WinRTEventWithoutDelegate"> <source>Event declarations that target WinMD must specify a delegate type. Add an As clause to the event declaration.</source> <target state="translated">Deklaracje zdarzeń przeznaczone dla WinMD muszą określać typ delegata. Dodaj klauzulę As do deklaracji zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_MixingWinRTAndNETEvents"> <source>Event '{0}' cannot implement a Windows Runtime event '{1}' and a regular .NET event '{2}'</source> <target state="translated">Zdarzenie „{0}” nie może implementować zdarzenia wykonawczego systemu Windows „{1}” i zwykłego zdarzenia platformy .NET „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EventImplRemoveHandlerParamWrong"> <source>Event '{0}' cannot implement event '{1}' on interface '{2}' because the parameters of their 'RemoveHandler' methods do not match.</source> <target state="translated">Zdarzenie „{0}” nie może implementować zdarzenia „{1}” w interfejsie „{2}”, ponieważ parametry ich metod „RemoveHandler” są niezgodne.</target> <note /> </trans-unit> <trans-unit id="ERR_AddParamWrongForWinRT"> <source>The type of the 'AddHandler' method's parameter must be the same as the type of the event.</source> <target state="translated">Typ parametru metody „AddHandler” musi być taki sam jak typ zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_RemoveParamWrongForWinRT"> <source>In a Windows Runtime event, the type of the 'RemoveHandler' method parameter must be 'EventRegistrationToken'</source> <target state="translated">W zdarzeniu środowiska wykonawczego systemu Windows parametr metody „RemoveHandler” musi mieć wartość „EventRegistrationToken”</target> <note /> </trans-unit> <trans-unit id="ERR_ReImplementingWinRTInterface5"> <source>'{0}.{1}' from 'implements {2}' is already implemented by the base class '{3}'. Re-implementation of Windows Runtime Interface '{4}' is not allowed</source> <target state="translated">'Element „{0}.{1}” z elementu „implements {2}” został już zaimplementowany przez klasę bazową „{3}”. Ponowna implementacja interfejsu środowiska wykonawczego systemu Windows „{4}” jest niedozwolona</target> <note /> </trans-unit> <trans-unit id="ERR_ReImplementingWinRTInterface4"> <source>'{0}.{1}' is already implemented by the base class '{2}'. Re-implementation of Windows Runtime Interface '{3}' is not allowed</source> <target state="translated">'Element „{0}.{1}” został już zaimplementowany przez klasę bazową „{2}”. Ponowna implementacja interfejsu środowiska wykonawczego systemu Windows „{3}” jest niedozwolona</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorByRefParam"> <source>Iterator methods cannot have ByRef parameters.</source> <target state="translated">Metody iteracyjne nie mogą mieć parametrów ByRef.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorExpressionLambda"> <source>Single-line lambdas cannot have the 'Iterator' modifier. Use a multiline lambda instead.</source> <target state="translated">Jednowierszowe wyrażenia lambda nie mogą mieć modyfikatora „Iterator”. W takim przypadku należy używać wielowierszowych wyrażeń lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorReturn"> <source>Iterator functions must return either IEnumerable(Of T), or IEnumerator(Of T), or the non-generic forms IEnumerable or IEnumerator.</source> <target state="translated">Funkcje iteracyjne muszą zwracać interfejsy IEnumerable(Of T) lub IEnumerator(Of T) albo nieogólne formy interfejsu IEnumerable lub IEnumerator.</target> <note /> </trans-unit> <trans-unit id="ERR_BadReturnValueInIterator"> <source>To return a value from an Iterator function, use 'Yield' rather than 'Return'.</source> <target state="translated">Aby była zwracana wartość z funkcji iteracyjnej, zamiast instrukcji „Return” należy użyć instrukcji „Yield”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInNonIteratorMethod"> <source>'Yield' can only be used in a method marked with the 'Iterator' modifier.</source> <target state="translated">'Instrukcji „Yield” można używać tylko w metodach oznaczonych modyfikatorem „Iterator”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInTryHandler"> <source>'Yield' cannot be used inside a 'Catch' statement or a 'Finally' statement.</source> <target state="translated">'Instrukcja „Yield” nie może być używana wewnątrz instrukcji „Catch” ani „Finally”.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValWinRtEventVal1"> <source>The AddHandler for Windows Runtime event '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">Element AddHandler dla zdarzenia środowiska uruchomieniowego systemu Windows „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Czy nie brakuje instrukcji „Return”?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValWinRtEventVal1_Title"> <source>The AddHandler for Windows Runtime event doesn't return a value on all code paths</source> <target state="translated">Element AddHandler dla zdarzenia środowiska uruchomieniowego systemu Windows nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodDefaultParameterValueMismatch2"> <source>Optional parameter of a method '{0}' does not have the same default value as the corresponding parameter of the partial method '{1}'.</source> <target state="translated">Parametr opcjonalny metody „{0}” nie ma tej samej wartości domyślnej co odpowiedni parametr metody częściowej „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamArrayMismatch2"> <source>Parameter of a method '{0}' differs by ParamArray modifier from the corresponding parameter of the partial method '{1}'.</source> <target state="translated">Parametr metody „{0}” różni się modyfikatorem ParamArray od odpowiedniego parametru metody częściowej „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMismatch"> <source>Module name '{0}' stored in '{1}' must match its filename.</source> <target state="translated">Nazwa modułu „{0}” przechowywana w elemencie „{1}” musi być zgodna z nazwą jego pliku.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleName"> <source>Invalid module name: {0}</source> <target state="translated">Nieprawidłowa nazwa modułu: {0}</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden"> <source>Attribute '{0}' from module '{1}' will be ignored in favor of the instance appearing in source.</source> <target state="translated">Atrybut „{0}” z modułu „{1}” zostanie zignorowany na rzecz wystąpienia ze źródła.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden_Title"> <source>Attribute from module will be ignored in favor of the instance appearing in source</source> <target state="translated">Atrybut z modułu zostanie zignorowany na rzecz wystąpienia ze źródła</target> <note /> </trans-unit> <trans-unit id="ERR_CmdOptionConflictsSource"> <source>Attribute '{0}' given in a source file conflicts with option '{1}'.</source> <target state="translated">Atrybut „{0}” podany w pliku źródłowym jest w konflikcie z opcją „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName"> <source>Referenced assembly '{0}' does not have a strong name.</source> <target state="translated">Przywoływany zestaw „{0}” nie ma silnej nazwy.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName_Title"> <source>Referenced assembly does not have a strong name</source> <target state="translated">Przywoływany zestaw nie ma silnej nazwy</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSignaturePublicKey"> <source>Invalid signature public key specified in AssemblySignatureKeyAttribute.</source> <target state="translated">W atrybucie AssemblySignatureKeyAttribute określono nieprawidłowy klucz publiczny sygnatury.</target> <note /> </trans-unit> <trans-unit id="ERR_CollisionWithPublicTypeInModule"> <source>Type '{0}' conflicts with public type defined in added module '{1}'.</source> <target state="translated">Typ „{0}” jest w konflikcie z typem publicznym zdefiniowanym w dodanym module „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypeConflictsWithDeclaration"> <source>Type '{0}' exported from module '{1}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Typ „{0}” wyeksportowany z modułu „{1}” powoduje konflikt z typem zadeklarowanym w podstawowym module tego zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypesConflict"> <source>Type '{0}' exported from module '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Typ „{0}” wyeksportowany z modułu „{1}” powoduje konflikt z typem „{2}” wyeksportowanym z modułu „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch"> <source>Referenced assembly '{0}' has different culture setting of '{1}'.</source> <target state="translated">Przywoływany zestaw „{0}” ma inne ustawienie kultury — „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch_Title"> <source>Referenced assembly has different culture setting</source> <target state="translated">Przywoływany zestaw ma inne ustawienie kultury</target> <note /> </trans-unit> <trans-unit id="ERR_AgnosticToMachineModule"> <source>Agnostic assembly cannot have a processor specific module '{0}'.</source> <target state="translated">Zestaw agnostyczny nie może mieć modułu specyficznego dla procesora „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingMachineModule"> <source>Assembly and module '{0}' cannot target different processors.</source> <target state="translated">Zestaw i moduł „{0}” nie mogą wskazywać różnych procesorów.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly"> <source>Referenced assembly '{0}' targets a different processor.</source> <target state="translated">Celem przywołanego zestawu „{0}” jest inny procesor.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly_Title"> <source>Referenced assembly targets a different processor</source> <target state="translated">Celem przywołanego zestawu jest inny procesor</target> <note /> </trans-unit> <trans-unit id="ERR_CryptoHashFailed"> <source>Cryptographic failure while creating hashes.</source> <target state="translated">Wystąpił błąd kryptograficzny w czasie tworzenia mieszań.</target> <note /> </trans-unit> <trans-unit id="ERR_CantHaveWin32ResAndManifest"> <source>Conflicting options specified: Win32 resource file; Win32 manifest.</source> <target state="translated">Określono opcje powodujące konflikt: plik zasobów Win32; manifest Win32.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithDeclaration"> <source>Forwarded type '{0}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Typ przesłany „{0}” powoduje konflikt z typem zadeklarowanym w podstawowym module tego zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypesConflict"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' forwarded to assembly '{3}'.</source> <target state="translated">Typ „{0}” przesłany do zestawu „{1}” powoduje konflikt z typem „{2}” przesłanym do zestawu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooLongMetadataName"> <source>Name '{0}' exceeds the maximum length allowed in metadata.</source> <target state="translated">Długość nazwy „{0}” przekracza maksymalną długość dozwoloną w metadanych.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNetModuleReference"> <source>Reference to '{0}' netmodule missing.</source> <target state="translated">Brak odwołania do modułu netmodule „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMustBeUnique"> <source>Module '{0}' is already defined in this assembly. Each module must have a unique filename.</source> <target state="translated">Moduł „{0}” jest już zdefiniowany w tym zestawie. Nazwa pliku każdego modułu musi być unikatowa.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithExportedType"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Typ „{0}” przesłany do zestawu „{1}” powoduje konflikt z typem „{2}” wyeksportowanym z modułu „{3}”.</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDREFERENCE"> <source>Adding assembly reference '{0}'</source> <target state="translated">Dodawanie odwołania do zestawu „{0}”</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDLINKREFERENCE"> <source>Adding embedded assembly reference '{0}'</source> <target state="translated">Dodawanie osadzonego odwołania do zestawu „{0}”</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDMODULE"> <source>Adding module reference '{0}'</source> <target state="translated">Dodawanie odwołania do modułu „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_NestingViolatesCLS1"> <source>Type '{0}' does not inherit the generic type parameters of its container.</source> <target state="translated">Typ „{0}” nie dziedziczy parametrów typu ogólnego ze swojego kontenera.</target> <note /> </trans-unit> <trans-unit id="ERR_PDBWritingFailed"> <source>Failure writing debug information: {0}</source> <target state="translated">Błąd podczas zapisu informacji o debugowaniu: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_ParamDefaultValueDiffersFromAttribute"> <source>The parameter has multiple distinct default values.</source> <target state="translated">Parametr ma wiele różnych domyślnych wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldHasMultipleDistinctConstantValues"> <source>The field has multiple distinct constant values.</source> <target state="translated">Pole ma wiele unikatowych wartości stałych.</target> <note /> </trans-unit> <trans-unit id="ERR_EncNoPIAReference"> <source>Cannot continue since the edit includes a reference to an embedded type: '{0}'.</source> <target state="translated">Nie można kontynuować, ponieważ edycja zawiera odwołanie do typu osadzonego: „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_EncReferenceToAddedMember"> <source>Member '{0}' added during the current debug session can only be accessed from within its declaring assembly '{1}'.</source> <target state="translated">Dostęp do składowej „{0}” dodanej podczas bieżącej sesji debugowania można uzyskać tylko w deklarowanym zestawie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedModule1"> <source>'{0}' is an unsupported .NET module.</source> <target state="translated">'Element „{0}” jest nieobsługiwanym modułem platformy .NET.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedEvent1"> <source>'{0}' is an unsupported event.</source> <target state="translated">'Element „{0}” jest nieobsługiwanym zdarzeniem.</target> <note /> </trans-unit> <trans-unit id="PropertiesCanNotHaveTypeArguments"> <source>Properties can not have type arguments</source> <target state="translated">Właściwości nie mogą mieć argumentów typu</target> <note /> </trans-unit> <trans-unit id="IdentifierSyntaxNotWithinSyntaxTree"> <source>IdentifierSyntax not within syntax tree</source> <target state="translated">Element IdentifierSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="AnonymousObjectCreationExpressionSyntaxNotWithinTree"> <source>AnonymousObjectCreationExpressionSyntax not within syntax tree</source> <target state="translated">Brak elementu AnonymousObjectCreationExpressionSyntax w drzewie składni</target> <note /> </trans-unit> <trans-unit id="FieldInitializerSyntaxNotWithinSyntaxTree"> <source>FieldInitializerSyntax not within syntax tree</source> <target state="translated">Element FieldInitializerSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="IDS_TheSystemCannotFindThePathSpecified"> <source>The system cannot find the path specified</source> <target state="translated">System nie może odnaleźć określonej ścieżki.</target> <note /> </trans-unit> <trans-unit id="ThereAreNoPointerTypesInVB"> <source>There are no pointer types in VB.</source> <target state="translated">Brak typów wskaźnikowych w języku Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ThereIsNoDynamicTypeInVB"> <source>There is no dynamic type in VB.</source> <target state="translated">Brak typów dynamicznych w języku Visual Basic.</target> <note /> </trans-unit> <trans-unit id="VariableSyntaxNotWithinSyntaxTree"> <source>variableSyntax not within syntax tree</source> <target state="translated">Element variableSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="AggregateSyntaxNotWithinSyntaxTree"> <source>AggregateSyntax not within syntax tree</source> <target state="translated">Brak elementu AggregateSyntax w drzewie składni</target> <note /> </trans-unit> <trans-unit id="FunctionSyntaxNotWithinSyntaxTree"> <source>FunctionSyntax not within syntax tree</source> <target state="translated">Element FunctionSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="PositionIsNotWithinSyntax"> <source>Position is not within syntax tree</source> <target state="translated">Pozycja nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="RangeVariableSyntaxNotWithinSyntaxTree"> <source>RangeVariableSyntax not within syntax tree</source> <target state="translated">Element RangeVariableSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="DeclarationSyntaxNotWithinSyntaxTree"> <source>DeclarationSyntax not within syntax tree</source> <target state="translated">Brak elementu DeclarationSyntax w drzewie składni</target> <note /> </trans-unit> <trans-unit id="StatementOrExpressionIsNotAValidType"> <source>StatementOrExpression is not an ExecutableStatementSyntax or an ExpressionSyntax</source> <target state="translated">Element StatementOrExpression nie jest typu ExecutableStatementSyntax lub ExpressionSyntax</target> <note /> </trans-unit> <trans-unit id="DeclarationSyntaxNotWithinTree"> <source>DeclarationSyntax not within tree</source> <target state="translated">Brak elementu DeclarationSyntax w drzewie</target> <note /> </trans-unit> <trans-unit id="TypeParameterNotWithinTree"> <source>TypeParameter not within tree</source> <target state="translated">Element TypeParameter w nie znajduje się w obrębie drzewa</target> <note /> </trans-unit> <trans-unit id="NotWithinTree"> <source> not within tree</source> <target state="translated"> nie w obrębie drzewa</target> <note /> </trans-unit> <trans-unit id="LocationMustBeProvided"> <source>Location must be provided in order to provide minimal type qualification.</source> <target state="translated">Lokalizacja musi być określona, aby zapewnić minimalną kwalifikację typu.</target> <note /> </trans-unit> <trans-unit id="SemanticModelMustBeProvided"> <source>SemanticModel must be provided in order to provide minimal type qualification.</source> <target state="translated">Należy podać element SemanticModel w celu określenia minimalnej kwalifikacji typu.</target> <note /> </trans-unit> <trans-unit id="NumberOfTypeParametersAndArgumentsMustMatch"> <source>the number of type parameters and arguments should be the same</source> <target state="translated">liczba parametrów typu i argumentów typu powinna być taka sama</target> <note /> </trans-unit> <trans-unit id="ERR_ResourceInModule"> <source>Cannot link resource files when building a module</source> <target state="translated">Nie można połączyć plików zasobów podczas kompilowania modułu</target> <note /> </trans-unit> <trans-unit id="NotAVbSymbol"> <source>Not a VB symbol.</source> <target state="translated">Nie jest to symbol języka Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ElementsCannotBeNull"> <source>Elements cannot be null.</source> <target state="translated">Elementy nie mogą mieć wartości null.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportClause"> <source>Unused import clause.</source> <target state="translated">Nieużywana klauzula importu.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportStatement"> <source>Unused import statement.</source> <target state="translated">Nieużywana instrukcja importu.</target> <note /> </trans-unit> <trans-unit id="WrongSemanticModelType"> <source>Expected a {0} SemanticModel.</source> <target state="translated">Oczekiwano elementu SemanticModel {0}.</target> <note /> </trans-unit> <trans-unit id="PositionNotWithinTree"> <source>Position must be within span of the syntax tree.</source> <target state="translated">Pozycja musi znajdować się w zasięgu drzewa składni.</target> <note /> </trans-unit> <trans-unit id="SpeculatedSyntaxNodeCannotBelongToCurrentCompilation"> <source>Syntax node to be speculated cannot belong to a syntax tree from the current compilation.</source> <target state="translated">Drzewo składni do przeanalizowania nie może należeć do drzewa składni bieżącej kompilacji.</target> <note /> </trans-unit> <trans-unit id="ChainingSpeculativeModelIsNotSupported"> <source>Chaining speculative semantic model is not supported. You should create a speculative model from the non-speculative ParentModel.</source> <target state="translated">Tworzenie łańcuchów spekulacyjnego modelu semantycznego nie jest obsługiwane. Należy utworzyć model spekulacyjny z nadrzędnego modelu niespekulacyjnego.</target> <note /> </trans-unit> <trans-unit id="IDS_ToolName"> <source>Microsoft (R) Visual Basic Compiler</source> <target state="translated">Kompilator Microsoft (R) Visual Basic Compiler</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine1"> <source>{0} version {1}</source> <target state="translated">{0} w wersji {1}</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine2"> <source>Copyright (C) Microsoft Corporation. All rights reserved.</source> <target state="translated">Copyright (C) Microsoft Corporation. Wszelkie prawa zastrzeżone.</target> <note /> </trans-unit> <trans-unit id="IDS_LangVersions"> <source>Supported language versions:</source> <target state="translated">Obsługiwane wersje językowe:</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong"> <source>Local name '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">Lokalna nazwa „{0}” jest za długa dla pliku PDB. Rozważ skrócenie jej lub skompilowanie bez opcji /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong_Title"> <source>Local name is too long for PDB</source> <target state="translated">Nazwa lokalna jest za długa dla pliku PDB</target> <note /> </trans-unit> <trans-unit id="WRN_PdbUsingNameTooLong"> <source>Import string '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">Ciąg importu „{0}” jest zbyt długi dla pliku PDB. Rozważ skrócenie go lub skompilowanie bez opcji /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbUsingNameTooLong_Title"> <source>Import string is too long for PDB</source> <target state="translated">Ciąg importu jest za długi dla pliku PDB</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefToTypeParameter"> <source>XML comment has a tag with a 'cref' attribute '{0}' that bound to a type parameter. Use the &lt;typeparamref&gt; tag instead.</source> <target state="translated">Komentarz XML ma tag z atrybutem „cref” „{0}”, który jest wiązany z parametrem typu. Zamiast tego użyj tagu &lt;typeparamref&gt;.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefToTypeParameter_Title"> <source>XML comment has a tag with a 'cref' attribute that bound to a type parameter</source> <target state="translated">Komentarz XML ma tag z atrybutem „cref”, który jest wiązany z parametrem typu</target> <note /> </trans-unit> <trans-unit id="ERR_LinkedNetmoduleMetadataMustProvideFullPEImage"> <source>Linked netmodule metadata must provide a full PE image: '{0}'.</source> <target state="translated">Połączone metadane modułu netmodule muszą określać pełny obraz PE: „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated"> <source>An instance of analyzer {0} cannot be created from {1} : {2}.</source> <target state="translated">Wystąpienia analizatora {0} nie można utworzyć z elementu {1}: {2}.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated_Title"> <source>Instance of analyzer cannot be created</source> <target state="translated">Nie można utworzyć wystąpienia analizatora</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly"> <source>The assembly {0} does not contain any analyzers.</source> <target state="translated">Zestaw {0} nie zawiera żadnych analizatorów.</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly_Title"> <source>Assembly does not contain any analyzers</source> <target state="translated">Zestaw nie zawiera analizatorów</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer"> <source>Unable to load analyzer assembly {0} : {1}.</source> <target state="translated">Nie można załadować zestawu analizatora {0}: {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer_Title"> <source>Unable to load analyzer assembly</source> <target state="translated">Nie można załadować zestawu analizatora</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer"> <source>Skipping some types in analyzer assembly {0} due to a ReflectionTypeLoadException : {1}.</source> <target state="translated">Niektóre typy zestawu analizatora {0} zostaną pominięte z powodu wyjątku ReflectionTypeLoadException: {1}.</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer_Title"> <source>Skip loading types in analyzer assembly that fail due to a ReflectionTypeLoadException</source> <target state="translated">Pomiń ładowanie typów w zestawie analizatora zakończonych niepowodzeniem z powodu wyjątku ReflectionTypeLoadException</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadRulesetFile"> <source>Error reading ruleset file {0} - {1}</source> <target state="translated">Błąd podczas odczytywania pliku zestawu reguł {0} — {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PlatformDoesntSupport"> <source>{0} is not supported in current project type.</source> <target state="translated">Element {0} nie jest obsługiwany w bieżącym typie projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_CantUseRequiredAttribute"> <source>The RequiredAttribute attribute is not permitted on Visual Basic types.</source> <target state="translated">Atrybut RequiredAttribute nie jest dozwolony w typach programu Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ERR_EncodinglessSyntaxTree"> <source>Cannot emit debug information for a source text without encoding.</source> <target state="translated">Nie można wyemitować informacji debugowania dla tekstu źródłowego bez kodowania.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatSpecifier"> <source>'{0}' is not a valid format specifier</source> <target state="translated">„{0}” nie jest prawidłowym specyfikatorem formatu</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPreprocessorConstantType"> <source>Preprocessor constant '{0}' of type '{1}' is not supported, only primitive types are allowed.</source> <target state="translated">Stała preprocesora „{0}” typu „{1}” nie jest obsługiwana. Dozwolone są tylko typy pierwotne.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedWarningKeyword"> <source>'Warning' expected.</source> <target state="translated">'Oczekiwano elementu „Warning”.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotBeMadeNullable1"> <source>'{0}' cannot be made nullable.</source> <target state="translated">'Nie można ustawić elementu „{0}” jako dopuszczającego wartość null.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConditionalWithRef"> <source>Leading '?' can only appear inside a 'With' statement, but not inside an object member initializer.</source> <target state="translated">Wiodący znak „?” może występować tylko w instrukcji „With”. Nie może występować w inicjatorze składowej obiektu.</target> <note /> </trans-unit> <trans-unit id="ERR_NullPropagatingOpInExpressionTree"> <source>A null propagating operator cannot be converted into an expression tree.</source> <target state="translated">Nie można przekonwertować operatora propagowania wartości null na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_TooLongOrComplexExpression"> <source>An expression is too long or complex to compile</source> <target state="translated">Wyrażenie jest zbyt długie lub zbyt złożone do skompilowania</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionDoesntHaveName"> <source>This expression does not have a name.</source> <target state="translated">To wyrażenie nie ma nazwy.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNameOfSubExpression"> <source>This sub-expression cannot be used inside NameOf argument.</source> <target state="translated">Nie można użyć tego podwyrażenia wewnątrz argumentu NameOf.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodTypeArgsUnexpected"> <source>Method type arguments unexpected.</source> <target state="translated">Nieoczekiwane argumenty typu metody.</target> <note /> </trans-unit> <trans-unit id="NoNoneSearchCriteria"> <source>SearchCriteria is expected.</source> <target state="translated">Oczekiwano elementu SearchCriteria.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCulture"> <source>Assembly culture strings may not contain embedded NUL characters.</source> <target state="translated">Ciągi kultury zestawu nie mogą zawierać osadzonych znaków NUL.</target> <note /> </trans-unit> <trans-unit id="ERR_InReferencedAssembly"> <source>There is an error in a referenced assembly '{0}'.</source> <target state="translated">Wystąpił błąd w przywoływanym zestawie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolationFormatWhitespace"> <source>Format specifier may not contain trailing whitespace.</source> <target state="translated">Specyfikator formatu nie może kończyć się znakiem odstępu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolationAlignmentOutOfRange"> <source>Alignment value is outside of the supported range.</source> <target state="translated">Wartość wyrównania przypada poza obsługiwanym zakresem.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringFactoryError"> <source>There were one or more errors emitting a call to {0}.{1}. Method or its return type may be missing or malformed.</source> <target state="translated">Wystąpił co najmniej jeden błąd podczas emitowania wywołania do elementu {0}.{1}. Brak metody lub jej typu zwracanego bądź zostały one źle sformułowane.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportClause_Title"> <source>Unused import clause</source> <target state="translated">Nieużywana klauzula importu</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportStatement_Title"> <source>Unused import statement</source> <target state="translated">Nieużywana instrukcja importu</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantStringTooLong"> <source>Length of String constant resulting from concatenation exceeds System.Int32.MaxValue. Try splitting the string into multiple constants.</source> <target state="translated">Długość stałej typu String w wyniku łączenia przekracza wartość System.Int32.MaxValue. Spróbuj podzielić ciąg na wiele stałych.</target> <note /> </trans-unit> <trans-unit id="ERR_LanguageVersion"> <source>Visual Basic {0} does not support {1}.</source> <target state="translated">Język Visual Basic {0} nie obsługuje {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPdbData"> <source>Error reading debug information for '{0}'</source> <target state="translated">Błąd podczas odczytywania informacji dotyczących debugowania elementu „{0}”</target> <note /> </trans-unit> <trans-unit id="FEATURE_ArrayLiterals"> <source>array literal expressions</source> <target state="translated">wyrażenia literału w tablicy</target> <note /> </trans-unit> <trans-unit id="FEATURE_AsyncExpressions"> <source>async methods or lambdas</source> <target state="translated">metody asynchroniczne lub wyrażenia lambda</target> <note /> </trans-unit> <trans-unit id="FEATURE_AutoProperties"> <source>auto-implemented properties</source> <target state="translated">właściwości zaimplementowane automatycznie</target> <note /> </trans-unit> <trans-unit id="FEATURE_ReadonlyAutoProperties"> <source>readonly auto-implemented properties</source> <target state="translated">automatycznie implementowane właściwości tylko do odczytu</target> <note /> </trans-unit> <trans-unit id="FEATURE_CoContraVariance"> <source>variance</source> <target state="translated">wariancja</target> <note /> </trans-unit> <trans-unit id="FEATURE_CollectionInitializers"> <source>collection initializers</source> <target state="translated">inicjatory kolekcji</target> <note /> </trans-unit> <trans-unit id="FEATURE_GlobalNamespace"> <source>declaring a Global namespace</source> <target state="translated">deklarowanie globalnej przestrzeni nazw</target> <note /> </trans-unit> <trans-unit id="FEATURE_Iterators"> <source>iterators</source> <target state="translated">iteratory</target> <note /> </trans-unit> <trans-unit id="FEATURE_LineContinuation"> <source>implicit line continuation</source> <target state="translated">niejawna kontynuacja wiersza</target> <note /> </trans-unit> <trans-unit id="FEATURE_StatementLambdas"> <source>multi-line lambda expressions</source> <target state="translated">wielowierszowe wyrażenia lambda</target> <note /> </trans-unit> <trans-unit id="FEATURE_SubLambdas"> <source>'Sub' lambda expressions</source> <target state="translated">'Wyrażenia lambda „Sub”</target> <note /> </trans-unit> <trans-unit id="FEATURE_NullPropagatingOperator"> <source>null conditional operations</source> <target state="translated">operacje warunkowe o wartości null</target> <note /> </trans-unit> <trans-unit id="FEATURE_NameOfExpressions"> <source>'nameof' expressions</source> <target state="translated">'wyrażenia „nameof”</target> <note /> </trans-unit> <trans-unit id="FEATURE_RegionsEverywhere"> <source>region directives within method bodies or regions crossing boundaries of declaration blocks</source> <target state="translated">dyrektywy regionu w treści metod lub regiony przekraczające granice bloków deklaracji</target> <note /> </trans-unit> <trans-unit id="FEATURE_MultilineStringLiterals"> <source>multiline string literals</source> <target state="translated">literały ciągów wielowierszowych</target> <note /> </trans-unit> <trans-unit id="FEATURE_CObjInAttributeArguments"> <source>CObj in attribute arguments</source> <target state="translated">CObj w argumentach atrybutów</target> <note /> </trans-unit> <trans-unit id="FEATURE_LineContinuationComments"> <source>line continuation comments</source> <target state="translated">komentarze dotyczące kontynuacji wiersza</target> <note /> </trans-unit> <trans-unit id="FEATURE_TypeOfIsNot"> <source>TypeOf IsNot expression</source> <target state="translated">Wyrażenie TypeOf IsNot</target> <note /> </trans-unit> <trans-unit id="FEATURE_YearFirstDateLiterals"> <source>year-first date literals</source> <target state="translated">literały daty z numerem roku na początku</target> <note /> </trans-unit> <trans-unit id="FEATURE_WarningDirectives"> <source>warning directives</source> <target state="translated">dyrektywy ostrzeżenia</target> <note /> </trans-unit> <trans-unit id="FEATURE_PartialModules"> <source>partial modules</source> <target state="translated">moduły częściowe</target> <note /> </trans-unit> <trans-unit id="FEATURE_PartialInterfaces"> <source>partial interfaces</source> <target state="translated">interfejsy częściowe</target> <note /> </trans-unit> <trans-unit id="FEATURE_ImplementingReadonlyOrWriteonlyPropertyWithReadwrite"> <source>implementing read-only or write-only property with read-write property</source> <target state="translated">implementowanie właściwości read-only lub write-only z właściwością read-write</target> <note /> </trans-unit> <trans-unit id="FEATURE_DigitSeparators"> <source>digit separators</source> <target state="translated">separatory cyfr</target> <note /> </trans-unit> <trans-unit id="FEATURE_BinaryLiterals"> <source>binary literals</source> <target state="translated">literały binarne</target> <note /> </trans-unit> <trans-unit id="FEATURE_Tuples"> <source>tuples</source> <target state="translated">krotki</target> <note /> </trans-unit> <trans-unit id="FEATURE_PrivateProtected"> <source>Private Protected</source> <target state="translated">Prywatny chroniony</target> <note /> </trans-unit> <trans-unit id="ERR_DebugEntryPointNotSourceMethodDefinition"> <source>Debug entry point must be a definition of a method declared in the current compilation.</source> <target state="translated">Punkt wejściowy debugowania musi być definicją metody zadeklarowanej w bieżącej kompilacji.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPathMap"> <source>The pathmap option was incorrectly formatted.</source> <target state="translated">Opcja pathmap jest nieprawidłowo sformatowana.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeIsNotASubmission"> <source>Syntax tree should be created from a submission.</source> <target state="translated">Drzewo składni powinno zostać utworzone na podstawie przesłanych danych.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyUserStrings"> <source>Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string or XML literals.</source> <target state="translated">Całkowita długość ciągów użytkownika używanych przez program przekracza dozwolony limit. Spróbuj ograniczyć użycie literałów ciągów lub XML.</target> <note /> </trans-unit> <trans-unit id="ERR_PeWritingFailure"> <source>An error occurred while writing the output file: {0}</source> <target state="translated">Wystąpił błąd podczas zapisywania pliku wyjściowego: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_OptionMustBeAbsolutePath"> <source>Option '{0}' must be an absolute path.</source> <target state="translated">Opcja „{0}” musi być ścieżką bezwzględną.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceLinkRequiresPdb"> <source>/sourcelink switch is only supported when emitting PDB.</source> <target state="translated">Przełącznik /sourcelink jest obsługiwany tylko w przypadku emitowania pliku PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleDuplicateElementName"> <source>Tuple element names must be unique.</source> <target state="translated">Nazwy elementów krotek muszą być unikatowe.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch"> <source>The tuple element name '{0}' is ignored because a different name or no name is specified by the target type '{1}'.</source> <target state="translated">Nazwa elementu krotki „{0}” została zignorowana, ponieważ typ elementu docelowego „{1}” określa inną nazwę lub nie określa żadnej nazwy.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch_Title"> <source>The tuple element name is ignored because a different name or no name is specified by the assignment target.</source> <target state="translated">Nazwa elementu krotki została zignorowana, ponieważ element docelowy przypisania określa inną nazwę lub nie określa żadnej nazwy.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementName"> <source>Tuple element name '{0}' is only allowed at position {1}.</source> <target state="translated">Nazwa elementu krotki „{0}“ jest dozwolona tylko na pozycji {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementNameAnyPosition"> <source>Tuple element name '{0}' is disallowed at any position.</source> <target state="translated">Nazwa elementu krotki „{0}“ nie jest dozwolona na żadnej pozycji.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleTooFewElements"> <source>Tuple must contain at least two elements.</source> <target state="translated">Krotka musi zawierać co najmniej dwa elementy.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNamesAttributeMissing"> <source>Cannot define a class or member that utilizes tuples because the compiler required type '{0}' cannot be found. Are you missing a reference?</source> <target state="translated">Nie można zdefiniować klasy lub składowej, która wykorzystuje krotki, ponieważ nie można znaleźć wymaganego typu kompilatora „{0}”. Czy brakuje odwołania?</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitTupleElementNamesAttribute"> <source>Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.</source> <target state="translated">Nie można odwołać się do atrybutu „System.Runtime.CompilerServices.TupleElementNamesAttribute” jawnie. Użyj składni krotek, aby zdefiniować nazwy krotek.</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturningCallInExpressionTree"> <source>An expression tree may not contain a call to a method or property that returns by reference.</source> <target state="translated">Drzewo wyrażenia nie może zawierać wywołania metody lub właściwości zwracanego przez referencję.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedWithoutPdb"> <source>/embed switch is only supported when emitting a PDB.</source> <target state="translated">Przełącznik /embed jest obsługiwany tylko w przypadku emitowania pliku PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInstrumentationKind"> <source>Invalid instrumentation kind: {0}</source> <target state="translated">Nieprawidłowy rodzaj instrumentacji: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_DocFileGen"> <source>Error writing to XML documentation file: {0}</source> <target state="translated">Błąd zapisu w pliku dokumentacji XML: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadAssemblyName"> <source>Invalid assembly name: {0}</source> <target state="translated">Nieprawidłowa nazwa zestawu: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_TypeForwardedToMultipleAssemblies"> <source>Module '{0}' in assembly '{1}' is forwarding the type '{2}' to multiple assemblies: '{3}' and '{4}'.</source> <target state="translated">Moduł „{0}” w zestawie „{1}” przekazuje typ „{2}” do wielu zestawów: „{3}” i „{4}”.</target> <note /> </trans-unit> <trans-unit id="ERR_Merge_conflict_marker_encountered"> <source>Merge conflict marker encountered</source> <target state="translated">Napotkano znacznik konfliktu scalania</target> <note /> </trans-unit> <trans-unit id="ERR_NoRefOutWhenRefOnly"> <source>Do not use refout when using refonly.</source> <target state="translated">Nie używaj opcji refout, gdy używana jest opcja refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNetModuleOutputWhenRefOutOrRefOnly"> <source>Cannot compile net modules when using /refout or /refonly.</source> <target state="translated">Nie można skompilować modułów sieciowych, gdy używana jest opcja /refout lub /refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNonTrailingNamedArgument"> <source>Named argument '{0}' is used out-of-position but is followed by an unnamed argument</source> <target state="translated">Nazwany argument „{0}” jest używany poza pozycją, ale następuje po nim nienazwany argument</target> <note /> </trans-unit> <trans-unit id="ERR_BadDocumentationMode"> <source>Provided documentation mode is unsupported or invalid: '{0}'.</source> <target state="translated">Podany tryb dokumentacji jest nieobsługiwany lub nieprawidłowy: „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLanguageVersion"> <source>Provided language version is unsupported or invalid: '{0}'.</source> <target state="translated">Podana wersja języka jest nieobsługiwana lub nieprawidłowa: „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSourceCodeKind"> <source>Provided source code kind is unsupported or invalid: '{0}'</source> <target state="translated">Podany rodzaj kodu źródłowego jest nieobsługiwany lub nieprawidłowy: „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_TupleInferredNamesNotAvailable"> <source>Tuple element name '{0}' is inferred. Please use language version {1} or greater to access an element by its inferred name.</source> <target state="translated">Nazwa elementu krotki „{0}” została wywnioskowana. Użyj wersji języka {1} lub nowszej, aby uzyskać dostęp do elementu według jego wywnioskowanej nazwy.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental"> <source>'{0}' is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">'Element „{0}” jest przeznaczony wyłącznie do celów ewaluacyjnych i może zostać zmieniony albo usunięty w przyszłych aktualizacjach.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental_Title"> <source>Type is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">Typ jest przeznaczony wyłącznie do celów ewaluacyjnych i może zostać zmieniony albo usunięty w przyszłych aktualizacjach.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInfo"> <source>Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}'</source> <target state="translated">Nie można odczytać informacji debugowania metody „{0}” (token 0x{1}) z zestawu „{2}”</target> <note /> </trans-unit> <trans-unit id="IConversionExpressionIsNotVisualBasicConversion"> <source>{0} is not a valid Visual Basic conversion expression</source> <target state="translated">{0} nie jest prawidłowym wyrażeniem konwersji języka Visual Basic</target> <note /> </trans-unit> <trans-unit id="IArgumentIsNotVisualBasicArgument"> <source>{0} is not a valid Visual Basic argument</source> <target state="translated">{0} nie jest prawidłowym argumentem języka Visual Basic</target> <note /> </trans-unit> <trans-unit id="FEATURE_LeadingDigitSeparator"> <source>leading digit separator</source> <target state="translated">wiodący separator cyfr</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTupleResolutionAmbiguous3"> <source>Predefined type '{0}' is declared in multiple referenced assemblies: '{1}' and '{2}'</source> <target state="translated">Wstępnie zdefiniowany typ „{0}” jest zadeklarowany w wielu przywoływanych zestawach: „{1}” i „{2}”</target> <note /> </trans-unit> <trans-unit id="ICompoundAssignmentOperationIsNotVisualBasicCompoundAssignment"> <source>{0} is not a valid Visual Basic compound assignment operation</source> <target state="translated">{0} nie jest prawidłową złożoną operacją przypisania w języku Visual Basic</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHashAlgorithmName"> <source>Invalid hash algorithm name: '{0}'</source> <target state="translated">Nieprawidłowa nazwa algorytmu wyznaczania wartości skrótu: „{0}”</target> <note /> </trans-unit> <trans-unit id="FEATURE_InterpolatedStrings"> <source>interpolated strings</source> <target state="translated">ciągi interpolowane</target> <note /> </trans-unit> <trans-unit id="FTL_InvalidInputFileName"> <source>File name '{0}' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long</source> <target state="translated">Nazwa pliku „{0}” jest pusta, zawiera nieprawidłowe znaki, zawiera specyfikację dysku bez bezwzględnej ścieżki lub jest za długa</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeNotSupportedInVB"> <source>'{0}' is not supported in VB.</source> <target state="translated">Element „{0}” nie jest obsługiwany w języku VB.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeNotSupportedInVB_Title"> <source>Attribute is not supported in VB</source> <target state="translated">Atrybut nie jest obsługiwany w języku VB</target> <note /> </trans-unit> </body> </file> </xliff>
<?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd"> <file datatype="xml" source-language="en" target-language="pl" original="../VBResources.resx"> <body> <trans-unit id="ERR_AssignmentInitOnly"> <source>Init-only property '{0}' can only be assigned by an object member initializer, or on 'Me', 'MyClass` or 'MyBase' in an instance constructor.</source> <target state="translated">Właściwość tylko do inicjowania „{0}” może być przypisana tylko przez inicjatora składowej obiektu lub w elemencie „Me”, „MyClass” lub „MyBase” w konstruktorze wystąpień.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSwitchValue"> <source>Command-line syntax error: '{0}' is not a valid value for the '{1}' option. The value must be of the form '{2}'.</source> <target state="translated">Błąd składni wiersza polecenia: „{0}” nie jest prawidłową wartością dla opcji „{1}”. Wartość musi mieć postać „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CommentsAfterLineContinuationNotAvailable1"> <source>Please use language version {0} or greater to use comments after line continuation character.</source> <target state="translated">Użyj wersji języka {0} lub nowszej, aby stosować komentarze po znaku kontynuacji wiersza.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultInterfaceImplementationInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a non-abstract member. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Nie można osadzić typu „{0}”, ponieważ ma nieabstrakcyjną składową. Rozważ ustawienie wartości false dla właściwości „Osadź typy międzyoperacyjne”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleAnalyzerConfigsInSameDir"> <source>Multiple analyzer config files cannot be in the same directory ('{0}').</source> <target state="translated">Wiele plików konfiguracji analizatora nie może znajdować się w tym samym katalogu („{0}”).</target> <note /> </trans-unit> <trans-unit id="ERR_OverridingInitOnlyProperty"> <source>'{0}' cannot override init-only '{1}'.</source> <target state="translated">Właściwość „{0}” nie może przesłonić właściwości tylko do inicjowania „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyDoesntImplementInitOnly"> <source>Init-only '{0}' cannot be implemented.</source> <target state="translated">Nie można zaimplementować właściwości tylko do inicjowania „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ReAbstractionInNoPIAType"> <source>Type '{0}' cannot be embedded because it has a re-abstraction of a member from base interface. Consider setting the 'Embed Interop Types' property to false.</source> <target state="translated">Nie można osadzić typu „{0}”, ponieważ zawiera ponowną abstrakcję składowej z interfejsu podstawowego. Rozważ ustawienie właściwości „Osadź typy międzyoperacyjne” na wartość false.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation"> <source>Target runtime doesn't support default interface implementation.</source> <target state="translated">Docelowe środowisko uruchomieniowe nie obsługuje domyślnej implementacji interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeDoesNotSupportProtectedAccessForInterfaceMember"> <source>Target runtime doesn't support 'Protected', 'Protected Friend', or 'Private Protected' accessibility for a member of an interface.</source> <target state="translated">Docelowe środowisko uruchomieniowe nie obsługuje poziomu dostępu „Protected”, „Protected Friend” ani „Private Protected” dla składowej interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedEventNeedsHandlerInTheSameType"> <source>Events of shared WithEvents variables cannot be handled by methods in a different type.</source> <target state="translated">Zdarzenia udostępnionych zmiennych WithEvents nie mogą zostać obsłużone przez metody w innym typie.</target> <note /> </trans-unit> <trans-unit id="ERR_UnmanagedCallersOnlyNotSupported"> <source>'UnmanagedCallersOnly' attribute is not supported.</source> <target state="translated">Atrybut „UnmanagedCallersOnly” jest nieobsługiwany.</target> <note /> </trans-unit> <trans-unit id="FEATURE_CallerArgumentExpression"> <source>caller argument expression</source> <target state="new">caller argument expression</target> <note /> </trans-unit> <trans-unit id="FEATURE_CommentsAfterLineContinuation"> <source>comments after line continuation</source> <target state="translated">komentarze po kontynuacji wiersza</target> <note /> </trans-unit> <trans-unit id="FEATURE_InitOnlySettersUsage"> <source>assigning to or passing 'ByRef' properties with init-only setters</source> <target state="translated">przypisywanie lub przekazywanie właściwości „ByRef” za pomocą metod ustawiających tylko do inicjowania</target> <note /> </trans-unit> <trans-unit id="FEATURE_UnconstrainedTypeParameterInConditional"> <source>unconstrained type parameters in binary conditional expressions</source> <target state="translated">parametry typu bez ograniczeń w binarnych wyrażeniach warunkowych</target> <note /> </trans-unit> <trans-unit id="IDS_VBCHelp"> <source> Visual Basic Compiler Options - OUTPUT FILE - -out:&lt;file&gt; Specifies the output file name. -target:exe Create a console application (default). (Short form: -t) -target:winexe Create a Windows application. -target:library Create a library assembly. -target:module Create a module that can be added to an assembly. -target:appcontainerexe Create a Windows application that runs in AppContainer. -target:winmdobj Create a Windows Metadata intermediate file -doc[+|-] Generates XML documentation file. -doc:&lt;file&gt; Generates XML documentation file to &lt;file&gt;. -refout:&lt;file&gt; Reference assembly output to generate - INPUT FILES - -addmodule:&lt;file_list&gt; Reference metadata from the specified modules -link:&lt;file_list&gt; Embed metadata from the specified interop assembly. (Short form: -l) -recurse:&lt;wildcard&gt; Include all files in the current directory and subdirectories according to the wildcard specifications. -reference:&lt;file_list&gt; Reference metadata from the specified assembly. (Short form: -r) -analyzer:&lt;file_list&gt; Run the analyzers from this assembly (Short form: -a) -additionalfile:&lt;file list&gt; Additional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings. - RESOURCES - -linkresource:&lt;resinfo&gt; Links the specified file as an external assembly resource. resinfo:&lt;file&gt;[,&lt;name&gt;[,public|private]] (Short form: -linkres) -nowin32manifest The default manifest should not be embedded in the manifest section of the output PE. -resource:&lt;resinfo&gt; Adds the specified file as an embedded assembly resource. resinfo:&lt;file&gt;[,&lt;name&gt;[,public|private]] (Short form: -res) -win32icon:&lt;file&gt; Specifies a Win32 icon file (.ico) for the default Win32 resources. -win32manifest:&lt;file&gt; The provided file is embedded in the manifest section of the output PE. -win32resource:&lt;file&gt; Specifies a Win32 resource file (.res). - CODE GENERATION - -optimize[+|-] Enable optimizations. -removeintchecks[+|-] Remove integer checks. Default off. -debug[+|-] Emit debugging information. -debug:full Emit full debugging information (default). -debug:pdbonly Emit full debugging information. -debug:portable Emit cross-platform debugging information. -debug:embedded Emit cross-platform debugging information into the target .dll or .exe. -deterministic Produce a deterministic assembly (including module version GUID and timestamp) -refonly Produce a reference assembly in place of the main output -instrument:TestCoverage Produce an assembly instrumented to collect coverage information -sourcelink:&lt;file&gt; Source link info to embed into PDB. - ERRORS AND WARNINGS - -nowarn Disable all warnings. -nowarn:&lt;number_list&gt; Disable a list of individual warnings. -warnaserror[+|-] Treat all warnings as errors. -warnaserror[+|-]:&lt;number_list&gt; Treat a list of warnings as errors. -ruleset:&lt;file&gt; Specify a ruleset file that disables specific diagnostics. -errorlog:&lt;file&gt;[,version=&lt;sarif_version&gt;] Specify a file to log all compiler and analyzer diagnostics in SARIF format. sarif_version:{1|2|2.1} Default is 1. 2 and 2.1 both mean SARIF version 2.1.0. -reportanalyzer Report additional analyzer information, such as execution time. -skipanalyzers[+|-] Skip execution of diagnostic analyzers. - LANGUAGE - -define:&lt;symbol_list&gt; Declare global conditional compilation symbol(s). symbol_list:name=value,... (Short form: -d) -imports:&lt;import_list&gt; Declare global Imports for namespaces in referenced metadata files. import_list:namespace,... -langversion:? Display the allowed values for language version -langversion:&lt;string&gt; Specify language version such as `default` (latest major version), or `latest` (latest version, including minor versions), or specific versions like `14` or `15.3` -optionexplicit[+|-] Require explicit declaration of variables. -optioninfer[+|-] Allow type inference of variables. -rootnamespace:&lt;string&gt; Specifies the root Namespace for all type declarations. -optionstrict[+|-] Enforce strict language semantics. -optionstrict:custom Warn when strict language semantics are not respected. -optioncompare:binary Specifies binary-style string comparisons. This is the default. -optioncompare:text Specifies text-style string comparisons. - MISCELLANEOUS - -help Display this usage message. (Short form: -?) -noconfig Do not auto-include VBC.RSP file. -nologo Do not display compiler copyright banner. -quiet Quiet output mode. -verbose Display verbose messages. -parallel[+|-] Concurrent build. -version Display the compiler version number and exit. - ADVANCED - -baseaddress:&lt;number&gt; The base address for a library or module (hex). -checksumalgorithm:&lt;alg&gt; Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default). -codepage:&lt;number&gt; Specifies the codepage to use when opening source files. -delaysign[+|-] Delay-sign the assembly using only the public portion of the strong name key. -publicsign[+|-] Public-sign the assembly using only the public portion of the strong name key. -errorreport:&lt;string&gt; Specifies how to handle internal compiler errors; must be prompt, send, none, or queue (default). -filealign:&lt;number&gt; Specify the alignment used for output file sections. -highentropyva[+|-] Enable high-entropy ASLR. -keycontainer:&lt;string&gt; Specifies a strong name key container. -keyfile:&lt;file&gt; Specifies a strong name key file. -libpath:&lt;path_list&gt; List of directories to search for metadata references. (Semi-colon delimited.) -main:&lt;class&gt; Specifies the Class or Module that contains Sub Main. It can also be a Class that inherits from System.Windows.Forms.Form. (Short form: -m) -moduleassemblyname:&lt;string&gt; Name of the assembly which this module will be a part of. -netcf Target the .NET Compact Framework. -nostdlib Do not reference standard libraries (system.dll and VBC.RSP file). -pathmap:&lt;K1&gt;=&lt;V1&gt;,&lt;K2&gt;=&lt;V2&gt;,... Specify a mapping for source path names output by the compiler. -platform:&lt;string&gt; Limit which platforms this code can run on; must be x86, x64, Itanium, arm, arm64 AnyCPU32BitPreferred or anycpu (default). -preferreduilang Specify the preferred output language name. -nosdkpath Disable searching the default SDK path for standard library assemblies. -sdkpath:&lt;path&gt; Location of the .NET Framework SDK directory (mscorlib.dll). -subsystemversion:&lt;version&gt; Specify subsystem version of the output PE. version:&lt;number&gt;[.&lt;number&gt;] -utf8output[+|-] Emit compiler output in UTF8 character encoding. @&lt;file&gt; Insert command-line settings from a text file -vbruntime[+|-|*] Compile with/without the default Visual Basic runtime. -vbruntime:&lt;file&gt; Compile with the alternate Visual Basic runtime in &lt;file&gt;. </source> <target state="translated"> Opcje kompilatora Visual Basic - PLIK WYJŚCIOWY - -out:&lt;plik&gt; Określa nazwę pliku wyjściowego. -target:exe Utwórz aplikację konsolową (domyślnie). (Krótka wersja: -t) -target:winexe Utwórz aplikację systemu Windows -target:library Utwórz zestaw biblioteki. -target:module Utwórz moduł, który można dodać do zestawu -target:appcontainerexe Utwórz aplikację systemu Windows uruchamianą w kontenerze aplikacji. -target:winmdobj Utwórz plik pośredni metadanych systemu Windows -doc[+|-] Generuje plik dokumentacji XML. -doc:&lt;file&gt; Generuje plik dokumentacji XML w pliku &lt;plik&gt;. -refout:&lt;plik&gt; Dane wyjściowe zestawu odwołania do wygenerowania - PLIKI WEJŚCIOWE - -addmodule:&lt;lista_plików&gt; Odwołuj się do metadanych z określonych modułów -link:&lt;lista_plików&gt; Osadź metadane z określonego zestawu międzyoperacyjnego. (Krótka wersja: -l) -recurse:&lt;symbol wieloznaczny&gt; Dołącz wszystkie pliki zawarte w bieżącym katalogu i jego podkatalogach zgodnie ze specyfikacją określoną przy użyciu symboli wieloznacznych. -reference:&lt;lista_plików&gt; Odwołuj się do metadanych z określonego zestawu. (Krótka wersja: -r) -analyzer:&lt;lista_plików&gt; Uruchom analizatory z tego zestawu (Krótka wersja: -a) -additionalfile:&lt;lista_plików&gt; Dodatkowe pliki, które nie mają bezpośredniego wpływu na generowanie kodu, ale mogą być używane przez analizatory w celu tworzenia komunikatów o błędach lub ostrzeżeń. - ZASOBY - -linkresource:&lt;informacje_o_zasobie&gt; Łączy określony plik jako zasób zewnętrzny zestawu. informacje_o_zasobie:&lt;plik&gt;[,&lt;nazwa&gt;[,public|private]] (Krótka wersja: -linkres) -nowin32manifest Manifest domyślny nie powinien być osadzony w sekcji manifestu w wyjściowym środowisku PE. -resource:&lt;informacje_o_zasobie&gt; Dodaje określony plik jako osadzony zasób zestawu. informacje_o_zasobie:&lt;plik&gt;[,&lt;nazwa&gt;[,public|private]] (Krótka wersja: -res) -win32icon:&lt;p&gt; Określa plik ikony środowiska Win32 (ico) dla domyślnych zasobów środowiska Win32. -win32manifest:&lt;plik&gt; Podany plik zostanie osadzony w sekcji manifestu wyjściowego środowiska PE. -win32resource:&lt;plik&gt; Określa plik zasobów środowiska Win32 (res). - GENEROWANIE KODU - -optimize[+|-] Włącz optymalizacje. -removeintchecks[+|-] Usuń kontrole liczb całkowitych. Domyślnie wyłączone. -debug[+|-] Emituj informacje o debugowaniu. -debug:full Emituj pełne informacje o debugowaniu (domyślnie). -debug:pdbonly Emituj pełne informacje o debugowaniu. -debug:portable Emituj informacje o debugowaniu międzyplatformowym. -debug:embedded Emituj informacje o debugowaniu międzyplatformowym do docelowego pliku DLL lub EXE. -deterministic Utwórz zestaw deterministyczny (w tym sygnaturę czasową i identyfikator GUID wersji modułu) -refonly Utwórz zestaw odwołania zamiast głównych danych wyjściowych -instrument:TestCoverage Utwórz zestaw instrumentowany w celu gromadzenia informacji o pokryciu -sourcelink:&lt;plik&gt; Informacje o linku źródłowym do wbudowania w pliku PDB. - BŁĘDY I OSTRZEŻENIA - -nowarn Wyłącz wszystkie ostrzeżenia. -nowarn:&lt;lista_numerów&gt; Wyłącz listę poszczególnych ostrzeżeń. -warnaserror[+|-] Traktuj wszystkie ostrzeżenia jako błędy. -warnaserror[+|-]:&lt;lista_numerów&gt; Traktuj ostrzeżenia z listy jako błędy. -ruleset:&lt;plik&gt; Określ plik zestawu reguł, który wyłącza określone opcje diagnostyczne. -errorlog:&lt;plik&gt;[,version=&lt;wersja_sarif&gt;] Określ plik, w którym mają zostać zarejestrowane dane diagnostyczne w formacie SARIF. wersja_sarif:{1|2|2.1} Domyślne wartości 1. 2 i 2.1 oznaczają format SARIF w wersji 2.1.0. -reportanalyzer Zgłoś dodatkowe informacje analizatora, takie jak czas wykonywania. -skipanalyzers[+|-] Pomiń wykonywanie analizatorów diagnostycznych. - JĘZYK - -define:&lt;lista_symboli&gt; Zadeklaruj globalne symbole kompilacji warunkowej. symbol_list:nazwa=wartość,... (Krótka wersja: -d) -imports:&lt;lista_importów&gt; Zadeklaruj globalne importy dla przestrzeni nazw w przywoływanych plikach metadanych. import_list:przestrzeń_nazw, ,... -langversion:? Wyświetl dozwolone wartości dla wersji języka -langversion:&lt;ciąg&gt; Określ wersję języka, taką jak „default” (najnowsza wersja główna) lub „latest” (najnowsza wersja, z uwzględnieniem wersji pomocniczych) albo konkretna wersja, na przykład „14” lub „15.3” -optionexplicit[+|-] Wymagaj jawnej deklaracji zmiennych. -optioninfer[+|-] Zezwalaj na wnioskowanie o typie zmiennych. -rootnamespace:&lt;ciąg&gt; Określa główną przestrzeń nazw dla wszystkich deklaracji typów. -optionstrict[+|-] Wymuszaj ścisłą semantykę języka. -optionstrict:custom Ostrzegaj, gdy ścisła semantyka języka nie jest przestrzegana. -optioncompare:binary Określa binarne porównywanie ciągów. Jest to opcja domyślna. -optioncompare:text Określa tekstowe porównywanie ciągów. - RÓŻNE - -help Wyświetl ten komunikat dotyczący użycia. (krótka wersja: -?) -noconfig Nie dołączaj automatycznie pliku VBC.RSP. -nologo Nie wyświetlaj baneru kompilatora z informacjami o prawach autorskich. -quiet Cichy tryb wyjściowy. -verbose Wyświetl pełne komunikaty -parallel[+|-] Współbieżna kompilacja. -version Wyświetl numer wersji kompilatora i wyjdź. - ZAAWANSOWANE - -baseaddress:&lt;numer&gt; Podstawowy adres biblioteki lub modułu (szesnastkowy). -checksumalgorithm:&lt;algorytm&gt; Określ algorytm obliczania sumy kontrolnej pliku źródłowego przechowywanej w pliku PDB. Obsługiwane wartości: SHA1 lub SHA256 (domyślnie). -codepage:&lt;numer&gt; Określa stronę kodową do użycia podczas otwierania plików źródłowych. -delaysign[+|-] Podpisz z opóźnieniem zestaw, używając tylko części publicznej klucza o silnej nazwie. -publicsign[+|-] Podpisz publicznie zestaw, używając tylko części publicznej klucza o silnej nazwie. -errorreport:&lt;ciąg&gt; Określa, w jaki sposób obsługiwać wewnętrzne błędy kompilatora: musi mieć wartość prompt, send, none lub queue (wartość domyślna). -filealign:&lt;numer&gt; Określ wyrównanie stosowane dla sekcji plików wyjściowych. -highentropyva[+|-] Włącz losowe generowanie układu przestrzeni adresowej o wysokiej entropii. -keycontainer:&lt;ciąg&gt; Określa kontener klucza o silnej nazwie. -keyfile:&lt;plik&gt; Określa plik klucza o silnej nazwie. -libpath:&lt;lista_ścieżek&gt; Lista katalogów, w których mają zostać wyszukane odwołania do metadanych (lista wartości oddzielonych średnikami). -main:&lt;klasa&gt; Określa klasę lub moduł zawierające element Sub Main. Może to również być klasa dziedzicząca po elemencie System.Windows.Forms.Form. (krótka wersja: -m) -moduleassemblyname:&lt;ciąg&gt; Nazwa zestawu, do którego będzie należeć ten moduł. -netcf Ustaw program .NET Compact Framework jako element docelowy. -nostdlib Nie odwołuj się do bibliotek standardowych (plików system.dll i VBC.RSP). -pathmap:&lt;K1&gt;=&lt;W1&gt;,&lt;K2&gt;=&lt;W2&gt;,... Określ mapowanie nazw ścieżek źródłowych wyprowadzanych przez kompilator. -platform:&lt;ciąg&gt; Ogranicz platformy, na jakich można uruchomić ten kod; dozwolone wartości: x86, x64, Itanium, arm, arm64, AnyCPU32BitPreferred lub anycpu (wartość domyślna). -preferreduilang Określ nazwę preferowanego języka wyjściowego. -nosdkpath Wyłącz wyszukiwanie ścieżki domyślnego zestawu SDK dla standardowych zestawów bibliotecznych. -sdkpath:&lt;ścieżka&gt; Lokalizacja katalogu zestawu .NET Framework SDK (mscorlib.dll). -subsystemversion:&lt;wersja&gt; Określ wersję podsystemu wyjściowego środowiska PE. version:&lt;numer&gt;[.&lt;numer&gt;] -utf8output[+|-] Emituj dane wyjściowe kompilatora przy użyciu kodowania znaków UTF8. @&lt;plik&gt; Wstaw ustawienia wiersza polecenia z pliku tekstowego -vbruntime[+|-|*] Wykonaj kompilację przy użyciu-bez użycia domyślnego środowiska uruchomieniowego języka Visual Basic. -vbruntime:&lt;plik&gt; Wykonaj kompilację przy użyciu alternatywnego środowiska uruchomieniowego języka Visual Basic w pliku &lt;plik&gt;. </target> <note /> </trans-unit> <trans-unit id="ThereAreNoFunctionPointerTypesInVB"> <source>There are no function pointer types in VB.</source> <target state="translated">W języku VB nie ma typów wskaźnikowych funkcji.</target> <note /> </trans-unit> <trans-unit id="ThereAreNoNativeIntegerTypesInVB"> <source>There are no native integer types in VB.</source> <target state="translated">Brak typów natywnej liczby całkowitej w języku Visual Basic.</target> <note /> </trans-unit> <trans-unit id="Trees0"> <source>trees({0})</source> <target state="translated">trees({0})</target> <note /> </trans-unit> <trans-unit id="TreesMustHaveRootNode"> <source>trees({0}) must have root node with SyntaxKind.CompilationUnit.</source> <target state="translated">Element trees({0}) musi mieć węzeł główny z elementem SyntaxKind.CompilationUnit.</target> <note /> </trans-unit> <trans-unit id="CannotAddCompilerSpecialTree"> <source>Cannot add compiler special tree</source> <target state="translated">Nie można dodać specjalnego drzewa kompilatora</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeAlreadyPresent"> <source>Syntax tree already present</source> <target state="translated">Drzewo składni już istnieje</target> <note /> </trans-unit> <trans-unit id="SubmissionCanHaveAtMostOneSyntaxTree"> <source>Submission can have at most one syntax tree.</source> <target state="translated">Przesłanie może mieć co najwyżej jedno drzewo składni.</target> <note /> </trans-unit> <trans-unit id="CannotRemoveCompilerSpecialTree"> <source>Cannot remove compiler special tree</source> <target state="translated">Nie można usunąć specjalnego drzewa kompilatora</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeNotFoundToRemove"> <source>SyntaxTree '{0}' not found to remove</source> <target state="translated">Nie znaleziono elementu SyntaxTree „{0}” do usunięcia</target> <note /> </trans-unit> <trans-unit id="TreeMustHaveARootNodeWithCompilationUnit"> <source>Tree must have a root node with SyntaxKind.CompilationUnit</source> <target state="translated">Drzewo musi mieć węzeł główny z elementem SyntaxKind.CompilationUnit</target> <note /> </trans-unit> <trans-unit id="CompilationVisualBasic"> <source>Compilation (Visual Basic): </source> <target state="translated">Kompilacja (Visual Basic): </target> <note /> </trans-unit> <trans-unit id="NodeIsNotWithinSyntaxTree"> <source>Node is not within syntax tree</source> <target state="translated">Węzeł nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="CantReferenceCompilationFromTypes"> <source>Can't reference compilation of type '{0}' from {1} compilation.</source> <target state="translated">Nie można odwołać się do kompilacji typu „{0}” z kompilacji {1}.</target> <note /> </trans-unit> <trans-unit id="PositionOfTypeParameterTooLarge"> <source>position of type parameter too large</source> <target state="translated">pozycja parametru typu jest zbyt duża</target> <note /> </trans-unit> <trans-unit id="AssociatedTypeDoesNotHaveTypeParameters"> <source>Associated type does not have type parameters</source> <target state="translated">Skojarzony typ nie zawiera parametrów typu</target> <note /> </trans-unit> <trans-unit id="IDS_FunctionReturnType"> <source>function return type</source> <target state="translated">zwracany typ funkcji</target> <note /> </trans-unit> <trans-unit id="TypeArgumentCannotBeNothing"> <source>Type argument cannot be Nothing</source> <target state="translated">Argument typu nie może mieć wartości Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework"> <source>The assembly '{0}' containing type '{1}' references .NET Framework, which is not supported.</source> <target state="translated">Zestaw „{0}” zawierający typ „{1}” odwołuje się do platformy .NET Framework, co nie jest obsługiwane.</target> <note>{1} is the type that was loaded, {0} is the containing assembly.</note> </trans-unit> <trans-unit id="WRN_AnalyzerReferencesFramework_Title"> <source>The loaded assembly references .NET Framework, which is not supported.</source> <target state="translated">Załadowany zestaw odwołuje się do platformy .NET Framework, co nie jest obsługiwane.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeHasInvalidParameterName_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is applied with an invalid parameter name.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect. It is applied with an invalid parameter name.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential"> <source>The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter '{0}' will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_CallerArgumentExpressionAttributeSelfReferential_Title"> <source>The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-referential.</source> <target state="new">The CallerArgumentExpressionAttribute applied to parameter will have no effect because it's self-referential.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration"> <source>Generator '{0}' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Generator „{0}” nie mógł wygenerować źródła. W rezultacie nie będzie on współtworzyć danych wyjściowych i mogą wystąpić błędy kompilacji. Typ wyjątku: „{1}”, komunikat: „{2}”</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Generator zgłosił następujący wyjątek: „{0}”.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringGeneration_Title"> <source>Generator failed to generate source.</source> <target state="translated">Generator nie mógł wygenerować źródła.</target> <note /> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization"> <source>Generator '{0}' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type '{1}' with message '{2}'</source> <target state="translated">Generator „{0}” nie mógł przeprowadzić inicjalizacji. W rezultacie nie będzie on współtworzyć danych wyjściowych i mogą wystąpić błędy kompilacji. Typ wyjątku: „{1}”, komunikat: „{2}”</target> <note>{0} is the name of the generator that failed. {1} is the type of exception that was thrown {2} is the message in the exception</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Description"> <source>Generator threw the following exception: '{0}'.</source> <target state="translated">Generator zgłosił następujący wyjątek: „{0}”.</target> <note>{0} is the string representation of the exception that was thrown.</note> </trans-unit> <trans-unit id="WRN_GeneratorFailedDuringInitialization_Title"> <source>Generator failed to initialize.</source> <target state="translated">Generator nie mógł przeprowadzić inicjalizacji.</target> <note /> </trans-unit> <trans-unit id="WrongNumberOfTypeArguments"> <source>Wrong number of type arguments</source> <target state="translated">Nieprawidłowa liczba argumentów typu</target> <note /> </trans-unit> <trans-unit id="ERR_FileNotFound"> <source>file '{0}' could not be found</source> <target state="translated">nie znaleziono pliku „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_NoResponseFile"> <source>unable to open response file '{0}'</source> <target state="translated">nie można otworzyć pliku odpowiedzi „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentRequired"> <source>option '{0}' requires '{1}'</source> <target state="translated">opcja „{0}” wymaga argumentu „{1}”</target> <note /> </trans-unit> <trans-unit id="ERR_SwitchNeedsBool"> <source>option '{0}' can be followed only by '+' or '-'</source> <target state="translated">po opcji „{0}” może występować tylko znak „+” lub „-”</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSwitchValue"> <source>the value '{1}' is invalid for option '{0}'</source> <target state="translated">wartość „{1}” jest nieprawidłowa dla opcji „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_MutuallyExclusiveOptions"> <source>Compilation options '{0}' and '{1}' can't both be specified at the same time.</source> <target state="translated">Nie można równocześnie określić opcji kompilacji „{0}” i „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang"> <source>The language name '{0}' is invalid.</source> <target state="translated">Nazwa języka „{0}” jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="WRN_BadUILang_Title"> <source>The language name for /preferreduilang is invalid</source> <target state="translated">Nazwa języka dla parametru /preferreduilang jest nieprawidłowa</target> <note /> </trans-unit> <trans-unit id="ERR_VBCoreNetModuleConflict"> <source>The options /vbruntime* and /target:module cannot be combined.</source> <target state="translated">Nie można łączyć opcji /vbruntime* i /target:module.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatForGuidForOption"> <source>Command-line syntax error: Invalid Guid format '{0}' for option '{1}'</source> <target state="translated">Błąd składni wiersza polecenia: nieprawidłowy format identyfikatora GUID „{0}” dla opcji „{1}”</target> <note /> </trans-unit> <trans-unit id="ERR_MissingGuidForOption"> <source>Command-line syntax error: Missing Guid for option '{1}'</source> <target state="translated">Błąd składni wiersza polecenia: brak identyfikatora Guid dla opcji „{1}”</target> <note /> </trans-unit> <trans-unit id="ERR_BadChecksumAlgorithm"> <source>Algorithm '{0}' is not supported</source> <target state="translated">Algorytm „{0}” nie jest obsługiwany</target> <note /> </trans-unit> <trans-unit id="WRN_BadSwitch"> <source>unrecognized option '{0}'; ignored</source> <target state="translated">nierozpoznana opcja „{0}”; zignorowano</target> <note /> </trans-unit> <trans-unit id="WRN_BadSwitch_Title"> <source>Unrecognized command-line option</source> <target state="translated">Nierozpoznana opcja wiersza polecenia</target> <note /> </trans-unit> <trans-unit id="ERR_NoSources"> <source>no input sources specified</source> <target state="translated">nie określono źródeł wejściowych</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded"> <source>source file '{0}' specified multiple times</source> <target state="translated">plik źródłowy „{0}” został określony wiele razy</target> <note /> </trans-unit> <trans-unit id="WRN_FileAlreadyIncluded_Title"> <source>Source file specified multiple times</source> <target state="translated">Plik źródłowy został określony wiele razy</target> <note /> </trans-unit> <trans-unit id="ERR_CantOpenFileWrite"> <source>can't open '{0}' for writing: {1}</source> <target state="translated">nie można otworzyć elementu „{0}” do zapisu: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadCodepage"> <source>code page '{0}' is invalid or not installed</source> <target state="translated">strona kodowa „{0}” jest nieprawidłowa lub nie została zainstalowana</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryFile"> <source>the file '{0}' is not a text file</source> <target state="translated">plik „{0}” nie jest plikiem tekstowym</target> <note /> </trans-unit> <trans-unit id="ERR_LibNotFound"> <source>could not find library '{0}'</source> <target state="translated">nie można znaleźć biblioteki „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataReferencesNotSupported"> <source>Metadata references not supported.</source> <target state="translated">Odwołania do metadanych nie są obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_IconFileAndWin32ResFile"> <source>cannot specify both /win32icon and /win32resource</source> <target state="translated">nie można jednocześnie określić parametrów /win32icon i /win32resource</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigInResponseFile"> <source>ignoring /noconfig option because it was specified in a response file</source> <target state="translated">opcja /noconfig zostanie zignorowana, ponieważ została określona w pliku odpowiedzi</target> <note /> </trans-unit> <trans-unit id="WRN_NoConfigInResponseFile_Title"> <source>Ignoring /noconfig option because it was specified in a response file</source> <target state="translated">Opcja /noconfig zostanie zignorowana, ponieważ została określona w pliku odpowiedzi</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidWarningId"> <source>warning number '{0}' for the option '{1}' is either not configurable or not valid</source> <target state="translated">numeru ostrzeżenia „{0}” dla opcji „{1}” nie można skonfigurować lub jest on nieprawidłowy</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidWarningId_Title"> <source>Warning number is either not configurable or not valid</source> <target state="translated">Nie można skonfigurować numeru ostrzeżenia lub numer jest nieprawidłowy</target> <note /> </trans-unit> <trans-unit id="ERR_NoSourcesOut"> <source>cannot infer an output file name from resource only input files; provide the '/out' option</source> <target state="translated">nie można wywnioskować nazwy pliku wyjściowego na podstawie plików wejściowych zawierających tylko zasoby; podaj opcję „/out”</target> <note /> </trans-unit> <trans-unit id="ERR_NeedModule"> <source>the /moduleassemblyname option may only be specified when building a target of type 'module'</source> <target state="translated">opcję /moduleassemblyname można określić tylko w przypadku kompilowania elementu docelowego typu „module”</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyName"> <source>'{0}' is not a valid value for /moduleassemblyname</source> <target state="translated">'Wartość „{0}” nie jest prawidłowa dla parametru /moduleassemblyname</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingManifestSwitches"> <source>Error embedding Win32 manifest: Option /win32manifest conflicts with /nowin32manifest.</source> <target state="translated">Błąd podczas osadzania manifestu Win32: opcja /win32manifest powoduje konflikt z opcją /nowin32manifest.</target> <note /> </trans-unit> <trans-unit id="WRN_IgnoreModuleManifest"> <source>Option /win32manifest ignored. It can be specified only when the target is an assembly.</source> <target state="translated">Opcja /win32manifest została zignorowana. Można ją określić tylko wówczas, gdy element docelowy jest zestawem.</target> <note /> </trans-unit> <trans-unit id="WRN_IgnoreModuleManifest_Title"> <source>Option /win32manifest ignored</source> <target state="translated">Opcja /win32manifest została zignorowana</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInNamespace"> <source>Statement is not valid in a namespace.</source> <target state="translated">Instrukcja nie jest prawidłowa w przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedType1"> <source>Type '{0}' is not defined.</source> <target state="translated">Typ „{0}” nie został zdefiniowany.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNext"> <source>'Next' expected.</source> <target state="translated">'Oczekiwano elementu Next.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCharConstant"> <source>Character constant must contain exactly one character.</source> <target state="translated">Stała znakowa musi zawierać dokładnie jeden znak.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedAssemblyEvent3"> <source>Reference required to assembly '{0}' containing the definition for event '{1}'. Add one to your project.</source> <target state="translated">Wymagane odwołanie do zestawu „{0}” z definicją zdarzenia „{1}”. Dodaj je do projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedModuleEvent3"> <source>Reference required to module '{0}' containing the definition for event '{1}'. Add one to your project.</source> <target state="translated">Wymagane odwołanie do modułu „{0}” z definicją zdarzenia „{1}”. Dodaj je do projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_LbExpectedEndIf"> <source>'#If' block must end with a matching '#End If'.</source> <target state="translated">'Blok #If musi kończyć się instrukcją #End If.</target> <note /> </trans-unit> <trans-unit id="ERR_LbNoMatchingIf"> <source>'#ElseIf', '#Else', or '#End If' must be preceded by a matching '#If'.</source> <target state="translated">'Instrukcje #ElseIf, #Else i #End If muszą być poprzedzone odpowiadającą im instrukcją #If.</target> <note /> </trans-unit> <trans-unit id="ERR_LbBadElseif"> <source>'#ElseIf' must be preceded by a matching '#If' or '#ElseIf'.</source> <target state="translated">'Element „#ElseIf” musi być poprzedzony odpowiadającym mu elementem „#If” lub „#ElseIf”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromRestrictedType1"> <source>Inheriting from '{0}' is not valid.</source> <target state="translated">Dziedziczenie po typie „{0}” jest niepoprawne.</target> <note /> </trans-unit> <trans-unit id="ERR_InvOutsideProc"> <source>Labels are not valid outside methods.</source> <target state="translated">Etykiety nie są prawidłowe poza metodami.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateCantImplement"> <source>Delegates cannot implement interface methods.</source> <target state="translated">Obiekty delegatów nie mogą implementować metod interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateCantHandleEvents"> <source>Delegates cannot handle events.</source> <target state="translated">Obiekty delegatów nie mogą obsługiwać zdarzeń.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorRequiresReferenceTypes1"> <source>'Is' operator does not accept operands of type '{0}'. Operands must be reference or nullable types.</source> <target state="translated">'Operator „Is” nie akceptuje argumentów operacji typu „{0}”. Typem argumentu operacji musi być odwołanie lub typ dopuszczający wartość null.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOfRequiresReferenceType1"> <source>'TypeOf ... Is' requires its left operand to have a reference type, but this operand has the value type '{0}'.</source> <target state="translated">'Instrukcja „TypeOf ... Is” wymaga, aby argument operacji po lewej stronie miał typ referencyjny, a ten argument operacji ma typ wartości „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyHasSet"> <source>Properties declared 'ReadOnly' cannot have a 'Set'.</source> <target state="translated">Właściwości zadeklarowane jako ReadOnly nie mogą mieć procedury Set.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyHasGet"> <source>Properties declared 'WriteOnly' cannot have a 'Get'.</source> <target state="translated">Właściwości zadeklarowane jako WriteOnly nie mogą mieć procedury Get.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideProc"> <source>Statement is not valid inside a method.</source> <target state="translated">Instrukcja nie jest prawidłowa wewnątrz metody.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideBlock"> <source>Statement is not valid inside '{0}' block.</source> <target state="translated">Instrukcja nie jest prawidłowa w ramach bloku „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedExpressionStatement"> <source>Expression statement is only allowed at the end of an interactive submission.</source> <target state="translated">Instrukcja wyrażenia jest dozwolona tylko na końcu przesyłania interaktywnego.</target> <note /> </trans-unit> <trans-unit id="ERR_EndProp"> <source>Property missing 'End Property'.</source> <target state="translated">We właściwości brakuje instrukcji End Property.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSubExpected"> <source>'End Sub' expected.</source> <target state="translated">'Oczekiwano instrukcji End Sub.</target> <note /> </trans-unit> <trans-unit id="ERR_EndFunctionExpected"> <source>'End Function' expected.</source> <target state="translated">'Oczekiwano instrukcji End Function.</target> <note /> </trans-unit> <trans-unit id="ERR_LbElseNoMatchingIf"> <source>'#Else' must be preceded by a matching '#If' or '#ElseIf'.</source> <target state="translated">'Instrukcja #Else musi być poprzedzona odpowiadającą jej instrukcją #If lub #ElseIf.</target> <note /> </trans-unit> <trans-unit id="ERR_CantRaiseBaseEvent"> <source>Derived classes cannot raise base class events.</source> <target state="translated">Klasy pochodne nie mogą generować zdarzeń klasy bazowej.</target> <note /> </trans-unit> <trans-unit id="ERR_TryWithoutCatchOrFinally"> <source>Try must have at least one 'Catch' or a 'Finally'.</source> <target state="translated">Blok Try musi zawierać co najmniej jedną instrukcję Catch lub Finally.</target> <note /> </trans-unit> <trans-unit id="ERR_EventsCantBeFunctions"> <source>Events cannot have a return type.</source> <target state="translated">Zdarzenia nie mogą mieć zwracanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndBrack"> <source>Bracketed identifier is missing closing ']'.</source> <target state="translated">Identyfikator ujęty w nawiasy kwadratowe nie ma nawiasu zamykającego ].</target> <note /> </trans-unit> <trans-unit id="ERR_Syntax"> <source>Syntax error.</source> <target state="translated">Błąd składni.</target> <note /> </trans-unit> <trans-unit id="ERR_Overflow"> <source>Overflow.</source> <target state="translated">Przepełnienie.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalChar"> <source>Character is not valid.</source> <target state="translated">Znak jest nieprawidłowy.</target> <note /> </trans-unit> <trans-unit id="ERR_StdInOptionProvidedButConsoleInputIsNotRedirected"> <source>stdin argument '-' is specified, but input has not been redirected from the standard input stream.</source> <target state="translated">określono argument stdin „-”, ale dane wejściowe nie zostały przekierowane ze standardowego strumienia wejściowego.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsObjectOperand1"> <source>Option Strict On prohibits operands of type Object for operator '{0}'.</source> <target state="translated">Ustawienie Option Strict On nie zezwala na stosowanie argumentów typu Object dla operatora „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopControlMustNotBeProperty"> <source>Loop control variable cannot be a property or a late-bound indexed array.</source> <target state="translated">Zmienna sterująca pętli nie może być właściwością ani tablicą indeksowaną z późnym wiązaniem.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodBodyNotAtLineStart"> <source>First statement of a method body cannot be on the same line as the method declaration.</source> <target state="translated">Pierwsza instrukcja treści metody nie może znajdować się w tym samym wierszu co deklaracja metody.</target> <note /> </trans-unit> <trans-unit id="ERR_MaximumNumberOfErrors"> <source>Maximum number of errors has been exceeded.</source> <target state="translated">Przekroczono maksymalną liczbę błędów.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordNotInInstanceMethod1"> <source>'{0}' is valid only within an instance method.</source> <target state="translated">'Element „{0}” jest prawidłowy tylko wewnątrz metody wystąpienia.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordFromStructure1"> <source>'{0}' is not valid within a structure.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w ramach struktury.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeConstructor1"> <source>Attribute constructor has a parameter of type '{0}', which is not an integral, floating-point or Enum type or one of Object, Char, String, Boolean, System.Type or 1-dimensional array of these types.</source> <target state="translated">Konstruktor atrybutu ma parametr typu „{0}”, który nie jest typem całkowitym, zmiennoprzecinkowym ani wyliczeniowym, jak również żadnym z typów Object, Char, String, Boolean lub System.Type ani jednowymiarową tablicą składającą się z tych typów.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayWithOptArgs"> <source>Method cannot have both a ParamArray and Optional parameters.</source> <target state="translated">Metoda nie może mieć zarówno parametru ParamArray, jak i Optional.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedArray1"> <source>'{0}' statement requires an array.</source> <target state="translated">'Instrukcja „{0}” wymaga tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayNotArray"> <source>ParamArray parameter must be an array.</source> <target state="translated">Parametr ParamArray musi być tablicą.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayRank"> <source>ParamArray parameter must be a one-dimensional array.</source> <target state="translated">Parametr ParamArray musi być tablicą jednowymiarową.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayRankLimit"> <source>Array exceeds the limit of 32 dimensions.</source> <target state="translated">Liczba wymiarów tablicy przekracza 32.</target> <note /> </trans-unit> <trans-unit id="ERR_AsNewArray"> <source>Arrays cannot be declared with 'New'.</source> <target state="translated">Nie można deklarować tablic przy użyciu instrukcji New.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs1"> <source>Too many arguments to '{0}'.</source> <target state="translated">Za dużo argumentów elementu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedCase"> <source>Statements and labels are not valid between 'Select Case' and first 'Case'.</source> <target state="translated">Instrukcje i etykiety nie są prawidłowe między instrukcją Select Case a pierwszą instrukcją Case.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredConstExpr"> <source>Constant expression is required.</source> <target state="translated">Wymagane jest wyrażenie stałe.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredConstConversion2"> <source>Conversion from '{0}' to '{1}' cannot occur in a constant expression.</source> <target state="translated">Konwersja z „{0}” na „{1}” nie może wystąpić w wyrażeniu stałym.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMe"> <source>'Me' cannot be the target of an assignment.</source> <target state="translated">'Element Me nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyAssignment"> <source>'ReadOnly' variable cannot be the target of an assignment.</source> <target state="translated">'Zmienna typu ReadOnly nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitSubOfFunc"> <source>'Exit Sub' is not valid in a Function or Property.</source> <target state="translated">'Instrukcja Exit Sub nie jest prawidłowa w przypadku funkcji lub właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitPropNot"> <source>'Exit Property' is not valid in a Function or Sub.</source> <target state="translated">'Instrukcja Exit Property nie jest prawidłowa w przypadku funkcji lub procedury.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitFuncOfSub"> <source>'Exit Function' is not valid in a Sub or Property.</source> <target state="translated">'Instrukcja Exit Function nie jest prawidłowa w przypadku procedury lub właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_LValueRequired"> <source>Expression is a value and therefore cannot be the target of an assignment.</source> <target state="translated">Wyrażenie jest wartością i dlatego nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_ForIndexInUse1"> <source>For loop control variable '{0}' already in use by an enclosing For loop.</source> <target state="translated">Zmienna „{0}” sterująca pętlą For jest już używana przez otaczającą pętlę For.</target> <note /> </trans-unit> <trans-unit id="ERR_NextForMismatch1"> <source>Next control variable does not match For loop control variable '{0}'.</source> <target state="translated">Zmienna sterująca w instrukcji Next nie pasuje do zmiennej „{0}” sterującej pętlą For.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseElseNoSelect"> <source>'Case Else' can only appear inside a 'Select Case' statement.</source> <target state="translated">'Instrukcja Case Else może wystąpić tylko wewnątrz instrukcji Select Case.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseNoSelect"> <source>'Case' can only appear inside a 'Select Case' statement.</source> <target state="translated">'Instrukcja Case może wystąpić tylko wewnątrz instrukcji Select Case.</target> <note /> </trans-unit> <trans-unit id="ERR_CantAssignToConst"> <source>Constant cannot be the target of an assignment.</source> <target state="translated">Stała nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedSubscript"> <source>Named arguments are not valid as array subscripts.</source> <target state="translated">Nazwane argumenty nie są prawidłowe jako indeksy tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndIf"> <source>'If' must end with a matching 'End If'.</source> <target state="translated">'Instrukcja If musi być zakończona odpowiadającą jej instrukcją End If.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndWhile"> <source>'While' must end with a matching 'End While'.</source> <target state="translated">'Instrukcja While musi być zakończona odpowiadającą jej instrukcją End While.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLoop"> <source>'Do' must end with a matching 'Loop'.</source> <target state="translated">'Instrukcja Do musi być zakończona odpowiadającą jej instrukcją Loop.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNext"> <source>'For' must end with a matching 'Next'.</source> <target state="translated">'Instrukcja For musi być zakończona odpowiadającą jej instrukcją Next.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndWith"> <source>'With' must end with a matching 'End With'.</source> <target state="translated">'Instrukcja With musi być zakończona odpowiadającą jej instrukcją End With.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseNoMatchingIf"> <source>'Else' must be preceded by a matching 'If' or 'ElseIf'.</source> <target state="translated">'Element „Else” musi być poprzedzony odpowiadającym mu elementem „If” lub „ElseIf”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndIfNoMatchingIf"> <source>'End If' must be preceded by a matching 'If'.</source> <target state="translated">'Instrukcja End If musi być poprzedzona odpowiadającą jej instrukcją If.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSelectNoSelect"> <source>'End Select' must be preceded by a matching 'Select Case'.</source> <target state="translated">'Instrukcja „End Select” musi być poprzedzona odpowiadającą jej instrukcją „Select Case”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitDoNotWithinDo"> <source>'Exit Do' can only appear inside a 'Do' statement.</source> <target state="translated">'Instrukcja Exit Do może wystąpić tylko wewnątrz instrukcji Do.</target> <note /> </trans-unit> <trans-unit id="ERR_EndWhileNoWhile"> <source>'End While' must be preceded by a matching 'While'.</source> <target state="translated">'Instrukcja End While musi być poprzedzona odpowiadającą jej instrukcją While.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopNoMatchingDo"> <source>'Loop' must be preceded by a matching 'Do'.</source> <target state="translated">'Instrukcja Loop musi być poprzedzona odpowiadającą jej instrukcją Do.</target> <note /> </trans-unit> <trans-unit id="ERR_NextNoMatchingFor"> <source>'Next' must be preceded by a matching 'For'.</source> <target state="translated">'Instrukcja Next musi być poprzedzona odpowiadającą jej instrukcją For.</target> <note /> </trans-unit> <trans-unit id="ERR_EndWithWithoutWith"> <source>'End With' must be preceded by a matching 'With'.</source> <target state="translated">'Instrukcja End With musi być poprzedzona odpowiadającą jej instrukcją With.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefined1"> <source>Label '{0}' is already defined in the current method.</source> <target state="translated">Etykieta „{0}” jest już zdefiniowana w bieżącej metodzie.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndSelect"> <source>'Select Case' must end with a matching 'End Select'.</source> <target state="translated">'Instrukcja Select Case musi być zakończona odpowiadającą jej instrukcją End Select.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitForNotWithinFor"> <source>'Exit For' can only appear inside a 'For' statement.</source> <target state="translated">'Instrukcja Exit For może wystąpić tylko wewnątrz instrukcji For.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitWhileNotWithinWhile"> <source>'Exit While' can only appear inside a 'While' statement.</source> <target state="translated">'Instrukcja Exit While może wystąpić tylko wewnątrz instrukcji While.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyProperty1"> <source>'ReadOnly' property '{0}' cannot be the target of an assignment.</source> <target state="translated">'Właściwość „{0}” typu „ReadOnly” nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitSelectNotWithinSelect"> <source>'Exit Select' can only appear inside a 'Select' statement.</source> <target state="translated">'Instrukcja Exit Select może wystąpić tylko wewnątrz instrukcji Select.</target> <note /> </trans-unit> <trans-unit id="ERR_BranchOutOfFinally"> <source>Branching out of a 'Finally' is not valid.</source> <target state="translated">Rozgałęzianie poza blokiem „Finally” jest nieprawidłowe.</target> <note /> </trans-unit> <trans-unit id="ERR_QualNotObjectRecord1"> <source>'!' requires its left operand to have a type parameter, class or interface type, but this operand has the type '{0}'.</source> <target state="translated">'Element „!” wymaga, aby lewy argument operacji zawierał parametr typu, klasę lub typ interfejsu, ale ten argument operacji jest typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewIndices"> <source>Number of indices is less than the number of dimensions of the indexed array.</source> <target state="translated">Liczba indeksów jest mniejsza niż liczba wymiarów tablicy indeksowanej.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyIndices"> <source>Number of indices exceeds the number of dimensions of the indexed array.</source> <target state="translated">Liczba indeksów przekracza liczbę wymiarów tablicy indeksowanej.</target> <note /> </trans-unit> <trans-unit id="ERR_EnumNotExpression1"> <source>'{0}' is an Enum type and cannot be used as an expression.</source> <target state="translated">Typem elementu „{0}” jest typ wyliczeniowy i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeNotExpression1"> <source>'{0}' is a type and cannot be used as an expression.</source> <target state="translated">'Element „{0}” jest typem i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassNotExpression1"> <source>'{0}' is a class type and cannot be used as an expression.</source> <target state="translated">'Typem elementu „{0}” jest typ klasy i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureNotExpression1"> <source>'{0}' is a structure type and cannot be used as an expression.</source> <target state="translated">'Typem elementu „{0}” jest typ struktury i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNotExpression1"> <source>'{0}' is an interface type and cannot be used as an expression.</source> <target state="translated">'Typem elementu „{0}” jest typ interfejsu i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotExpression1"> <source>'{0}' is a namespace and cannot be used as an expression.</source> <target state="translated">'Element „{0}” jest przestrzenią nazw i nie można go używać jako wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNamespaceName1"> <source>'{0}' is not a valid name and cannot be used as the root namespace name.</source> <target state="translated">'Element „{0}” nie jest prawidłową nazwą i nie można go użyć jako nazwy głównej przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlPrefixNotExpression"> <source>'{0}' is an XML prefix and cannot be used as an expression. Use the GetXmlNamespace operator to create a namespace object.</source> <target state="translated">'Element „{0}” jest prefiksem XML i nie można go używać jako wyrażenia. Użyj operatora GetXmlNamespace, aby utworzyć obiekt przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleExtends"> <source>'Inherits' can appear only once within a 'Class' statement and can only specify one class.</source> <target state="translated">'Instrukcja Inherits może wystąpić tylko raz w instrukcji Class i może określać tylko jedną klasę.</target> <note /> </trans-unit> <trans-unit id="ERR_PropMustHaveGetSet"> <source>Property without a 'ReadOnly' or 'WriteOnly' specifier must provide both a 'Get' and a 'Set'.</source> <target state="translated">Właściwość bez specyfikatora „ReadOnly” lub „WriteOnly” musi udostępniać zarówno procedurę „Get”, jak i „Set”.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyHasNoWrite"> <source>'WriteOnly' property must provide a 'Set'.</source> <target state="translated">'Właściwość typu WriteOnly musi udostępniać procedurę Set.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyHasNoGet"> <source>'ReadOnly' property must provide a 'Get'.</source> <target state="translated">'Właściwość typu ReadOnly musi udostępniać procedurę Get.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttribute1"> <source>Attribute '{0}' is not valid: Incorrect argument value.</source> <target state="translated">Atrybut „{0}” jest niepoprawny: niepoprawna wartość argumentu.</target> <note /> </trans-unit> <trans-unit id="ERR_LabelNotDefined1"> <source>Label '{0}' is not defined.</source> <target state="translated">Etykieta „{0}” nie jest zdefiniowana.</target> <note /> </trans-unit> <trans-unit id="ERR_ErrorCreatingWin32ResourceFile"> <source>Error creating Win32 resources: {0}</source> <target state="translated">Błąd podczas tworzenia zasobów Win32: {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToCreateTempFile"> <source>Cannot create temporary file: {0}</source> <target state="translated">Nie można utworzyć pliku tymczasowego: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNewCall2"> <source>First statement of this 'Sub New' must be a call to 'MyBase.New' or 'MyClass.New' because base class '{0}' of '{1}' does not have an accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">Pierwsza instrukcja w tym elemencie „Sub New” musi być wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ klasa bazowa „{0}” klasy „{1}” nie ma dostępnego elementu „Sub New”, który można wywoływać bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedMember3"> <source>{0} '{1}' must implement '{2}' for interface '{3}'.</source> <target state="translated">Element {0} „{1}” musi implementować element „{2}” dla interfejsu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWithRef"> <source>Leading '.' or '!' can only appear inside a 'With' statement.</source> <target state="translated">Wiodący znak . lub ! może wystąpić tylko wewnątrz instrukcji With.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAccessCategoryUsed"> <source>Only one of 'Public', 'Private', 'Protected', 'Friend', 'Protected Friend', or 'Private Protected' can be specified.</source> <target state="translated">Można określić tylko jeden z modyfikatorów: Public, Private, Protected, Friend, Protected Friend i Private Protected.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateModifierCategoryUsed"> <source>Only one of 'NotOverridable', 'MustOverride', or 'Overridable' can be specified.</source> <target state="translated">Można określić tylko jeden z modyfikatorów: NotOverridable, MustOverride lub Overridable.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateSpecifier"> <source>Specifier is duplicated.</source> <target state="translated">Specyfikator jest zduplikowany.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeConflict6"> <source>{0} '{1}' and {2} '{3}' conflict in {4} '{5}'.</source> <target state="translated">Element {0} „{1}” i {2} „{3}” powoduje konflikt w elemencie {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedTypeKeyword"> <source>Keyword does not name a type.</source> <target state="translated">Słowo kluczowe nie określa typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtraSpecifiers"> <source>Specifiers valid only at the beginning of a declaration.</source> <target state="translated">Specyfikatory są prawidłowe tylko na początku deklaracji.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedType"> <source>Type expected.</source> <target state="translated">Oczekiwano typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUseOfKeyword"> <source>Keyword is not valid as an identifier.</source> <target state="translated">Słowo kluczowe nie jest prawidłowe jako identyfikator.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndEnum"> <source>'End Enum' must be preceded by a matching 'Enum'.</source> <target state="translated">Instrukcja „End Enum” musi być poprzedzona odpowiadającą jej instrukcją „Enum”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndEnum"> <source>'Enum' must end with a matching 'End Enum'.</source> <target state="translated">Instrukcja Enum musi być zakończona odpowiadającą jej instrukcją End Enum.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDeclaration"> <source>Declaration expected.</source> <target state="translated">Oczekiwano deklaracji.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayMustBeLast"> <source>End of parameter list expected. Cannot define parameters after a paramarray parameter.</source> <target state="translated">Oczekiwano końca listy parametrów. Nie można zdefiniować parametrów po parametrze paramarray.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecifiersInvalidOnInheritsImplOpt"> <source>Specifiers and attributes are not valid on this statement.</source> <target state="translated">Specyfikatory i atrybuty nie są prawidłowe w tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSpecifier"> <source>Expected one of 'Dim', 'Const', 'Public', 'Private', 'Protected', 'Friend', 'Shadows', 'ReadOnly' or 'Shared'.</source> <target state="translated">Oczekiwano jednej z instrukcji: Dim, Const, Public, Private, Protected, Friend, Shadows, ReadOnly lub Shared.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedComma"> <source>Comma expected.</source> <target state="translated">Oczekiwano przecinka.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAs"> <source>'As' expected.</source> <target state="translated">'Oczekiwano klauzuli „As”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRparen"> <source>')' expected.</source> <target state="translated">'Oczekiwano znaku „)”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLparen"> <source>'(' expected.</source> <target state="translated">'Oczekiwano znaku „(”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNewInType"> <source>'New' is not valid in this context.</source> <target state="translated">'Instrukcja New nie jest prawidłowa w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedExpression"> <source>Expression expected.</source> <target state="translated">Oczekiwano wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOptional"> <source>'Optional' expected.</source> <target state="translated">'Oczekiwano instrukcji „Optional”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIdentifier"> <source>Identifier expected.</source> <target state="translated">Oczekiwano identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIntLiteral"> <source>Integer constant expected.</source> <target state="translated">Oczekiwano stałej całkowitej.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEOS"> <source>End of statement expected.</source> <target state="translated">Oczekiwano końca instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedForOptionStmt"> <source>'Option' must be followed by 'Compare', 'Explicit', 'Infer', or 'Strict'.</source> <target state="translated">'Po instrukcji „Option” musi znajdować się element „Compare”, „Explicit”, „Infer” lub „Strict”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionCompare"> <source>'Option Compare' must be followed by 'Text' or 'Binary'.</source> <target state="translated">'Po instrukcji Option Compare musi wystąpić element Text lub Binary.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOptionCompare"> <source>'Compare' expected.</source> <target state="translated">'Oczekiwano instrukcji „Compare”.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowImplicitObject"> <source>Option Strict On requires all variable declarations to have an 'As' clause.</source> <target state="translated">Ustawienie Option Strict On wymaga, aby wszystkie deklaracje zmiennych miały klauzulę „As”.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsImplicitProc"> <source>Option Strict On requires all Function, Property, and Operator declarations to have an 'As' clause.</source> <target state="translated">Ustawienie Option Strict On wymaga, aby wszystkie deklaracje funkcji, właściwości i operatorów miały klauzulę „As”.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsImplicitArgs"> <source>Option Strict On requires that all method parameters have an 'As' clause.</source> <target state="translated">Ustawienie Option Strict On wymaga, aby wszystkie parametry metody miały klauzulę „As”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidParameterSyntax"> <source>Comma or ')' expected.</source> <target state="translated">Oczekiwano przecinka lub znaku ).</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSubFunction"> <source>'Sub' or 'Function' expected.</source> <target state="translated">'Oczekiwano instrukcji Sub lub Function.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedStringLiteral"> <source>String constant expected.</source> <target state="translated">Oczekiwano stałej w postaci ciągu.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingLibInDeclare"> <source>'Lib' expected.</source> <target state="translated">'Oczekiwano instrukcji Lib.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateNoInvoke1"> <source>Delegate class '{0}' has no Invoke method, so an expression of this type cannot be the target of a method call.</source> <target state="translated">Klasa delegatu „{0}” nie ma metody Invoke, dlatego wyrażenie tego typu nie może być elementem docelowym wywołania metody.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingIsInTypeOf"> <source>'Is' expected.</source> <target state="translated">'Oczekiwano instrukcji „Is”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateOption1"> <source>'Option {0}' statement can only appear once per file.</source> <target state="translated">'Instrukcja „Option {0}” może wystąpić w pliku tylko raz.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantInherit"> <source>'Inherits' not valid in Modules.</source> <target state="translated">'Instrukcja Inherits nie jest prawidłowa w modułach.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantImplement"> <source>'Implements' not valid in Modules.</source> <target state="translated">'Instrukcja Implements nie jest prawidłowa w modułach.</target> <note /> </trans-unit> <trans-unit id="ERR_BadImplementsType"> <source>Implemented type must be an interface.</source> <target state="translated">Implementowany typ musi być interfejsem.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstFlags1"> <source>'{0}' is not valid on a constant declaration.</source> <target state="translated">'Element „{0}” nie jest poprawny w deklaracji stałej.</target> <note /> </trans-unit> <trans-unit id="ERR_BadWithEventsFlags1"> <source>'{0}' is not valid on a WithEvents declaration.</source> <target state="translated">'Element „{0}” nie jest poprawny w deklaracji WithEvents.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDimFlags1"> <source>'{0}' is not valid on a member variable declaration.</source> <target state="translated">'Element „{0}” nie jest poprawny w deklaracji zmiennej składowej.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParamName1"> <source>Parameter already declared with name '{0}'.</source> <target state="translated">Zadeklarowano już parametr o nazwie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_LoopDoubleCondition"> <source>'Loop' cannot have a condition if matching 'Do' has one.</source> <target state="translated">'Instrukcja Loop nie może zawierać warunku, jeśli zawiera go już odpowiadająca jej instrukcja Do.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRelational"> <source>Relational operator expected.</source> <target state="translated">Oczekiwano operatora relacyjnego.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedExitKind"> <source>'Exit' must be followed by 'Sub', 'Function', 'Property', 'Do', 'For', 'While', 'Select', or 'Try'.</source> <target state="translated">'Po instrukcji „Exit” musi występować instrukcja „Sub”, „Function”, „Property”, „Do”, „For”, „While”, „Select” lub „Try”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNamedArgumentInAttributeList"> <source>Named argument expected.</source> <target state="translated">Oczekiwano nazwanego argumentu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgumentSpecificationBeforeFixedArgumentInLateboundInvocation"> <source>Named argument specifications must appear after all fixed arguments have been specified in a late bound invocation.</source> <target state="translated">Specyfikacje argumentu nazwanego muszą występować po wszystkich stałych argumentach, które zostały określone w wywołaniu późnego wiązania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedNamedArgument"> <source>Named argument expected. Please use language version {0} or greater to use non-trailing named arguments.</source> <target state="translated">Oczekiwano argumentu nazwanego. Użyj wersji języka {0} lub nowszej, aby używać argumentów nazwanych innych niż końcowe.</target> <note /> </trans-unit> <trans-unit id="ERR_BadMethodFlags1"> <source>'{0}' is not valid on a method declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji metody.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEventFlags1"> <source>'{0}' is not valid on an event declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDeclareFlags1"> <source>'{0}' is not valid on a Declare.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w elemencie Declare</target> <note /> </trans-unit> <trans-unit id="ERR_BadLocalConstFlags1"> <source>'{0}' is not valid on a local constant declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji stałej lokalnej.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLocalDimFlags1"> <source>'{0}' is not valid on a local variable declaration.</source> <target state="translated">'Element „{0}” nie jest poprawny w deklaracji zmiennej lokalnej.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedConditionalDirective"> <source>'If', 'ElseIf', 'Else', 'Const', 'Region', 'ExternalSource', 'ExternalChecksum', 'Enable', 'Disable', 'End' or 'R' expected.</source> <target state="translated">'Oczekiwano instrukcji „If”, „ElseIf”, „Else”, „Const”, „Region”, „ExternalSource”, „ExternalChecksum”, „Enable”, „Disable”, „End” lub „R”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEQ"> <source>'=' expected.</source> <target state="translated">'Oczekiwano znaku „=”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorNotFound1"> <source>Type '{0}' has no constructors.</source> <target state="translated">Typ „{0}” nie ma konstruktorów.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndInterface"> <source>'End Interface' must be preceded by a matching 'Interface'.</source> <target state="translated">'Instrukcja End Interface musi być poprzedzona odpowiadającą jej instrukcją Interface.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndInterface"> <source>'Interface' must end with a matching 'End Interface'.</source> <target state="translated">'Instrukcja Interface musi być zakończona odpowiadającą jej instrukcją End Interface.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFrom2"> <source> '{0}' inherits from '{1}'.</source> <target state="translated"> Element „{0}” dziedziczy po elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNestedIn2"> <source> '{0}' is nested in '{1}'.</source> <target state="translated"> Element „{0}” jest zagnieżdżony w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceCycle1"> <source>Class '{0}' cannot inherit from itself: {1}</source> <target state="translated">Klasa „{0}” nie może dziedziczyć po sobie samej: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromNonClass"> <source>Classes can inherit only from other classes.</source> <target state="translated">Klasy mogą dziedziczyć tylko po innych klasach.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefinedType3"> <source>'{0}' is already declared as '{1}' in this {2}.</source> <target state="translated">'Element „{0}” jest już zadeklarowany jako „{1}” w tym elemencie {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadOverrideAccess2"> <source>'{0}' cannot override '{1}' because they have different access levels.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ mają one różne poziomy dostępu.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideNotOverridable2"> <source>'{0}' cannot override '{1}' because it is declared 'NotOverridable'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ jest on zadeklarowany jako „NotOverridable”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateProcDef1"> <source>'{0}' has multiple definitions with identical signatures.</source> <target state="translated">'Element „{0}” ma wiele definicji o identycznych sygnaturach.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateProcDefWithDifferentTupleNames2"> <source>'{0}' has multiple definitions with identical signatures with different tuple element names, including '{1}'.</source> <target state="translated">'Element „{0}” ma wiele definicji z identycznymi sygnaturami z różnymi nazwami elementów krotki, w tym „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceMethodFlags1"> <source>'{0}' is not valid on an interface method declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji metody interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound2"> <source>'{0}' is not a parameter of '{1}'.</source> <target state="translated">'Element „{0}” nie jest parametrem elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfacePropertyFlags1"> <source>'{0}' is not valid on an interface property declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji właściwości interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice2"> <source>Parameter '{0}' of '{1}' already has a matching argument.</source> <target state="translated">Parametr „{0}” („{1}”) ma już zgodny argument.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceCantUseEventSpecifier1"> <source>'{0}' is not valid on an interface event declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji zdarzenia interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypecharNoMatch2"> <source>Type character '{0}' does not match declared data type '{1}'.</source> <target state="translated">Znak typu „{0}” nie odpowiada zadeklarowanemu typowi danych „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSubOrFunction"> <source>'Sub' or 'Function' expected after 'Delegate'.</source> <target state="translated">'Oczekiwano instrukcji Sub lub Function po instrukcji Delegate.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEmptyEnum1"> <source>Enum '{0}' must contain at least one member.</source> <target state="translated">Wyliczenie „{0}” musi zawierać co najmniej jedną składową.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidConstructorCall"> <source>Constructor call is valid only as the first statement in an instance constructor.</source> <target state="translated">Wywołanie konstruktora jest prawidłowe tylko jako pierwsza instrukcja w konstruktorze wystąpienia.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverrideConstructor"> <source>'Sub New' cannot be declared 'Overrides'.</source> <target state="translated">'Nie można zadeklarować elementu Sub New jako Overrides.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorCannotBeDeclaredPartial"> <source>'Sub New' cannot be declared 'Partial'.</source> <target state="translated">'Nie można zadeklarować elementu „Sub New” jako „Partial”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleEmitFailure"> <source>Failed to emit module '{0}': {1}</source> <target state="translated">Wyemitowanie modułu „{0}” nie powiodło się: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_EncUpdateFailedMissingAttribute"> <source>Cannot update '{0}'; attribute '{1}' is missing.</source> <target state="translated">Nie można zaktualizować elementu „{0}”. Brak atrybutu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideNotNeeded3"> <source>{0} '{1}' cannot be declared 'Overrides' because it does not override a {0} in a base class.</source> <target state="translated">Nie można zadeklarować elementu {0} „{1}” jako „Overrides”, ponieważ nie przesłania on elementu {0} w klasie bazowej.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDot"> <source>'.' expected.</source> <target state="translated">'Oczekiwano znaku „.”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocals1"> <source>Local variable '{0}' is already declared in the current block.</source> <target state="translated">Zmienna lokalna „{0}” jest już zadeklarowana w bieżącym bloku.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsProc"> <source>Statement cannot appear within a method body. End of method assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści metody. Założono koniec metody.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalSameAsFunc"> <source>Local variable cannot have the same name as the function containing it.</source> <target state="translated">Zmienna lokalna nie może mieć takiej samej nazwy jak zawierająca ją funkcja.</target> <note /> </trans-unit> <trans-unit id="ERR_RecordEmbeds2"> <source> '{0}' contains '{1}' (variable '{2}').</source> <target state="translated"> Element „{0}” zawiera element „{1}” (zmienna „{2}”).</target> <note /> </trans-unit> <trans-unit id="ERR_RecordCycle2"> <source>Structure '{0}' cannot contain an instance of itself: {1}</source> <target state="translated">Struktura „{0}” nie może zawierać wystąpienia samej siebie: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceCycle1"> <source>Interface '{0}' cannot inherit from itself: {1}</source> <target state="translated">Interfejs „{0}” nie może dziedziczyć po samym sobie: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SubNewCycle2"> <source> '{0}' calls '{1}'.</source> <target state="translated"> Element „{0}” wywołuje element „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SubNewCycle1"> <source>Constructor '{0}' cannot call itself: {1}</source> <target state="translated">Konstruktor „{0}” nie może wywoływać samego siebie: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromCantInherit3"> <source>'{0}' cannot inherit from {2} '{1}' because '{1}' is declared 'NotInheritable'.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {2} „{1}”, ponieważ element „{1}” jest zadeklarowany jako „NotInheritable”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithOptional2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by optional parameters.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie parametrami opcjonalnymi.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithReturnType2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by return types.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie zwracanymi typami.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharWithType1"> <source>Type character '{0}' cannot be used in a declaration with an explicit type.</source> <target state="translated">Nie można użyć znaku typu „{0}” w deklaracji z typem jawnym.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnSub"> <source>Type character cannot be used in a 'Sub' declaration because a 'Sub' doesn't return a value.</source> <target state="translated">Nie można użyć znaku typu w deklaracji Sub, ponieważ procedura Sub nie zwraca wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithDefault2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by the default values of optional parameters.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie wartościami domyślnymi parametrów opcjonalnych.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingSubscript"> <source>Array subscript expression missing.</source> <target state="translated">Brak wyrażenia indeksu tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithDefault2"> <source>'{0}' cannot override '{1}' because they differ by the default values of optional parameters.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się wartościami domyślnymi parametrów opcjonalnych.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithOptional2"> <source>'{0}' cannot override '{1}' because they differ by optional parameters.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się parametrami opcjonalnymi.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldOfValueFieldOfMarshalByRef3"> <source>Cannot refer to '{0}' because it is a member of the value-typed field '{1}' of class '{2}' which has 'System.MarshalByRefObject' as a base class.</source> <target state="translated">Nie można odwołać się do elementu „{0}”, ponieważ jest to element członkowski pola „{1}” o typie wartości klasy „{2}”, której klasą bazową jest „System.MarshalByRefObject”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMismatch2"> <source>Value of type '{0}' cannot be converted to '{1}'.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CaseAfterCaseElse"> <source>'Case' cannot follow a 'Case Else' in the same 'Select' statement.</source> <target state="translated">'Instrukcja Case nie może wystąpić po instrukcji Case Else w tej samej instrukcji Select.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertArrayMismatch4"> <source>Value of type '{0}' cannot be converted to '{1}' because '{2}' is not derived from '{3}'.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”, ponieważ element „{2}” nie pochodzi od elementu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertObjectArrayMismatch3"> <source>Value of type '{0}' cannot be converted to '{1}' because '{2}' is not a reference type.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”, ponieważ element „{2}” nie jest typem referencyjnym.</target> <note /> </trans-unit> <trans-unit id="ERR_ForLoopType1"> <source>'For' loop control variable cannot be of type '{0}' because the type does not support the required operators.</source> <target state="translated">'Zmienna sterująca pętli „For” nie może być zmienną typu „{0}”, ponieważ ten typ nie obsługuje wymaganych operatorów.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithByref2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by parameters declared 'ByRef' or 'ByVal'.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie parametrami zadeklarowanymi jako „ByRef” lub „ByVal”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsFromNonInterface"> <source>Interface can inherit only from another interface.</source> <target state="translated">Interfejs może dziedziczyć tylko po innym interfejsie.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceOrderOnInherits"> <source>'Inherits' statements must precede all declarations in an interface.</source> <target state="translated">'Instrukcje „Inherits” muszą znajdować się przed wszystkimi deklaracjami w interfejsie.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateDefaultProps1"> <source>'Default' can be applied to only one property name in a {0}.</source> <target state="translated">'Element „Default” można stosować tylko do jednej nazwy właściwości w elemencie {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMissingFromProperty2"> <source>'{0}' and '{1}' cannot overload each other because only one is declared 'Default'.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ tylko jeden z nich jest zadeklarowany jako „Default”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverridingPropertyKind2"> <source>'{0}' cannot override '{1}' because they differ by 'ReadOnly' or 'WriteOnly'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się ustawieniem „ReadOnly” lub „WriteOnly”.</target> <note /> </trans-unit> <trans-unit id="ERR_NewInInterface"> <source>'Sub New' cannot be declared in an interface.</source> <target state="translated">'Nie można zadeklarować elementu Sub New w interfejsie.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnNew1"> <source>'Sub New' cannot be declared '{0}'.</source> <target state="translated">'Nie można zadeklarować elementu „Sub New” jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadingPropertyKind2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by 'ReadOnly' or 'WriteOnly'.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie ustawieniem „ReadOnly” lub „WriteOnly”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDefaultNotExtend1"> <source>Class '{0}' cannot be indexed because it has no default property.</source> <target state="translated">Nie można zaindeksować klasy „{0}”, ponieważ nie ma ona właściwości domyślnej.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadWithArrayVsParamArray2"> <source>'{0}' and '{1}' cannot overload each other because they differ only by parameters declared 'ParamArray'.</source> <target state="translated">Elementy „{0}” i „{1}” nie mogą przeciążać siebie nawzajem, ponieważ różnią się jedynie parametrami zadeklarowanymi jako „ParamArray”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInstanceMemberAccess"> <source>Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.</source> <target state="translated">Nie można odwołać się do składowej wystąpienia klasy z wnętrza udostępnionej metody lub udostępnionego inicjatora składowej bez jawnego wystąpienia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedRbrace"> <source>'}' expected.</source> <target state="translated">'Oczekiwano znaku „}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleAsType1"> <source>Module '{0}' cannot be used as a type.</source> <target state="translated">Nie można użyć modułu „{0}” jako typu.</target> <note /> </trans-unit> <trans-unit id="ERR_NewIfNullOnNonClass"> <source>'New' cannot be used on an interface.</source> <target state="translated">'Nie można użyć instrukcji New w interfejsie.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchAfterFinally"> <source>'Catch' cannot appear after 'Finally' within a 'Try' statement.</source> <target state="translated">'Instrukcja Catch nie może wystąpić po instrukcji Finally w instrukcji Try.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchNoMatchingTry"> <source>'Catch' cannot appear outside a 'Try' statement.</source> <target state="translated">'Instrukcja Catch nie może wystąpić poza instrukcją Try.</target> <note /> </trans-unit> <trans-unit id="ERR_FinallyAfterFinally"> <source>'Finally' can only appear once in a 'Try' statement.</source> <target state="translated">'Instrukcja Finally może wystąpić tylko raz w instrukcji Try.</target> <note /> </trans-unit> <trans-unit id="ERR_FinallyNoMatchingTry"> <source>'Finally' cannot appear outside a 'Try' statement.</source> <target state="translated">'Instrukcja Finally nie może wystąpić poza instrukcją Try.</target> <note /> </trans-unit> <trans-unit id="ERR_EndTryNoTry"> <source>'End Try' must be preceded by a matching 'Try'.</source> <target state="translated">'Instrukcja End Try musi być poprzedzona odpowiadającą jej instrukcją Try.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndTry"> <source>'Try' must end with a matching 'End Try'.</source> <target state="translated">'Instrukcja Try musi być zakończona odpowiadającą jej instrukcją End Try.</target> <note /> </trans-unit> <trans-unit id="ERR_BadDelegateFlags1"> <source>'{0}' is not valid on a Delegate declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji Delegate.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstructorOnBase2"> <source>Class '{0}' must declare a 'Sub New' because its base class '{1}' does not have an accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">Klasa „{0}” musi mieć deklarację elementu „Sub New”, ponieważ jej klasa bazowa „{1}” nie ma dostępnego elementu „Sub New”, który można wywołać bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleSymbol2"> <source>'{0}' is not accessible in this context because it is '{1}'.</source> <target state="translated">'Element „{0}” nie jest dostępny w tym kontekście, ponieważ jest to element „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleMember3"> <source>'{0}.{1}' is not accessible in this context because it is '{2}'.</source> <target state="translated">'Element „{0}.{1}” nie jest dostępny w tym kontekście, ponieważ jest to element „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchNotException1"> <source>'Catch' cannot catch type '{0}' because it is not 'System.Exception' or a class that inherits from 'System.Exception'.</source> <target state="translated">'Instrukcja „Catch” nie może przechwycić typu „{0}”, ponieważ nie jest to „System.Exception” ani klasa, która dziedziczy po „System.Exception”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitTryNotWithinTry"> <source>'Exit Try' can only appear inside a 'Try' statement.</source> <target state="translated">'Instrukcja Exit Try może wystąpić tylko wewnątrz instrukcji Try.</target> <note /> </trans-unit> <trans-unit id="ERR_BadRecordFlags1"> <source>'{0}' is not valid on a Structure declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji struktury.</target> <note /> </trans-unit> <trans-unit id="ERR_BadEnumFlags1"> <source>'{0}' is not valid on an Enum declaration.</source> <target state="translated">Element „{0}” nie jest prawidłowy w deklaracji wyliczenia.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceFlags1"> <source>'{0}' is not valid on an Interface declaration.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w deklaracji interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithByref2"> <source>'{0}' cannot override '{1}' because they differ by a parameter that is marked as 'ByRef' versus 'ByVal'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się parametrem oznaczonym jest jako „ByRef” lub „ByVal”.</target> <note /> </trans-unit> <trans-unit id="ERR_MyBaseAbstractCall1"> <source>'MyBase' cannot be used with method '{0}' because it is declared 'MustOverride'.</source> <target state="translated">'Instrukcja „MyBase” nie może być użyta z metodą „{0}”, ponieważ jest ona zadeklarowana jako „MustOverride”.</target> <note /> </trans-unit> <trans-unit id="ERR_IdentNotMemberOfInterface4"> <source>'{0}' cannot implement '{1}' because there is no matching {2} on interface '{3}'.</source> <target state="translated">'Element „{0}” nie może zaimplementować elementu „{1}”, ponieważ nie ma pasującego elementu {2} w interfejsie „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementingInterfaceWithDifferentTupleNames5"> <source>'{0}' cannot implement {1} '{2}' on interface '{3}' because the tuple element names in '{4}' do not match those in '{5}'.</source> <target state="translated">'Element „{0}” nie może implementować elementu {1} „{2}” w ramach interfejsu „{3}”, ponieważ nazwy elementów krotki w elemencie „{4}” nie pasują do nazw w elemencie „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_WithEventsRequiresClass"> <source>'WithEvents' variables must have an 'As' clause.</source> <target state="translated">'Zmienne WithEvents muszą mieć klauzulę As.</target> <note /> </trans-unit> <trans-unit id="ERR_WithEventsAsStruct"> <source>'WithEvents' variables can only be typed as classes, interfaces or type parameters with class constraints.</source> <target state="translated">'Zmienne „WithEvents” można określać tylko jako klasy, interfejsy lub parametry typu z ograniczeniami klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvertArrayRankMismatch2"> <source>Value of type '{0}' cannot be converted to '{1}' because the array types have different numbers of dimensions.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”, ponieważ typy tablic mają różną liczbę wymiarów.</target> <note /> </trans-unit> <trans-unit id="ERR_RedimRankMismatch"> <source>'ReDim' cannot change the number of dimensions of an array.</source> <target state="translated">'Nie można zmienić liczby wymiarów tablicy przy użyciu instrukcji ReDim.</target> <note /> </trans-unit> <trans-unit id="ERR_StartupCodeNotFound1"> <source>'Sub Main' was not found in '{0}'.</source> <target state="translated">'Nie odnaleziono instrukcji „Sub Main” w elemencie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstAsNonConstant"> <source>Constants must be of an intrinsic or enumerated type, not a class, structure, type parameter, or array type.</source> <target state="translated">Stałe muszą być typu wewnętrznego lub wyliczeniowego, a nie typu klasy, struktury, parametru typu lub tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndSub"> <source>'End Sub' must be preceded by a matching 'Sub'.</source> <target state="translated">'Instrukcja End Sub musi być poprzedzona odpowiadającą jej instrukcją Sub.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndFunction"> <source>'End Function' must be preceded by a matching 'Function'.</source> <target state="translated">'Instrukcja End Function musi być poprzedzona odpowiadającą jej instrukcją Function.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndProperty"> <source>'End Property' must be preceded by a matching 'Property'.</source> <target state="translated">'Instrukcja End Property musi być poprzedzona odpowiadającą jej instrukcją Property.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseMethodSpecifier1"> <source>Methods in a Module cannot be declared '{0}'.</source> <target state="translated">Metody w module nie mogą być zadeklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseEventSpecifier1"> <source>Events in a Module cannot be declared '{0}'.</source> <target state="translated">Zdarzenia w module nie mogą być zadeklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantUseVarSpecifier1"> <source>Members in a Structure cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować składowych w strukturze jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOverrideDueToReturn2"> <source>'{0}' cannot override '{1}' because they differ by their return types.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ różnią się one zwracanym typem.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidOverrideDueToTupleNames2"> <source>'{0}' cannot override '{1}' because they differ by their tuple element names.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ różnią się nazwami elementów krotki.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidOverrideDueToTupleNames2_Title"> <source>Member cannot override because it differs by its tuple element names.</source> <target state="translated">Składowa nie może przesłaniać, ponieważ różni się nazwami elementów krotki.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantWithNoValue"> <source>Constants must have a value.</source> <target state="translated">Stałe muszą mieć wartość.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionOverflow1"> <source>Constant expression not representable in type '{0}'.</source> <target state="translated">Nieprawidłowa reprezentacja wyrażenia stałego w typie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertyGet"> <source>'Get' is already declared.</source> <target state="translated">'Element „Get” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePropertySet"> <source>'Set' is already declared.</source> <target state="translated">'Element „Set” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotDeclared1"> <source>'{0}' is not declared. It may be inaccessible due to its protection level.</source> <target state="translated">'Element „{0}” nie został zadeklarowany. Może on być niedostępny z powodu swojego poziomu ochrony.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryOperands3"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'.</source> <target state="translated">Operator „{0}” nie jest zdefiniowany dla typu „{1}” i „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedProcedure"> <source>Expression is not a method.</source> <target state="translated">Wyrażenie nie jest metodą.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument2"> <source>Argument not specified for parameter '{0}' of '{1}'.</source> <target state="translated">Nie określono argumentu dla parametru „{0}” elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotMember2"> <source>'{0}' is not a member of '{1}'.</source> <target state="translated">'Element „{0}” nie jest składową elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndClassNoClass"> <source>'End Class' must be preceded by a matching 'Class'.</source> <target state="translated">'Instrukcja End Class musi być poprzedzona odpowiadającą jej instrukcją Class.</target> <note /> </trans-unit> <trans-unit id="ERR_BadClassFlags1"> <source>Classes cannot be declared '{0}'.</source> <target state="translated">Klas nie można deklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportsMustBeFirst"> <source>'Imports' statements must precede any declarations.</source> <target state="translated">'Instrukcje Imports muszą znajdować się przed wszelkimi deklaracjami.</target> <note /> </trans-unit> <trans-unit id="ERR_NonNamespaceOrClassOnImport2"> <source>'{1}' for the Imports '{0}' does not refer to a Namespace, Class, Structure, Enum or Module.</source> <target state="translated">Element „{1}” dla operacji importu „{0}” nie odwołuje się do przestrzeni nazw, klasy, struktury, wyliczenia ani modułu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypecharNotallowed"> <source>Type declaration characters are not valid in this context.</source> <target state="translated">Znaki deklaracji typu nie są prawidłowe w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectReferenceNotSupplied"> <source>Reference to a non-shared member requires an object reference.</source> <target state="translated">Odwołanie do nieudostępnionej składowej wymaga odwołania do obiektu.</target> <note /> </trans-unit> <trans-unit id="ERR_MyClassNotInClass"> <source>'MyClass' cannot be used outside of a class.</source> <target state="translated">'Nie można użyć instrukcji MyClass poza klasą.</target> <note /> </trans-unit> <trans-unit id="ERR_IndexedNotArrayOrProc"> <source>Expression is not an array or a method, and cannot have an argument list.</source> <target state="translated">Wyrażenie nie jest tablicą ani metodą i nie może mieć listy argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_EventSourceIsArray"> <source>'WithEvents' variables cannot be typed as arrays.</source> <target state="translated">'Zmienne WithEvents nie mogą być zmiennymi typu tablicowego.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedConstructorWithParams"> <source>Shared 'Sub New' cannot have any parameters.</source> <target state="translated">Udostępniony element Sub New nie może mieć żadnych parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedConstructorIllegalSpec1"> <source>Shared 'Sub New' cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować udostępnianego elementu „Sub New” jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndClass"> <source>'Class' statement must end with a matching 'End Class'.</source> <target state="translated">'Instrukcja Class musi być zakończona odpowiadającą jej instrukcją End Class.</target> <note /> </trans-unit> <trans-unit id="ERR_UnaryOperand2"> <source>Operator '{0}' is not defined for type '{1}'.</source> <target state="translated">Operator „{0}” nie jest zdefiniowany dla typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsWithDefault1"> <source>'Default' cannot be combined with '{0}'.</source> <target state="translated">'Nie można łączyć instrukcji „Default” z elementem „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidValue"> <source>Expression does not produce a value.</source> <target state="translated">Wyrażenie nie zwraca wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorFunction"> <source>Constructor must be declared as a Sub, not as a Function.</source> <target state="translated">Konstruktor musi być zadeklarowany jako procedura, a nie funkcja.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLiteralExponent"> <source>Exponent is not valid.</source> <target state="translated">Wykładnik nie jest prawidłowy.</target> <note /> </trans-unit> <trans-unit id="ERR_NewCannotHandleEvents"> <source>'Sub New' cannot handle events.</source> <target state="translated">'Element Sub New nie może obsługiwać zdarzeń.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularEvaluation1"> <source>Constant '{0}' cannot depend on its own value.</source> <target state="translated">Stała „{0}” nie może zależeć od własnej wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnSharedMeth1"> <source>'Shared' cannot be combined with '{0}' on a method declaration.</source> <target state="translated">'Nie można łączyć instrukcji „Shared” z elementem „{0}” w deklaracji metody.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnSharedProperty1"> <source>'Shared' cannot be combined with '{0}' on a property declaration.</source> <target state="translated">'Nie można łączyć instrukcji „Shared” z elementem „{0}” w deklaracji właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnStdModuleProperty1"> <source>Properties in a Module cannot be declared '{0}'.</source> <target state="translated">Właściwości w module nie mogą być zadeklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedOnProcThatImpl"> <source>Methods or events that implement interface members cannot be declared 'Shared'.</source> <target state="translated">Metody lub zdarzenia, które implementują składowe interfejsu, nie mogą być zadeklarowane jako Shared.</target> <note /> </trans-unit> <trans-unit id="ERR_NoWithEventsVarOnHandlesList"> <source>Handles clause requires a WithEvents variable defined in the containing type or one of its base types.</source> <target state="translated">Klauzula Handles wymaga zmiennej WithEvents zdefiniowanej w zawierającym ją typie lub jednym z jej typów podstawowych.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceAccessMismatch5"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of the base {1} to {3} '{4}'.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {1} „{2}”, ponieważ rozszerza on dostęp podstawowego elementu {1} do {3} „{4}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NarrowingConversionDisallowed2"> <source>Option Strict On disallows implicit conversions from '{0}' to '{1}'.</source> <target state="translated">Ustawienie „Option Strict On” uniemożliwia niejawne konwersje z elementu „{0}” na „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoArgumentCountOverloadCandidates1"> <source>Overload resolution failed because no accessible '{0}' accepts this number of arguments.</source> <target state="translated">Rozpoznanie przeciążenia nie powiodło się, ponieważ żaden z dostępnych elementów „{0}” nie akceptuje tej liczby argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NoViableOverloadCandidates1"> <source>Overload resolution failed because no '{0}' is accessible.</source> <target state="translated">Rozpoznanie przeciążenia zakończyło się niepowodzeniem, ponieważ żaden z parametrów „{0}” nie jest dostępny.</target> <note /> </trans-unit> <trans-unit id="ERR_NoCallableOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called with these arguments:{1}</source> <target state="translated">Ustalanie przeciążenia nie powiodło się, ponieważ brak jest dostępnego elementu „{0}”, który można wywołać z tymi argumentami: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called:{1}</source> <target state="translated">Rozpoznanie przeciążenia nie powiodło się, ponieważ nie ma dostępnego elementu „{0}” do wywołania: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonNarrowingOverloadCandidates2"> <source>Overload resolution failed because no accessible '{0}' can be called without a narrowing conversion:{1}</source> <target state="translated">Ustalanie przeciążenia nie powiodło się, ponieważ brak jest dostępnego elementu „{0}”, którego można wywołać bez konwersji zawężającej: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNarrowing3"> <source>Argument matching parameter '{0}' narrows from '{1}' to '{2}'.</source> <target state="translated">Dopasowywanie argumentu dla parametru „{0}” powoduje zawężenie typu „{1}” do typu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoMostSpecificOverload2"> <source>Overload resolution failed because no accessible '{0}' is most specific for these arguments:{1}</source> <target state="translated">Ustalanie przeciążenia nie powiodło się, ponieważ brak jest dostępnego elementu „{0}”, który jest najbardziej konkretny dla tych argumentów: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_NotMostSpecificOverload"> <source>Not most specific.</source> <target state="translated">Brak specyficznego elementu.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadCandidate2"> <source> '{0}': {1}</source> <target state="translated"> „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_NoGetProperty1"> <source>Property '{0}' is 'WriteOnly'.</source> <target state="translated">Właściwość „{0}” jest tylko do zapisu.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSetProperty1"> <source>Property '{0}' is 'ReadOnly'.</source> <target state="translated">Właściwość „{0}” jest tylko do odczytu.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamTypingInconsistency"> <source>All parameters must be explicitly typed if any of them are explicitly typed.</source> <target state="translated">Jeśli którekolwiek z parametrów mają jawnie określone typy, to wszystkie parametry muszą mieć jawnie określone typy.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamNameFunctionNameCollision"> <source>Parameter cannot have the same name as its defining function.</source> <target state="translated">Parametr nie może mieć takiej samej nazwy jak definiująca go funkcja.</target> <note /> </trans-unit> <trans-unit id="ERR_DateToDoubleConversion"> <source>Conversion from 'Date' to 'Double' requires calling the 'Date.ToOADate' method.</source> <target state="translated">Konwersja typu Date na typ Double wymaga wywołania metody Date.ToOADate.</target> <note /> </trans-unit> <trans-unit id="ERR_DoubleToDateConversion"> <source>Conversion from 'Double' to 'Date' requires calling the 'Date.FromOADate' method.</source> <target state="translated">Konwersja typu Double na typ Date wymaga wywołania metody Date.FromOADate.</target> <note /> </trans-unit> <trans-unit id="ERR_ZeroDivide"> <source>Division by zero occurred while evaluating this expression.</source> <target state="translated">Podczas obliczania tego wyrażenia wystąpiło dzielenie przez zero.</target> <note /> </trans-unit> <trans-unit id="ERR_TryAndOnErrorDoNotMix"> <source>Method cannot contain both a 'Try' statement and an 'On Error' or 'Resume' statement.</source> <target state="translated">Metoda nie może zawierać jednocześnie instrukcji Try i instrukcji On Error lub Resume.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyAccessIgnored"> <source>Property access must assign to the property or use its value.</source> <target state="translated">Operacja dostępu do właściwości musi przypisywać wartość właściwości lub używać jej wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNoDefault1"> <source>'{0}' cannot be indexed because it has no default property.</source> <target state="translated">'Nie można zaindeksować elementu „{0}”, ponieważ nie ma on domyślnej właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyAttribute1"> <source>Attribute '{0}' cannot be applied to an assembly.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidModuleAttribute1"> <source>Attribute '{0}' cannot be applied to a module.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do modułu.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInUnnamedNamespace1"> <source>'{0}' is ambiguous.</source> <target state="translated">'Element „{0}” jest niejednoznaczny.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultMemberNotProperty1"> <source>Default member of '{0}' is not a property.</source> <target state="translated">Domyślna składowa elementu „{0}” nie jest właściwością.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInNamespace2"> <source>'{0}' is ambiguous in the namespace '{1}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny w przestrzeni nazw „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInImports2"> <source>'{0}' is ambiguous, imported from the namespaces or types '{1}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny. Element ten został zaimportowany z przestrzeni nazw lub typów: „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInModules2"> <source>'{0}' is ambiguous between declarations in Modules '{1}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny między deklaracjami w modułach „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousInNamespaces2"> <source>'{0}' is ambiguous between declarations in namespaces '{1}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny między deklaracjami w przestrzeniach nazw „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerTooFewDimensions"> <source>Array initializer has too few dimensions.</source> <target state="translated">Inicjator tablicy ma za mało wymiarów.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerTooManyDimensions"> <source>Array initializer has too many dimensions.</source> <target state="translated">Inicjator tablicy ma za dużo wymiarów.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerTooFewElements1"> <source>Array initializer is missing {0} elements.</source> <target state="translated">W inicjatorze tablicy brak następującej liczby elementów: {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerTooManyElements1"> <source>Array initializer has {0} too many elements.</source> <target state="translated">Inicjator tablicy ma za dużo elementów (o {0}).</target> <note /> </trans-unit> <trans-unit id="ERR_NewOnAbstractClass"> <source>'New' cannot be used on a class that is declared 'MustInherit'.</source> <target state="translated">'Nie można użyć instrukcji „New” w klasie, która jest zadeklarowana jako „MustInherit”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateNamedImportAlias1"> <source>Alias '{0}' is already declared.</source> <target state="translated">Alias „{0}” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicatePrefix"> <source>XML namespace prefix '{0}' is already declared.</source> <target state="translated">Prefiks przestrzeni nazw XML „{0}” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsLateBinding"> <source>Option Strict On disallows late binding.</source> <target state="translated">Ustawienie Option Strict On uniemożliwia późne wiązanie.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfOperandNotMethod"> <source>'AddressOf' operand must be the name of a method (without parentheses).</source> <target state="translated">'Argument operacji „AddressOf” musi być nazwą metody (bez nawiasów).</target> <note /> </trans-unit> <trans-unit id="ERR_EndExternalSource"> <source>'#End ExternalSource' must be preceded by a matching '#ExternalSource'.</source> <target state="translated">'Dyrektywa #End ExternalSource musi być poprzedzona odpowiadającą jej dyrektywą #ExternalSource.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndExternalSource"> <source>'#ExternalSource' statement must end with a matching '#End ExternalSource'.</source> <target state="translated">'Dyrektywa #ExternalSource musi być zakończona odpowiadającą jej dyrektywą #End ExternalSource.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedExternalSource"> <source>'#ExternalSource' directives cannot be nested.</source> <target state="translated">'Dyrektywy #ExternalSource nie mogą być zagnieżdżane.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNotDelegate1"> <source>'AddressOf' expression cannot be converted to '{0}' because '{0}' is not a delegate type.</source> <target state="translated">'Nie można przekonwertować wyrażenia „AddressOf” na typ „{0}”, ponieważ typ „{0}” nie jest typem delegowanym.</target> <note /> </trans-unit> <trans-unit id="ERR_SyncLockRequiresReferenceType1"> <source>'SyncLock' operand cannot be of type '{0}' because '{0}' is not a reference type.</source> <target state="translated">'Argument operacji „SyncLock” nie może być typu „{0}”, ponieważ „{0}” nie jest typem referencyjnym.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodAlreadyImplemented2"> <source>'{0}.{1}' cannot be implemented more than once.</source> <target state="translated">'Nie można zaimplementować elementu „{0}.{1}” więcej niż raz.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateInInherits1"> <source>'{0}' cannot be inherited more than once.</source> <target state="translated">'Nie można dziedziczyć elementu „{0}” więcej niż raz.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamArrayArgument"> <source>Named argument cannot match a ParamArray parameter.</source> <target state="translated">Nie można dopasować nazwanego argumentu do parametru ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedParamArrayArgument"> <source>Omitted argument cannot match a ParamArray parameter.</source> <target state="translated">Nie można dopasować pominiętego argumentu do parametru ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayArgumentMismatch"> <source>Argument cannot match a ParamArray parameter.</source> <target state="translated">Argument nie jest zgodny z parametrem ParamArray.</target> <note /> </trans-unit> <trans-unit id="ERR_EventNotFound1"> <source>Event '{0}' cannot be found.</source> <target state="translated">Nie można znaleźć zdarzenia „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseVariableSpecifier1"> <source>Variables in Modules cannot be declared '{0}'.</source> <target state="translated">Zmienne w modułach nie mogą być deklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedEventNeedsSharedHandler"> <source>Events of shared WithEvents variables cannot be handled by non-shared methods.</source> <target state="translated">Zdarzenia udostępnionych zmiennych WithEvents nie mogą zostać obsłużone przez metody nieudostępnione.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedMinus"> <source>'-' expected.</source> <target state="translated">'Oczekiwano znaku „-”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceMemberSyntax"> <source>Interface members must be methods, properties, events, or type definitions.</source> <target state="translated">Składowe interfejsu muszą być metodami, właściwościami, zdarzeniami lub definicjami typów.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideInterface"> <source>Statement cannot appear within an interface body.</source> <target state="translated">Instrukcja nie może wystąpić w treści interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsInterface"> <source>Statement cannot appear within an interface body. End of interface assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści interfejsu. Założono koniec interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsInNotInheritableClass1"> <source>'NotInheritable' classes cannot have members declared '{0}'.</source> <target state="translated">'Klasy „NotInheritable” nie mogą mieć składowych zadeklarowanych jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseOnlyClassesMustBeExplicit2"> <source>Class '{0}' must either be declared 'MustInherit' or override the following inherited 'MustOverride' member(s): {1}.</source> <target state="translated">Klasa „{0}” musi być zadeklarowana jako „MustInherit” lub przesłaniać następujące dziedziczone składowe „MustOverride”: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_MustInheritEventNotOverridden"> <source>'{0}' is a MustOverride event in the base class '{1}'. Visual Basic does not support event overriding. You must either provide an implementation for the event in the base class, or make class '{2}' MustInherit.</source> <target state="translated">„{0}” jest zdarzeniem MustOverride w klasie bazowej „{1}”. Język Visual Basic nie obsługuje przesłaniania zdarzeń. Musisz określić implementację zdarzenia w klasie bazowej lub ustawić klasę „{2}” jako zdarzenie MustInherit.</target> <note /> </trans-unit> <trans-unit id="ERR_NegativeArraySize"> <source>Array dimensions cannot have a negative size.</source> <target state="translated">Wymiary tablicy nie mogą mieć rozmiaru ujemnego.</target> <note /> </trans-unit> <trans-unit id="ERR_MyClassAbstractCall1"> <source>'MustOverride' method '{0}' cannot be called with 'MyClass'.</source> <target state="translated">Nie można wywołać metody „{0}” typu „MustOverride” przy użyciu elementu „MyClass”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndDisallowedInDllProjects"> <source>'End' statement cannot be used in class library projects.</source> <target state="translated">'Nie można użyć instrukcji End w projektach biblioteki klas.</target> <note /> </trans-unit> <trans-unit id="ERR_BlockLocalShadowing1"> <source>Variable '{0}' hides a variable in an enclosing block.</source> <target state="translated">Zmienna „{0}” ukrywa zmienną w otaczającym bloku.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleNotAtNamespace"> <source>'Module' statements can occur only at file or namespace level.</source> <target state="translated">'Instrukcje Module mogą wystąpić tylko na poziomie pliku lub przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAtNamespace"> <source>'Namespace' statements can occur only at file or namespace level.</source> <target state="translated">'Instrukcje Namespace mogą wystąpić tylko na poziomie pliku lub przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEnum"> <source>Statement cannot appear within an Enum body.</source> <target state="translated">Instrukcja nie może wystąpić w treści wyliczenia.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsEnum"> <source>Statement cannot appear within an Enum body. End of Enum assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści wyliczenia. Założono koniec wyliczenia.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionStrict"> <source>'Option Strict' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Po instrukcji Option Strict może wystąpić jedynie opcja On lub Off.</target> <note /> </trans-unit> <trans-unit id="ERR_EndStructureNoStructure"> <source>'End Structure' must be preceded by a matching 'Structure'.</source> <target state="translated">'Instrukcja End Structure musi być poprzedzona odpowiadającą jej instrukcją Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_EndModuleNoModule"> <source>'End Module' must be preceded by a matching 'Module'.</source> <target state="translated">'Instrukcja End Module musi być poprzedzona odpowiadającą jej instrukcją Module.</target> <note /> </trans-unit> <trans-unit id="ERR_EndNamespaceNoNamespace"> <source>'End Namespace' must be preceded by a matching 'Namespace'.</source> <target state="translated">'Instrukcja End Namespace musi być poprzedzona odpowiadającą jej instrukcją Namespace.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndStructure"> <source>'Structure' statement must end with a matching 'End Structure'.</source> <target state="translated">'Instrukcja Structure musi być zakończona odpowiadającą jej instrukcją End Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndModule"> <source>'Module' statement must end with a matching 'End Module'.</source> <target state="translated">'Instrukcja Module musi być zakończona odpowiadającą jej instrukcją End Module.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndNamespace"> <source>'Namespace' statement must end with a matching 'End Namespace'.</source> <target state="translated">'Instrukcja Namespace musi być zakończona odpowiadającą jej instrukcją End Namespace.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionStmtWrongOrder"> <source>'Option' statements must precede any declarations or 'Imports' statements.</source> <target state="translated">'Instrukcje Option muszą występować przed wszelkimi deklaracjami i instrukcjami Imports.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantInherit"> <source>Structures cannot have 'Inherits' statements.</source> <target state="translated">Struktury nie mogą mieć instrukcji Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_NewInStruct"> <source>Structures cannot declare a non-shared 'Sub New' with no parameters.</source> <target state="translated">Struktury nie mogą deklarować nieudostępnianych elementów „Sub New” bez parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndGet"> <source>'End Get' must be preceded by a matching 'Get'.</source> <target state="translated">'Instrukcja End Get musi być poprzedzona odpowiadającą jej instrukcją Get.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndGet"> <source>'Get' statement must end with a matching 'End Get'.</source> <target state="translated">'Instrukcja Get musi być zakończona odpowiadającą jej instrukcją End Get.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndSet"> <source>'End Set' must be preceded by a matching 'Set'.</source> <target state="translated">'Instrukcja End Set musi być poprzedzona odpowiadającą jej instrukcją Set.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndSet"> <source>'Set' statement must end with a matching 'End Set'.</source> <target state="translated">'Instrukcja Set musi być zakończona odpowiadającą jej instrukcją End Set.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsProperty"> <source>Statement cannot appear within a property body. End of property assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści właściwości. Założono koniec właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateWriteabilityCategoryUsed"> <source>'ReadOnly' and 'WriteOnly' cannot be combined.</source> <target state="translated">'Nie można łączyć elementów „ReadOnly” i „WriteOnly”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedGreater"> <source>'&gt;' expected.</source> <target state="translated">'Oczekiwano znaku „&gt;”.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeStmtWrongOrder"> <source>Assembly or Module attribute statements must precede any declarations in a file.</source> <target state="translated">Instrukcje atrybutu zestawu lub modułu muszą występować przed wszelkimi deklaracjami w pliku.</target> <note /> </trans-unit> <trans-unit id="ERR_NoExplicitArraySizes"> <source>Array bounds cannot appear in type specifiers.</source> <target state="translated">Granice tablicy nie mogą wystąpić w specyfikatorze typu.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyFlags1"> <source>Properties cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować właściwości jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionExplicit"> <source>'Option Explicit' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Po instrukcji Option Explicit może wystąpić jedynie opcja On lub Off.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleParameterSpecifiers"> <source>'ByVal' and 'ByRef' cannot be combined.</source> <target state="translated">'Nie można łączyć elementów „ByVal” i „ByRef”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleOptionalParameterSpecifiers"> <source>'Optional' and 'ParamArray' cannot be combined.</source> <target state="translated">'Nie można łączyć elementów „Optional” i „ParamArray”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedProperty1"> <source>Property '{0}' is of an unsupported type.</source> <target state="translated">Właściwość „{0}” jest nieobsługiwanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionalParameterUsage1"> <source>Attribute '{0}' cannot be applied to a method with optional parameters.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do metody z parametrami opcjonalnymi.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnFromNonFunction"> <source>'Return' statement in a Sub or a Set cannot return a value.</source> <target state="translated">'Instrukcja Return w bloku Sub lub Set nie może zwracać wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_UnterminatedStringLiteral"> <source>String constants must end with a double quote.</source> <target state="translated">Stałe w postaci ciągu muszą być zakończone znakiem podwójnego cudzysłowu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedType1"> <source>'{0}' is an unsupported type.</source> <target state="translated">'Element „{0}” jest nieobsługiwanym typem.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEnumBase"> <source>Enums must be declared as an integral type.</source> <target state="translated">Wyliczenia należy deklarować jako typ całkowity.</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefIllegal1"> <source>{0} parameters cannot be declared 'ByRef'.</source> <target state="translated">Parametrów {0} nie można deklarować jako „ByRef”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedAssembly3"> <source>Reference required to assembly '{0}' containing the type '{1}'. Add one to your project.</source> <target state="translated">Wymagane odwołanie do zestawu „{0}” z typem „{1}”. Dodaj je do projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnreferencedModule3"> <source>Reference required to module '{0}' containing the type '{1}'. Add one to your project.</source> <target state="translated">Wymagane odwołanie do modułu „{0}” z typem „{1}”. Dodaj je do projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnWithoutValue"> <source>'Return' statement in a Function, Get, or Operator must return a value.</source> <target state="translated">'Instrukcja Return w bloku Function, Get lub Operator musi zwracać wartość.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedField1"> <source>Field '{0}' is of an unsupported type.</source> <target state="translated">Pole „{0}” jest nieobsługiwanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedMethod1"> <source>'{0}' has a return type that is not supported or parameter types that are not supported.</source> <target state="translated">'Element „{0}” ma nieobsługiwany typ zwracany albo nieobsługiwane typy parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonIndexProperty1"> <source>Property '{0}' with no parameters cannot be found.</source> <target state="translated">Nie można odnaleźć właściwości „{0}” bez parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributePropertyType1"> <source>Property or field '{0}' does not have a valid attribute type.</source> <target state="translated">Właściwość lub pole „{0}” nie ma prawidłowego typu atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalsCannotHaveAttributes"> <source>Attributes cannot be applied to local variables.</source> <target state="translated">Nie można zastosować atrybutów do zmiennych lokalnych.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyOrFieldNotDefined1"> <source>Field or property '{0}' is not found.</source> <target state="translated">Nie odnaleziono pola lub właściwości „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeUsage2"> <source>Attribute '{0}' cannot be applied to '{1}' because the attribute is not valid on this declaration type.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do elementu „{1}”, ponieważ atrybut nie jest prawidłowy w tym typie deklaracji.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeUsageOnAccessor"> <source>Attribute '{0}' cannot be applied to '{1}' of '{2}' because the attribute is not valid on this declaration type.</source> <target state="translated">Nie można zastosować atrybutu „{0}” do elementu „{1}” w „{2}”, ponieważ atrybut nie jest prawidłowy w tym typie deklaracji.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedTypeInInheritsClause2"> <source>Class '{0}' cannot reference its nested type '{1}' in Inherits clause.</source> <target state="translated">Klasa „{0}” nie może odwoływać się do swojego zagnieżdżonego typu „{1}” w klauzuli Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInItsInheritsClause1"> <source>Class '{0}' cannot reference itself in Inherits clause.</source> <target state="translated">Klasa „{0}” nie może odwoływać się siebie samej w klauzuli Inherits.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseTypeReferences2"> <source> Base type of '{0}' needs '{1}' to be resolved.</source> <target state="translated"> Typ podstawowy elementu „{0}” potrzebuje elementu „{1}”, aby mógł zostać rozpoznany.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalBaseTypeReferences3"> <source>Inherits clause of {0} '{1}' causes cyclic dependency: {2}</source> <target state="translated">Klauzula Inherits elementu {0} „{1}” powoduje wystąpienie zależności cyklicznej: {2}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMultipleAttributeUsage1"> <source>Attribute '{0}' cannot be applied multiple times.</source> <target state="translated">Nie można wielokrotnie zastosować atrybutu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMultipleAttributeUsageInNetModule2"> <source>Attribute '{0}' in '{1}' cannot be applied multiple times.</source> <target state="translated">Nie można wielokrotnie zastosować atrybutu „{0}” w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantThrowNonException"> <source>'Throw' operand must derive from 'System.Exception'.</source> <target state="translated">'Argument operacji „Throw” musi pochodzić od klasy „System.Exception”.</target> <note /> </trans-unit> <trans-unit id="ERR_MustBeInCatchToRethrow"> <source>'Throw' statement cannot omit operand outside a 'Catch' statement or inside a 'Finally' statement.</source> <target state="translated">'Instrukcja „Throw” nie może pomijać argumentu operacji poza instrukcją „Catch” lub wewnątrz instrukcji „Finally”.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayMustBeByVal"> <source>ParamArray parameters must be declared 'ByVal'.</source> <target state="translated">Parametry ParamArray muszą być zadeklarowane jako ByVal.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoleteSymbol2"> <source>'{0}' is obsolete: '{1}'.</source> <target state="translated">'Element „{0}” jest przestarzały: „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_RedimNoSizes"> <source>'ReDim' statements require a parenthesized list of the new bounds of each dimension of the array.</source> <target state="translated">'Instrukcja ReDim wymaga ujętej w nawiasy listy nowych granic dla każdego wymiaru tablicy.</target> <note /> </trans-unit> <trans-unit id="ERR_InitWithMultipleDeclarators"> <source>Explicit initialization is not permitted with multiple variables declared with a single type specifier.</source> <target state="translated">Jawne inicjowanie nie jest dozwolone, gdy wiele zmiennych zadeklarowano za pomocą jednego specyfikatora typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InitWithExplicitArraySizes"> <source>Explicit initialization is not permitted for arrays declared with explicit bounds.</source> <target state="translated">Jawne inicjowanie nie jest dozwolone w przypadku tablic zadeklarowanych z jawnymi granicami.</target> <note /> </trans-unit> <trans-unit id="ERR_EndSyncLockNoSyncLock"> <source>'End SyncLock' must be preceded by a matching 'SyncLock'.</source> <target state="translated">'Instrukcja End SyncLock musi być poprzedzona odpowiadającą jej instrukcją SyncLock.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndSyncLock"> <source>'SyncLock' statement must end with a matching 'End SyncLock'.</source> <target state="translated">'Instrukcja SyncLock musi być zakończona odpowiadającą jej instrukcją End SyncLock.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotEvent2"> <source>'{0}' is not an event of '{1}'.</source> <target state="translated">'Element „{0}” nie jest zdarzeniem elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AddOrRemoveHandlerEvent"> <source>'AddHandler' or 'RemoveHandler' statement event operand must be a dot-qualified expression or a simple name.</source> <target state="translated">'Argument operacji zdarzenia dla instrukcji „AddHandler” lub „RemoveHandler” musi być wyrażeniem kwalifikowanym kropką lub nazwą prostą.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedEnd"> <source>'End' statement not valid.</source> <target state="translated">'Instrukcja End jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitForNonArray2"> <source>Array initializers are valid only for arrays, but the type of '{0}' is '{1}'.</source> <target state="translated">Inicjatory tablic są prawidłowe tylko dla tablic, ale typem elementu „{0}” jest „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndRegionNoRegion"> <source>'#End Region' must be preceded by a matching '#Region'.</source> <target state="translated">'Instrukcja #End Region musi być poprzedzona odpowiadającą jej instrukcją #Region.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndRegion"> <source>'#Region' statement must end with a matching '#End Region'.</source> <target state="translated">'Instrukcja #Region musi być zakończona odpowiadającą jej instrukcją #End Region.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsStmtWrongOrder"> <source>'Inherits' statement must precede all declarations in a class.</source> <target state="translated">'Instrukcja „Inherits” musi znajdować się przed wszystkimi deklaracjami w klasie.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousAcrossInterfaces3"> <source>'{0}' is ambiguous across the inherited interfaces '{1}' and '{2}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny w obrębie odziedziczonych interfejsów „{1}” i „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPropertyAmbiguousAcrossInterfaces4"> <source>Default property access is ambiguous between the inherited interface members '{0}' of interface '{1}' and '{2}' of interface '{3}'.</source> <target state="translated">Dostęp do właściwości domyślnej jest niejednoznaczny dla dziedziczonej składowej „{0}” interfejsu „{1}” i dziedziczonej składowej „{2}” interfejsu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceEventCantUse1"> <source>Events in interfaces cannot be declared '{0}'.</source> <target state="translated">Zdarzenia w interfejsach nie mogą być zadeklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExecutableAsDeclaration"> <source>Statement cannot appear outside of a method body.</source> <target state="translated">Instrukcja nie może wystąpić poza treścią metody.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureNoDefault1"> <source>Structure '{0}' cannot be indexed because it has no default property.</source> <target state="translated">Nie można indeksować struktury „{0}”, ponieważ nie ma ona domyślnej właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_MustShadow2"> <source>{0} '{1}' must be declared 'Shadows' because another member with this name is declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” musi być zadeklarowany jako „Shadows”, ponieważ inna składowa o tej samej nazwie jest zadeklarowana jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithOptionalTypes2"> <source>'{0}' cannot override '{1}' because they differ by the types of optional parameters.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się typami parametrów opcjonalnych.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndOfExpression"> <source>End of expression expected.</source> <target state="translated">Oczekiwano końca wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_StructsCannotHandleEvents"> <source>Methods declared in structures cannot have 'Handles' clauses.</source> <target state="translated">Metody zadeklarowane w strukturach nie mogą mieć klauzul Handles.</target> <note /> </trans-unit> <trans-unit id="ERR_OverridesImpliesOverridable"> <source>Methods declared 'Overrides' cannot be declared 'Overridable' because they are implicitly overridable.</source> <target state="translated">Metody zadeklarowane jako „Overrides” nie mogą być zadeklarowane jako „Overridable”, ponieważ niejawnie są one możliwe do przesłonięcia.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalNamedSameAsParam1"> <source>'{0}' is already declared as a parameter of this method.</source> <target state="translated">'Element „{0}” jest już zadeklarowany jako parametr tej metody.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalNamedSameAsParamInLambda1"> <source>Variable '{0}' is already declared as a parameter of this or an enclosing lambda expression.</source> <target state="translated">Zmienna „{0}” jest już zadeklarowana jako parametr tego lub otaczającego wyrażenia lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseTypeSpecifier1"> <source>Type in a Module cannot be declared '{0}'.</source> <target state="translated">Typ w module nie może być zadeklarowany jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InValidSubMainsFound1"> <source>No accessible 'Main' method with an appropriate signature was found in '{0}'.</source> <target state="translated">W elemencie „{0}” nie odnaleziono dostępnej metody „Main” z odpowiednią sygnaturą.</target> <note /> </trans-unit> <trans-unit id="ERR_MoreThanOneValidMainWasFound2"> <source>'Sub Main' is declared more than once in '{0}': {1}</source> <target state="translated">'Element „Sub Main” zadeklarowano więcej niż raz w elemencie „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_CannotConvertValue2"> <source>Value '{0}' cannot be converted to '{1}'.</source> <target state="translated">Wartości „{0}” nie można skonwertować na typ „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OnErrorInSyncLock"> <source>'On Error' statements are not valid within 'SyncLock' statements.</source> <target state="translated">'Instrukcje On Error nie są prawidłowe w instrukcjach SyncLock.</target> <note /> </trans-unit> <trans-unit id="ERR_NarrowingConversionCollection2"> <source>Option Strict On disallows implicit conversions from '{0}' to '{1}'; the Visual Basic 6.0 collection type is not compatible with the .NET Framework collection type.</source> <target state="translated">Ustawienie „Option Strict On” uniemożliwia niejawną konwersję z elementu „{0}” na „{1}”. Typ kolekcji języka Visual Basic 6.0 nie jest zgodny z typem kolekcji .NET Framework.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoTryHandler"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'Try', 'Catch' or 'Finally' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „Try”, „Catch” lub „Finally”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoSyncLock"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'SyncLock' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „SyncLock”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoWith"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'With' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „With”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoFor"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'For' or 'For Each' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „For” lub „For Each”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicConstructor"> <source>Attribute cannot be used because it does not have a Public constructor.</source> <target state="translated">Nie można użyć atrybutu, ponieważ nie ma on konstruktora Public.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultEventNotFound1"> <source>Event '{0}' specified by the 'DefaultEvent' attribute is not a publicly accessible event for this class.</source> <target state="translated">Zdarzenie „{0}” określane przez atrybut „DefaultEvent” nie jest zdarzeniem publicznie dostępnym dla tej klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNonSerializedUsage"> <source>'NonSerialized' attribute will not have any effect on this member because its containing class is not exposed as 'Serializable'.</source> <target state="translated">'Atrybut „NonSerialized” nie ma wpływu na tą składową, ponieważ zawierająca ją klasa nie jest ujawniona jako element Serializable.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedContinueKind"> <source>'Continue' must be followed by 'Do', 'For' or 'While'.</source> <target state="translated">'Po instrukcji „Continue” musi następować element „Do”, „For” lub „While”.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueDoNotWithinDo"> <source>'Continue Do' can only appear inside a 'Do' statement.</source> <target state="translated">'Element Continue Do może się znajdować tylko w instrukcji Do.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueForNotWithinFor"> <source>'Continue For' can only appear inside a 'For' statement.</source> <target state="translated">'Element Continue For może się znajdować tylko w instrukcji For.</target> <note /> </trans-unit> <trans-unit id="ERR_ContinueWhileNotWithinWhile"> <source>'Continue While' can only appear inside a 'While' statement.</source> <target state="translated">'Element Continue While może się znajdować tylko w instrukcji While.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateParameterSpecifier"> <source>Parameter specifier is duplicated.</source> <target state="translated">Specyfikator parametru jest zduplikowany.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleCantUseDLLDeclareSpecifier1"> <source>'Declare' statements in a Module cannot be declared '{0}'.</source> <target state="translated">'Instrukcji „Declare” w module nie można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_StructCantUseDLLDeclareSpecifier1"> <source>'Declare' statements in a structure cannot be declared '{0}'.</source> <target state="translated">'Instrukcji „Declare” w strukturze nie można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TryCastOfValueType1"> <source>'TryCast' operand must be reference type, but '{0}' is a value type.</source> <target state="translated">'Argument operacji „TryCast” musi być typem referencyjnym, ale element „{0}” to typ wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_TryCastOfUnconstrainedTypeParam1"> <source>'TryCast' operands must be class-constrained type parameter, but '{0}' has no class constraint.</source> <target state="translated">'Argumenty operacji „TryCast” muszą być parametrami typu z ograniczeniem klasy, ale element „{0}” nie ma ograniczenia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousDelegateBinding2"> <source>No accessible '{0}' is most specific: {1}</source> <target state="translated">Żaden z dostępnych elementów „{0}” nie jest bardziej konkretny od pozostałych: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_SharedStructMemberCannotSpecifyNew"> <source>Non-shared members in a Structure cannot be declared 'New'.</source> <target state="translated">Nie można zadeklarować nieudostępnionych składowych w strukturze jako „New”.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericSubMainsFound1"> <source>None of the accessible 'Main' methods with the appropriate signatures found in '{0}' can be the startup method since they are all either generic or nested in generic types.</source> <target state="translated">Żadna z dostępnych metod „Main” z odpowiednią sygnaturą znalezionych w elemencie „{0}” nie może być metodą startową, ponieważ są one metodami ogólnymi lub zagnieżdżonymi w typach ogólnych.</target> <note /> </trans-unit> <trans-unit id="ERR_GeneralProjectImportsError3"> <source>Error in project-level import '{0}' at '{1}' : {2}</source> <target state="translated">Błąd w imporcie na poziomie projektu „{0}” pod adresem „{1}” : {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidTypeForAliasesImport2"> <source>'{1}' for the Imports alias to '{0}' does not refer to a Namespace, Class, Structure, Interface, Enum or Module.</source> <target state="translated">Element „{1}” dla aliasu Imports elementu „{0}” nie odwołuje się do elementu Namespace, Class, Structure, Interface, Enum lub Module.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedConstant2"> <source>Field '{0}.{1}' has an invalid constant value.</source> <target state="translated">Pole „{0}.{1}” ma nieprawidłową wartość stałej.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteArgumentsNeedParens"> <source>Method arguments must be enclosed in parentheses.</source> <target state="translated">Argumenty metod muszą być ujęte w nawiasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteLineNumbersAreLabels"> <source>Labels that are numbers must be followed by colons.</source> <target state="translated">Po etykietach, które są liczbami, muszą następować dwukropki.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteStructureNotType"> <source>'Type' statements are no longer supported; use 'Structure' statements instead.</source> <target state="translated">'Instrukcje „Type” nie są już obsługiwane. Zamiast nich używaj instrukcji „Structure”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteObjectNotVariant"> <source>'Variant' is no longer a supported type; use the 'Object' type instead.</source> <target state="translated">'Typ Variant nie jest już obsługiwany; zamiast niego użyj typu Object.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteLetSetNotNeeded"> <source>'Let' and 'Set' assignment statements are no longer supported.</source> <target state="translated">'Instrukcje przypisania Let i Set nie są już obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoletePropertyGetLetSet"> <source>Property Get/Let/Set are no longer supported; use the new Property declaration syntax.</source> <target state="translated">Instrukcje Get/Let/Set dotyczące właściwości nie są już obsługiwane; użyj nowej składni deklaracji właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteWhileWend"> <source>'Wend' statements are no longer supported; use 'End While' statements instead.</source> <target state="translated">'Instrukcje „Wend” nie są już obsługiwane. Zamiast nich używaj instrukcji „End While”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteRedimAs"> <source>'ReDim' statements can no longer be used to declare array variables.</source> <target state="translated">'Nie można już używać instrukcji ReDim do deklarowania zmiennych tablicowych.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteOptionalWithoutValue"> <source>Optional parameters must specify a default value.</source> <target state="translated">Parametry opcjonalne muszą określać wartość domyślną.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteGosub"> <source>'GoSub' statements are no longer supported.</source> <target state="translated">'Instrukcje GoSub nie są już obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteOnGotoGosub"> <source>'On GoTo' and 'On GoSub' statements are no longer supported.</source> <target state="translated">'Instrukcje On GoTo i On GoSub nie są już obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteEndIf"> <source>'EndIf' statements are no longer supported; use 'End If' instead.</source> <target state="translated">'Instrukcje „EndIf” nie są już obsługiwane; zamiast nich używaj instrukcji „End If”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteExponent"> <source>'D' can no longer be used to indicate an exponent, use 'E' instead.</source> <target state="translated">'Litery „D” nie można już używać do określenia wykładnika; zamiast niej użyj litery „E”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteAsAny"> <source>'As Any' is not supported in 'Declare' statements.</source> <target state="translated">'Element As Any nie jest obsługiwany w instrukcjach Declare.</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteGetStatement"> <source>'Get' statements are no longer supported. File I/O functionality is available in the 'Microsoft.VisualBasic' namespace.</source> <target state="translated">'Instrukcje „Get” nie są już obsługiwane. Funkcje We/Wy dla plików są dostępne w przestrzeni nazw „Microsoft.VisualBasic”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithArrayVsParamArray2"> <source>'{0}' cannot override '{1}' because they differ by parameters declared 'ParamArray'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się parametrami zadeklarowanymi jako „ParamArray”.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularBaseDependencies4"> <source>This inheritance causes circular dependencies between {0} '{1}' and its nested or base type '{2}'.</source> <target state="translated">To dziedziczenie powoduje powstanie zależności cyklicznych między elementem {0} „{1}” a jego zagnieżdżonym lub podstawowym typem „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedBase2"> <source>{0} '{1}' cannot inherit from a type nested within it.</source> <target state="translated">Element {0} „{1}” nie może dziedziczyć po typie, który jest w nim zagnieżdżony.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchOutsideAssembly4"> <source>'{0}' cannot expose type '{1}' outside the project through {2} '{3}'.</source> <target state="translated">'Element „{0}” nie może ujawnić typu „{1}” poza projektem za pomocą elementu {2} „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceAccessMismatchOutside3"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of the base {1} outside the assembly.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {1} „{2}”, ponieważ rozszerza on dostęp podstawowego elementu {1} poza zestaw.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoletePropertyAccessor3"> <source>'{0}' accessor of '{1}' is obsolete: '{2}'.</source> <target state="translated">'Metoda dostępu „{0}” elementu „{1}” jest przestarzała: „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoletePropertyAccessor2"> <source>'{0}' accessor of '{1}' is obsolete.</source> <target state="translated">'Metoda dostępu „{0}” elementu „{1}” jest przestarzała.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchImplementedEvent6"> <source>'{0}' cannot expose the underlying delegate type '{1}' of the event it is implementing to {2} '{3}' through {4} '{5}'.</source> <target state="translated">'Element „{0}” nie może ujawnić podstawowego typu delegowanego „{1}” zdarzenia, które implementuje w elemencie {2} „{3}” za pomocą elementu {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatchImplementedEvent4"> <source>'{0}' cannot expose the underlying delegate type '{1}' of the event it is implementing outside the project through {2} '{3}'.</source> <target state="translated">'Element „{0}” nie może ujawnić podstawowego typu delegowanego „{1}” zdarzenia, które implementuje poza projektem za pomocą elementu {2} „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritanceCycleInImportedType1"> <source>Type '{0}' is not supported because it either directly or indirectly inherits from itself.</source> <target state="translated">Typ „{0}” nie jest obsługiwany, ponieważ dziedziczy on pośrednio albo bezpośrednio po sobie samym.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonObsoleteConstructorOnBase3"> <source>Class '{0}' must declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete.</source> <target state="translated">Klasa „{0}” musi deklarować element „Sub New”, ponieważ element „{1}” w swojej klasie bazowej „{2}” jest oznaczony jako przestarzały.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNonObsoleteConstructorOnBase4"> <source>Class '{0}' must declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete: '{3}'.</source> <target state="translated">Klasa „{0}” musi deklarować element „Sub New”, ponieważ element „{1}” w swojej klasie bazowej „{2}” jest oznaczony jako przestarzały: „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNonObsoleteNewCall3"> <source>First statement of this 'Sub New' must be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete.</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” musi być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ element „{0}” w klasie bazowej „{1}” klasy „{2}” jest oznaczony jako przestarzały.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNonObsoleteNewCall4"> <source>First statement of this 'Sub New' must be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete: '{3}'.</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” musi być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ element „{0}” w klasie bazowej „{1}” klasy „{2}” jest oznaczony jako przestarzały: „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsTypeArgAccessMismatch7"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of type '{3}' to {4} '{5}'.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {1} „{2}”, ponieważ rozszerza on dostęp do typu „{3}” do elementu {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InheritsTypeArgAccessMismatchOutside5"> <source>'{0}' cannot inherit from {1} '{2}' because it expands the access of type '{3}' outside the assembly.</source> <target state="translated">'Element „{0}” nie może dziedziczyć po elemencie {1} „{2}”, ponieważ rozszerza on dostęp do typu „{3}” poza zestaw.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeAccessMismatch3"> <source>Specified access '{0}' for '{1}' does not match the access '{2}' specified on one of its other partial types.</source> <target state="translated">Dostęp „{0}” określony dla elementu „{1}” nie jest zgodny z dostępem „{2}” określonym w jednym z jego innych typów częściowych.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeBadMustInherit1"> <source>'MustInherit' cannot be specified for partial type '{0}' because it cannot be combined with 'NotInheritable' specified for one of its other partial types.</source> <target state="translated">'Elementu „MustInherit” nie można określić dla typu częściowego „{0}”, ponieważ nie można go łączyć z elementem „NotInheritable” określonym dla jednego z jego innych typów częściowych.</target> <note /> </trans-unit> <trans-unit id="ERR_MustOverOnNotInheritPartClsMem1"> <source>'MustOverride' cannot be specified on this member because it is in a partial type that is declared 'NotInheritable' in another partial definition.</source> <target state="translated">'Elementu „MustOverride” nie można określić w tej składowej, ponieważ znajduje się ona w typie częściowym zadeklarowanym jako „NotInheritable” w innej definicji częściowej.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseMismatchForPartialClass3"> <source>Base class '{0}' specified for class '{1}' cannot be different from the base class '{2}' of one of its other partial types.</source> <target state="translated">Klasa bazowa „{0}” określona dla klasy „{1}” nie może się różnić od klasy bazowej „{2}” jednego z jej pozostałych typów częściowych.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeTypeParamNameMismatch3"> <source>Type parameter name '{0}' does not match the name '{1}' of the corresponding type parameter defined on one of the other partial types of '{2}'.</source> <target state="translated">Nazwa parametru typu „{0}” nie jest zgodna z nazwą „{1}” odpowiedniego parametru typu zdefiniowanego w jednym z innych typów częściowych elementu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialTypeConstraintMismatch1"> <source>Constraints for this type parameter do not match the constraints on the corresponding type parameter defined on one of the other partial types of '{0}'.</source> <target state="translated">Ograniczenia dla tego parametru typu nie są zgodne z ograniczeniami w odpowiednim parametrze typu zdefiniowanym w jednym z innych typów częściowych elementu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_LateBoundOverloadInterfaceCall1"> <source>Late bound overload resolution cannot be applied to '{0}' because the accessing instance is an interface type.</source> <target state="translated">Ustalanie przeciążenia późnego wiązania nie może zostać zastosowane w elemencie „{0}”, ponieważ wystąpienie uzyskujące dostęp jest typem interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredAttributeConstConversion2"> <source>Conversion from '{0}' to '{1}' cannot occur in a constant expression used as an argument to an attribute.</source> <target state="translated">Konwersja z elementu „{0}” na element „{1}” nie może wystąpić w wyrażeniu stałym używanym jako argument atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousOverrides3"> <source>Member '{0}' that matches this signature cannot be overridden because the class '{1}' contains multiple members with this same name and signature: {2}</source> <target state="translated">Składowa „{0}” zgodna z sygnaturą nie może zostać przesłoniona, ponieważ klasa „{1}” zawiera wiele składowych o tej samej nazwie i sygnaturze: {2}.</target> <note /> </trans-unit> <trans-unit id="ERR_OverriddenCandidate1"> <source> '{0}'</source> <target state="translated"> „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousImplements3"> <source>Member '{0}.{1}' that matches this signature cannot be implemented because the interface '{2}' contains multiple members with this same name and signature: '{3}' '{4}'</source> <target state="translated">Składowa „{0}.{1}” zgodna z tą sygnaturą nie może zostać zaimplementowana, ponieważ interfejs „{2}” zawiera wiele składowych o tej samej nazwie i sygnaturze: „{3}” „{4}”</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNotCreatableDelegate1"> <source>'AddressOf' expression cannot be converted to '{0}' because type '{0}' is declared 'MustInherit' and cannot be created.</source> <target state="translated">'Nie można przekonwertować wyrażenia „AddressOf” na typ „{0}”, ponieważ typ „{0}” został zadeklarowany jako „MustInherit” i nie można go utworzyć.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassGenericMethod"> <source>Generic methods cannot be exposed to COM.</source> <target state="translated">Metod ogólnych nie można ujawniać modelowi COM.</target> <note /> </trans-unit> <trans-unit id="ERR_SyntaxInCastOp"> <source>Syntax error in cast operator; two arguments separated by comma are required.</source> <target state="translated">Błąd składni w operatorze rzutowania. Wymagane są dwa argumenty rozdzielone przecinkiem.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitializerForNonConstDim"> <source>Array initializer cannot be specified for a non constant dimension; use the empty initializer '{}'.</source> <target state="translated">Inicjatora tablicy nie można określić dla niestałego wymiaru; użyj pustego inicjatora „{}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingFailure3"> <source>No accessible method '{0}' has a signature compatible with delegate '{1}':{2}</source> <target state="translated">Żadna z dostępnych metod „{0}” nie ma sygnatury zgodnej z delegatem „{1}”:{2}.</target> <note /> </trans-unit> <trans-unit id="ERR_StructLayoutAttributeNotAllowed"> <source>Attribute 'StructLayout' cannot be applied to a generic type.</source> <target state="translated">Nie można zastosować atrybutu „StructLayout” do typu ogólnego.</target> <note /> </trans-unit> <trans-unit id="ERR_IterationVariableShadowLocal1"> <source>Range variable '{0}' hides a variable in an enclosing block or a range variable previously defined in the query expression.</source> <target state="translated">Zmienna zakresu „{0}” ukrywa zmienną w otaczającym bloku lub zmiennej zakresu wcześniej zdefiniowanej w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionInfer"> <source>'Option Infer' can be followed only by 'On' or 'Off'.</source> <target state="translated">'Po instrukcji „Option Infer” może wystąpić jedynie opcja „On” lub „Off”.</target> <note /> </trans-unit> <trans-unit id="ERR_CircularInference1"> <source>Type of '{0}' cannot be inferred from an expression containing '{0}'.</source> <target state="translated">Nie można wywnioskować typu elementu „{0}” na podstawie wyrażenia zawierającego element „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InAccessibleOverridingMethod5"> <source>'{0}' in class '{1}' cannot override '{2}' in class '{3}' because an intermediate class '{4}' overrides '{2}' in class '{3}' but is not accessible.</source> <target state="translated">'Element „{0}” w klasie „{1}” nie może przesłonić elementu „{2}” w klasie „{3}”, ponieważ klasa pośrednicząca „{4}”, która przesłania element „{2}” w klasie „{3}”, jest niedostępna.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuitableWidestType1"> <source>Type of '{0}' cannot be inferred because the loop bounds and the step clause do not convert to the same type.</source> <target state="translated">Nie można wywnioskować typu elementu „{0}”, ponieważ granice pętli i klauzula step nie są konwertowane na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousWidestType3"> <source>Type of '{0}' is ambiguous because the loop bounds and the step clause do not convert to the same type.</source> <target state="translated">Typ „{0}” jest niejednoznaczny, ponieważ granice pętli i klauzula step nie są konwertowane na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAssignmentOperatorInInit"> <source>'=' expected (object initializer).</source> <target state="translated">'Oczekiwano znaku „=” (inicjator obiektów).</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQualifiedNameInInit"> <source>Name of field or property being initialized in an object initializer must start with '.'.</source> <target state="translated">Nazwa pola lub właściwości inicjowanej w inicjatorze obiektów musi zaczynać się od znaku „.”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLbrace"> <source>'{' expected.</source> <target state="translated">'Oczekiwano znaku „{”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnrecognizedTypeOrWith"> <source>Type or 'With' expected.</source> <target state="translated">Oczekiwano typu lub instrukcji „With”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAggrMemberInit1"> <source>Multiple initializations of '{0}'. Fields and properties can be initialized only once in an object initializer expression.</source> <target state="translated">Wiele operacji inicjowania elementu „{0}”. W wyrażeniu inicjatora obiektów pola i właściwości mogą być inicjowane tylko raz.</target> <note /> </trans-unit> <trans-unit id="ERR_NonFieldPropertyAggrMemberInit1"> <source>Member '{0}' cannot be initialized in an object initializer expression because it is not a field or property.</source> <target state="translated">Nie można zainicjować składowej „{0}” w wyrażeniu inicjatora obiektów, ponieważ nie jest ona polem ani właściwością.</target> <note /> </trans-unit> <trans-unit id="ERR_SharedMemberAggrMemberInit1"> <source>Member '{0}' cannot be initialized in an object initializer expression because it is shared.</source> <target state="translated">Nie można zainicjować składowej „{0}” w wyrażeniu inicjatora obiektów, ponieważ jest ona udostępniona.</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterizedPropertyInAggrInit1"> <source>Property '{0}' cannot be initialized in an object initializer expression because it requires arguments.</source> <target state="translated">Nie można zainicjować właściwości „{0}” w wyrażeniu inicjatora obiektów, ponieważ wymaga ona argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NoZeroCountArgumentInitCandidates1"> <source>Property '{0}' cannot be initialized in an object initializer expression because all accessible overloads require arguments.</source> <target state="translated">Nie można zainicjować właściwości „{0}” w wyrażeniu inicjatora obiektów, ponieważ wszystkie dostępne przeciążenia wymagają argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_AggrInitInvalidForObject"> <source>Object initializer syntax cannot be used to initialize an instance of 'System.Object'.</source> <target state="translated">Nie można użyć składni inicjatora obiektów do zainicjowania wystąpienia obiektu System.Object.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerExpected"> <source>Initializer expected.</source> <target state="translated">Oczekiwano inicjatora.</target> <note /> </trans-unit> <trans-unit id="ERR_LineContWithCommentOrNoPrecSpace"> <source>The line continuation character '_' must be preceded by at least one white space and it must be followed by a comment or the '_' must be the last character on the line.</source> <target state="translated">Znak kontynuacji wiersza „_” musi być poprzedzony co najmniej jednym białym znakiem i musi po nim następować komentarz lub znak „_” musi być ostatnim w wierszu.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleFile1"> <source>Unable to load module file '{0}': {1}</source> <target state="translated">Nie można załadować pliku modułu „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_BadRefLib1"> <source>Unable to load referenced library '{0}': {1}</source> <target state="translated">Nie można załadować określonej w odwołaniu biblioteki „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_EventHandlerSignatureIncompatible2"> <source>Method '{0}' cannot handle event '{1}' because they do not have a compatible signature.</source> <target state="translated">Metoda „{0}” nie może obsłużyć zdarzenia „{1}”, ponieważ metoda i zdarzenie nie mają zgodnej sygnatury.</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionalCompilationConstantNotValid"> <source>Conditional compilation constant '{1}' is not valid: {0}</source> <target state="translated">Stała kompilacji warunkowej „{1}” jest nieprawidłowa: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwice1"> <source>Interface '{0}' can be implemented only once by this type.</source> <target state="translated">Interfejs „{0}” może być zaimplementowany przez ten typ tylko raz.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames2"> <source>Interface '{0}' can be implemented only once by this type, but already appears with different tuple element names, as '{1}'.</source> <target state="translated">Interfejs „{0}” można zaimplementować tylko raz według tego typu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames3"> <source>Interface '{0}' can be implemented only once by this type, but already appears with different tuple element names, as '{1}' (via '{2}').</source> <target state="translated">Interfejs „{0}” można zaimplementować tylko raz według tego typu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{1}” (poprzez „{2}”).</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNamesReverse3"> <source>Interface '{0}' (via '{1}') can be implemented only once by this type, but already appears with different tuple element names, as '{2}'.</source> <target state="translated">Interfejs „{0}” (poprzez „{1}”) można zaimplementować tylko raz według tego typu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceImplementedTwiceWithDifferentTupleNames4"> <source>Interface '{0}' (via '{1}') can be implemented only once by this type, but already appears with different tuple element names, as '{2}' (via '{3}').</source> <target state="translated">Interfejs „{0}” (poprzez „{1}”) można zaimplementować tylko raz według tego typu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{2}” (poprzez „{3}”).</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames2"> <source>Interface '{0}' can be inherited only once by this interface, but already appears with different tuple element names, as '{1}'.</source> <target state="translated">Interfejs „{0}” można odziedziczyć tylko raz według tego interfejsu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames3"> <source>Interface '{0}' can be inherited only once by this interface, but already appears with different tuple element names, as '{1}' (via '{2}').</source> <target state="translated">Interfejs „{0}” można odziedziczyć tylko raz według tego interfejsu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{1}” (poprzez „{2}”).</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNamesReverse3"> <source>Interface '{0}' (via '{1}') can be inherited only once by this interface, but already appears with different tuple element names, as '{2}'.</source> <target state="translated">Interfejs „{0}” (poprzez „{1}”) można odziedziczyć tylko raz według tego interfejsu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceInheritedTwiceWithDifferentTupleNames4"> <source>Interface '{0}' (via '{1}') can be inherited only once by this interface, but already appears with different tuple element names, as '{2}' (via '{3}').</source> <target state="translated">Interfejs „{0}” (poprzez „{1}”) można odziedziczyć tylko raz według tego interfejsu, lecz występuje już z innymi nazwami elementów krotki, takimi jak „{2}” (poprzez „{3}”).</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceNotImplemented1"> <source>Interface '{0}' is not implemented by this class.</source> <target state="translated">Interfejs „{0}” nie jest implementowany przez tę klasę.</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousImplementsMember3"> <source>'{0}' exists in multiple base interfaces. Use the name of the interface that declares '{0}' in the 'Implements' clause instead of the name of the derived interface.</source> <target state="translated">'Element „{0}” istnieje w wielu interfejsach podstawowych. Użyj nazwy interfejsu deklarującego element „{0}” w klauzuli „Implements” zamiast nazwy interfejsu pochodnego.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsOnNew"> <source>'Sub New' cannot implement interface members.</source> <target state="translated">'Element Sub New nie może implementować składowych interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitInStruct"> <source>Arrays declared as structure members cannot be declared with an initial size.</source> <target state="translated">Tablice deklarowane jako składowe struktur nie mogą być deklarowane z rozmiarem początkowym.</target> <note /> </trans-unit> <trans-unit id="ERR_EventTypeNotDelegate"> <source>Events declared with an 'As' clause must have a delegate type.</source> <target state="translated">Zdarzenia deklarowane z klauzulą „As” muszą mieć typ delegata.</target> <note /> </trans-unit> <trans-unit id="ERR_ProtectedTypeOutsideClass"> <source>Protected types can only be declared inside of a class.</source> <target state="translated">Typy chronione mogą być deklarowane tylko wewnątrz klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultPropertyWithNoParams"> <source>Properties with no required parameters cannot be declared 'Default'.</source> <target state="translated">Właściwości bez żadnych wymaganych parametrów nie mogą być deklarowane jako Default.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializerInStruct"> <source>Initializers on structure members are valid only for 'Shared' members and constants.</source> <target state="translated">Inicjatory w składowych struktur są prawidłowe tylko w przypadku wartości stałych i składowych „Shared”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateImport1"> <source>Namespace or type '{0}' has already been imported.</source> <target state="translated">Przestrzeń nazw lub typ „{0}” zostały już zaimportowane.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleFlags1"> <source>Modules cannot be declared '{0}'.</source> <target state="translated">Moduły nie mogą być deklarowane jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsStmtWrongOrder"> <source>'Implements' statements must follow any 'Inherits' statement and precede all declarations in a class.</source> <target state="translated">'Instrukcje „Implements” muszą występować po wszelkich instrukcjach „Inherits” i muszą znajdować się przed wszystkimi deklaracjami w klasie.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberClashesWithSynth7"> <source>{0} '{1}' implicitly defines '{2}', which conflicts with a member implicitly declared for {3} '{4}' in {5} '{6}'.</source> <target state="translated">Element {0} „{1}” niejawnie definiuje element „{2}”, który powoduje konflikt ze składową zadeklarowaną niejawnie dla elementu {3} „{4}” w elemencie {5} „{6}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberClashesWithMember5"> <source>{0} '{1}' implicitly defines '{2}', which conflicts with a member of the same name in {3} '{4}'.</source> <target state="translated">Element {0} „{1}” niejawnie definiuje element „{2}”, który powoduje konflikt ze składową o tej samej nazwie w elemencie {3} „{4}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MemberClashesWithSynth6"> <source>{0} '{1}' conflicts with a member implicitly declared for {2} '{3}' in {4} '{5}'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt ze składową zadeklarowaną niejawnie dla elementu {2} „{3}” w elemencie {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeClashesWithVbCoreType4"> <source>{0} '{1}' conflicts with a Visual Basic Runtime {2} '{3}'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt ze środowiskiem uruchomieniowym języka Visual Basic {2} „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeMissingAction"> <source>First argument to a security attribute must be a valid SecurityAction.</source> <target state="translated">Pierwszy argument atrybutu zabezpieczeń musi być poprawnym elementem SecurityAction.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidAction"> <source>Security attribute '{0}' has an invalid SecurityAction value '{1}'.</source> <target state="translated">Atrybut zabezpieczeń „{0}” ma nieprawidłową wartość SecurityAction: „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionAssembly"> <source>SecurityAction value '{0}' is invalid for security attributes applied to an assembly.</source> <target state="translated">Wartość SecurityAction „{0}” jest niepoprawna dla atrybutów zabezpieczeń zastosowanych względem zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidActionTypeOrMethod"> <source>SecurityAction value '{0}' is invalid for security attributes applied to a type or a method.</source> <target state="translated">Wartość SecurityAction „{0}” jest niepoprawna dla atrybutów zabezpieczeń zastosowanych względem typu lub metody.</target> <note /> </trans-unit> <trans-unit id="ERR_PrincipalPermissionInvalidAction"> <source>SecurityAction value '{0}' is invalid for PrincipalPermission attribute.</source> <target state="translated">Wartość SecurityAction „{0}” jest niepoprawna dla atrybutu PrincipalPermission.</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeInvalidFile"> <source>Unable to resolve file path '{0}' specified for the named argument '{1}' for PermissionSet attribute.</source> <target state="translated">Nie można rozpoznać ścieżki do pliku „{0}” określonej dla nazwanego argumentu „{1}” dla atrybutu PermissionSet.</target> <note /> </trans-unit> <trans-unit id="ERR_PermissionSetAttributeFileReadError"> <source>Error reading file '{0}' specified for the named argument '{1}' for PermissionSet attribute: '{2}'.</source> <target state="translated">Błąd podczas odczytu pliku „{0}” określonego dla nazwanego argumentu „{1}” dla atrybutu PermissionSet: „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SetHasOnlyOneParam"> <source>'Set' method cannot have more than one parameter.</source> <target state="translated">'Metoda „Set” nie może mieć więcej parametrów niż jeden.</target> <note /> </trans-unit> <trans-unit id="ERR_SetValueNotPropertyType"> <source>'Set' parameter must have the same type as the containing property.</source> <target state="translated">'Parametr Set musi mieć taki sam typ jak zawierająca go właściwość.</target> <note /> </trans-unit> <trans-unit id="ERR_SetHasToBeByVal1"> <source>'Set' parameter cannot be declared '{0}'.</source> <target state="translated">'Nie można zadeklarować parametru „Set” jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_StructureCantUseProtected"> <source>Method in a structure cannot be declared 'Protected', 'Protected Friend', or 'Private Protected'.</source> <target state="translated">Nie można zadeklarować metody w strukturze jako Protected, Protected Friend lub Private Protected.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceDelegateSpecifier1"> <source>Delegate in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować delegatu w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceEnumSpecifier1"> <source>Enum in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować wyliczenia w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceClassSpecifier1"> <source>Class in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować klasy w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceStructSpecifier1"> <source>Structure in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować struktury w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadInterfaceInterfaceSpecifier1"> <source>Interface in an interface cannot be declared '{0}'.</source> <target state="translated">Nie można zadeklarować interfejsu w interfejsie jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfObsoleteSymbolNoMessage1"> <source>'{0}' is obsolete.</source> <target state="translated">'Element „{0}” jest przestarzały.</target> <note /> </trans-unit> <trans-unit id="ERR_MetaDataIsNotAssembly"> <source>'{0}' is a module and cannot be referenced as an assembly.</source> <target state="translated">'Element „{0}” jest modułem i nie można się do niego odwoływać jako do zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_MetaDataIsNotModule"> <source>'{0}' is an assembly and cannot be referenced as a module.</source> <target state="translated">'Element „{0}” jest zestawem i nie można się do niego odwoływać jako do modułu.</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceComparison3"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'. Use 'Is' operator to compare two reference types.</source> <target state="translated">Operator „{0}” nie jest zdefiniowany dla typów „{1}” i „{2}”. Użyj operatora „Is”, aby porównać dwa typy referencyjne.</target> <note /> </trans-unit> <trans-unit id="ERR_CatchVariableNotLocal1"> <source>'{0}' is not a local variable or parameter, and so cannot be used as a 'Catch' variable.</source> <target state="translated">'Element „{0}” nie jest zmienną lokalną ani parametrem i w związku z tym nie można go użyć jako zmiennej instrukcji „Catch”.</target> <note /> </trans-unit> <trans-unit id="ERR_ModuleMemberCantImplement"> <source>Members in a Module cannot implement interface members.</source> <target state="translated">Składowe w module nie mogą implementować składowych interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_EventDelegatesCantBeFunctions"> <source>Events cannot be declared with a delegate type that has a return type.</source> <target state="translated">Zdarzenia nie mogą być zadeklarowane z typem delegata, który ma zwracany typ.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDate"> <source>Date constant is not valid.</source> <target state="translated">Stała daty jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="ERR_CantOverride4"> <source>'{0}' cannot override '{1}' because it is not declared 'Overridable'.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ nie jest on zadeklarowany jako „Overridable”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyArraysOnBoth"> <source>Array modifiers cannot be specified on both a variable and its type.</source> <target state="translated">Modyfikatory tablicy nie mogą być określone jednocześnie w zmiennej i jej typie.</target> <note /> </trans-unit> <trans-unit id="ERR_NotOverridableRequiresOverrides"> <source>'NotOverridable' cannot be specified for methods that do not override another method.</source> <target state="translated">'Dla metod, które nie przesłaniają innej metody, nie można określić słowa kluczowego „NotOverridable”.</target> <note /> </trans-unit> <trans-unit id="ERR_PrivateTypeOutsideType"> <source>Types declared 'Private' must be inside another type.</source> <target state="translated">Typy zadeklarowane jako Private muszą znajdować się wewnątrz innego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeRefResolutionError3"> <source>Import of type '{0}' from assembly or module '{1}' failed.</source> <target state="translated">Importowanie typu „{0}” z zestawu lub modułu „{1}” nie powiodło się.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTupleTypeRefResolutionError1"> <source>Predefined type '{0}' is not defined or imported.</source> <target state="translated">Wstępnie zdefiniowany typ „{0}” nie jest zdefiniowany ani zaimportowany.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayWrongType"> <source>ParamArray parameters must have an array type.</source> <target state="translated">Parametry ParamArray muszą być typu tablicowego.</target> <note /> </trans-unit> <trans-unit id="ERR_CoClassMissing2"> <source>Implementing class '{0}' for interface '{1}' cannot be found.</source> <target state="translated">Nie można znaleźć implementującej klasy „{0}” dla interfejsu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidCoClass1"> <source>Type '{0}' cannot be used as an implementing class.</source> <target state="translated">Typ „{0}” nie może być używany jako klasa implementująca.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidMeReference"> <source>Reference to object under construction is not valid when calling another constructor.</source> <target state="translated">Odwołanie do właśnie konstruowanego obiektu nie jest prawidłowe podczas wywoływania innego konstruktora.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplicitMeReference"> <source>Implicit reference to object under construction is not valid when calling another constructor.</source> <target state="translated">Niejawne odwołanie do właśnie konstruowanego obiektu nie jest prawidłowe podczas wywoływania innego konstruktora.</target> <note /> </trans-unit> <trans-unit id="ERR_RuntimeMemberNotFound2"> <source>Member '{0}' cannot be found in class '{1}'. This condition is usually the result of a mismatched 'Microsoft.VisualBasic.dll'.</source> <target state="translated">Nie można odnaleźć składowej „{0}” w klasie „{1}”. Ta sytuacja jest zazwyczaj wynikiem niedopasowania biblioteki „Microsoft.VisualBasic.dll”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags"> <source>Property accessors cannot be declared '{0}'.</source> <target state="translated">Metod dostępu do właściwości nie można deklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlagsRestrict"> <source>Access modifier '{0}' is not valid. The access modifier of 'Get' and 'Set' should be more restrictive than the property access level.</source> <target state="translated">Modyfikator dostępu „{0}” jest nieprawidłowy. Modyfikator dostępu elementu „Get” i „Set” powinien być bardziej restrykcyjny niż poziom dostępu do właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOneAccessorForGetSet"> <source>Access modifier can only be applied to either 'Get' or 'Set', but not both.</source> <target state="translated">Modyfikator dostępu można stosować do elementu „Get” lub elementu „Set”, ale nie do obu elementów naraz.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleSet"> <source>'Set' accessor of property '{0}' is not accessible.</source> <target state="translated">'Metoda dostępu „Set” właściwości „{0}” jest niedostępna.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleGet"> <source>'Get' accessor of property '{0}' is not accessible.</source> <target state="translated">'Metoda dostępu „Get” właściwości „{0}” jest niedostępna.</target> <note /> </trans-unit> <trans-unit id="ERR_WriteOnlyNoAccessorFlag"> <source>'WriteOnly' properties cannot have an access modifier on 'Set'.</source> <target state="translated">'Właściwości „WriteOnly” nie mogą mieć modyfikatora dostępu w elemencie „Set”.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyNoAccessorFlag"> <source>'ReadOnly' properties cannot have an access modifier on 'Get'.</source> <target state="translated">'Właściwości „ReadOnly” nie mogą mieć modyfikatora dostępu w elemencie „Get”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags1"> <source>Property accessors cannot be declared '{0}' in a 'NotOverridable' property.</source> <target state="translated">Metod dostępu do właściwości nie można deklarować jako „{0}” we właściwości „NotOverridable”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags2"> <source>Property accessors cannot be declared '{0}' in a 'Default' property.</source> <target state="translated">Metod dostępu do właściwości nie można deklarować jako „{0}” we właściwości „Default”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPropertyAccessorFlags3"> <source>Property cannot be declared '{0}' because it contains a 'Private' accessor.</source> <target state="translated">Właściwość nie może być zadeklarowana jako „{0}”, ponieważ zawiera metodę dostępu „Private”.</target> <note /> </trans-unit> <trans-unit id="ERR_InAccessibleCoClass3"> <source>Implementing class '{0}' for interface '{1}' is not accessible in this context because it is '{2}'.</source> <target state="translated">Implementująca klasa „{0}” dla interfejsu „{1}” jest niedostępna w tym kontekście, ponieważ jest to element „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingValuesForArraysInApplAttrs"> <source>Arrays used as attribute arguments are required to explicitly specify values for all elements.</source> <target state="translated">Tablice używane jako argumenty atrybutów są wymagane do jawnego określenia wartości dla wszystkich elementów.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitEventMemberNotInvalid"> <source>'Exit AddHandler', 'Exit RemoveHandler' and 'Exit RaiseEvent' are not valid. Use 'Return' to exit from event members.</source> <target state="translated">'Elementy „Exit AddHandler”, „Exit RemoveHandler” i „Exit RaiseEvent” są nieprawidłowe. Użyj elementu „Return”, aby wyjść ze składowych zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_InvInsideEndsEvent"> <source>Statement cannot appear within an event body. End of event assumed.</source> <target state="translated">Instrukcja nie może wystąpić w treści zdarzenia. Założono koniec zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndEvent"> <source>'Custom Event' must end with a matching 'End Event'.</source> <target state="translated">'Element „Custom Event” musi być zakończony odpowiadającym mu elementem „End Event”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndAddHandler"> <source>'AddHandler' declaration must end with a matching 'End AddHandler'.</source> <target state="translated">'Deklaracja „AddHandler” musi być zakończona odpowiadającym jej elementem „End AddHandler”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndRemoveHandler"> <source>'RemoveHandler' declaration must end with a matching 'End RemoveHandler'.</source> <target state="translated">'Deklaracja „RemoveHandler” musi być zakończona odpowiadającym jej elementem „End RemoveHandler”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingEndRaiseEvent"> <source>'RaiseEvent' declaration must end with a matching 'End RaiseEvent'.</source> <target state="translated">'Deklaracja „RaiseEvent” musi być zakończona odpowiadającym jej elementem „End RaiseEvent”.</target> <note /> </trans-unit> <trans-unit id="ERR_CustomEventInvInInterface"> <source>'Custom' modifier is not valid on events declared in interfaces.</source> <target state="translated">'Modyfikator „Custom” jest nieprawidłowy w zdarzeniach deklarowanych w interfejsach.</target> <note /> </trans-unit> <trans-unit id="ERR_CustomEventRequiresAs"> <source>'Custom' modifier is not valid on events declared without explicit delegate types.</source> <target state="translated">'Modyfikator „Custom” jest nieprawidłowy w zdarzeniach deklarowanych bez jawnych typów delegata.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndEvent"> <source>'End Event' must be preceded by a matching 'Custom Event'.</source> <target state="translated">'Element „End Event” musi być poprzedzony odpowiadającym mu elementem „Custom Event”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndAddHandler"> <source>'End AddHandler' must be preceded by a matching 'AddHandler' declaration.</source> <target state="translated">'Element „End AddHandler” musi być poprzedzony odpowiadającą mu deklaracją „AddHandler”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndRemoveHandler"> <source>'End RemoveHandler' must be preceded by a matching 'RemoveHandler' declaration.</source> <target state="translated">'Element „End RemoveHandler” musi być poprzedzony odpowiadającą mu deklaracją „RemoveHandler”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndRaiseEvent"> <source>'End RaiseEvent' must be preceded by a matching 'RaiseEvent' declaration.</source> <target state="translated">'Element „End RaiseEvent” musi być poprzedzony odpowiadającą mu deklaracją „RaiseEvent”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAddHandlerDef"> <source>'AddHandler' is already declared.</source> <target state="translated">'Element „AddHandler” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRemoveHandlerDef"> <source>'RemoveHandler' is already declared.</source> <target state="translated">'Element „RemoveHandler” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRaiseEventDef"> <source>'RaiseEvent' is already declared.</source> <target state="translated">'Element „RaiseEvent” jest już zadeklarowany.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingAddHandlerDef1"> <source>'AddHandler' definition missing for event '{0}'.</source> <target state="translated">'Brak definicji elementu „AddHandler” dla zdarzenia „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRemoveHandlerDef1"> <source>'RemoveHandler' definition missing for event '{0}'.</source> <target state="translated">'Brak definicji elementu „RemoveHandler” dla zdarzenia „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRaiseEventDef1"> <source>'RaiseEvent' definition missing for event '{0}'.</source> <target state="translated">'Brak definicji elementu „RaiseEvent” dla zdarzenia „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EventAddRemoveHasOnlyOneParam"> <source>'AddHandler' and 'RemoveHandler' methods must have exactly one parameter.</source> <target state="translated">'Metody „AddHandler” i „RemoveHandler” muszą mieć dokładnie jeden parametr.</target> <note /> </trans-unit> <trans-unit id="ERR_EventAddRemoveByrefParamIllegal"> <source>'AddHandler' and 'RemoveHandler' method parameters cannot be declared 'ByRef'.</source> <target state="translated">'Parametrów metody „AddHandler” i „RemoveHandler” nie można deklarować jako „ByRef”.</target> <note /> </trans-unit> <trans-unit id="ERR_SpecifiersInvOnEventMethod"> <source>Specifiers are not valid on 'AddHandler', 'RemoveHandler' and 'RaiseEvent' methods.</source> <target state="translated">Specyfikatory w metodach „AddHandler”, „RemoveHandler” i „RaiseEvent” są nieprawidłowe.</target> <note /> </trans-unit> <trans-unit id="ERR_AddRemoveParamNotEventType"> <source>'AddHandler' and 'RemoveHandler' method parameters must have the same delegate type as the containing event.</source> <target state="translated">'Parametry metody „AddHandler” i „RemoveHandler” muszą mieć ten sam typ delegata co zawierające je zdarzenie.</target> <note /> </trans-unit> <trans-unit id="ERR_RaiseEventShapeMismatch1"> <source>'RaiseEvent' method must have the same signature as the containing event's delegate type '{0}'.</source> <target state="translated">'Metoda „RaiseEvent” musi mieć taką samą sygnaturę jak typ delegowany „{0}” zdarzenia zawierającego.</target> <note /> </trans-unit> <trans-unit id="ERR_EventMethodOptionalParamIllegal1"> <source>'AddHandler', 'RemoveHandler' and 'RaiseEvent' method parameters cannot be declared '{0}'.</source> <target state="translated">'Parametrów metod „AddHandler”, „RemoveHandler” i „RaiseEvent” nie można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantReferToMyGroupInsideGroupType1"> <source>'{0}' cannot refer to itself through its default instance; use 'Me' instead.</source> <target state="translated">'Element „{0}” nie może odwoływać się do siebie samego za pomocą domyślnego wystąpienia; zamiast tego użyj konstrukcji „Me”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidUseOfCustomModifier"> <source>'Custom' modifier can only be used immediately before an 'Event' declaration.</source> <target state="translated">'Modyfikatora „Custom” można używać tylko bezpośrednio przed deklaracją „Event”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOptionStrictCustom"> <source>Option Strict Custom can only be used as an option to the command-line compiler (vbc.exe).</source> <target state="translated">Elementu Option Strict Custom można użyć tylko jako opcji dla kompilatora wiersza polecenia (vbc.exe).</target> <note /> </trans-unit> <trans-unit id="ERR_ObsoleteInvalidOnEventMember"> <source>'{0}' cannot be applied to the 'AddHandler', 'RemoveHandler', or 'RaiseEvent' definitions. If required, apply the attribute directly to the event.</source> <target state="translated">'Elementu „{0}” nie można stosować do definicji „AddHandler”, „RemoveHandler” ani „RaiseEvent”. Jeśli jest to wymagane, zastosuj atrybut bezpośrednio do zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingIncompatible2"> <source>Method '{0}' does not have a signature compatible with delegate '{1}'.</source> <target state="translated">Metoda „{0}” nie ma sygnatury zgodnej z delegatem „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlName"> <source>XML name expected.</source> <target state="translated">Oczekiwano nazwy XML.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedXmlPrefix"> <source>XML namespace prefix '{0}' is not defined.</source> <target state="translated">Nie zdefiniowano prefiksu przestrzeni nazw XML „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateXmlAttribute"> <source>Duplicate XML attribute '{0}'.</source> <target state="translated">Zduplikowany atrybut XML „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MismatchedXmlEndTag"> <source>End tag &lt;/{0}{1}{2}&gt; expected.</source> <target state="translated">Oczekiwano tagu końcowego &lt;/{0}{1}{2}&gt;.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingXmlEndTag"> <source>Element is missing an end tag.</source> <target state="translated">Brak tagu końcowego w elemencie.</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedXmlPrefix"> <source>XML namespace prefix '{0}' is reserved for use by XML and the namespace URI cannot be changed.</source> <target state="translated">Prefiks przestrzeni nazw XML „{0}” jest zastrzeżony do użytku przez kod XML i nie można zmienić identyfikatora URI przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingVersionInXmlDecl"> <source>Required attribute 'version' missing from XML declaration.</source> <target state="translated">Brak wymaganego atrybutu „version” w deklaracji XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalAttributeInXmlDecl"> <source>XML declaration does not allow attribute '{0}{1}{2}'.</source> <target state="translated">Deklaracja XML nie zezwala na użycie atrybutu „{0}{1}{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_QuotedEmbeddedExpression"> <source>Embedded expression cannot appear inside a quoted attribute value. Try removing quotes.</source> <target state="translated">Wyrażenie osadzone nie może występować wewnątrz wartości atrybutu umieszczonej w cudzysłowie. Spróbuj usunąć znaki cudzysłowu.</target> <note /> </trans-unit> <trans-unit id="ERR_VersionMustBeFirstInXmlDecl"> <source>XML attribute 'version' must be the first attribute in XML declaration.</source> <target state="translated">Atrybut XML „version” musi być pierwszym atrybutem w deklaracji XML.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOrder"> <source>XML attribute '{0}' must appear before XML attribute '{1}'.</source> <target state="translated">Atrybut XML „{0}” musi występować przed atrybutem XML „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndEmbedded"> <source>Expected closing '%&gt;' for embedded expression.</source> <target state="translated">Oczekiwano zamykających znaków „%&gt;” dla wyrażenia osadzonego.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndPI"> <source>Expected closing '?&gt;' for XML processor instruction.</source> <target state="translated">Oczekiwano zamykających znaków „?&gt;” dla instrukcji procesora XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndComment"> <source>Expected closing '--&gt;' for XML comment.</source> <target state="translated">Oczekiwano zamykających znaków „--&gt;” dla komentarza XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlEndCData"> <source>Expected closing ']]&gt;' for XML CDATA section.</source> <target state="translated">Oczekiwano zamykających znaków „]]&gt;” dla sekcji CDATA XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSQuote"> <source>Expected matching closing single quote for XML attribute value.</source> <target state="translated">Oczekiwano zgodnego pojedynczego cudzysłowu zamykającego dla wartości atrybutu XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQuote"> <source>Expected matching closing double quote for XML attribute value.</source> <target state="translated">Oczekiwano zgodnego podwójnego cudzysłowu zamykającego dla wartości atrybutu XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedLT"> <source>Expected beginning '&lt;' for an XML tag.</source> <target state="translated">Oczekiwano rozpoczynającego znaku „&lt;” dla tagu XML.</target> <note /> </trans-unit> <trans-unit id="ERR_StartAttributeValue"> <source>Expected quoted XML attribute value or embedded expression.</source> <target state="translated">Oczekiwano umieszczonej w cudzysłowie wartości atrybutu XML lub wyrażenia osadzonego.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDiv"> <source>Expected '/' for XML end tag.</source> <target state="translated">Oczekiwano znaku „/” dla tagu końcowego XML.</target> <note /> </trans-unit> <trans-unit id="ERR_NoXmlAxesLateBinding"> <source>XML axis properties do not support late binding.</source> <target state="translated">Właściwości osi XML nie obsługują późnego wiązania.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlStartNameChar"> <source>Character '{0}' ({1}) is not allowed at the beginning of an XML name.</source> <target state="translated">Znak „{0}” ({1}) jest niedozwolony na początku nazwy XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlNameChar"> <source>Character '{0}' ({1}) is not allowed in an XML name.</source> <target state="translated">Znak „{0}” ({1}) jest niedozwolony w nazwie XML.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlCommentChar"> <source>Character sequence '--' is not allowed in an XML comment.</source> <target state="translated">Sekwencja znaków „--” jest niedozwolona w komentarzu XML.</target> <note /> </trans-unit> <trans-unit id="ERR_EmbeddedExpression"> <source>An embedded expression cannot be used here.</source> <target state="translated">Tutaj nie można użyć wyrażenia osadzonego.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlWhiteSpace"> <source>Missing required white space.</source> <target state="translated">Brak wymaganych białych znaków.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalProcessingInstructionName"> <source>XML processing instruction name '{0}' is not valid.</source> <target state="translated">Nazwa „{0}” instrukcji przetwarzającej kod XML jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="ERR_DTDNotSupported"> <source>XML DTDs are not supported.</source> <target state="translated">Definicje DTD XML nie są obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlWhiteSpace"> <source>White space cannot appear here.</source> <target state="translated">Tutaj nie mogą występować białe znaki.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSColon"> <source>Expected closing ';' for XML entity.</source> <target state="translated">Oczekiwano zamykającego znaku „;” dla jednostki XML.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlBeginEmbedded"> <source>Expected '%=' at start of an embedded expression.</source> <target state="translated">Oczekiwano znaków „%=” na początku wyrażenia osadzonego.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEntityReference"> <source>XML entity references are not supported.</source> <target state="translated">Odwołania do jednostek XML nie są obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeValue1"> <source>Attribute value is not valid; expecting '{0}'.</source> <target state="translated">Wartość atrybutu jest nieprawidłowa, oczekiwano „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAttributeValue2"> <source>Attribute value is not valid; expecting '{0}' or '{1}'.</source> <target state="translated">Wartość atrybutu jest nieprawidłowa, oczekiwano „{0}” lub „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedXmlNamespace"> <source>Prefix '{0}' cannot be bound to namespace name reserved for '{1}'.</source> <target state="translated">Nie można powiązać prefiksu „{0}” z nazwą przestrzeni nazw zastrzeżoną dla elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalDefaultNamespace"> <source>Namespace declaration with prefix cannot have an empty value inside an XML literal.</source> <target state="translated">Deklaracja przestrzeni nazw z prefiksem nie może mieć wartości pustej wewnątrz literału XML.</target> <note /> </trans-unit> <trans-unit id="ERR_QualifiedNameNotAllowed"> <source>':' is not allowed. XML qualified names cannot be used in this context.</source> <target state="translated">'Znak „:” jest niedozwolony. Nie można używać kwalifikowanych nazw XML w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedXmlns"> <source>Namespace declaration must start with 'xmlns'.</source> <target state="translated">Deklaracja przestrzeni nazw musi zaczynać się elementem „xmlns”.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalXmlnsPrefix"> <source>Element names cannot use the 'xmlns' prefix.</source> <target state="translated">W nazwach elementów nie można używać prefiksu „xmlns”.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlFeaturesNotAvailable"> <source>XML literals and XML axis properties are not available. Add references to System.Xml, System.Xml.Linq, and System.Core or other assemblies declaring System.Linq.Enumerable, System.Xml.Linq.XElement, System.Xml.Linq.XName, System.Xml.Linq.XAttribute and System.Xml.Linq.XNamespace types.</source> <target state="translated">Literały XML i właściwości osi XML są niedostępne. Dodaj odwołania do zestawów System.Xml, System.Xml.Linq i System.Core lub innych zestawów deklarujących typy System.Linq.Enumerable, System.Xml.Linq.XElement, System.Xml.Linq.XName, System.Xml.Linq.XAttribute i System.Xml.Linq.XNamespace.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToReadUacManifest2"> <source>Unable to open Win32 manifest file '{0}' : {1}</source> <target state="translated">Nie można otworzyć pliku manifestu Win32 „{0}”: {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_UseValueForXmlExpression3"> <source>Cannot convert '{0}' to '{1}'. You can use the 'Value' property to get the string value of the first element of '{2}'.</source> <target state="translated">Nie można przekonwertować elementu „{0}” na „{1}”. Przy użyciu właściwości „Value” można uzyskać wartość ciągu pierwszego elementu obiektu „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UseValueForXmlExpression3_Title"> <source>Cannot convert IEnumerable(Of XElement) to String</source> <target state="translated">Nie można przekonwertować interfejsu IEnumerable(Of XElement) na ciąg</target> <note /> </trans-unit> <trans-unit id="ERR_TypeMismatchForXml3"> <source>Value of type '{0}' cannot be converted to '{1}'. You can use the 'Value' property to get the string value of the first element of '{2}'.</source> <target state="translated">Nie można przekonwertować wartości typu „{0}” na „{1}”. Przy użyciu właściwości „Value” można uzyskać wartość ciągu pierwszego elementu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryOperandsForXml4"> <source>Operator '{0}' is not defined for types '{1}' and '{2}'. You can use the 'Value' property to get the string value of the first element of '{3}'.</source> <target state="translated">Operator „{0}” nie jest zdefiniowany dla typów „{1}” i „{2}”. Przy użyciu właściwości „Value” można uzyskać wartość ciągu pierwszego elementu obiektu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_FullWidthAsXmlDelimiter"> <source>Full width characters are not valid as XML delimiters.</source> <target state="translated">Znaki o pełnej szerokości nie mogą być ogranicznikami XML.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSubsystemVersion"> <source>The value '{0}' is not a valid subsystem version. The version must be 6.02 or greater for ARM or AppContainerExe, and 4.00 or greater otherwise.</source> <target state="translated">Wartość „{0}” nie jest prawidłową wersją podsystemu. Wersja musi mieć wartość 6.02 lub wyższą dla elementu ARM lub AppContainerExe oraz 4.00 lub wyższą w innych przypadkach.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFileAlignment"> <source>Invalid file section alignment '{0}'</source> <target state="translated">Nieprawidłowe wyrównanie sekcji pliku „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidOutputName"> <source>Invalid output name: {0}</source> <target state="translated">Nieprawidłowa nazwa wyjścia: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInformationFormat"> <source>Invalid debug information format: {0}</source> <target state="translated">Nieprawidłowy format informacji debugowania: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_LibAnycpu32bitPreferredConflict"> <source>/platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe.</source> <target state="translated">Polecenia /platform:anycpu32bitpreferred można używać tylko z przełącznikami /t:exe, /t:winexe i /t:appcontainerexe.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedAccess"> <source>Expression has the type '{0}' which is a restricted type and cannot be used to access members inherited from 'Object' or 'ValueType'.</source> <target state="translated">Wyrażenie zawiera typ „{0}”, który jest typem ograniczonym i nie można go używać do uzyskiwania dostępu do składowych dziedziczonych po elemencie „Object” lub „ValueType”.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedConversion1"> <source>Expression of type '{0}' cannot be converted to 'Object' or 'ValueType'.</source> <target state="translated">Wyrażenia typu „{0}” nie można przekonwertować na element „Object” ani „ValueType”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypecharInLabel"> <source>Type characters are not allowed in label identifiers.</source> <target state="translated">Znaki typu są niedozwolone w identyfikatorach etykiet.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedType1"> <source>'{0}' cannot be made nullable, and cannot be used as the data type of an array element, field, anonymous type member, type argument, 'ByRef' parameter, or return statement.</source> <target state="translated">'Typ „{0}” nie może być typem dopuszczającym wartość null i nie można go używać jako typu danych elementu tablicy, pola, składowej typu anonimowego, argumentu typu, parametru „ByRef” ani instrukcji return.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypecharInAlias"> <source>Type characters are not allowed on Imports aliases.</source> <target state="translated">Znaki typu są niedozwolone w aliasach Imports.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAccessibleConstructorOnBase"> <source>Class '{0}' has no accessible 'Sub New' and cannot be inherited.</source> <target state="translated">Klasa „{0}” nie ma dostępnego elementu „Sub New” i nie może być dziedziczona.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticLocalInStruct"> <source>Local variables within methods of structures cannot be declared 'Static'.</source> <target state="translated">W metodach struktur nie można deklarować zmiennych lokalnych jako „Static”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocalStatic1"> <source>Static local variable '{0}' is already declared.</source> <target state="translated">Statyczna zmienna lokalna „{0}” jest już zadeklarowana.</target> <note /> </trans-unit> <trans-unit id="ERR_ImportAliasConflictsWithType2"> <source>Imports alias '{0}' conflicts with '{1}' declared in the root namespace.</source> <target state="translated">Alias instrukcji Imports „{0}” powoduje konflikt z elementem „{1}” zadeklarowanym w głównej przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_CantShadowAMustOverride1"> <source>'{0}' cannot shadow a method declared 'MustOverride'.</source> <target state="translated">'Element „{0}” nie może zasłaniać metody zadeklarowanej jako „MustOverride”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleEventImplMismatch3"> <source>Event '{0}' cannot implement event '{2}.{1}' because its delegate type does not match the delegate type of another event implemented by '{0}'.</source> <target state="translated">Zdarzenie „{0}” nie może implementować zdarzenia „{2}.{1}”, ponieważ jego typ delegowany nie pasuje do typu delegowanego innego zdarzenia implementowanego przez zdarzenie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSpecifierCombo2"> <source>'{0}' and '{1}' cannot be combined.</source> <target state="translated">'Nie można połączyć elementów „{0}” i „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MustBeOverloads2"> <source>{0} '{1}' must be declared 'Overloads' because another '{1}' is declared 'Overloads' or 'Overrides'.</source> <target state="translated">Element {0} „{1}” musi być zadeklarowany jako „Overloads”, ponieważ inny element „{1}” jest zadeklarowany jako „Overloads” lub „Overrides”.</target> <note /> </trans-unit> <trans-unit id="ERR_MustOverridesInClass1"> <source>'{0}' must be declared 'MustInherit' because it contains methods declared 'MustOverride'.</source> <target state="translated">'Element „{0}” musi być zadeklarowany jako „MustInherit”, ponieważ zawiera metody zadeklarowane jako „MustOverride”.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesSyntaxInClass"> <source>'Handles' in classes must specify a 'WithEvents' variable, 'MyBase', 'MyClass' or 'Me' qualified with a single identifier.</source> <target state="translated">'Element „Handles” w klasach musi określać zmienną „WithEvents”, „MyBase”, „MyClass” lub „Me” kwalifikowaną za pomocą pojedynczego identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_SynthMemberShadowsMustOverride5"> <source>'{0}', implicitly declared for {1} '{2}', cannot shadow a 'MustOverride' method in the base {3} '{4}'.</source> <target state="translated">'Element „{0}” niejawnie zadeklarowany dla elementu {1} „{2}” nie może zasłonić metody „MustOverride” w podstawowym elemencie {3} „{4}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotOverrideInAccessibleMember"> <source>'{0}' cannot override '{1}' because it is not accessible in this context.</source> <target state="translated">'Element „{0}” nie może przesłaniać elementu „{1}”, ponieważ nie jest on dostępny w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesSyntaxInModule"> <source>'Handles' in modules must specify a 'WithEvents' variable qualified with a single identifier.</source> <target state="translated">'Elementy „Handles” w module muszą określać zmienną „WithEvents” kwalifikowaną za pomocą pojedynczego identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOpRequiresReferenceTypes1"> <source>'IsNot' requires operands that have reference types, but this operand has the value type '{0}'.</source> <target state="translated">'Element „IsNot” wymaga argumentów operacji, które mają typ referencyjny, ale ten argument operacji ma typ wartości „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ClashWithReservedEnumMember1"> <source>'{0}' conflicts with the reserved member by this name that is implicitly declared in all enums.</source> <target state="translated">Element „{0}” powoduje konflikt z zastrzeżoną składową o tej nazwie, która została niejawnie zadeklarowana we wszystkich wyliczeniach.</target> <note /> </trans-unit> <trans-unit id="ERR_MultiplyDefinedEnumMember2"> <source>'{0}' is already declared in this {1}.</source> <target state="translated">'Element „{0}” jest już zadeklarowany w tym elemencie {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadUseOfVoid"> <source>'System.Void' can only be used in a GetType expression.</source> <target state="translated">'Elementu „System.Void” można użyć tylko w wyrażeniu GetType.</target> <note /> </trans-unit> <trans-unit id="ERR_EventImplMismatch5"> <source>Event '{0}' cannot implement event '{1}' on interface '{2}' because their delegate types '{3}' and '{4}' do not match.</source> <target state="translated">Zdarzenie „{0}” nie może implementować zdarzenia „{1}” w interfejsie „{2}”, ponieważ ich typy delegowane „{3}” i „{4}” są niezgodne.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeUnavailable3"> <source>Type '{0}' in assembly '{1}' has been forwarded to assembly '{2}'. Either a reference to '{2}' is missing from your project or the type '{0}' is missing from assembly '{2}'.</source> <target state="translated">Typ „{0}” w zestawie „{1}” został przekazany do zestawu „{2}”. Brak odwołania do zestawu „{2}” w projekcie lub typu „{0}” w zestawie „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeFwdCycle2"> <source>'{0}' in assembly '{1}' has been forwarded to itself and so is an unsupported type.</source> <target state="translated">'Element „{0}” w zestawie „{1}” został przesłany dalej do samego siebie, i dlatego jest nieobsługiwanym typem.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeInCCExpression"> <source>Non-intrinsic type names are not allowed in conditional compilation expressions.</source> <target state="translated">Nazwy typu niewewnętrznego nie są dozwolone w wyrażeniach kompilacji warunkowej.</target> <note /> </trans-unit> <trans-unit id="ERR_BadCCExpression"> <source>Syntax error in conditional compilation expression.</source> <target state="translated">Błąd składni w wyrażeniu kompilacji warunkowej.</target> <note /> </trans-unit> <trans-unit id="ERR_VoidArrayDisallowed"> <source>Arrays of type 'System.Void' are not allowed in this expression.</source> <target state="translated">Tablice typu „System.Void” są niedozwolone w tym wyrażeniu.</target> <note /> </trans-unit> <trans-unit id="ERR_MetadataMembersAmbiguous3"> <source>'{0}' is ambiguous because multiple kinds of members with this name exist in {1} '{2}'.</source> <target state="translated">'Element „{0}” jest niejednoznaczny, ponieważ wiele rodzajów składowych o tej nazwie istnieje w elemencie {1} „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOfExprAlwaysFalse2"> <source>Expression of type '{0}' can never be of type '{1}'.</source> <target state="translated">Wyrażenie typu „{0}” nigdy nie może być typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyPrivatePartialMethods1"> <source>Partial methods must be declared 'Private' instead of '{0}'.</source> <target state="translated">Metody częściowe muszą być zadeklarowane jako „Private” zamiast „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustBePrivate"> <source>Partial methods must be declared 'Private'.</source> <target state="translated">Metody częściowe muszą być zadeklarowane jako „Private”.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOnePartialMethodAllowed2"> <source>Method '{0}' cannot be declared 'Partial' because only one method '{1}' can be marked 'Partial'.</source> <target state="translated">Metody „{0}” nie można zadeklarować jako „Partial”, ponieważ tylko jedną metodę „{1}” można oznaczyć jako „Partial”.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyOneImplementingMethodAllowed3"> <source>Method '{0}' cannot implement partial method '{1}' because '{2}' already implements it. Only one method can implement a partial method.</source> <target state="translated">Metoda „{0}” nie może implementować metody częściowej „{1}”, ponieważ już implementuje ją metoda „{2}”. Tylko jedna metoda może implementować metodę częściową.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodMustBeEmpty"> <source>Partial methods must have empty method bodies.</source> <target state="translated">Metody częściowe muszą mieć pustą treść metody.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustBeSub1"> <source>'{0}' cannot be declared 'Partial' because partial methods must be Subs.</source> <target state="translated">'Nie można zadeklarować metody „{0}” jako „Partial”, ponieważ metody częściowe muszą być typu Sub.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodGenericConstraints2"> <source>Method '{0}' does not have the same generic constraints as the partial method '{1}'.</source> <target state="translated">Metoda „{0}” nie ma takich samych ograniczeń ogólnych jak metoda częściowa „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialDeclarationImplements1"> <source>Partial method '{0}' cannot use the 'Implements' keyword.</source> <target state="translated">W metodzie częściowej „{0}” nie można używać słowa kluczowego „Implements”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPartialMethodInAddressOf1"> <source>'AddressOf' cannot be applied to '{0}' because '{0}' is a partial method without an implementation.</source> <target state="translated">'Nie można zastosować wyrażenia „AddressOf” do metody „{0}”, ponieważ „{0}” jest metodą częściową bez implementacji.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementationMustBePrivate2"> <source>Method '{0}' must be declared 'Private' in order to implement partial method '{1}'.</source> <target state="translated">Metoda „{0}” musi być zadeklarowana jako „Private”, aby mogła implementować metodę częściową „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamNamesMustMatch3"> <source>Parameter name '{0}' does not match the name of the corresponding parameter, '{1}', defined on the partial method declaration '{2}'.</source> <target state="translated">Nazwa parametru „{0}” nie jest zgodna z nazwą odpowiadającego mu parametru „{1}” zdefiniowanego w deklaracji metody częściowej „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodTypeParamNameMismatch3"> <source>Name of type parameter '{0}' does not match '{1}', the corresponding type parameter defined on the partial method declaration '{2}'.</source> <target state="translated">Nazwa parametru typu „{0}” nie jest zgodna z odpowiadającym mu parametrem typu „{1}” zdefiniowanego w deklaracji metody częściowej „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeSharedProperty1"> <source>'Shared' attribute property '{0}' cannot be the target of an assignment.</source> <target state="translated">'Właściwość „{0}” atrybutu „Shared” nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeReadOnlyProperty1"> <source>'ReadOnly' attribute property '{0}' cannot be the target of an assignment.</source> <target state="translated">'Właściwość „{0}” atrybutu „ReadOnly” nie może być elementem docelowym przypisania.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateResourceName1"> <source>Resource name '{0}' cannot be used more than once.</source> <target state="translated">Nie można użyć nazwy zasobu „{0}” więcej niż raz.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateResourceFileName1"> <source>Each linked resource and module must have a unique filename. Filename '{0}' is specified more than once in this assembly.</source> <target state="translated">Każdy połączony zasób oraz moduł muszą mieć unikatową nazwę pliku. Nazwa pliku „{0}” jest określona więcej niż jeden raz w tym zestawie.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeMustBeClassNotStruct1"> <source>'{0}' cannot be used as an attribute because it is not a class.</source> <target state="translated">'Nie można użyć elementu „{0}” jako atrybutu, ponieważ nie jest on klasą.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeMustInheritSysAttr"> <source>'{0}' cannot be used as an attribute because it does not inherit from 'System.Attribute'.</source> <target state="translated">'Nie można użyć elementu „{0}” jako atrybutu, ponieważ nie dziedziczy on po klasie „System.Attribute”.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeCannotBeAbstract"> <source>'{0}' cannot be used as an attribute because it is declared 'MustInherit'.</source> <target state="translated">'Nie można użyć elementu „{0}” jako atrybutu, ponieważ jest on zadeklarowany jako „MustInherit”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnableToOpenResourceFile1"> <source>Unable to open resource file '{0}': {1}</source> <target state="translated">Nie można otworzyć pliku zasobów „{0}”: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicProperty1"> <source>Attribute member '{0}' cannot be the target of an assignment because it is not declared 'Public'.</source> <target state="translated">Składowa atrybutu „{0}” nie może być elementem docelowym przypisania, ponieważ nie jest zadeklarowana jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_STAThreadAndMTAThread0"> <source>'System.STAThreadAttribute' and 'System.MTAThreadAttribute' cannot both be applied to the same method.</source> <target state="translated">'Nie można zastosować elementów System.STAThreadAttribute i System.MTAThreadAttribute do tej samej metody.</target> <note /> </trans-unit> <trans-unit id="ERR_IndirectUnreferencedAssembly4"> <source>Project '{0}' makes an indirect reference to assembly '{1}', which contains '{2}'. Add a file reference to '{3}' to your project.</source> <target state="translated">Projekt „{0}” wykonuje pośrednie odwołanie do zestawu „{1}”, który zawiera element „{2}”. Dodaj do projektu odwołanie pliku do elementu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicType1"> <source>Type '{0}' cannot be used in an attribute because it is not declared 'Public'.</source> <target state="translated">Nie można użyć typu „{0}” w atrybucie, ponieważ nie jest on zadeklarowany jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeNonPublicContType2"> <source>Type '{0}' cannot be used in an attribute because its container '{1}' is not declared 'Public'.</source> <target state="translated">Nie można użyć typu „{0}” w atrybucie, ponieważ jego kontener „{1}” nie jest zadeklarowany jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnNonEmptySubOrFunction"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Sub, Function, or Operator with a non-empty body.</source> <target state="translated">'Elementu „System.Runtime.InteropServices.DllImportAttribute” nie można zastosować do elementu Sub, Function lub Operator z niepustą treścią.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnDeclare"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Declare.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DllImportAttribute” do elementu Declare.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnGetOrSet"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a Get or Set.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DllImportAttribute” do elementu Get ani Set.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnGenericSubOrFunction"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a method that is generic or contained in a generic type.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DllImportAttribute” do metody ogólnej lub zawartej w typie ogólnym.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassOnGeneric"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to a class that is generic or contained inside a generic type.</source> <target state="translated">'Nie można zastosować elementu „Microsoft.VisualBasic.ComClassAttribute” do klasy ogólnej lub zawartej w typie ogólnym.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInstanceMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to instance method.</source> <target state="translated">'Elementu System.Runtime.InteropServices.DllImportAttribute nie można zastosować do metody wystąpienia.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnInterfaceMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to interface methods.</source> <target state="translated">'Elementu „System.Runtime.InteropServices.DllImportAttribute” nie można zastosować do metod interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportNotLegalOnEventMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to 'AddHandler', 'RemoveHandler' or 'RaiseEvent' method.</source> <target state="translated">'Elementu System.Runtime.InteropServices.DllImportAttribute nie można zastosować do metody AddHandler, RemoveHandler ani RaiseEvent.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadArguments"> <source>Friend assembly reference '{0}' is invalid. InternalsVisibleTo declarations cannot have a version, culture, public key token, or processor architecture specified.</source> <target state="translated">Odwołanie do przyjaznego zestawu „{0}” jest nieprawidłowe. Deklaracje InternalsVisibleTo nie mogą mieć określonej wersji, kultury, tokena klucza publicznego ani architektury procesora.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyStrongNameRequired"> <source>Friend assembly reference '{0}' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.</source> <target state="translated">Odwołanie do przyjaznego zestawu „{0}” jest nieprawidłowe. Zestawy podpisane silnymi nazwami muszą określać klucz publiczny w swoich deklaracjach InternalsVisibleTo.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyNameInvalid"> <source>Friend declaration '{0}' is invalid and cannot be resolved.</source> <target state="translated">Deklaracja elementu zaprzyjaźnionego „{0}” jest nieprawidłowa i nie można jej rozpoznać.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendAssemblyBadAccessOverride2"> <source>Member '{0}' cannot override member '{1}' defined in another assembly/project because the access modifier 'Protected Friend' expands accessibility. Use 'Protected' instead.</source> <target state="translated">Składowa „{0}” nie może przesłaniać składowej „{1}” zdefiniowanej w innym zestawie/projekcie, ponieważ modyfikator dostępu „Protected Friend” rozszerza dostępność. Zamiast niego użyj modyfikatora „Protected”.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfLocalBeforeDeclaration1"> <source>Local variable '{0}' cannot be referred to before it is declared.</source> <target state="translated">Nie można odwołać się do zmiennej lokalnej „{0}” przed jej zadeklarowaniem.</target> <note /> </trans-unit> <trans-unit id="ERR_UseOfKeywordFromModule1"> <source>'{0}' is not valid within a Module.</source> <target state="translated">'Element „{0}” nie jest prawidłowy w ramach modułu.</target> <note /> </trans-unit> <trans-unit id="ERR_BogusWithinLineIf"> <source>Statement cannot end a block outside of a line 'If' statement.</source> <target state="translated">Instrukcja nie może kończyć bloku poza instrukcją If wiersza.</target> <note /> </trans-unit> <trans-unit id="ERR_CharToIntegralTypeMismatch1"> <source>'Char' values cannot be converted to '{0}'. Use 'Microsoft.VisualBasic.AscW' to interpret a character as a Unicode value or 'Microsoft.VisualBasic.Val' to interpret it as a digit.</source> <target state="translated">'Nie można konwertować wartości „Char” na elementy „{0}”. Użyj elementu „Microsoft.VisualBasic.AscW”, aby zinterpretować znak jako wartość Unicode, lub elementu „Microsoft.VisualBasic.Val”, aby zinterpretować go jako cyfrę.</target> <note /> </trans-unit> <trans-unit id="ERR_IntegralToCharTypeMismatch1"> <source>'{0}' values cannot be converted to 'Char'. Use 'Microsoft.VisualBasic.ChrW' to interpret a numeric value as a Unicode character or first convert it to 'String' to produce a digit.</source> <target state="translated">'Nie można konwertować wartości „{0}” na elementy „Char”. Użyj elementu „Microsoft.VisualBasic.ChrW”, aby zinterpretować wartość numeryczną jako znak Unicode, lub najpierw przekonwertuj ją na typ „String”, aby otrzymać cyfrę.</target> <note /> </trans-unit> <trans-unit id="ERR_NoDirectDelegateConstruction1"> <source>Delegate '{0}' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor.</source> <target state="translated">Delegat „{0}” wymaga wyrażenia „AddressOf” lub wyrażenia lambda jako jedynego argumentu dla jego konstruktora.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodMustBeFirstStatementOnLine"> <source>Method declaration statements must be the first statement on a logical line.</source> <target state="translated">Instrukcja deklaracji metody musi być pierwszą instrukcją w wierszu logicznym.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrAssignmentNotFieldOrProp1"> <source>'{0}' cannot be named as a parameter in an attribute specifier because it is not a field or property.</source> <target state="translated">'Nie można użyć elementu „{0}” jako parametru w specyfikatorze atrybutu, ponieważ nie jest to pole ani właściwość.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowsObjectComparison1"> <source>Option Strict On disallows operands of type Object for operator '{0}'. Use the 'Is' operator to test for object identity.</source> <target state="translated">Ustawienie „Option Strict On” uniemożliwia stosowanie argumentów operacji typu Object dla operatora „{0}”. Użyj operatora „Is” w celu zbadania tożsamości obiektu.</target> <note /> </trans-unit> <trans-unit id="ERR_NoConstituentArraySizes"> <source>Bounds can be specified only for the top-level array when initializing an array of arrays.</source> <target state="translated">Granice można określić tylko dla tablicy najwyższego poziomu podczas inicjowania tablicy tablic.</target> <note /> </trans-unit> <trans-unit id="ERR_FileAttributeNotAssemblyOrModule"> <source>'Assembly' or 'Module' expected.</source> <target state="translated">'Oczekiwano instrukcji Assembly lub Module.</target> <note /> </trans-unit> <trans-unit id="ERR_FunctionResultCannotBeIndexed1"> <source>'{0}' has no parameters and its return type cannot be indexed.</source> <target state="translated">'Element „{0}” nie ma parametrów, a jego typ zwracany nie może być indeksowany.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentSyntax"> <source>Comma, ')', or a valid expression continuation expected.</source> <target state="translated">Oczekiwano przecinka, znaku ) lub prawidłowej kontynuacji wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedResumeOrGoto"> <source>'Resume' or 'GoTo' expected.</source> <target state="translated">'Oczekiwano instrukcji Resume lub GoTo.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAssignmentOperator"> <source>'=' expected.</source> <target state="translated">'Oczekiwano znaku „=”.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted2"> <source>Parameter '{0}' in '{1}' already has a matching omitted argument.</source> <target state="translated">Parametr „{0}” w elemencie „{1}” ma już pasujący pominięty argument.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotCallEvent1"> <source>'{0}' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.</source> <target state="translated">Element „{0}” jest zdarzeniem i nie można go wywołać bezpośrednio. Użyj instrukcji „RaiseEvent”, aby wywołać zdarzenie.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachCollectionDesignPattern1"> <source>Expression is of type '{0}', which is not a collection type.</source> <target state="translated">Wyrażenie jest typu „{0}”, który nie jest typem kolekcji.</target> <note /> </trans-unit> <trans-unit id="ERR_DefaultValueForNonOptionalParam"> <source>Default values cannot be supplied for parameters that are not declared 'Optional'.</source> <target state="translated">Nie można podać wartości domyślnych dla parametrów, które nie są zadeklarowane jako Optional.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterMyBase"> <source>'MyBase' must be followed by '.' and an identifier.</source> <target state="translated">'Po elemencie „MyBase” musi wystąpić znak „.” i identyfikator.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterMyClass"> <source>'MyClass' must be followed by '.' and an identifier.</source> <target state="translated">'Po elemencie „MyClass” musi wystąpić znak „.” i identyfikator.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictArgumentCopyBackNarrowing3"> <source>Option Strict On disallows narrowing from type '{1}' to type '{2}' in copying the value of 'ByRef' parameter '{0}' back to the matching argument.</source> <target state="translated">Ustawienie „Option Strict On” uniemożliwia zawężanie z typu „{1}” do typu „{2}” podczas kopiowania wartości parametru „ByRef” „{0}” z powrotem do pasującego argumentu.</target> <note /> </trans-unit> <trans-unit id="ERR_LbElseifAfterElse"> <source>'#ElseIf' cannot follow '#Else' as part of a '#If' block.</source> <target state="translated">'Instrukcja „#ElseIf” nie może wystąpić po instrukcji „#Else” jako część bloku „#If”.</target> <note /> </trans-unit> <trans-unit id="ERR_StandaloneAttribute"> <source>Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.</source> <target state="translated">Specyfikator atrybutu nie jest kompletną instrukcją. Użyj kontynuacji wiersza, aby zastosować atrybut do następnej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_NoUniqueConstructorOnBase2"> <source>Class '{0}' must declare a 'Sub New' because its base class '{1}' has more than one accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">Klasa „{0}” musi mieć deklarację elementu „Sub New”, ponieważ jej klasa bazowa „{1}” ma więcej niż jeden dostępny element „Sub New”, który można wywołać bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtraNextVariable"> <source>'Next' statement names more variables than there are matching 'For' statements.</source> <target state="translated">'Instrukcja „Next” zawiera więcej zmiennych, niż istnieje odpowiadających jej instrukcji „For”.</target> <note /> </trans-unit> <trans-unit id="ERR_RequiredNewCallTooMany2"> <source>First statement of this 'Sub New' must be a call to 'MyBase.New' or 'MyClass.New' because base class '{0}' of '{1}' has more than one accessible 'Sub New' that can be called with no arguments.</source> <target state="translated">Pierwszą instrukcją w tym bloku „Sub New” musi być wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ klasa bazowa „{0}” klasy „{1}” ma więcej niż jeden dostępny element „Sub New”, który można wywołać bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_ForCtlVarArraySizesSpecified"> <source>Array declared as for loop control variable cannot be declared with an initial size.</source> <target state="translated">Tablica zadeklarowana jako zmienna sterująca pętli for nie może być zadeklarowana z rozmiarem początkowym.</target> <note /> </trans-unit> <trans-unit id="ERR_BadFlagsOnNewOverloads"> <source>The '{0}' keyword is used to overload inherited members; do not use the '{0}' keyword when overloading 'Sub New'.</source> <target state="translated">Słowo kluczowe „{0}” służy do przeciążania dziedziczonych składowych; nie należy używać słowa kluczowego „{0}” do przeciążania elementu „Sub New”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnGenericParam"> <source>Type character cannot be used in a type parameter declaration.</source> <target state="translated">Znaku typu nie można użyć w deklaracji parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewGenericArguments1"> <source>Too few type arguments to '{0}'.</source> <target state="translated">Za mało argumentów typu dla elementu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyGenericArguments1"> <source>Too many type arguments to '{0}'.</source> <target state="translated">Za dużo argumentów typu elementu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericConstraintNotSatisfied2"> <source>Type argument '{0}' does not inherit from or implement the constraint type '{1}'.</source> <target state="translated">Argument typu „{0}” nie dziedziczy po typie ograniczenia „{1}” ani nie implementuje go.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOrMemberNotGeneric1"> <source>'{0}' has no type parameters and so cannot have type arguments.</source> <target state="translated">'Element „{0}” nie ma parametrów typu i dlatego nie może mieć argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_NewIfNullOnGenericParam"> <source>'New' cannot be used on a type parameter that does not have a 'New' constraint.</source> <target state="translated">'Elementu New nie można używać w parametrze typu, który nie ma ograniczenia New.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleClassConstraints1"> <source>Type parameter '{0}' can only have one constraint that is a class.</source> <target state="translated">Parametr typu „{0}” może mieć tylko jedno ograniczenie, które jest klasą.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstNotClassInterfaceOrTypeParam1"> <source>Type constraint '{0}' must be either a class, interface or type parameter.</source> <target state="translated">Ograniczenie typu „{0}” musi być klasą, interfejsem lub parametrem typu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateTypeParamName1"> <source>Type parameter already declared with name '{0}'.</source> <target state="translated">Zadeklarowano już parametr typu o nazwie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam2"> <source>Type parameter '{0}' for '{1}' cannot be inferred.</source> <target state="translated">Nie można wywnioskować parametru typu „{0}” dla elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorGenericParam1"> <source>'Is' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a type parameter with no class constraint.</source> <target state="translated">'Argument operacji „Is” typu „{0}” można porównać tylko z elementem „Nothing”, ponieważ element „{0}” jest parametrem typu bez ograniczenia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentCopyBackNarrowing3"> <source>Copying the value of 'ByRef' parameter '{0}' back to the matching argument narrows from type '{1}' to type '{2}'.</source> <target state="translated">Kopiowanie wartości parametru „ByRef” „{0}” z powrotem do pasującego argumentu powoduje zawężenie z typu „{1}” do typu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ShadowingGenericParamWithMember1"> <source>'{0}' has the same name as a type parameter.</source> <target state="translated">'Element „{0}” ma taką samą nazwę jak parametr typu.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericParamBase2"> <source>{0} '{1}' cannot inherit from a type parameter.</source> <target state="translated">Element {0} „{1}” nie może dziedziczyć po parametrze typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsGenericParam"> <source>Type parameter not allowed in 'Implements' clause.</source> <target state="translated">Parametr typu niedozwolony w klauzuli Implements.</target> <note /> </trans-unit> <trans-unit id="ERR_OnlyNullLowerBound"> <source>Array lower bounds can be only '0'.</source> <target state="translated">Dolne granice tablicy mogą mieć tylko wartość „0”.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassConstraintNotInheritable1"> <source>Type constraint cannot be a 'NotInheritable' class.</source> <target state="translated">Ograniczenie typu nie może być klasą NotInheritable.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintIsRestrictedType1"> <source>'{0}' cannot be used as a type constraint.</source> <target state="translated">'Elementu „{0}” nie można użyć jako ograniczenia typu.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericParamsOnInvalidMember"> <source>Type parameters cannot be specified on this declaration.</source> <target state="translated">W tej deklaracji nie można określić parametrów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericArgsOnAttributeSpecifier"> <source>Type arguments are not valid because attributes cannot be generic.</source> <target state="translated">Argumenty typu są nieprawidłowe, ponieważ atrybuty nie mogą być ogólne.</target> <note /> </trans-unit> <trans-unit id="ERR_AttrCannotBeGenerics"> <source>Type parameters, generic types or types contained in generic types cannot be used as attributes.</source> <target state="translated">Parametrów typu, typów ogólnych lub typów zawartych w typach ogólnych nie można używać jako atrybutów.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticLocalInGenericMethod"> <source>Local variables within generic methods cannot be declared 'Static'.</source> <target state="translated">Zmienne lokalne z metodami ogólnymi nie mogą być deklarowane jako Static.</target> <note /> </trans-unit> <trans-unit id="ERR_SyntMemberShadowsGenericParam3"> <source>{0} '{1}' implicitly defines a member '{2}' which has the same name as a type parameter.</source> <target state="translated">Element {0} „{1}” niejawnie definiuje składową „{2}”, która ma taką samą nazwę jak parametr typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintAlreadyExists1"> <source>Constraint type '{0}' already specified for this type parameter.</source> <target state="translated">Typ ograniczenia „{0}” jest już określony dla tego parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfacePossiblyImplTwice2"> <source>Cannot implement interface '{0}' because its implementation could conflict with the implementation of another implemented interface '{1}' for some type arguments.</source> <target state="translated">Nie można zaimplementować interfejsu „{0}”, ponieważ jego implementacja może powodować konflikt z implementacją innego zaimplementowanego interfejsu „{1}” w przypadku niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ModulesCannotBeGeneric"> <source>Modules cannot be generic.</source> <target state="translated">Moduły nie mogą być ogólne.</target> <note /> </trans-unit> <trans-unit id="ERR_GenericClassCannotInheritAttr"> <source>Classes that are generic or contained in a generic type cannot inherit from an attribute class.</source> <target state="translated">Klasy, które są ogólne lub są zawarte w typie ogólnym, nie mogą dziedziczyć po klasie atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_DeclaresCantBeInGeneric"> <source>'Declare' statements are not allowed in generic types or types contained in generic types.</source> <target state="translated">'Instrukcje „Declare” nie są dozwolone w typach ogólnych ani typach zawartych w typach ogólnych.</target> <note /> </trans-unit> <trans-unit id="ERR_OverrideWithConstraintMismatch2"> <source>'{0}' cannot override '{1}' because they differ by type parameter constraints.</source> <target state="translated">'Element „{0}” nie może przesłonić elementu „{1}”, ponieważ elementy różnią się ograniczeniami parametrów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ImplementsWithConstraintMismatch3"> <source>'{0}' cannot implement '{1}.{2}' because they differ by type parameter constraints.</source> <target state="translated">'Element „{0}” nie może implementować elementu „{1}.{2}”, ponieważ różnią się one ograniczeniami parametrów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_OpenTypeDisallowed"> <source>Type parameters or types constructed with type parameters are not allowed in attribute arguments.</source> <target state="translated">Parametry typu lub typy utworzone za pomocą parametrów typu są niedozwolone w argumentach atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_HandlesInvalidOnGenericMethod"> <source>Generic methods cannot use 'Handles' clause.</source> <target state="translated">Metody ogólne nie mogą używać klauzuli Handles.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleNewConstraints"> <source>'New' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'Ograniczenie New nie może być określone wiele razy dla tego samego parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_MustInheritForNewConstraint2"> <source>Type argument '{0}' is declared 'MustInherit' and does not satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">Argument typu „{0}” jest deklarowany jako „MustInherit” i nie spełnia ograniczenia „New” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NoSuitableNewForNewConstraint2"> <source>Type argument '{0}' must have a public parameterless instance constructor to satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">Argument typu „{0}” musi mieć publiczny konstruktor wystąpienia bez parametrów, aby spełniać ograniczenie „New” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGenericParamForNewConstraint2"> <source>Type parameter '{0}' must have either a 'New' constraint or a 'Structure' constraint to satisfy the 'New' constraint for type parameter '{1}'.</source> <target state="translated">Parametr typu „{0}” musi mieć ograniczenie „New” lub „Structure”, aby spełniać ograniczenie „New” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NewArgsDisallowedForTypeParam"> <source>Arguments cannot be passed to a 'New' used on a type parameter.</source> <target state="translated">Argumentów nie można przekazać do elementu „New” używanego w parametrze typu.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateRawGenericTypeImport1"> <source>Generic type '{0}' cannot be imported more than once.</source> <target state="translated">Typ ogólny „{0}” nie może zostać zaimportowany więcej niż raz.</target> <note /> </trans-unit> <trans-unit id="ERR_NoTypeArgumentCountOverloadCand1"> <source>Overload resolution failed because no accessible '{0}' accepts this number of type arguments.</source> <target state="translated">Rozpoznanie przeciążenia nie powiodło się, ponieważ żaden z dostępnych elementów „{0}” nie akceptuje tej liczby argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeArgsUnexpected"> <source>Type arguments unexpected.</source> <target state="translated">Nieoczekiwane argumenty typu.</target> <note /> </trans-unit> <trans-unit id="ERR_NameSameAsMethodTypeParam1"> <source>'{0}' is already declared as a type parameter of this method.</source> <target state="translated">'Element „{0}” jest już zadeklarowany jako parametr typu tej metody.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamNameFunctionNameCollision"> <source>Type parameter cannot have the same name as its defining function.</source> <target state="translated">Parametr typu nie może mieć nazwy takiej samej jak definiująca go funkcja.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConstraintSyntax"> <source>Type or 'New' expected.</source> <target state="translated">Oczekiwano typu lub elementu „New”.</target> <note /> </trans-unit> <trans-unit id="ERR_OfExpected"> <source>'Of' required when specifying type arguments for a generic type or method.</source> <target state="translated">'Wymagany element „Of” podczas określania argumentów typu dla typu ogólnego lub metody ogólnej.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayOfRawGenericInvalid"> <source>'(' unexpected. Arrays of uninstantiated generic types are not allowed.</source> <target state="translated">'Nieoczekiwany znak „(”. Tablice typów ogólnych bez wystąpień nie są dozwolone.</target> <note /> </trans-unit> <trans-unit id="ERR_ForEachAmbiguousIEnumerable1"> <source>'For Each' on type '{0}' is ambiguous because the type implements multiple instantiations of 'System.Collections.Generic.IEnumerable(Of T)'.</source> <target state="translated">Element „For Each” w typie „{0}” jest niejednoznaczny, ponieważ typ implementuje wiele wystąpień elementu „System.Collections.Generic.IEnumerable(Of T)”.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOperatorGenericParam1"> <source>'IsNot' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a type parameter with no class constraint.</source> <target state="translated">'Argument operacji „IsNot” typu „{0}” można porównać tylko z elementem „Nothing”, ponieważ element „{0}” jest parametrem typu bez ograniczenia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamQualifierDisallowed"> <source>Type parameters cannot be used as qualifiers.</source> <target state="translated">Parametrów typu nie można używać jako kwalifikatorów.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMissingCommaOrRParen"> <source>Comma or ')' expected.</source> <target state="translated">Oczekiwano przecinka lub znaku ).</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamMissingAsCommaOrRParen"> <source>'As', comma or ')' expected.</source> <target state="translated">'Oczekiwano elementu „As”, przecinka lub znaku „)”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleReferenceConstraints"> <source>'Class' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'Ograniczenie elementu Class nie może być określone wiele razy dla tego samego parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_MultipleValueConstraints"> <source>'Structure' constraint cannot be specified multiple times for the same type parameter.</source> <target state="translated">'Ograniczenie elementu Structure nie może być określone wiele razy dla tego samego parametru typu.</target> <note /> </trans-unit> <trans-unit id="ERR_NewAndValueConstraintsCombined"> <source>'New' constraint and 'Structure' constraint cannot be combined.</source> <target state="translated">'Nie można łączyć ograniczeń New i Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAndValueConstraintsCombined"> <source>'Class' constraint and 'Structure' constraint cannot be combined.</source> <target state="translated">'Nie można łączyć ograniczeń Class i Structure.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForStructConstraint2"> <source>Type argument '{0}' does not satisfy the 'Structure' constraint for type parameter '{1}'.</source> <target state="translated">Argument typu „{0}” nie spełnia warunków ograniczenia „Structure” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForRefConstraint2"> <source>Type argument '{0}' does not satisfy the 'Class' constraint for type parameter '{1}'.</source> <target state="translated">Argument typu „{0}” nie spełnia warunków ograniczenia „Class” dla parametru typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_RefAndClassTypeConstrCombined"> <source>'Class' constraint and a specific class type constraint cannot be combined.</source> <target state="translated">'Nie można łączyć ograniczenia Class i określonego ograniczenia typu klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ValueAndClassTypeConstrCombined"> <source>'Structure' constraint and a specific class type constraint cannot be combined.</source> <target state="translated">'Nie można łączyć ograniczenia Structure i określonego ograniczenia typu klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashIndirectIndirect4"> <source>Indirect constraint '{0}' obtained from the type parameter constraint '{1}' conflicts with the indirect constraint '{2}' obtained from the type parameter constraint '{3}'.</source> <target state="translated">Ograniczenie pośrednie „{0}” uzyskane z ograniczenia parametru typu „{1}” powoduje konflikt z ograniczeniem pośrednim „{2}” uzyskanym z ograniczenia parametru typu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashDirectIndirect3"> <source>Constraint '{0}' conflicts with the indirect constraint '{1}' obtained from the type parameter constraint '{2}'.</source> <target state="translated">Ograniczenie „{0}” powoduje konflikt z ograniczeniem pośrednim „{1}” uzyskanym z ograniczenia parametru typu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintClashIndirectDirect3"> <source>Indirect constraint '{0}' obtained from the type parameter constraint '{1}' conflicts with the constraint '{2}'.</source> <target state="translated">Ograniczenie pośrednie „{0}” uzyskane z ograniczenia parametru typu „{1}” powoduje konflikt z ograniczeniem „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintCycleLink2"> <source> '{0}' is constrained to '{1}'.</source> <target state="translated"> Element „{0}” jest ograniczony do elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstraintCycle2"> <source>Type parameter '{0}' cannot be constrained to itself: {1}</source> <target state="translated">Parametru typu „{0}” nie można ograniczyć do niego samego: {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeParamWithStructConstAsConst"> <source>Type parameter with a 'Structure' constraint cannot be used as a constraint.</source> <target state="translated">Parametru typu z ograniczeniem „Structure” nie można używać jako ograniczenia.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableDisallowedForStructConstr1"> <source>'System.Nullable' does not satisfy the 'Structure' constraint for type parameter '{0}'. Only non-nullable 'Structure' types are allowed.</source> <target state="translated">Element „System.Nullable” nie spełnia warunków ograniczenia „Structure” dla parametru typu „{0}”. Dozwolone są tylko nienullowalne typy „Structure”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingDirectConstraints3"> <source>Constraint '{0}' conflicts with the constraint '{1}' already specified for type parameter '{2}'.</source> <target state="translated">Ograniczenie „{0}” powoduje konflikt z ograniczeniem „{1}” już określonym dla parametru typu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceUnifiesWithInterface2"> <source>Cannot inherit interface '{0}' because it could be identical to interface '{1}' for some type arguments.</source> <target state="translated">Nie można dziedziczyć interfejsu „{0}”, ponieważ może być on taki sam jak interfejs „{1}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_BaseUnifiesWithInterfaces3"> <source>Cannot inherit interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' for some type arguments.</source> <target state="translated">Nie można dziedziczyć interfejsu „{0}”, ponieważ interfejs „{1}”, po którym ten interfejs dziedziczy, może być taki sam jak interfejs „{2}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceBaseUnifiesWithBase4"> <source>Cannot inherit interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' from which the interface '{3}' inherits for some type arguments.</source> <target state="translated">Nie można dziedziczyć interfejsu „{0}”, ponieważ interfejs „{1}”, po którym ten interfejs dziedziczy, może być taki sam jak interfejs „{2}”, po którym dziedziczy interfejs „{3}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterfaceUnifiesWithBase3"> <source>Cannot inherit interface '{0}' because it could be identical to interface '{1}' from which the interface '{2}' inherits for some type arguments.</source> <target state="translated">Nie można dziedziczyć interfejsu „{0}”, ponieważ może on być taki sam jak interfejs „{1}”, po którym dziedziczy interfejs „{2}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsBaseUnifiesWithInterfaces3"> <source>Cannot implement interface '{0}' because the interface '{1}' from which it inherits could be identical to implemented interface '{2}' for some type arguments.</source> <target state="translated">Nie można zaimplementować interfejsu „{0}”, ponieważ interfejs „{1}”, po którym ten interfejs dziedziczy, może być taki sam jak zaimplementowany interfejs „{2}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsInterfaceBaseUnifiesWithBase4"> <source>Cannot implement interface '{0}' because the interface '{1}' from which it inherits could be identical to interface '{2}' from which the implemented interface '{3}' inherits for some type arguments.</source> <target state="translated">Nie można zaimplementować interfejsu „{0}”, ponieważ interfejs „{1}”, po którym ten interfejs dziedziczy, może być taki sam jak interfejs „{2}”, po którym dziedziczy zaimplementowany interfejs „{3}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ClassInheritsInterfaceUnifiesWithBase3"> <source>Cannot implement interface '{0}' because it could be identical to interface '{1}' from which the implemented interface '{2}' inherits for some type arguments.</source> <target state="translated">Nie można zaimplementować interfejsu „{0}”, ponieważ może on być taki sam jak interfejs „{1}”, po którym dziedziczy zaimplementowany interfejs „{2}” dla niektórych argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionalsCantBeStructGenericParams"> <source>Generic parameters used as optional parameter types must be class constrained.</source> <target state="translated">Parametry ogólne używane jako opcjonalne typy parametrów muszą mieć ograniczenia klasy.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfNullableMethod"> <source>Methods of 'System.Nullable(Of T)' cannot be used as operands of the 'AddressOf' operator.</source> <target state="translated">Nie można używać metod typu „System.Nullable(Of T)” jako argumentów operatora „AddressOf”.</target> <note /> </trans-unit> <trans-unit id="ERR_IsOperatorNullable1"> <source>'Is' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a nullable type.</source> <target state="translated">'Argument operacji „Is” typu „{0}” można porównać tylko z elementem „Nothing”, ponieważ typ „{0}” jest typem dopuszczającym wartość null.</target> <note /> </trans-unit> <trans-unit id="ERR_IsNotOperatorNullable1"> <source>'IsNot' operand of type '{0}' can be compared only to 'Nothing' because '{0}' is a nullable type.</source> <target state="translated">'Argument operacji „IsNot” typu „{0}” można porównać tylko z elementem „Nothing”, ponieważ typ „{0}” jest typem dopuszczającym wartość null.</target> <note /> </trans-unit> <trans-unit id="ERR_ShadowingTypeOutsideClass1"> <source>'{0}' cannot be declared 'Shadows' outside of a class, structure, or interface.</source> <target state="translated">'Nie można zadeklarować elementu „{0}” jako „Shadows” poza klasą, strukturą lub interfejsem.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertySetParamCollisionWithValue"> <source>Property parameters cannot have the name 'Value'.</source> <target state="translated">Parametry właściwości nie mogą mieć nazwy Value.</target> <note /> </trans-unit> <trans-unit id="ERR_SxSIndirectRefHigherThanDirectRef3"> <source>The project currently contains references to more than one version of '{0}', a direct reference to version {2} and an indirect reference to version {1}. Change the direct reference to use version {1} (or higher) of {0}.</source> <target state="translated">Projekt obecnie zawiera odwołania do więcej niż jednej wersji elementu {0}, bezpośrednie odwołanie do wersji {2} i pośrednie odwołanie do wersji {1}. Zmień odwołanie bezpośrednie tak, aby używana w nim była wersja {1} (lub wyższa) elementu {0}.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateReferenceStrong"> <source>Multiple assemblies with equivalent identity have been imported: '{0}' and '{1}'. Remove one of the duplicate references.</source> <target state="translated">Zostało zaimportowanych wiele zestawów o równoważnej tożsamości: „{0}” i „{1}”. Usuń jedno ze zduplikowanych odwołań.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateReference2"> <source>Project already has a reference to assembly '{0}'. A second reference to '{1}' cannot be added.</source> <target state="translated">Projekt już ma odwołanie do zestawu {0}. Nie można dodać drugiego odwołania do elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCallOrIndex"> <source>Illegal call expression or index expression.</source> <target state="translated">Niedozwolone wyrażenie wywołania lub indeksu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictDefaultPropertyAttribute"> <source>Conflict between the default property and the 'DefaultMemberAttribute' defined on '{0}'.</source> <target state="translated">Konflikt między właściwością domyślną a elementem „DefaultMemberAttribute” zdefiniowanym w elemencie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeUuid2"> <source>'{0}' cannot be applied because the format of the GUID '{1}' is not correct.</source> <target state="translated">'Nie można zastosować elementu „{0}”, ponieważ format identyfikatora GUID „{1}” jest niepoprawny.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassAndReservedAttribute1"> <source>'Microsoft.VisualBasic.ComClassAttribute' and '{0}' cannot both be applied to the same class.</source> <target state="translated">'Nie można zastosować elementów „Microsoft.VisualBasic.ComClassAttribute” i „{0}” w tej samej klasie.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassRequiresPublicClass2"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to '{0}' because its container '{1}' is not declared 'Public'.</source> <target state="translated">'Nie można zastosować elementu „Microsoft.VisualBasic.ComClassAttribute” do elementu „{0}”, ponieważ jego kontener „{1}” nie jest zadeklarowany jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassReservedDispIdZero1"> <source>'System.Runtime.InteropServices.DispIdAttribute' cannot be applied to '{0}' because 'Microsoft.VisualBasic.ComClassAttribute' reserves zero for the default property.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DispIdAttribute” do elementu „{0}”, ponieważ element „Microsoft.VisualBasic.ComClassAttribute” rezerwuje zero jako właściwość domyślną.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassReservedDispId1"> <source>'System.Runtime.InteropServices.DispIdAttribute' cannot be applied to '{0}' because 'Microsoft.VisualBasic.ComClassAttribute' reserves values less than zero.</source> <target state="translated">'Nie można zastosować elementu „System.Runtime.InteropServices.DispIdAttribute” do elementu „{0}”, ponieważ element „Microsoft.VisualBasic.ComClassAttribute” rezerwuje wartości mniejsze od zera.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassDuplicateGuids1"> <source>'InterfaceId' and 'EventsId' parameters for 'Microsoft.VisualBasic.ComClassAttribute' on '{0}' cannot have the same value.</source> <target state="translated">'Parametry „InterfaceId” i „EventsId” dla elementu „Microsoft.VisualBasic.ComClassAttribute” w elemencie „{0}” nie mogą mieć tej samej wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassCantBeAbstract0"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to a class that is declared 'MustInherit'.</source> <target state="translated">'Nie można zastosować elementu „Microsoft.VisualBasic.ComClassAttribute” do klasy, która jest zadeklarowana jako „MustInherit”.</target> <note /> </trans-unit> <trans-unit id="ERR_ComClassRequiresPublicClass1"> <source>'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to '{0}' because it is not declared 'Public'.</source> <target state="translated">'Nie można zastosować elementu „Microsoft.VisualBasic.ComClassAttribute” do elementu „{0}”, ponieważ nie jest on zadeklarowany jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnknownOperator"> <source>Operator declaration must be one of: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</source> <target state="translated">Deklaracja operatora musi mieć jedną z następujących wartości: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateConversionCategoryUsed"> <source>'Widening' and 'Narrowing' cannot be combined.</source> <target state="translated">'Nie można łączyć elementów Widening i Narrowing.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorNotOverloadable"> <source>Operator is not overloadable. Operator declaration must be one of: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</source> <target state="translated">Operatora nie można przeciążyć. Deklaracja operatora musi mieć jedną z następujących wartości: +, -, *, \, /, ^, &amp;, Like, Mod, And, Or, Xor, Not, &lt;&lt;, &gt;&gt;, =, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, CType, IsTrue, IsFalse.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHandles"> <source>'Handles' is not valid on operator declarations.</source> <target state="translated">'Element Handles nie jest prawidłowy w deklaracjach operatora.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplements"> <source>'Implements' is not valid on operator declarations.</source> <target state="translated">'Element Implements nie jest prawidłowy w deklaracjach operatora.</target> <note /> </trans-unit> <trans-unit id="ERR_EndOperatorExpected"> <source>'End Operator' expected.</source> <target state="translated">'Oczekiwano elementu „End Operator”.</target> <note /> </trans-unit> <trans-unit id="ERR_EndOperatorNotAtLineStart"> <source>'End Operator' must be the first statement on a line.</source> <target state="translated">'Element End Operator musi być pierwszą instrukcją w wierszu.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidEndOperator"> <source>'End Operator' must be preceded by a matching 'Operator'.</source> <target state="translated">'Element „End Operator” musi być poprzedzony odpowiadającym mu elementem „Operator”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExitOperatorNotValid"> <source>'Exit Operator' is not valid. Use 'Return' to exit an operator.</source> <target state="translated">'Element Exit Operator jest nieprawidłowy. Użyj elementu Return, aby wyjść z operatora.</target> <note /> </trans-unit> <trans-unit id="ERR_ParamArrayIllegal1"> <source>'{0}' parameters cannot be declared 'ParamArray'.</source> <target state="translated">'Parametrów „{0}” nie można zadeklarować jako „ParamArray”.</target> <note /> </trans-unit> <trans-unit id="ERR_OptionalIllegal1"> <source>'{0}' parameters cannot be declared 'Optional'.</source> <target state="translated">'Parametrów „{0}” nie można zadeklarować jako „Optional”.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorMustBePublic"> <source>Operators must be declared 'Public'.</source> <target state="translated">Operatory należy zadeklarować jako „Public”.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorMustBeShared"> <source>Operators must be declared 'Shared'.</source> <target state="translated">Operatory należy zadeklarować jako „Shared”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadOperatorFlags1"> <source>Operators cannot be declared '{0}'.</source> <target state="translated">Operatorów nie można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OneParameterRequired1"> <source>Operator '{0}' must have one parameter.</source> <target state="translated">Operator „{0}” musi mieć jeden parametr.</target> <note /> </trans-unit> <trans-unit id="ERR_TwoParametersRequired1"> <source>Operator '{0}' must have two parameters.</source> <target state="translated">Operator „{0}” musi mieć dwa parametry.</target> <note /> </trans-unit> <trans-unit id="ERR_OneOrTwoParametersRequired1"> <source>Operator '{0}' must have either one or two parameters.</source> <target state="translated">Operator „{0}” musi mieć jeden lub dwa parametry.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvMustBeWideningOrNarrowing"> <source>Conversion operators must be declared either 'Widening' or 'Narrowing'.</source> <target state="translated">Operatory konwersji muszą być zadeklarowane jako Widening lub Narrowing.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorDeclaredInModule"> <source>Operators cannot be declared in modules.</source> <target state="translated">Nie można zadeklarować operatorów w modułach.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSpecifierOnNonConversion1"> <source>Only conversion operators can be declared '{0}'.</source> <target state="translated">Tylko operatory konwersji można zadeklarować jako „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnaryParamMustBeContainingType1"> <source>Parameter of this unary operator must be of the containing type '{0}'.</source> <target state="translated">Parametr tego operatora jednoargumentowego musi być typu zawierającego „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BinaryParamMustBeContainingType1"> <source>At least one parameter of this binary operator must be of the containing type '{0}'.</source> <target state="translated">Co najmniej jeden parametr tego operatora binarnego musi być typu zawierającego „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConvParamMustBeContainingType1"> <source>Either the parameter type or the return type of this conversion operator must be of the containing type '{0}'.</source> <target state="translated">Typ parametru lub typ zwracany tego operatora konwersji muszą być typu zawierającego „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorRequiresBoolReturnType1"> <source>Operator '{0}' must have a return type of Boolean.</source> <target state="translated">Operator „{0}” musi mieć typ zwracany Boolean.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToSameType"> <source>Conversion operators cannot convert from a type to the same type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToInterfaceType"> <source>Conversion operators cannot convert to an interface type.</source> <target state="translated">Operatory konwersji nie mogą konwertować na typ interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToBaseType"> <source>Conversion operators cannot convert from a type to its base type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu na jego typ podstawowy.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToDerivedType"> <source>Conversion operators cannot convert from a type to its derived type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu na typ, który od niego pochodzi.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionToObject"> <source>Conversion operators cannot convert to Object.</source> <target state="translated">Operatory konwersji nie mogą konwertować na element Object.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromInterfaceType"> <source>Conversion operators cannot convert from an interface type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu interfejsu.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromBaseType"> <source>Conversion operators cannot convert from a base type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu podstawowego.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromDerivedType"> <source>Conversion operators cannot convert from a derived type.</source> <target state="translated">Operatory konwersji nie mogą konwertować z typu pochodnego.</target> <note /> </trans-unit> <trans-unit id="ERR_ConversionFromObject"> <source>Conversion operators cannot convert from Object.</source> <target state="translated">Operatory konwersji nie mogą konwertować z elementu Object.</target> <note /> </trans-unit> <trans-unit id="ERR_MatchingOperatorExpected2"> <source>Matching '{0}' operator is required for '{1}'.</source> <target state="translated">Wymagany pasujący operator „{0}” dla elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableLogicalOperator3"> <source>Return and parameter types of '{0}' must be '{1}' to be used in a '{2}' expression.</source> <target state="translated">Typy zwracane i typy parametrów „{0}” muszą być typu „{1}”, aby można było ich używać w wyrażeniu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConditionOperatorRequired3"> <source>Type '{0}' must define operator '{1}' to be used in a '{2}' expression.</source> <target state="translated">Typ „{0}” musi definiować operator „{1}”, aby mógł zostać użyty w wyrażeniu „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CopyBackTypeMismatch3"> <source>Cannot copy the value of 'ByRef' parameter '{0}' back to the matching argument because type '{1}' cannot be converted to type '{2}'.</source> <target state="translated">Nie można skopiować wartości parametru „ByRef” „{0}” z powrotem do zgodnego argumentu, ponieważ typu „{1}” nie można przekonwertować na typ „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ForLoopOperatorRequired2"> <source>Type '{0}' must define operator '{1}' to be used in a 'For' statement.</source> <target state="translated">Typ „{0}” musi definiować operator „{1}”, aby można było go używać w instrukcji „For”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableForLoopOperator2"> <source>Return and parameter types of '{0}' must be '{1}' to be used in a 'For' statement.</source> <target state="translated">Typy zwracane i typy parametrów „{0}” muszą być typu „{1}”, aby można było używać ich w instrukcji „For”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnacceptableForLoopRelOperator2"> <source>Parameter types of '{0}' must be '{1}' to be used in a 'For' statement.</source> <target state="translated">Typy parametru „{0}” muszą być typu „{1}”, aby można było ich użyć w instrukcji 'For'.</target> <note /> </trans-unit> <trans-unit id="ERR_OperatorRequiresIntegerParameter1"> <source>Operator '{0}' must have a second parameter of type 'Integer' or 'Integer?'.</source> <target state="translated">Operator „{0}” musi mieć drugi parametr typu „Integer” lub „Integer?”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyNullableOnBoth"> <source>Nullable modifier cannot be specified on both a variable and its type.</source> <target state="translated">Modyfikator dopuszczający wartość null nie może być określony jednocześnie w zmiennej i jej typie.</target> <note /> </trans-unit> <trans-unit id="ERR_BadTypeArgForStructConstraintNull"> <source>Type '{0}' must be a value type or a type argument constrained to 'Structure' in order to be used with 'Nullable' or nullable modifier '?'.</source> <target state="translated">Typ „{0}” musi być typem wartości lub typem argumentu ograniczonym do elementu „Structure”, aby można go było używać z modyfikatorem „Nullable” lub modyfikatorem dopuszczającym wartość null „?”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyArrayAndNullableOnBoth"> <source>Nullable modifier '?' and array modifiers '(' and ')' cannot be specified on both a variable and its type.</source> <target state="translated">Modyfikator dopuszczający wartość null „?” oraz modyfikatory tablicy „(” i „)” nie mogą być określone jednocześnie w zmiennej i jej typie.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyTypeCharacterOnIIF"> <source>Expressions used with an 'If' expression cannot contain type characters.</source> <target state="translated">Wyrażenia używane w wyrażeniu „If” nie mogą zawierać znaków typu.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFName"> <source>'If' operands cannot be named arguments.</source> <target state="translated">'Argumenty operatora „If” nie mogą być nazwanymi argumentami.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFConversion"> <source>Cannot infer a common type for the second and third operands of the 'If' operator. One must have a widening conversion to the other.</source> <target state="translated">Nie można wywnioskować wspólnego typu dla drugiego i trzeciego argumentu operacji operatora „If”. Jeden musi umożliwiać konwersję rozszerzającą do drugiego.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalCondTypeInIIF"> <source>First operand in a binary 'If' expression must be a nullable value type, a reference type, or an unconstrained generic type.</source> <target state="translated">Pierwszy operand w binarnym wyrażeniu „If” musi być typem wartości dopuszczającym wartość null, typem referencyjnym lub typem ogólnym bez ograniczeń.</target> <note /> </trans-unit> <trans-unit id="ERR_CantCallIIF"> <source>'If' operator cannot be used in a 'Call' statement.</source> <target state="translated">Operatora „If” nie można użyć w instrukcji „Call”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyAsNewAndNullable"> <source>Nullable modifier cannot be specified in variable declarations with 'As New'.</source> <target state="translated">Modyfikator dopuszczający wartość null nie może być określany w deklaracjach zmiennych za pomocą instrukcji „As New”.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFConversion2"> <source>Cannot infer a common type for the first and second operands of the binary 'If' operator. One must have a widening conversion to the other.</source> <target state="translated">Nie można wywnioskować wspólnego typu dla pierwszego i drugiego argumentu operacji binarnego operatora „If”. Jeden musi umożliwiać konwersję rozszerzającą do drugiego.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNullTypeInCCExpression"> <source>Nullable types are not allowed in conditional compilation expressions.</source> <target state="translated">Typy dopuszczające wartości null nie są dozwolone w wyrażeniach kompilacji warunkowej.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableImplicit"> <source>Nullable modifier cannot be used with a variable whose implicit type is 'Object'.</source> <target state="translated">Modyfikator dopuszczający wartość null nie może być używany ze zmienną, której typem niejawnym jest „Object”.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingRuntimeHelper"> <source>Requested operation is not available because the runtime library function '{0}' is not defined.</source> <target state="translated">Żądana operacja jest niedostępna, ponieważ funkcja biblioteki uruchomieniowej „{0}” nie jest zdefiniowana.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedDotAfterGlobalNameSpace"> <source>'Global' must be followed by '.' and an identifier.</source> <target state="translated">'Po elemencie „Global” musi wystąpić znak „.” i identyfikator.</target> <note /> </trans-unit> <trans-unit id="ERR_NoGlobalExpectedIdentifier"> <source>'Global' not allowed in this context; identifier expected.</source> <target state="translated">'Element „Global” jest niedozwolony w tym kontekście; oczekiwano identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_NoGlobalInHandles"> <source>'Global' not allowed in handles; local name expected.</source> <target state="translated">'Element „Global” jest niedozwolony w elementach Handles; oczekiwano nazwy lokalnej.</target> <note /> </trans-unit> <trans-unit id="ERR_ElseIfNoMatchingIf"> <source>'ElseIf' must be preceded by a matching 'If' or 'ElseIf'.</source> <target state="translated">'Element „ElseIf” musi być poprzedzony odpowiadającym mu elementem „If” lub „ElseIf”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAttributeConstructor2"> <source>Attribute constructor has a 'ByRef' parameter of type '{0}'; cannot use constructors with byref parameters to apply the attribute.</source> <target state="translated">Konstruktor atrybutu ma parametr „ByRef” typu „{0}”; konstruktorów z parametrami byref nie można używać do zastosowania atrybutu.</target> <note /> </trans-unit> <trans-unit id="ERR_EndUsingWithoutUsing"> <source>'End Using' must be preceded by a matching 'Using'.</source> <target state="translated">'Element „End Using” musi być poprzedzony odpowiadającym mu elementem „Using”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEndUsing"> <source>'Using' must end with a matching 'End Using'.</source> <target state="translated">'Element „Using” musi być zakończony odpowiadającym mu elementem „End Using”.</target> <note /> </trans-unit> <trans-unit id="ERR_GotoIntoUsing"> <source>'GoTo {0}' is not valid because '{0}' is inside a 'Using' statement that does not contain this statement.</source> <target state="translated">'Instrukcja „GoTo {0}” jest nieprawidłowa, ponieważ element „{0}” znajduje się wewnątrz instrukcji „Using”, która nie zawiera tej instrukcji.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingRequiresDisposePattern"> <source>'Using' operand of type '{0}' must implement 'System.IDisposable'.</source> <target state="translated">'Argument operacji „Using” typu „{0}” musi implementować interfejs „System.IDisposable”.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingResourceVarNeedsInitializer"> <source>'Using' resource variable must have an explicit initialization.</source> <target state="translated">'Zmienna zasobu Using musi być jawnie inicjowana.</target> <note /> </trans-unit> <trans-unit id="ERR_UsingResourceVarCantBeArray"> <source>'Using' resource variable type can not be array type.</source> <target state="translated">'Typ zmiennej zasobu „Using” nie może być typem tablicowym.</target> <note /> </trans-unit> <trans-unit id="ERR_OnErrorInUsing"> <source>'On Error' statements are not valid within 'Using' statements.</source> <target state="translated">'Instrukcje On Error nie są prawidłowe w instrukcjach Using.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyNameConflictInMyCollection"> <source>'{0}' has the same name as a member used for type '{1}' exposed in a 'My' group. Rename the type or its enclosing namespace.</source> <target state="translated">'Element „{0}” ma taką samą nazwę jak składowa użyta dla typu „{1}” ujawniona w grupie „My”. Zmień nazwę typu lub obejmującej go przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidImplicitVar"> <source>Implicit variable '{0}' is invalid because of '{1}'.</source> <target state="translated">Zmienna niejawna „{0}” jest nieprawidłowa z powodu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ObjectInitializerRequiresFieldName"> <source>Object initializers require a field name to initialize.</source> <target state="translated">Inicjatory obiektów wymagają nazwy pola do zainicjowania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedFrom"> <source>'From' expected.</source> <target state="translated">'Oczekiwano instrukcji „From”.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaBindingMismatch1"> <source>Nested function does not have the same signature as delegate '{0}'.</source> <target state="translated">Funkcja zagnieżdżona nie ma takiej samej sygnatury jak obiekt delegowany „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaBindingMismatch2"> <source>Nested sub does not have a signature that is compatible with delegate '{0}'.</source> <target state="translated">Zagnieżdżony element sub nie ma sygnatury zgodnej z obiektem delegowanym „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftByRefParamQuery1"> <source>'ByRef' parameter '{0}' cannot be used in a query expression.</source> <target state="translated">'Nie można użyć parametru ByRef „{0}” w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionTreeNotSupported"> <source>Expression cannot be converted into an expression tree.</source> <target state="translated">Nie można przekonwertować wyrażenia na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftStructureMeQuery"> <source>Instance members and 'Me' cannot be used within query expressions in structures.</source> <target state="translated">Nie można używać składowych wystąpień i elementu „Me” w wyrażeniach zapytań w strukturach.</target> <note /> </trans-unit> <trans-unit id="ERR_InferringNonArrayType1"> <source>Variable cannot be initialized with non-array type '{0}'.</source> <target state="translated">Nie można zainicjować zmiennej przy użyciu typu nietablicowego „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ByRefParamInExpressionTree"> <source>References to 'ByRef' parameters cannot be converted to an expression tree.</source> <target state="translated">Nie można przekonwertować odwołań do parametrów „ByRef” na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateAnonTypeMemberName1"> <source>Anonymous type member or property '{0}' is already declared.</source> <target state="translated">Składowa lub właściwość typu anonimowego „{0}” jest już zadeklarowana.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAnonymousTypeForExprTree"> <source>Cannot convert anonymous type to an expression tree because a property of the type is used to initialize another property.</source> <target state="translated">Nie można przekonwertować typu anonimowego na drzewo wyrażenia, ponieważ właściwość typu jest używana do inicjowania innej właściwości.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftAnonymousType1"> <source>Anonymous type property '{0}' cannot be used in the definition of a lambda expression within the same initialization list.</source> <target state="translated">Nie można użyć właściwości typu anonimowego „{0}” w definicji wyrażenia lambda w obrębie tej samej listy inicjowania.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionOnlyAllowedOnModuleSubOrFunction"> <source>'Extension' attribute can be applied only to 'Module', 'Sub', or 'Function' declarations.</source> <target state="translated">'Atrybut „Extension” można stosować tylko w deklaracjach „Module”, „Sub” lub „Function”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodNotInModule"> <source>Extension methods can be defined only in modules.</source> <target state="translated">Metody rozszerzenia można definiować tylko w modułach.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodNoParams"> <source>Extension methods must declare at least one parameter. The first parameter specifies which type to extend.</source> <target state="translated">Metody rozszerzenia muszą deklarować co najmniej jeden parametr. Pierwszy parametr określa typ do rozszerzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOptionalFirstArg"> <source>'Optional' cannot be applied to the first parameter of an extension method. The first parameter specifies which type to extend.</source> <target state="translated">'Nie można zastosować elementu „Optional” do pierwszego parametru metody rozszerzenia. Pierwszy parametr określa typ do rozszerzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodParamArrayFirstArg"> <source>'ParamArray' cannot be applied to the first parameter of an extension method. The first parameter specifies which type to extend.</source> <target state="translated">'Nie można zastosować elementu „ParamArray” do pierwszego parametru metody rozszerzenia. Pierwszy parametr określa typ do rozszerzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeFieldNameInference"> <source>Anonymous type member name can be inferred only from a simple or qualified name with no arguments.</source> <target state="translated">Nazwę składowej typu anonimowego można wywnioskować tylko na podstawie prostej lub kwalifikowanej nazwy bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NameNotMemberOfAnonymousType2"> <source>'{0}' is not a member of '{1}'; it does not exist in the current context.</source> <target state="translated">'Element „{0}” nie jest składową elementu „{1}”. Nie istnieje on w bieżącym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionAttributeInvalid"> <source>The custom-designed version of 'System.Runtime.CompilerServices.ExtensionAttribute' found by the compiler is not valid. Its attribute usage flags must be set to allow assemblies, classes, and methods.</source> <target state="translated">Niestandardowo zaprojektowana wersja klasy „System.Runtime.CompilerServices.ExtensionAttribute” odnaleziona przez kompilator jest nieprawidłowa. Jej flagi użycia atrybutów należy ustawić tak, aby zezwalały na zestawy, klasy i metody.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypePropertyOutOfOrder1"> <source>Anonymous type member property '{0}' cannot be used to infer the type of another member property because the type of '{0}' is not yet established.</source> <target state="translated">Nie można użyć właściwości składowej typu anonimowego „{0}” do wywnioskowania typu innej właściwości składowej, ponieważ typ elementu „{0}” nie jest jeszcze ustalony.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeDisallowsTypeChar"> <source>Type characters cannot be used in anonymous type declarations.</source> <target state="translated">Nie można używać znaków typu w deklaracjach typów anonimowych.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleLiteralDisallowsTypeChar"> <source>Type characters cannot be used in tuple literals.</source> <target state="translated">Znaki typu nie mogą być używane w literałach krotek.</target> <note /> </trans-unit> <trans-unit id="ERR_NewWithTupleTypeSyntax"> <source>'New' cannot be used with tuple type. Use a tuple literal expression instead.</source> <target state="translated">'Instrukcji „new” nie można użyć dla typu krotki. Użyj zamiast tego wyrażenia literału krotki.</target> <note /> </trans-unit> <trans-unit id="ERR_PredefinedValueTupleTypeMustBeStruct"> <source>Predefined type '{0}' must be a structure.</source> <target state="translated">Wstępnie zdefiniowany typ „{0}” musi być strukturą.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodUncallable1"> <source>Extension method '{0}' has type constraints that can never be satisfied.</source> <target state="translated">Metoda rozszerzenia „{0}” ma ograniczenia typu, których nie będzie można nigdy spełnić.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOverloadCandidate3"> <source> Extension method '{0}' defined in '{1}': {2}</source> <target state="translated"> Metoda rozszerzenia „{0}” zdefiniowana w elemencie „{1}”: {2}</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatch"> <source>Method does not have a signature compatible with the delegate.</source> <target state="translated">Metoda nie ma sygnatury zgodnej z delegatem.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingTypeInferenceFails"> <source>Type arguments could not be inferred from the delegate.</source> <target state="translated">Nie można wywnioskować argumentów typu na podstawie delegata.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs"> <source>Too many arguments.</source> <target state="translated">Za dużo argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted1"> <source>Parameter '{0}' already has a matching omitted argument.</source> <target state="translated">Parametr „{0}” ma już pasujący pominięty argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice1"> <source>Parameter '{0}' already has a matching argument.</source> <target state="translated">Parametr „{0}” ma już pasujący argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound1"> <source>'{0}' is not a method parameter.</source> <target state="translated">'Element „{0}” nie jest parametrem metody.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument1"> <source>Argument not specified for parameter '{0}'.</source> <target state="translated">Nie określono parametru dla argumentu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam1"> <source>Type parameter '{0}' cannot be inferred.</source> <target state="translated">Nie można wywnioskować parametru typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodOverloadCandidate2"> <source> Extension method '{0}' defined in '{1}'.</source> <target state="translated"> Metoda rozszerzenia „{0}” zdefiniowana w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNeedField"> <source>Anonymous type must contain at least one member.</source> <target state="translated">Typ anonimowy musi zawierać co najmniej jedną składową.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeNameWithoutPeriod"> <source>Anonymous type member name must be preceded by a period.</source> <target state="translated">Nazwa składowej typu anonimowego musi być poprzedzona kropką.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonymousTypeExpectedIdentifier"> <source>Identifier expected, preceded with a period.</source> <target state="translated">Oczekiwano identyfikatora poprzedzonego kropką.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyArgs2"> <source>Too many arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Za dużo argumentów dla metody rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgAlsoOmitted3"> <source>Parameter '{0}' in extension method '{1}' defined in '{2}' already has a matching omitted argument.</source> <target state="translated">Parametr „{0}” metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}” ma już pasujący pominięty argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedArgUsedTwice3"> <source>Parameter '{0}' of extension method '{1}' defined in '{2}' already has a matching argument.</source> <target state="translated">Parametr „{0}” metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}” ma już pasujący argument.</target> <note /> </trans-unit> <trans-unit id="ERR_NamedParamNotFound3"> <source>'{0}' is not a parameter of extension method '{1}' defined in '{2}'.</source> <target state="translated">'Element „{0}” nie jest parametrem metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OmittedArgument3"> <source>Argument not specified for parameter '{0}' of extension method '{1}' defined in '{2}'.</source> <target state="translated">Nie określono argumentu dla parametru „{0}” metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnboundTypeParam3"> <source>Type parameter '{0}' for extension method '{1}' defined in '{2}' cannot be inferred.</source> <target state="translated">Nie można wywnioskować parametru typu „{0}” metody rozszerzenia „{1}” zdefiniowanej w elemencie „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooFewGenericArguments2"> <source>Too few type arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Za mało argumentów typu dla metody rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyGenericArguments2"> <source>Too many type arguments to extension method '{0}' defined in '{1}'.</source> <target state="translated">Za dużo argumentów typu dla metody rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedInOrEq"> <source>'In' or '=' expected.</source> <target state="translated">'Oczekiwano elementu „In” lub znaku „=”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedQueryableSource"> <source>Expression of type '{0}' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider.</source> <target state="translated">Wyrażenie typu „{0}” nie umożliwia formułowania zapytań. Upewnij się, że nie brakuje odwołania do zestawu i/lub importu przestrzeni nazw dla dostawcy LINQ.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryOperatorNotFound"> <source>Definition of method '{0}' is not accessible in this context.</source> <target state="translated">Definicja metody „{0}” jest niedostępna w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseOnErrorGotoWithClosure"> <source>Method cannot contain both a '{0}' statement and a definition of a variable that is used in a lambda or query expression.</source> <target state="translated">Metoda nie może zawierać zarówno instrukcji „{0}”, jak i definicji zmiennej użytej w wyrażeniu lambda lub wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotGotoNonScopeBlocksWithClosure"> <source>'{0}{1}' is not valid because '{2}' is inside a scope that defines a variable that is used in a lambda or query expression.</source> <target state="translated">'Instrukcja „{0}{1}” jest nieprawidłowa, ponieważ element „{2}” znajduje się wewnątrz zakresu, który definiuje zmienną używaną w wyrażeniu lambda lub wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeQuery"> <source>Instance of restricted type '{0}' cannot be used in a query expression.</source> <target state="translated">Nie można użyć wystąpienia typu ograniczonego „{0}” w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonymousTypeFieldNameInference"> <source>Range variable name can be inferred only from a simple or qualified name with no arguments.</source> <target state="translated">Nazwę zmiennej zakresu można wywnioskować tylko na podstawie prostej lub kwalifikowanej nazwy bez argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryDuplicateAnonTypeMemberName1"> <source>Range variable '{0}' is already declared.</source> <target state="translated">Zmienna zakresu „{0}” jest już zadeklarowana.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonymousTypeDisallowsTypeChar"> <source>Type characters cannot be used in range variable declarations.</source> <target state="translated">Nie można używać znaków typu w deklaracjach zmiennych zakresu.</target> <note /> </trans-unit> <trans-unit id="ERR_ReadOnlyInClosure"> <source>'ReadOnly' variable cannot be the target of an assignment in a lambda expression inside a constructor.</source> <target state="translated">'Zmienna ReadOnly nie może być elementem docelowym przypisania w wyrażeniu lambda wewnątrz konstruktora.</target> <note /> </trans-unit> <trans-unit id="ERR_ExprTreeNoMultiDimArrayCreation"> <source>Multi-dimensional array cannot be converted to an expression tree.</source> <target state="translated">Nie można przekonwertować tablicy wielowymiarowej na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExprTreeNoLateBind"> <source>Late binding operations cannot be converted to an expression tree.</source> <target state="translated">Nie można przekonwertować operacji późnego wiązania na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedBy"> <source>'By' expected.</source> <target state="translated">'Oczekiwano elementu „By”.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryInvalidControlVariableName1"> <source>Range variable name cannot match the name of a member of the 'Object' class.</source> <target state="translated">Nazwa zmiennej zakresu nie może być zgodna z nazwą składowej klasy „Object”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIn"> <source>'In' expected.</source> <target state="translated">'Oczekiwano elementu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryNameNotDeclared"> <source>Name '{0}' is either not declared or not in the current scope.</source> <target state="translated">Nazwa „{0}” nie jest zadeklarowana lub nie znajduje się w bieżącym zakresie.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedFunctionArgumentNarrowing3"> <source>Return type of nested function matching parameter '{0}' narrows from '{1}' to '{2}'.</source> <target state="translated">Typ zwracany funkcji zagnieżdżonej pasującej do parametru „{0}” zawęża się od „{1}” do „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AnonTypeFieldXMLNameInference"> <source>Anonymous type member name cannot be inferred from an XML identifier that is not a valid Visual Basic identifier.</source> <target state="translated">Nie można wywnioskować nazwy składowej typu anonimowego na podstawie identyfikatora XML, który nie jest prawidłowym identyfikatorem języka Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryAnonTypeFieldXMLNameInference"> <source>Range variable name cannot be inferred from an XML identifier that is not a valid Visual Basic identifier.</source> <target state="translated">Nie można wywnioskować nazwy zmiennej zakresu na podstawie identyfikatora XML, który nie jest prawidłowym identyfikatorem języka Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedInto"> <source>'Into' expected.</source> <target state="translated">'Oczekiwano operatora „Into”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeCharOnAggregation"> <source>Aggregate function name cannot be used with a type character.</source> <target state="translated">Nazwy funkcji agregowania nie można używać ze znakiem typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedOn"> <source>'On' expected.</source> <target state="translated">'Oczekiwano operatora „On”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedEquals"> <source>'Equals' expected.</source> <target state="translated">'Oczekiwano operatora „Equals”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedAnd"> <source>'And' expected.</source> <target state="translated">'Oczekiwano operatora „And”.</target> <note /> </trans-unit> <trans-unit id="ERR_EqualsTypeMismatch"> <source>'Equals' cannot compare a value of type '{0}' with a value of type '{1}'.</source> <target state="translated">'Operator „Equals” nie umożliwia porównania wartości typu „{0}” z wartością typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EqualsOperandIsBad"> <source>You must reference at least one range variable on both sides of the 'Equals' operator. Range variable(s) {0} must appear on one side of the 'Equals' operator, and range variable(s) {1} must appear on the other.</source> <target state="translated">Po obu stronach operatora „Equals” musi znajdować się odwołanie do co najmniej jednej zmiennej zakresu. Zmienne zakresu {0} muszą znajdować się po jednej, a zmienne zakresu {1} po drugiej stronie operatora „Equals”.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNotDelegate1"> <source>Lambda expression cannot be converted to '{0}' because '{0}' is not a delegate type.</source> <target state="translated">Wyrażenia lambda nie można przekonwertować na typ „{0}”, ponieważ typ „{0}” nie jest typem delegowanym.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNotCreatableDelegate1"> <source>Lambda expression cannot be converted to '{0}' because type '{0}' is declared 'MustInherit' and cannot be created.</source> <target state="translated">Wyrażenia lambda nie można przekonwertować na typ „{0}”, ponieważ typ „{0}” jest zadeklarowany jako „MustInherit” i nie można go utworzyć.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotInferNullableForVariable1"> <source>A nullable type cannot be inferred for variable '{0}'.</source> <target state="translated">Nie można wywnioskować typu dopuszczającego wartość null dla zmiennej „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableTypeInferenceNotSupported"> <source>Nullable type inference is not supported in this context.</source> <target state="translated">Wnioskowanie typu dopuszczającego wartość null nie jest obsługiwane w tym kontekście.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedJoin"> <source>'Join' expected.</source> <target state="translated">'Oczekiwano operatora „Join”.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableParameterMustSpecifyType"> <source>Nullable parameters must specify a type.</source> <target state="translated">Parametry dopuszczające wartości null muszą określać typ.</target> <note /> </trans-unit> <trans-unit id="ERR_IterationVariableShadowLocal2"> <source>Range variable '{0}' hides a variable in an enclosing block, a previously defined range variable, or an implicitly declared variable in a query expression.</source> <target state="translated">Zmienna zakresu „{0}” ukrywa zmienną w otaczającym bloku, w uprzednio zdefiniowanej zmiennej zakresu lub w niejawnie zadeklarowanej zmiennej w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdasCannotHaveAttributes"> <source>Attributes cannot be applied to parameters of lambda expressions.</source> <target state="translated">Nie można zastosować atrybutów do parametrów wyrażeń lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaInSelectCaseExpr"> <source>Lambda expressions are not valid in the first expression of a 'Select Case' statement.</source> <target state="translated">Wyrażenia lambda nie są prawidłowe w pierwszym wyrażeniu instrukcji Select Case.</target> <note /> </trans-unit> <trans-unit id="ERR_AddressOfInSelectCaseExpr"> <source>'AddressOf' expressions are not valid in the first expression of a 'Select Case' statement.</source> <target state="translated">'Wyrażenia „AddressOf” nie są prawidłowe w pierwszym wyrażeniu instrukcji „Select Case”.</target> <note /> </trans-unit> <trans-unit id="ERR_NullableCharNotSupported"> <source>The '?' character cannot be used here.</source> <target state="translated">Tutaj nie można użyć znaku „?”.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftStructureMeLambda"> <source>Instance members and 'Me' cannot be used within a lambda expression in structures.</source> <target state="translated">Nie można używać składowych wystąpień i elementu „Me” w wyrażeniach lambda w strukturach.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftByRefParamLambda1"> <source>'ByRef' parameter '{0}' cannot be used in a lambda expression.</source> <target state="translated">'Nie można użyć parametru ByRef „{0}” w wyrażeniu lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeLambda"> <source>Instance of restricted type '{0}' cannot be used in a lambda expression.</source> <target state="translated">Nie można użyć wystąpienia typu ograniczonego „{0}” w wyrażeniu lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaParamShadowLocal1"> <source>Lambda parameter '{0}' hides a variable in an enclosing block, a previously defined range variable, or an implicitly declared variable in a query expression.</source> <target state="translated">Parametr lambda „{0}” ukrywa zmienną w otaczającym bloku, w uprzednio zdefiniowanej zmiennej zakresu lub w niejawnie zadeklarowanej zmiennej w wyrażeniu zapytania.</target> <note /> </trans-unit> <trans-unit id="ERR_StrictDisallowImplicitObjectLambda"> <source>Option Strict On requires each lambda expression parameter to be declared with an 'As' clause if its type cannot be inferred.</source> <target state="translated">Ustawienie Option Strict On wymaga zadeklarowania każdego parametru wyrażenia lambda za pomocą klauzuli „As”, jeśli nie można wywnioskować ich typu.</target> <note /> </trans-unit> <trans-unit id="ERR_CantSpecifyParamsOnLambdaParamNoType"> <source>Array modifiers cannot be specified on lambda expression parameter name. They must be specified on its type.</source> <target state="translated">Nie można określić modyfikatorów tablicy w nazwie parametru wyrażenia lambda. Muszą być one określone w jego typie.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailure3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicit3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu, ponieważ jest możliwy więcej niż jeden typ. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”, ponieważ możliwe jest użycie więcej niż jednego typu. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureAmbiguous3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because more than one type is possible. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”, ponieważ możliwe jest użycie więcej niż jednego typu. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu, ponieważ jest możliwy więcej niż jeden typ.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”, ponieważ możliwe jest użycie więcej niż jednego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitAmbiguous3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because more than one type is possible.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”, ponieważ możliwe jest użycie więcej niż jednego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu, ponieważ nie można konwertować ich na jeden typ. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”, ponieważ nie można konwertować ich na ten sam typ. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoBest3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because they do not convert to the same type. Specifying the data type(s) explicitly might correct this error.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”, ponieważ nie można konwertować ich na ten sam typ. Jawne określenie typów danych może rozwiązać ten problem.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest1"> <source>Data type(s) of the type parameter(s) cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu, ponieważ nie można konwertować ich na jeden typ.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest2"> <source>Data type(s) of the type parameter(s) in method '{0}' cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie „{0}”, ponieważ nie można konwertować ich na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceFailureNoExplicitNoBest3"> <source>Data type(s) of the type parameter(s) in extension method '{0}' defined in '{1}' cannot be inferred from these arguments because they do not convert to the same type.</source> <target state="translated">Na podstawie tych argumentów nie można wywnioskować typów danych parametrów typu w metodzie rozszerzenia „{0}” zdefiniowanej w elemencie „{1}”, ponieważ nie można konwertować ich na ten sam typ.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatchStrictOff2"> <source>Option Strict On does not allow narrowing in implicit type conversions between method '{0}' and delegate '{1}'.</source> <target state="translated">Ustawienie Option Strict On nie zezwala na zawężanie w niejawnych konwersjach typów między metodą „{0}” a delegatem „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InaccessibleReturnTypeOfMember2"> <source>'{0}' is not accessible in this context because the return type is not accessible.</source> <target state="translated">'Element „{0}” nie jest dostępny w tym kontekście, ponieważ typ zwracany jest niedostępny.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedIdentifierOrGroup"> <source>'Group' or an identifier expected.</source> <target state="translated">'Oczekiwano elementu „Group” lub identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_UnexpectedGroup"> <source>'Group' not allowed in this context; identifier expected.</source> <target state="translated">'Element „Group” jest niedozwolony w tym kontekście; oczekiwano identyfikatora.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingMismatchStrictOff3"> <source>Option Strict On does not allow narrowing in implicit type conversions between extension method '{0}' defined in '{2}' and delegate '{1}'.</source> <target state="translated">Ustawienie Option Strict On nie zezwala na zawężanie w niejawnych konwersjach typów między metodą rozszerzenia „{0}” zdefiniowaną w elemencie „{2}” a delegatem „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DelegateBindingIncompatible3"> <source>Extension Method '{0}' defined in '{2}' does not have a signature compatible with delegate '{1}'.</source> <target state="translated">Metoda rozszerzenia „{0}” zdefiniowana w elemencie „{2}” nie ma sygnatury zgodnej z delegatem „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ArgumentNarrowing2"> <source>Argument matching parameter '{0}' narrows to '{1}'.</source> <target state="translated">Dopasowywanie argumentu dla parametru „{0}” powoduje zawężenie do typu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadCandidate1"> <source> {0}</source> <target state="translated"> {0}</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyInitializedInStructure"> <source>Auto-implemented Properties contained in Structures cannot have initializers unless they are marked 'Shared'.</source> <target state="translated">Automatycznie implementowany obiekt Properties zawarty w obiekcie Structures nie może mieć inicjatorów, chyba że są oznaczone jako „Shared”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsElements"> <source>XML elements cannot be selected from type '{0}'.</source> <target state="translated">Nie można wybierać elementów XML z typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsAttributes"> <source>XML attributes cannot be selected from type '{0}'.</source> <target state="translated">Nie można wybierać atrybutów XML z typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeDisallowsDescendants"> <source>XML descendant elements cannot be selected from type '{0}'.</source> <target state="translated">Nie można wybierać podrzędnych elementów XML z typu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeOrMemberNotGeneric2"> <source>Extension method '{0}' defined in '{1}' is not generic (or has no free type parameters) and so cannot have type arguments.</source> <target state="translated">Metoda rozszerzenia „{0}” zdefiniowana w elemencie „{1}” nie jest ogólna (lub nie ma parametrów typu dowolnego) i dlatego nie może mieć argumentów typu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExtensionMethodCannotBeLateBound"> <source>Late-bound extension methods are not supported.</source> <target state="translated">Metody rozszerzenia z późnym wiązaniem nie są obsługiwane.</target> <note /> </trans-unit> <trans-unit id="ERR_TypeInferenceArrayRankMismatch1"> <source>Cannot infer a data type for '{0}' because the array dimensions do not match.</source> <target state="translated">Nie można wywnioskować typu danych dla elementu „{0}”, ponieważ wymiary tablicy nie są zgodne.</target> <note /> </trans-unit> <trans-unit id="ERR_QueryStrictDisallowImplicitObject"> <source>Type of the range variable cannot be inferred, and late binding is not allowed with Option Strict on. Use an 'As' clause to specify the type.</source> <target state="translated">Nie można wywnioskować typu zmiennej zakresu, a późne wiązanie nie jest dozwolone z ustawieniem Option Strict on. Użyj klauzuli „As”, aby określić typ.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedInterfaceWithGeneric"> <source>Type '{0}' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.</source> <target state="translated">Typ „{0}” nie może zostać osadzony, ponieważ ma argument ogólny. Rozważ wyłączenie osadzania typów międzyoperacyjnych.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotUseGenericTypeAcrossAssemblyBoundaries"> <source>Type '{0}' cannot be used across assembly boundaries because it has a generic type argument that is an embedded interop type.</source> <target state="translated">Typ „{0}” nie może być używany między granicami zestawu, ponieważ ma argument typu ogólnego, który jest osadzonym typem międzyoperacyjnym.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbol2"> <source>'{0}' is obsolete: '{1}'.</source> <target state="translated">'Element „{0}” jest przestarzały: „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbol2_Title"> <source>Type or member is obsolete</source> <target state="translated">Typ lub składowa jest przestarzała</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverloadBase4"> <source>{0} '{1}' shadows an overloadable member declared in the base {2} '{3}'. If you want to overload the base method, this method must be declared 'Overloads'.</source> <target state="translated">Element {0} „{1}” zasłania składową, która może zostać przeciążona i jest zadeklarowana w bazowym elemencie {2} „{3}”. Aby można było przeciążyć metodę bazową, ta metoda musi być zadeklarowana jako „Overloads”.</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverloadBase4_Title"> <source>Member shadows an overloadable member declared in the base type</source> <target state="translated">Składowa zasłania składową z możliwością przeciążenia zadeklarowaną w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_OverrideType5"> <source>{0} '{1}' conflicts with {2} '{1}' in the base {3} '{4}' and should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt z elementem {2} „{1}” w podstawowym elemencie {3} „{4}” i powinien być zadeklarowany jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_OverrideType5_Title"> <source>Member conflicts with member in the base type and should be declared 'Shadows'</source> <target state="translated">Wystąpił konflikt składowej ze składową w typie podstawowym — należy zadeklarować element „Shadows”</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverride2"> <source>{0} '{1}' shadows an overridable method in the base {2} '{3}'. To override the base method, this method must be declared 'Overrides'.</source> <target state="translated">Element {0} „{1}” zasłania w podstawowym elemencie {2} „{3}” metodę, którą można przesłonić. Aby można było przesłonić metodę podstawową, metoda ta musi być zadeklarowana jako „Overrides”.</target> <note /> </trans-unit> <trans-unit id="WRN_MustOverride2_Title"> <source>Member shadows an overridable method in the base type</source> <target state="translated">Składowa zasłania metodę z możliwością przeciążenia zadeklarowaną w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultnessShadowed4"> <source>Default property '{0}' conflicts with the default property '{1}' in the base {2} '{3}'. '{0}' will be the default property. '{0}' should be declared 'Shadows'.</source> <target state="translated">Właściwość domyślna „{0}” powoduje konflikt z właściwością domyślną „{1}” w podstawowym elemencie {2} „{3}”. Właściwość „{0}” będzie domyślna. Właściwość „{0}” powinna zostać zadeklarowana jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_DefaultnessShadowed4_Title"> <source>Default property conflicts with the default property in the base type</source> <target state="translated">Wystąpił konflikt właściwości domyślnej z właściwością domyślną w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbolNoMessage1"> <source>'{0}' is obsolete.</source> <target state="translated">'Element „{0}” jest przestarzały.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoleteSymbolNoMessage1_Title"> <source>Type or member is obsolete</source> <target state="translated">Typ lub składowa jest przestarzała</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration0"> <source>Possible problem detected while building assembly: {0}</source> <target state="translated">Wykryto potencjalny problem podczas kompilowania zestawu: {0}.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration0_Title"> <source>Possible problem detected while building assembly</source> <target state="translated">Wykryto potencjalny problem podczas kompilowania zestawu</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration1"> <source>Possible problem detected while building assembly '{0}': {1}</source> <target state="translated">Wykryto potencjalny problem podczas kompilowania zestawu „{0}”: {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyGeneration1_Title"> <source>Possible problem detected while building assembly</source> <target state="translated">Wykryto potencjalny problem podczas kompilowania zestawu</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassNoMembers1"> <source>'Microsoft.VisualBasic.ComClassAttribute' is specified for class '{0}' but '{0}' has no public members that can be exposed to COM; therefore, no COM interfaces are generated.</source> <target state="translated">'Element „Microsoft.VisualBasic.ComClassAttribute” jest określony dla klasy „{0}”, ale klasa „{0}” nie ma publicznych składowych, których można ujawnić w modelu COM. Z tego powodu nie wygenerowano interfejsów modelu COM.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassNoMembers1_Title"> <source>'Microsoft.VisualBasic.ComClassAttribute' is specified for class but class has no public members that can be exposed to COM</source> <target state="translated">'Atrybut „Microsoft.VisualBasic.ComClassAttribute” został określony dla klasy, ale klasa nie zawiera publicznych składowych, które można ujawnić modelowi COM</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsMember5"> <source>{0} '{1}' implicitly declares '{2}', which conflicts with a member in the base {3} '{4}', and so the {0} should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” niejawnie deklaruje element „{2}”, który powoduje konflikt ze składową w bazowym elemencie {3} „{4}” i dlatego element {0} powinien być zadeklarowany jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsMember5_Title"> <source>Property or event implicitly declares type or member that conflicts with a member in the base type</source> <target state="translated">Właściwość lub zdarzenie niejawnie deklaruje typ lub składową powodującą konflikt ze składową w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_MemberShadowsSynthMember6"> <source>{0} '{1}' conflicts with a member implicitly declared for {2} '{3}' in the base {4} '{5}' and should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt ze składową niejawnie zadeklarowaną dla elementu {2} „{3}” w bazowym elemencie {4} „{5}” i dlatego powinien być zadeklarowany jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_MemberShadowsSynthMember6_Title"> <source>Member conflicts with a member implicitly declared for property or event in the base type</source> <target state="translated">Wystąpił konflikt składowej ze składową niejawnie zadeklarowaną dla właściwości lub zdarzenia w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsSynthMember7"> <source>{0} '{1}' implicitly declares '{2}', which conflicts with a member implicitly declared for {3} '{4}' in the base {5} '{6}'. {0} should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” deklaruje niejawnie element „{2}”, który powoduje konflikt ze składową niejawnie zadeklarowaną dla elementu {3} „{4}” w bazowym elemencie {5} „{6}”. Element {0} należy zadeklarować jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_SynthMemberShadowsSynthMember7_Title"> <source>Property or event implicitly declares member, which conflicts with a member implicitly declared for property or event in the base type</source> <target state="translated">Właściwość lub zdarzenie niejawnie deklaruje składową powodującą konflikt ze składową niejawnie zadeklarowaną dla właściwości lub zdarzenia w typie podstawowym</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor3"> <source>'{0}' accessor of '{1}' is obsolete: '{2}'.</source> <target state="translated">'Metoda dostępu „{0}” elementu „{1}” jest przestarzała: „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor3_Title"> <source>Property accessor is obsolete</source> <target state="translated">Metoda dostępu do właściwości jest przestarzała</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor2"> <source>'{0}' accessor of '{1}' is obsolete.</source> <target state="translated">'Metoda dostępu „{0}” elementu „{1}” jest przestarzała.</target> <note /> </trans-unit> <trans-unit id="WRN_UseOfObsoletePropertyAccessor2_Title"> <source>Property accessor is obsolete</source> <target state="translated">Metoda dostępu do właściwości jest przestarzała</target> <note /> </trans-unit> <trans-unit id="WRN_FieldNotCLSCompliant1"> <source>Type of member '{0}' is not CLS-compliant.</source> <target state="translated">Typ składowej „{0}” nie jest zgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_FieldNotCLSCompliant1_Title"> <source>Type of member is not CLS-compliant</source> <target state="translated">Typ składowej jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_BaseClassNotCLSCompliant2"> <source>'{0}' is not CLS-compliant because it derives from '{1}', which is not CLS-compliant.</source> <target state="translated">'Element „{0}” jest niezgodny ze specyfikacją CLS, ponieważ dziedziczy po elemencie „{1}”, który jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_BaseClassNotCLSCompliant2_Title"> <source>Type is not CLS-compliant because it derives from base type that is not CLS-compliant</source> <target state="translated">Typ jest niezgodny ze specyfikacją CLS, ponieważ pochodzi od typu podstawowego, który jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ProcTypeNotCLSCompliant1"> <source>Return type of function '{0}' is not CLS-compliant.</source> <target state="translated">Zwracany typ funkcji „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_ProcTypeNotCLSCompliant1_Title"> <source>Return type of function is not CLS-compliant</source> <target state="translated">Zwracany typ funkcji jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ParamNotCLSCompliant1"> <source>Type of parameter '{0}' is not CLS-compliant.</source> <target state="translated">Typ parametru „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_ParamNotCLSCompliant1_Title"> <source>Type of parameter is not CLS-compliant</source> <target state="translated">Typ parametru jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_InheritedInterfaceNotCLSCompliant2"> <source>'{0}' is not CLS-compliant because the interface '{1}' it inherits from is not CLS-compliant.</source> <target state="translated">'Element „{0}” jest niezgodny ze specyfikacją CLS, ponieważ interfejs „{1}”, po którym dziedziczy, jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_InheritedInterfaceNotCLSCompliant2_Title"> <source>Type is not CLS-compliant because the interface it inherits from is not CLS-compliant</source> <target state="translated">Typ jest niezgodny ze specyfikacją CLS, ponieważ interfejs, po którym on dziedziczy, jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLSMemberInNonCLSType3"> <source>{0} '{1}' cannot be marked CLS-compliant because its containing type '{2}' is not CLS-compliant.</source> <target state="translated">Elementu {0} „{1}” nie można oznaczyć jako zgodnego ze specyfikacją CLS, ponieważ jego zawierający typ „{2}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSMemberInNonCLSType3_Title"> <source>Member cannot be marked CLS-compliant because its containing type is not CLS-compliant</source> <target state="translated">Nie można oznaczyć składowej jako zgodnej ze specyfikacją CLS, ponieważ jej typ zawierający jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NameNotCLSCompliant1"> <source>Name '{0}' is not CLS-compliant.</source> <target state="translated">Nazwa „{0}” jest niezgodna ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NameNotCLSCompliant1_Title"> <source>Name is not CLS-compliant</source> <target state="translated">Nazwa jest niezgodna ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_EnumUnderlyingTypeNotCLS1"> <source>Underlying type '{0}' of Enum is not CLS-compliant.</source> <target state="translated">Typ bazowy „{0}” wyliczenia jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_EnumUnderlyingTypeNotCLS1_Title"> <source>Underlying type of Enum is not CLS-compliant</source> <target state="translated">Typ podstawowy wyliczenia jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMemberInCLSInterface1"> <source>Non CLS-compliant '{0}' is not allowed in a CLS-compliant interface.</source> <target state="translated">Element „{0}” niezgodny ze specyfikacją CLS jest niedozwolony w interfejsie zgodnym ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMemberInCLSInterface1_Title"> <source>Non CLS-compliant member is not allowed in a CLS-compliant interface</source> <target state="translated">Niezgodna ze specyfikacją CLS składowa jest niedozwolona w interfejsie zgodnym ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMustOverrideInCLSType1"> <source>Non CLS-compliant 'MustOverride' member is not allowed in CLS-compliant type '{0}'.</source> <target state="translated">Składowa „MustOverride” niezgodna ze specyfikacją CLS nie jest dozwolona w elementach „{0}” zgodnych ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_NonCLSMustOverrideInCLSType1_Title"> <source>Non CLS-compliant 'MustOverride' member is not allowed in CLS-compliant type</source> <target state="translated">Niezgodna ze specyfikacją CLS składowa „MustOverride” jest niedozwolona w typie zgodnym ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayOverloadsNonCLS2"> <source>'{0}' is not CLS-compliant because it overloads '{1}' which differs from it only by array of array parameter types or by the rank of the array parameter types.</source> <target state="translated">Element „{0}” nie jest zgodny ze specyfikacją CLS, ponieważ przeciąża element „{1}”, który różni się od niego tylko tablicą typów parametrów tablicowych lub rangą typów parametrów tablicowych.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayOverloadsNonCLS2_Title"> <source>Method is not CLS-compliant because it overloads method which differs from it only by array of array parameter types or by the rank of the array parameter types</source> <target state="translated">Metoda jest niezgodna ze specyfikacją CLS, ponieważ przeciąża metodę, która różni się od niej tylko tablicą typów parametrów tablicowych lub rangą typów parametrów tablicowych</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant1"> <source>Root namespace '{0}' is not CLS-compliant.</source> <target state="translated">Główna przestrzeń nazw „{0}” jest niezgodna ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant1_Title"> <source>Root namespace is not CLS-compliant</source> <target state="translated">Główna przestrzeń nazw jest niezgodna ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant2"> <source>Name '{0}' in the root namespace '{1}' is not CLS-compliant.</source> <target state="translated">Nazwa „{0}” w głównej przestrzeni nazw „{1}” jest niezgodna ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_RootNamespaceNotCLSCompliant2_Title"> <source>Part of the root namespace is not CLS-compliant</source> <target state="translated">Część głównej przestrzeni nazw jest niezgodna ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_GenericConstraintNotCLSCompliant1"> <source>Generic parameter constraint type '{0}' is not CLS-compliant.</source> <target state="translated">Typ ograniczenia parametru ogólnego „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_GenericConstraintNotCLSCompliant1_Title"> <source>Generic parameter constraint type is not CLS-compliant</source> <target state="translated">Typ ograniczenia parametru ogólnego jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_TypeNotCLSCompliant1"> <source>Type '{0}' is not CLS-compliant.</source> <target state="translated">Typ „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeNotCLSCompliant1_Title"> <source>Type is not CLS-compliant</source> <target state="translated">Typ nie jest zgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_OptionalValueNotCLSCompliant1"> <source>Type of optional value for optional parameter '{0}' is not CLS-compliant.</source> <target state="translated">Typ wartości opcjonalnej dla parametru opcjonalnego „{0}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_OptionalValueNotCLSCompliant1_Title"> <source>Type of optional value for optional parameter is not CLS-compliant</source> <target state="translated">Typ opcjonalnej wartości parametru opcjonalnego jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_CLSAttrInvalidOnGetSet"> <source>System.CLSCompliantAttribute cannot be applied to property 'Get' or 'Set'.</source> <target state="translated">Nie można zastosować elementu System.CLSCompliantAttribute do właściwości „Get” lub „Set”.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSAttrInvalidOnGetSet_Title"> <source>System.CLSCompliantAttribute cannot be applied to property 'Get' or 'Set'</source> <target state="translated">Nie można zastosować elementu System.CLSCompliantAttribute do właściwości „Get” lub „Set”</target> <note /> </trans-unit> <trans-unit id="WRN_TypeConflictButMerged6"> <source>{0} '{1}' and partial {2} '{3}' conflict in {4} '{5}', but are being merged because one of them is declared partial.</source> <target state="translated">Element {0} „{1}” i częściowy element {2} „{3}” powodują konflikt w elemencie {4} „{5}”, ale są scalane, ponieważ jeden z nich jest zadeklarowany jako częściowy.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeConflictButMerged6_Title"> <source>Type and partial type conflict, but are being merged because one of them is declared partial</source> <target state="translated">Wystąpił konflikt typu i typu częściowego, ale trwa ich scalanie, ponieważ jeden z nich został zadeklarowany jako częściowy</target> <note /> </trans-unit> <trans-unit id="WRN_ShadowingGenericParamWithParam1"> <source>Type parameter '{0}' has the same name as a type parameter of an enclosing type. Enclosing type's type parameter will be shadowed.</source> <target state="translated">Parametr typu „{0}” ma taką samą nazwę jak parametr typu zamykającego. Parametr typu zamykającego zostanie zasłonięty.</target> <note /> </trans-unit> <trans-unit id="WRN_ShadowingGenericParamWithParam1_Title"> <source>Type parameter has the same name as a type parameter of an enclosing type</source> <target state="translated">Parametr typu ma taką samą nazwę jak parametr typu otaczającego</target> <note /> </trans-unit> <trans-unit id="WRN_CannotFindStandardLibrary1"> <source>Could not find standard library '{0}'.</source> <target state="translated">Nie można odnaleźć biblioteki standardowej „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_CannotFindStandardLibrary1_Title"> <source>Could not find standard library</source> <target state="translated">Nie można odnaleźć biblioteki standardowej</target> <note /> </trans-unit> <trans-unit id="WRN_EventDelegateTypeNotCLSCompliant2"> <source>Delegate type '{0}' of event '{1}' is not CLS-compliant.</source> <target state="translated">Typ delegowany „{0}” zdarzenia „{1}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_EventDelegateTypeNotCLSCompliant2_Title"> <source>Delegate type of event is not CLS-compliant</source> <target state="translated">Typ delegowania zdarzenia jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_DebuggerHiddenIgnoredOnProperties"> <source>System.Diagnostics.DebuggerHiddenAttribute does not affect 'Get' or 'Set' when applied to the Property definition. Apply the attribute directly to the 'Get' and 'Set' procedures as appropriate.</source> <target state="translated">Atrybut System.Diagnostics.DebuggerHiddenAttribute nie ma wpływu na elementy „Get” ani „Set”, gdy jest stosowany do definicji Property. Zastosuj atrybut bezpośrednio do odpowiednich procedur „Get” i „Set”.</target> <note /> </trans-unit> <trans-unit id="WRN_DebuggerHiddenIgnoredOnProperties_Title"> <source>System.Diagnostics.DebuggerHiddenAttribute does not affect 'Get' or 'Set' when applied to the Property definition</source> <target state="translated">Atrybut System.Diagnostics.DebuggerHiddenAttribute zastosowany dla definicji właściwości nie ma wpływu na właściwości „Get” lub „Set”</target> <note /> </trans-unit> <trans-unit id="WRN_SelectCaseInvalidRange"> <source>Range specified for 'Case' statement is not valid. Make sure that the lower bound is less than or equal to the upper bound.</source> <target state="translated">Zakres określony dla instrukcji „Case” jest nieprawidłowy. Upewnij się, że dolna granica jest mniejsza lub równa górnej granicy.</target> <note /> </trans-unit> <trans-unit id="WRN_SelectCaseInvalidRange_Title"> <source>Range specified for 'Case' statement is not valid</source> <target state="translated">Zakres określony dla instrukcji „Case” jest nieprawidłowy</target> <note /> </trans-unit> <trans-unit id="WRN_CLSEventMethodInNonCLSType3"> <source>'{0}' method for event '{1}' cannot be marked CLS compliant because its containing type '{2}' is not CLS compliant.</source> <target state="translated">'Metody „{0}” dla zdarzenia „{1}” nie można oznaczyć jako zgodnej ze specyfikacją CLS, ponieważ jej typ zawierający „{2}” jest niezgodny ze specyfikacją CLS.</target> <note /> </trans-unit> <trans-unit id="WRN_CLSEventMethodInNonCLSType3_Title"> <source>AddHandler or RemoveHandler method for event cannot be marked CLS compliant because its containing type is not CLS compliant</source> <target state="translated">Nie można oznaczyć metody AddHandler lub RemoveHandler dla zdarzenia jako zgodnej ze specyfikacją CLS, ponieważ jej typ zawierający jest niezgodny ze specyfikacją CLS</target> <note /> </trans-unit> <trans-unit id="WRN_ExpectedInitComponentCall2"> <source>'{0}' in designer-generated type '{1}' should call InitializeComponent method.</source> <target state="translated">Element „{0}” w typie wygenerowanym przez projektanta „{1}” powinien wywoływać metodę InitializeComponent.</target> <note /> </trans-unit> <trans-unit id="WRN_ExpectedInitComponentCall2_Title"> <source>Constructor in designer-generated type should call InitializeComponent method</source> <target state="translated">Konstruktor w typie wygenerowanym przez projektanta powinien wywoływać metodę InitializeComponent</target> <note /> </trans-unit> <trans-unit id="WRN_NamespaceCaseMismatch3"> <source>Casing of namespace name '{0}' does not match casing of namespace name '{1}' in '{2}'.</source> <target state="translated">Wielkość liter nazwy przestrzeni nazw „{0}” nie pasuje do wielkości liter nazwy przestrzeni nazw „{1}” w pliku „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_NamespaceCaseMismatch3_Title"> <source>Casing of namespace name does not match</source> <target state="translated">Niezgodna wielkość liter w nazwie przestrzeni nazw</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyNamespaceOrClass1"> <source>Namespace or type specified in the Imports '{0}' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.</source> <target state="translated">Przestrzeń nazw lub typ określony w elemencie Imports „{0}” nie zawiera żadnej publicznej składowej lub nie można jej znaleźć. Upewnij się, że przestrzeń nazw lub typ są zdefiniowane i zawierają co najmniej jedną publiczną składową. Upewnij się, że w nazwie importowanego elementu nie są używane aliasy.</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyNamespaceOrClass1_Title"> <source>Namespace or type specified in Imports statement doesn't contain any public member or cannot be found</source> <target state="translated">Przestrzeń nazw lub typ określony w instrukcji Imports nie zawiera żadnej publicznej składowej lub nie można jej znaleźć</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyProjectNamespaceOrClass1"> <source>Namespace or type specified in the project-level Imports '{0}' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.</source> <target state="translated">Przestrzeń nazw lub typ określony w elemencie Imports „{0}” na poziomie projektu nie zawiera żadnej publicznej składowej lub nie można jej znaleźć. Upewnij się, że przestrzeń nazw lub typ zostały zdefiniowane i zawierają co najmniej jedną publiczną składową. Upewnij się, że w nazwie importowanego elementu nie są używane aliasy.</target> <note /> </trans-unit> <trans-unit id="WRN_UndefinedOrEmptyProjectNamespaceOrClass1_Title"> <source>Namespace or type imported at project level doesn't contain any public member or cannot be found</source> <target state="translated">Przestrzeń nazw lub typ zaimportowany na poziomie projektu nie zawiera żadnej publicznej składowej lub nie można jej znaleźć</target> <note /> </trans-unit> <trans-unit id="WRN_IndirectRefToLinkedAssembly2"> <source>A reference was created to embedded interop assembly '{0}' because of an indirect reference to that assembly from assembly '{1}'. Consider changing the 'Embed Interop Types' property on either assembly.</source> <target state="translated">Utworzono odwołanie do osadzonego zestawu międzyoperacyjnego „{0}” z powodu pośredniego odwołania do tego zestawu z zestawu „{1}”. Rozważ zmianę właściwości osadzania typów międzyoperacyjnych w jednym z zestawów.</target> <note /> </trans-unit> <trans-unit id="WRN_IndirectRefToLinkedAssembly2_Title"> <source>A reference was created to embedded interop assembly because of an indirect reference to that assembly</source> <target state="translated">Utworzono odwołanie do osadzonego zestawu międzyoperacyjnego z powodu pośredniego odwołania do tego zestawu</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase3"> <source>Class '{0}' should declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete.</source> <target state="translated">Klasa „{0}” powinna deklarować element „Sub New”, ponieważ element „{1}” w swojej klasie bazowej „{2}” jest oznaczony jako przestarzały.</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase3_Title"> <source>Class should declare a 'Sub New' because the constructor in its base class is marked obsolete</source> <target state="translated">Należy zadeklarować element „Sub New” w klasie, ponieważ konstruktor w klasie bazowej został oznaczony jako przestarzały</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase4"> <source>Class '{0}' should declare a 'Sub New' because the '{1}' in its base class '{2}' is marked obsolete: '{3}'.</source> <target state="translated">Klasa „{0}” powinna deklarować element „Sub New”, ponieważ element „{1}” w swojej klasie bazowej „{2}” jest oznaczony jako przestarzały: „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_NoNonObsoleteConstructorOnBase4_Title"> <source>Class should declare a 'Sub New' because the constructor in its base class is marked obsolete</source> <target state="translated">Należy zadeklarować element „Sub New” w klasie, ponieważ konstruktor w klasie bazowej został oznaczony jako przestarzały</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall3"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete.</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” powinna być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ element „{0}” w klasie bazowej „{1}” elementu „{2}” jest oznaczony jako przestarzały.</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall3_Title"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the constructor in the base class is marked obsolete</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” powinna być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ konstruktor w klasie bazowej został oznaczony jako przestarzały</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall4"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the '{0}' in the base class '{1}' of '{2}' is marked obsolete: '{3}'</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” powinna być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ element „{0}” w klasie bazowej „{1}” elementu „{2}” jest oznaczony jako przestarzały: „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RequiredNonObsoleteNewCall4_Title"> <source>First statement of this 'Sub New' should be an explicit call to 'MyBase.New' or 'MyClass.New' because the constructor in the base class is marked obsolete</source> <target state="translated">Pierwsza instrukcja tego elementu „Sub New” powinna być jawnym wywołaniem elementu „MyBase.New” lub „MyClass.New”, ponieważ konstruktor w klasie bazowej został oznaczony jako przestarzały</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinOperator"> <source>Operator without an 'As' clause; type of Object assumed.</source> <target state="translated">Operator bez klauzuli As; przyjęto typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinOperator_Title"> <source>Operator without an 'As' clause</source> <target state="translated">Operator bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_ConstraintsFailedForInferredArgs2"> <source>Type arguments inferred for method '{0}' result in the following warnings :{1}</source> <target state="translated">Argumenty typu wywnioskowane dla metody „{0}” powodują wystąpienie następujących ostrzeżeń: {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_ConstraintsFailedForInferredArgs2_Title"> <source>Type arguments inferred for method result in warnings</source> <target state="translated">Argumenty typu wywnioskowane dla metody powodują ostrzeżenia</target> <note /> </trans-unit> <trans-unit id="WRN_ConditionalNotValidOnFunction"> <source>Attribute 'Conditional' is only valid on 'Sub' declarations.</source> <target state="translated">Atrybut „Conditional” jest prawidłowy tylko w deklaracjach „Sub”.</target> <note /> </trans-unit> <trans-unit id="WRN_ConditionalNotValidOnFunction_Title"> <source>Attribute 'Conditional' is only valid on 'Sub' declarations</source> <target state="translated">Atrybut „Conditional” jest prawidłowy tylko w deklaracjach „Sub”</target> <note /> </trans-unit> <trans-unit id="WRN_UseSwitchInsteadOfAttribute"> <source>Use command-line option '{0}' or appropriate project settings instead of '{1}'.</source> <target state="translated">Użyj opcji wiersza polecenia „{0}” lub odpowiednich ustawień projektu zamiast elementu „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UseSwitchInsteadOfAttribute_Title"> <source>Use command-line option /keyfile, /keycontainer, or /delaysign instead of AssemblyKeyFileAttribute, AssemblyKeyNameAttribute, or AssemblyDelaySignAttribute</source> <target state="translated">Użyj opcji wiersza polecenia /keyfile, /keycontainer lub /delaysign zamiast AssemblyKeyFileAttribute, AssemblyKeyNameAttribute lub AssemblyDelaySignAttribute</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveAddHandlerCall"> <source>Statement recursively calls the containing '{0}' for event '{1}'.</source> <target state="translated">Instrukcja cyklicznie wywołuje zawierający ją element „{0}” dla zdarzenia „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveAddHandlerCall_Title"> <source>Statement recursively calls the event's containing AddHandler</source> <target state="translated">Instrukcja rekursywnie wywołuje zawierający ją element AddHandler dla zdarzenia</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionCopyBack"> <source>Implicit conversion from '{1}' to '{2}' in copying the value of 'ByRef' parameter '{0}' back to the matching argument.</source> <target state="translated">Niejawna konwersja z „{1}” na „{2}” podczas kopiowania wartości parametru „ByRef” „{0}” z powrotem do pasującego argumentu.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionCopyBack_Title"> <source>Implicit conversion in copying the value of 'ByRef' parameter back to the matching argument</source> <target state="translated">Niejawna konwersja podczas kopiowania wartości parametru „ByRef” z powrotem do pasującego argumentu</target> <note /> </trans-unit> <trans-unit id="WRN_MustShadowOnMultipleInheritance2"> <source>{0} '{1}' conflicts with other members of the same name across the inheritance hierarchy and so should be declared 'Shadows'.</source> <target state="translated">Element {0} „{1}” powoduje konflikt z innymi składowymi o tej samej nazwie w hierarchii dziedziczenia i dlatego powinien być zadeklarowany jako „Shadows”.</target> <note /> </trans-unit> <trans-unit id="WRN_MustShadowOnMultipleInheritance2_Title"> <source>Method conflicts with other members of the same name across the inheritance hierarchy and so should be declared 'Shadows'</source> <target state="translated">Wystąpił konflikt metody z innymi składowymi o tej samej nazwie w hierarchii dziedziczenia — należy zadeklarować element „Shadows”</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveOperatorCall"> <source>Expression recursively calls the containing Operator '{0}'.</source> <target state="translated">Wyrażenie cyklicznie wywołuje zawierający je operator „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursiveOperatorCall_Title"> <source>Expression recursively calls the containing Operator</source> <target state="translated">Wyrażenie rekursywnie wywołuje zawierający je operator</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversion2"> <source>Implicit conversion from '{0}' to '{1}'.</source> <target state="translated">Niejawna konwersja z „{0}” na „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversion2_Title"> <source>Implicit conversion</source> <target state="translated">Niejawna konwersja</target> <note /> </trans-unit> <trans-unit id="WRN_MutableStructureInUsing"> <source>Local variable '{0}' is read-only and its type is a structure. Invoking its members or passing it ByRef does not change its content and might lead to unexpected results. Consider declaring this variable outside of the 'Using' block.</source> <target state="translated">Zmienna lokalna „{0}” jest tylko do odczytu i jej typ jest strukturą. Wywoływanie jej składowych lub przekazywanie jej przez odwołanie (ByRef) nie zmienia jej zawartości i może prowadzić do nieoczekiwanych wyników. Rozważ zadeklarowanie tej zmiennej poza blokiem „Using”.</target> <note /> </trans-unit> <trans-unit id="WRN_MutableStructureInUsing_Title"> <source>Local variable declared by Using statement is read-only and its type is a structure</source> <target state="translated">Zmienna lokalna zadeklarowana przez instrukcję Using jest przeznaczona tylko do odczytu i jej typem jest struktura</target> <note /> </trans-unit> <trans-unit id="WRN_MutableGenericStructureInUsing"> <source>Local variable '{0}' is read-only. When its type is a structure, invoking its members or passing it ByRef does not change its content and might lead to unexpected results. Consider declaring this variable outside of the 'Using' block.</source> <target state="translated">Zmienna lokalna „{0}” jest tylko do odczytu. Gdy jej typ jest strukturą, wywoływanie jej składowych lub przekazywanie jej przez odwołanie (ByRef) nie zmienia jej zawartości i może prowadzić do nieoczekiwanych wyników. Rozważ zadeklarowanie tej zmiennej poza blokiem „Using”.</target> <note /> </trans-unit> <trans-unit id="WRN_MutableGenericStructureInUsing_Title"> <source>Local variable declared by Using statement is read-only and its type may be a structure</source> <target state="translated">Zmienna lokalna zadeklarowana przez instrukcję Using jest przeznaczona tylko do odczytu i jej typem może być struktura</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionSubst1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ImplicitConversionSubst1_Title"> <source>Implicit conversion</source> <target state="translated">Niejawna konwersja</target> <note /> </trans-unit> <trans-unit id="WRN_LateBindingResolution"> <source>Late bound resolution; runtime errors could occur.</source> <target state="translated">Rozpoznanie późnego wiązania; mogą wystąpić błędy w czasie wykonywania.</target> <note /> </trans-unit> <trans-unit id="WRN_LateBindingResolution_Title"> <source>Late bound resolution</source> <target state="translated">Rozpoznawanie późnego wiązania</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1"> <source>Operands of type Object used for operator '{0}'; use the 'Is' operator to test object identity.</source> <target state="translated">Argumenty operacji typu Object użyte dla operatora „{0}”; użyj operatora „Is”, aby sprawdzić tożsamość obiektu.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1_Title"> <source>Operands of type Object used for operator</source> <target state="translated">Dla operatora użyto argumentów operacji typu Object</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath2"> <source>Operands of type Object used for operator '{0}'; runtime errors could occur.</source> <target state="translated">Argumenty operacji typu Object użyte dla operatora „{0}”; mogą wystąpić błędy podczas wykonywania.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath2_Title"> <source>Operands of type Object used for operator</source> <target state="translated">Dla operatora użyto argumentów operacji typu Object</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedVar1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedVar1_Title"> <source>Variable declaration without an 'As' clause</source> <target state="translated">Deklaracja zmiennej bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumed1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumed1_Title"> <source>Function without an 'As' clause</source> <target state="translated">Funkcja bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedProperty1"> <source>{0}</source> <target state="translated">{0}</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectAssumedProperty1_Title"> <source>Property without an 'As' clause</source> <target state="translated">Właściwość bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinVarDecl"> <source>Variable declaration without an 'As' clause; type of Object assumed.</source> <target state="translated">Deklaracja zmiennej bez klauzuli „As”; przyjęto typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinVarDecl_Title"> <source>Variable declaration without an 'As' clause</source> <target state="translated">Deklaracja zmiennej bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinFunction"> <source>Function without an 'As' clause; return type of Object assumed.</source> <target state="translated">Funkcja bez klauzuli „As”; przyjęto zwracany typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinFunction_Title"> <source>Function without an 'As' clause</source> <target state="translated">Funkcja bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinProperty"> <source>Property without an 'As' clause; type of Object assumed.</source> <target state="translated">Właściwość bez klauzuli „As”; przyjęto typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_MissingAsClauseinProperty_Title"> <source>Property without an 'As' clause</source> <target state="translated">Właściwość bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocal"> <source>Unused local variable: '{0}'.</source> <target state="translated">Nieużywana zmienna lokalna: „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocal_Title"> <source>Unused local variable</source> <target state="translated">Nieużyta zmienna lokalna</target> <note /> </trans-unit> <trans-unit id="WRN_SharedMemberThroughInstance"> <source>Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated.</source> <target state="translated">Dostęp przez wystąpienie do udostępnionej składowej, stałej składowej, składowej wyliczenia lub typu zagnieżdżonego; wyrażenie kwalifikujące nie zostanie obliczone.</target> <note /> </trans-unit> <trans-unit id="WRN_SharedMemberThroughInstance_Title"> <source>Access of shared member, constant member, enum member or nested type through an instance</source> <target state="translated">Dostęp przez wystąpienie do udostępnionej składowej, stałej składowej, składowej wyliczenia lub typu zagnieżdżonego</target> <note /> </trans-unit> <trans-unit id="WRN_RecursivePropertyCall"> <source>Expression recursively calls the containing property '{0}'.</source> <target state="translated">Wyrażenie cyklicznie wywołuje zawierającą je właściwość „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RecursivePropertyCall_Title"> <source>Expression recursively calls the containing property</source> <target state="translated">Wyrażenie rekursywnie wywołuje zawierającą je właściwość</target> <note /> </trans-unit> <trans-unit id="WRN_OverlappingCatch"> <source>'Catch' block never reached, because '{0}' inherits from '{1}'.</source> <target state="translated">'Blok „Catch” nigdy nie został osiągnięty, ponieważ element „{0}” dziedziczy po elemencie „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_OverlappingCatch_Title"> <source>'Catch' block never reached; exception type's base type handled above in the same Try statement</source> <target state="translated">'Blok „Catch” nie jest nigdy osiągany; typ podstawowy typu wyjątku jest obsługiwany powyżej w tej samej instrukcji Try</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRef"> <source>Variable '{0}' is passed by reference before it has been assigned a value. A null reference exception could result at runtime.</source> <target state="translated">Zmienna „{0}” jest przekazywana przez referencję, zanim zostanie do niej przypisana wartość. W czasie wykonania może wystąpić wyjątek referencji o wartości null.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRef_Title"> <source>Variable is passed by reference before it has been assigned a value</source> <target state="translated">Zmienna została przekazana przez referencję przed przypisaniem do niej wartości</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateCatch"> <source>'Catch' block never reached; '{0}' handled above in the same Try statement.</source> <target state="translated">'Blok „Catch” nie został nigdy osiągnięty; element „{0}” został obsłużony powyżej w tej samej instrukcji Try.</target> <note /> </trans-unit> <trans-unit id="WRN_DuplicateCatch_Title"> <source>'Catch' block never reached; exception type handled above in the same Try statement</source> <target state="translated">'Blok „Catch” nie jest nigdy osiągany; typ wyjątku jest obsługiwany powyżej w tej samej instrukcji Try</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1Not"> <source>Operands of type Object used for operator '{0}'; use the 'IsNot' operator to test object identity.</source> <target state="translated">Argumenty operacji typu Object użyte dla operatora „{0}”; użyj operatora „IsNot”, aby sprawdzić tożsamość obiektu.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMath1Not_Title"> <source>Operands of type Object used for operator &lt;&gt;</source> <target state="translated">Dla operatora &lt;&gt; użyto argumentów operacji typu Object</target> <note /> </trans-unit> <trans-unit id="WRN_BadChecksumValExtChecksum"> <source>Bad checksum value, non hex digits or odd number of hex digits.</source> <target state="translated">Nieprawidłowa wartość sumy kontrolnej, cyfry nieszesnastkowe lub nieparzysta liczba cyfr szesnastkowych.</target> <note /> </trans-unit> <trans-unit id="WRN_BadChecksumValExtChecksum_Title"> <source>Bad checksum value, non hex digits or odd number of hex digits</source> <target state="translated">Nieprawidłowa wartość sumy kontrolnej, cyfry nieszesnastkowe lub nieparzysta liczba cyfr szesnastkowych</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleDeclFileExtChecksum"> <source>File name already declared with a different GUID and checksum value.</source> <target state="translated">Nazwa pliku została już zadeklarowana z innym identyfikatorem GUID i wartością sumy kontrolnej.</target> <note /> </trans-unit> <trans-unit id="WRN_MultipleDeclFileExtChecksum_Title"> <source>File name already declared with a different GUID and checksum value</source> <target state="translated">Nazwa pliku została już zadeklarowana z innym identyfikatorem GUID i inną wartością sumy kontrolnej</target> <note /> </trans-unit> <trans-unit id="WRN_BadGUIDFormatExtChecksum"> <source>Bad GUID format.</source> <target state="translated">Nieprawidłowy format identyfikatora GUID.</target> <note /> </trans-unit> <trans-unit id="WRN_BadGUIDFormatExtChecksum_Title"> <source>Bad GUID format</source> <target state="translated">Nieprawidłowy format identyfikatora GUID</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMathSelectCase"> <source>Operands of type Object used in expressions for 'Select', 'Case' statements; runtime errors could occur.</source> <target state="translated">Argumenty operacji typu Object używane w wyrażeniach dla instrukcji Select, Case; mogą wystąpić błędy czasu wykonania.</target> <note /> </trans-unit> <trans-unit id="WRN_ObjectMathSelectCase_Title"> <source>Operands of type Object used in expressions for 'Select', 'Case' statements</source> <target state="translated">W wyrażeniach dla instrukcji „Select” i „Case” użyto argumentów operacji typu Object</target> <note /> </trans-unit> <trans-unit id="WRN_EqualToLiteralNothing"> <source>This expression will always evaluate to Nothing (due to null propagation from the equals operator). To check if the value is null consider using 'Is Nothing'.</source> <target state="translated">Wartością tego wyrażenia zawsze będzie Nothing (z powodu propagacji wartości null z operatora równości). Aby sprawdzać, czy wartość jest równa null, rozważ użycie warunku „Is Nothing”.</target> <note /> </trans-unit> <trans-unit id="WRN_EqualToLiteralNothing_Title"> <source>This expression will always evaluate to Nothing</source> <target state="translated">To wyrażenie zawsze da wynik Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_NotEqualToLiteralNothing"> <source>This expression will always evaluate to Nothing (due to null propagation from the equals operator). To check if the value is not null consider using 'IsNot Nothing'.</source> <target state="translated">Wartością tego wyrażenia zawsze będzie Nothing (z powodu propagacji wartości null z operatora równości). Aby sprawdzać, czy wartość nie jest równa null, rozważ użycie warunku „IsNot Nothing”.</target> <note /> </trans-unit> <trans-unit id="WRN_NotEqualToLiteralNothing_Title"> <source>This expression will always evaluate to Nothing</source> <target state="translated">To wyrażenie zawsze da wynik Nothing</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocalConst"> <source>Unused local constant: '{0}'.</source> <target state="translated">Nieużywana stała lokalna: „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_UnusedLocalConst_Title"> <source>Unused local constant</source> <target state="translated">Nieużywana stała lokalna</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassInterfaceShadows5"> <source>'Microsoft.VisualBasic.ComClassAttribute' on class '{0}' implicitly declares {1} '{2}', which conflicts with a member of the same name in {3} '{4}'. Use 'Microsoft.VisualBasic.ComClassAttribute(InterfaceShadows:=True)' if you want to hide the name on the base {4}.</source> <target state="translated">'Element „Microsoft.VisualBasic.ComClassAttribute” w klasie „{0}” niejawnie deklaruje element {1} „{2}”, który powoduje konflikt ze składową o tej samej nazwie w elemencie {3} „{4}”. Użyj elementu „Microsoft.VisualBasic.ComClassAttribute(InterfaceShadows:=True)”, jeśli chcesz ukryć nazwę w bazie {4}.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassInterfaceShadows5_Title"> <source>'Microsoft.VisualBasic.ComClassAttribute' on class implicitly declares member, which conflicts with a member of the same name</source> <target state="translated">'Atrybut „Microsoft.VisualBasic.ComClassAttribute” klasy niejawnie deklaruje składową pozostającą w konflikcie ze składową o tej samej nazwie</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassPropertySetObject1"> <source>'{0}' cannot be exposed to COM as a property 'Let'. You will not be able to assign non-object values (such as numbers or strings) to this property from Visual Basic 6.0 using a 'Let' statement.</source> <target state="translated">'Element „{0}” nie może być ujawniony dla modelu COM jako instrukcja „Let” właściwości. Przy użyciu instrukcji „Let” nie będzie można przypisać do tej właściwości wartości niebędących obiektami (takich jak liczby czy ciągi) w języku Visual Basic 6.0.</target> <note /> </trans-unit> <trans-unit id="WRN_ComClassPropertySetObject1_Title"> <source>Property cannot be exposed to COM as a property 'Let'</source> <target state="translated">Nie można ujawnić właściwości modelowi COM jako właściwości „Let”</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRef"> <source>Variable '{0}' is used before it has been assigned a value. A null reference exception could result at runtime.</source> <target state="translated">Zmienna „{0}” jest używana, zanim zostanie do niej przypisana wartość. Podczas wykonywania może wystąpić wyjątek pustej referencji.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRef_Title"> <source>Variable is used before it has been assigned a value</source> <target state="translated">Zmienna została użyta przed przypisaniem do niej wartości</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncRef1"> <source>Function '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">Funkcja „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Podczas wykonywania może wystąpić wyjątek pustej referencji, gdy zostanie użyty wynik.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncRef1_Title"> <source>Function doesn't return a value on all code paths</source> <target state="translated">Funkcja nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpRef1"> <source>Operator '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">Operator „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Podczas wykonywania może wystąpić wyjątek pustej referencji, gdy zostanie użyty wynik.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpRef1_Title"> <source>Operator doesn't return a value on all code paths</source> <target state="translated">Operator nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropRef1"> <source>Property '{0}' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.</source> <target state="translated">Właściwość „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Podczas wykonywania może wystąpić wyjątek pustej referencji, gdy zostanie użyty wynik.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropRef1_Title"> <source>Property doesn't return a value on all code paths</source> <target state="translated">Właściwość nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRefStr"> <source>Variable '{0}' is passed by reference before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use</source> <target state="translated">Zmienna „{0}” jest przekazywana przez referencję, zanim zostanie do niej przypisana wartość. Podczas wykonywania może wystąpić wyjątek referencji o wartości null. Upewnij się, że struktura lub wszystkie składowe odwołania są zainicjowane przed użyciem</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefByRefStr_Title"> <source>Variable is passed by reference before it has been assigned a value</source> <target state="translated">Zmienna została przekazana przez referencję przed przypisaniem do niej wartości</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefStr"> <source>Variable '{0}' is used before it has been assigned a value. A null reference exception could result at runtime. Make sure the structure or all the reference members are initialized before use</source> <target state="translated">Zmienna „{0}” jest używana, zanim zostanie do niej przypisana wartość. Podczas wykonywania może wystąpić wyjątek pustej referencji. Upewnij się, że struktura lub wszystkie składowe odwołania są zainicjowane przed użyciem.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgUseNullRefStr_Title"> <source>Variable is used before it has been assigned a value</source> <target state="translated">Zmienna została użyta przed przypisaniem do niej wartości</target> <note /> </trans-unit> <trans-unit id="WRN_StaticLocalNoInference"> <source>Static variable declared without an 'As' clause; type of Object assumed.</source> <target state="translated">Zmienna statyczna zadeklarowana bez klauzuli „As”; przyjęto typ Object.</target> <note /> </trans-unit> <trans-unit id="WRN_StaticLocalNoInference_Title"> <source>Static variable declared without an 'As' clause</source> <target state="translated">Zmienna statyczna zadeklarowana bez klauzuli „As”</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName"> <source>Assembly reference '{0}' is invalid and cannot be resolved.</source> <target state="translated">Odwołanie do zestawu „{0}” jest nieprawidłowe i nie można go rozpoznać.</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidAssemblyName_Title"> <source>Assembly reference is invalid and cannot be resolved</source> <target state="translated">Odwołanie do zestawu jest nieprawidłowe i nie można go rozpoznać</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadXMLLine"> <source>XML comment block must immediately precede the language element to which it applies. XML comment will be ignored.</source> <target state="translated">Blok komentarza XML musi bezpośrednio poprzedzać element języka, do którego jest stosowany. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadXMLLine_Title"> <source>XML comment block must immediately precede the language element to which it applies</source> <target state="translated">Blok komentarza XML musi bezpośrednio poprzedzać element języka, do którego jest stosowany</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocMoreThanOneCommentBlock"> <source>Only one XML comment block is allowed per language element.</source> <target state="translated">Tylko jeden blok komentarza XML może przypadać na element języka.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocMoreThanOneCommentBlock_Title"> <source>Only one XML comment block is allowed per language element</source> <target state="translated">Dozwolony jest tylko jeden blok komentarza XML na element języka</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocNotFirstOnLine"> <source>XML comment must be the first statement on a line. XML comment will be ignored.</source> <target state="translated">Komentarz XML musi być pierwszą instrukcją w wierszu. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocNotFirstOnLine_Title"> <source>XML comment must be the first statement on a line</source> <target state="translated">Komentarz XML musi być pierwszą instrukcją w wierszu</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInsideMethod"> <source>XML comment cannot appear within a method or a property. XML comment will be ignored.</source> <target state="translated">Komentarz XML nie może występować w metodzie ani właściwości. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInsideMethod_Title"> <source>XML comment cannot appear within a method or a property</source> <target state="translated">Komentarz XML nie może występować w metodzie ani właściwości</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParseError1"> <source>XML documentation parse error: {0} XML comment will be ignored.</source> <target state="translated">Błąd analizowania dokumentacji XML: komentarz XML {0} zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParseError1_Title"> <source>XML documentation parse error</source> <target state="translated">Błąd analizowania dokumentacji XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocDuplicateXMLNode1"> <source>XML comment tag '{0}' appears with identical attributes more than once in the same XML comment block.</source> <target state="translated">Tag komentarza XML „{0}” występuje z identycznymi atrybutami więcej niż raz w tym samym bloku komentarza XML.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocDuplicateXMLNode1_Title"> <source>XML comment tag appears with identical attributes more than once in the same XML comment block</source> <target state="translated">Tag komentarza XML występuje z identycznymi atrybutami więcej niż raz w tym samym bloku komentarza XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocIllegalTagOnElement2"> <source>XML comment tag '{0}' is not permitted on a '{1}' language element.</source> <target state="translated">Tag komentarza XML „{0}” nie jest dozwolony w elemencie języka „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocIllegalTagOnElement2_Title"> <source>XML comment tag is not permitted on language element</source> <target state="translated">Tag komentarza XML nie jest dozwolony w elemencie języka</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadParamTag2"> <source>XML comment parameter '{0}' does not match a parameter on the corresponding '{1}' statement.</source> <target state="translated">Parametr komentarza XML „{0}” nie jest zgodny z parametrem w odpowiedniej instrukcji „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadParamTag2_Title"> <source>XML comment parameter does not match a parameter on the corresponding declaration statement</source> <target state="translated">Parametr komentarza XML jest niezgodny z parametrem w odpowiedniej instrukcji deklaracji</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParamTagWithoutName"> <source>XML comment parameter must have a 'name' attribute.</source> <target state="translated">Parametr komentarza XML musi mieć atrybut „name”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocParamTagWithoutName_Title"> <source>XML comment parameter must have a 'name' attribute</source> <target state="translated">Parametr komentarza XML musi mieć atrybut „name”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefAttributeNotFound1"> <source>XML comment has a tag with a 'cref' attribute '{0}' that could not be resolved.</source> <target state="translated">Komentarz XML ma tag z atrybutem „cref” „{0}”, którego nie można rozpoznać.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefAttributeNotFound1_Title"> <source>XML comment has a tag with a 'cref' attribute that could not be resolved</source> <target state="translated">Komentarz XML ma tag z atrybutem „cref”, którego nie można rozpoznać</target> <note /> </trans-unit> <trans-unit id="WRN_XMLMissingFileOrPathAttribute1"> <source>XML comment tag 'include' must have a '{0}' attribute. XML comment will be ignored.</source> <target state="translated">Tag komentarza XML „include” musi mieć atrybut „{0}”. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLMissingFileOrPathAttribute1_Title"> <source>XML comment tag 'include' must have 'file' and 'path' attributes</source> <target state="translated">Tag komentarza XML „include” musi mieć atrybuty „file” i „path”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLCannotWriteToXMLDocFile2"> <source>Unable to create XML documentation file '{0}': {1}</source> <target state="translated">Nie można utworzyć pliku XML dokumentacji „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLCannotWriteToXMLDocFile2_Title"> <source>Unable to create XML documentation file</source> <target state="translated">Nie można utworzyć pliku XML dokumentacji</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocWithoutLanguageElement"> <source>XML documentation comments must precede member or type declarations.</source> <target state="translated">Komentarze dokumentacji XML muszą występować przed deklaracjami składowej lub typu.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocWithoutLanguageElement_Title"> <source>XML documentation comments must precede member or type declarations</source> <target state="translated">Komentarze dokumentacji XML muszą występować przed deklaracjami składowej lub typu</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnWriteOnlyProperty"> <source>XML comment tag 'returns' is not permitted on a 'WriteOnly' Property.</source> <target state="translated">Tag komentarza XML „returns” jest niedozwolony we właściwości „WriteOnly”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnWriteOnlyProperty_Title"> <source>XML comment tag 'returns' is not permitted on a 'WriteOnly' Property</source> <target state="translated">Tag komentarza XML „returns” jest niedozwolony we właściwości „WriteOnly”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocOnAPartialType"> <source>XML comment cannot be applied more than once on a partial {0}. XML comments for this {0} will be ignored.</source> <target state="translated">Komentarza XML nie można zastosować więcej niż raz w częściowym elemencie {0}. Komentarze XML dla tego elementu {0} zostaną zignorowane.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocOnAPartialType_Title"> <source>XML comment cannot be applied more than once on a partial type</source> <target state="translated">Nie można zastosować komentarza XML więcej niż raz w typie częściowym</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnADeclareSub"> <source>XML comment tag 'returns' is not permitted on a 'declare sub' language element.</source> <target state="translated">Tag komentarza XML „returns” jest niedozwolony w elemencie języka „declare sub”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocReturnsOnADeclareSub_Title"> <source>XML comment tag 'returns' is not permitted on a 'declare sub' language element</source> <target state="translated">Tag komentarza XML „returns” jest niedozwolony w elemencie języka „declare sub”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocStartTagWithNoEndTag"> <source>XML documentation parse error: Start tag '{0}' doesn't have a matching end tag. XML comment will be ignored.</source> <target state="translated">Błąd analizowania dokumentacji XML: tag początkowy „{0}” nie ma zgodnego tagu końcowego. Komentarz XML zostanie zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocStartTagWithNoEndTag_Title"> <source>XML documentation parse error: Start tag doesn't have a matching end tag</source> <target state="translated">Błąd analizowania dokumentacji XML: tag początkowy nie ma zgodnego tagu końcowego</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadGenericParamTag2"> <source>XML comment type parameter '{0}' does not match a type parameter on the corresponding '{1}' statement.</source> <target state="translated">Parametr typu komentarza XML „{0}” nie jest zgodny z parametrem typu w odpowiedniej instrukcji „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadGenericParamTag2_Title"> <source>XML comment type parameter does not match a type parameter on the corresponding declaration statement</source> <target state="translated">Parametr typu komentarza XML jest niezgodny z parametrem typu w odpowiedniej instrukcji deklaracji</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocGenericParamTagWithoutName"> <source>XML comment type parameter must have a 'name' attribute.</source> <target state="translated">Parametr typu komentarza XML musi mieć atrybut „name”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocGenericParamTagWithoutName_Title"> <source>XML comment type parameter must have a 'name' attribute</source> <target state="translated">Parametr typu komentarza XML musi mieć atrybut „name”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocExceptionTagWithoutCRef"> <source>XML comment exception must have a 'cref' attribute.</source> <target state="translated">Wyjątek komentarza XML musi mieć atrybut „cref”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocExceptionTagWithoutCRef_Title"> <source>XML comment exception must have a 'cref' attribute</source> <target state="translated">Wyjątek komentarza XML musi mieć atrybut „cref”</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInvalidXMLFragment"> <source>Unable to include XML fragment '{0}' of file '{1}'.</source> <target state="translated">Nie można dołączyć fragmentu XML „{0}” pliku „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocInvalidXMLFragment_Title"> <source>Unable to include XML fragment</source> <target state="translated">Nie można dołączyć fragmentu XML</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadFormedXML"> <source>Unable to include XML fragment '{1}' of file '{0}'. {2}</source> <target state="translated">Nie można dołączyć fragmentu XML „{0}” pliku „{1}”. {2}</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocBadFormedXML_Title"> <source>Unable to include XML fragment</source> <target state="translated">Nie można dołączyć fragmentu XML</target> <note /> </trans-unit> <trans-unit id="WRN_InterfaceConversion2"> <source>Runtime errors might occur when converting '{0}' to '{1}'.</source> <target state="translated">Podczas konwertowania elementu „{0}” na „{1}” mogą wystąpić błędy czasu wykonywania.</target> <note /> </trans-unit> <trans-unit id="WRN_InterfaceConversion2_Title"> <source>Runtime errors might occur when converting to or from interface type</source> <target state="translated">Błędy w czasie wykonywania mogą występować podczas konwertowania na typ interfejsu lub z tego typu</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableLambda"> <source>Using the iteration variable in a lambda expression may have unexpected results. Instead, create a local variable within the loop and assign it the value of the iteration variable.</source> <target state="translated">Użycie zmiennej iteracyjnej w wyrażeniu lambda może spowodować nieoczekiwane wyniki. Zamiast tego utwórz zmienną lokalną w pętli i przypisz jej wartość zmiennej iteracyjnej.</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableLambda_Title"> <source>Using the iteration variable in a lambda expression may have unexpected results</source> <target state="translated">Użycie zmiennej iteracji w wyrażeniu lambda może mieć nieoczekiwane skutki</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaPassedToRemoveHandler"> <source>Lambda expression will not be removed from this event handler. Assign the lambda expression to a variable and use the variable to add and remove the event.</source> <target state="translated">Wyrażenie lambda nie zostanie usunięte z tej procedury obsługi zdarzeń. Przypisz wyrażenie lambda do zmiennej i używaj jej do dodawania i usuwania zdarzenia.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaPassedToRemoveHandler_Title"> <source>Lambda expression will not be removed from this event handler</source> <target state="translated">Wyrażenie lambda nie zostanie usunięte z tej procedury obsługi zdarzeń</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableQuery"> <source>Using the iteration variable in a query expression may have unexpected results. Instead, create a local variable within the loop and assign it the value of the iteration variable.</source> <target state="translated">Użycie zmiennej iteracyjnej w wyrażeniu zapytania może spowodować nieoczekiwane wyniki. Zamiast tego utwórz zmienną lokalną w pętli i przypisz jej wartość zmiennej iteracyjnej.</target> <note /> </trans-unit> <trans-unit id="WRN_LiftControlVariableQuery_Title"> <source>Using the iteration variable in a query expression may have unexpected results</source> <target state="translated">Użycie zmiennej iteracji w wyrażeniu zapytania może mieć nieoczekiwane skutki</target> <note /> </trans-unit> <trans-unit id="WRN_RelDelegatePassedToRemoveHandler"> <source>The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event. Assign the 'AddressOf' expression to a variable, and use the variable to add or remove the method as the handler.</source> <target state="translated">Wyrażenie „AddressOf” nie przynosi efektów w tym kontekście, ponieważ argument metody dla wyrażenia „AddressOf” wymaga swobodnej konwersji na typ delegata zdarzenia. Przypisz wyrażenie „AddressOf” do zmiennej i używaj jej do dodawania lub usuwania metody jako procedury obsługi.</target> <note /> </trans-unit> <trans-unit id="WRN_RelDelegatePassedToRemoveHandler_Title"> <source>The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event</source> <target state="translated">Wyrażenie „AddressOf” nie przynosi efektów w tym kontekście, ponieważ argument metody dla wyrażenia „AddressOf” wymaga swobodnej konwersji na typ delegata zdarzenia</target> <note /> </trans-unit> <trans-unit id="WRN_QueryMissingAsClauseinVarDecl"> <source>Range variable is assumed to be of type Object because its type cannot be inferred. Use an 'As' clause to specify a different type.</source> <target state="translated">Przyjęto, że zmienna zakresu będzie typu Object, ponieważ nie można wywnioskować jej typu. Użyj klauzuli „As”, aby określić inny typ.</target> <note /> </trans-unit> <trans-unit id="WRN_QueryMissingAsClauseinVarDecl_Title"> <source>Range variable is assumed to be of type Object because its type cannot be inferred</source> <target state="translated">Przyjęto, że zmienna zakresu będzie typu Object, ponieważ nie można wywnioskować jej typu</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdaMissingFunction"> <source>Multiline lambda expression is missing 'End Function'.</source> <target state="translated">W wielowierszowym wyrażeniu lambda brakuje instrukcji „End Function”.</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdaMissingSub"> <source>Multiline lambda expression is missing 'End Sub'.</source> <target state="translated">W wielowierszowym wyrażeniu lambda brakuje instrukcji „End Sub”.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeOnLambdaReturnType"> <source>Attributes cannot be applied to return types of lambda expressions.</source> <target state="translated">Nie można stosować atrybutów do zwracanych typów wyrażeń lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_SubDisallowsStatement"> <source>Statement is not valid inside a single-line statement lambda.</source> <target state="translated">Instrukcja wewnątrz jednowierszowej instrukcji lambda jest nieprawidłowa.</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesBang"> <source>This single-line statement lambda must be enclosed in parentheses. For example: (Sub() &lt;statement&gt;)!key</source> <target state="translated">Jednowierszowa instrukcja lambda musi być ujęta w nawiasy. Na przykład: (Sub() &lt;instrukcja&gt;)!key</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesDot"> <source>This single-line statement lambda must be enclosed in parentheses. For example: (Sub() &lt;statement&gt;).Invoke()</source> <target state="translated">Jednowierszowa instrukcja lambda musi być ujęta w nawiasy. Na przykład: (Sub() &lt;instrukcja&gt;).Invoke()</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresParenthesesLParen"> <source>This single-line statement lambda must be enclosed in parentheses. For example: Call (Sub() &lt;statement&gt;) ()</source> <target state="translated">Jednowierszowa instrukcja lambda musi być ujęta w nawiasy. Na przykład: Call (Sub() &lt;instrukcja&gt;) ()</target> <note /> </trans-unit> <trans-unit id="ERR_SubRequiresSingleStatement"> <source>Single-line statement lambdas must include exactly one statement.</source> <target state="translated">Jednowierszowe instrukcje lambda muszą zawierać dokładnie jedną instrukcję.</target> <note /> </trans-unit> <trans-unit id="ERR_StaticInLambda"> <source>Static local variables cannot be declared inside lambda expressions.</source> <target state="translated">Nie można deklarować statycznych zmiennych lokalnych wewnątrz wyrażeń lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_InitializedExpandedProperty"> <source>Expanded Properties cannot be initialized.</source> <target state="translated">Rozszerzone właściwości nie mogą być zainicjowane.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCantHaveParams"> <source>Auto-implemented properties cannot have parameters.</source> <target state="translated">Właściwości zaimplementowane automatycznie nie mogą mieć parametrów.</target> <note /> </trans-unit> <trans-unit id="ERR_AutoPropertyCantBeWriteOnly"> <source>Auto-implemented properties cannot be WriteOnly.</source> <target state="translated">Właściwości implementowane automatycznie nie mogą mieć określonego ustawienia WriteOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_IllegalOperandInIIFCount"> <source>'If' operator requires either two or three operands.</source> <target state="translated">'Operator „If” wymaga dwóch lub trzech argumentów.</target> <note /> </trans-unit> <trans-unit id="ERR_NotACollection1"> <source>Cannot initialize the type '{0}' with a collection initializer because it is not a collection type.</source> <target state="translated">Nie można zainicjować typu „{0}” za pomocą inicjatora kolekcji, ponieważ to nie jest typ kolekcji.</target> <note /> </trans-unit> <trans-unit id="ERR_NoAddMethod1"> <source>Cannot initialize the type '{0}' with a collection initializer because it does not have an accessible 'Add' method.</source> <target state="translated">Nie można zainicjować typu „{0}” za pomocą inicjatora kolekcji, ponieważ nie ma on dostępnej metody „Add”.</target> <note /> </trans-unit> <trans-unit id="ERR_CantCombineInitializers"> <source>An Object Initializer and a Collection Initializer cannot be combined in the same initialization.</source> <target state="translated">Nie można łączyć inicjatora obiektu i inicjatora kolekcji w tej samej inicjacji.</target> <note /> </trans-unit> <trans-unit id="ERR_EmptyAggregateInitializer"> <source>An aggregate collection initializer entry must contain at least one element.</source> <target state="translated">Wpis inicjatora kolekcji zagregowanej musi zawierać co najmniej jeden element.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEndElementNoMatchingStart"> <source>XML end element must be preceded by a matching start element.</source> <target state="translated">Końcowy element XML musi być poprzedzony zgodnym elementem początkowym.</target> <note /> </trans-unit> <trans-unit id="ERR_MultilineLambdasCannotContainOnError"> <source>'On Error' and 'Resume' cannot appear inside a lambda expression.</source> <target state="translated">'Instrukcje „On Error” i „Resume” nie mogą wystąpić wewnątrz wyrażenia lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceDisallowedHere"> <source>Keywords 'Out' and 'In' can only be used in interface and delegate declarations.</source> <target state="translated">Słów kluczowych „Out” oraz „In” można używać tylko w deklaracjach interfejsu i delegata.</target> <note /> </trans-unit> <trans-unit id="ERR_XmlEndCDataNotAllowedInContent"> <source>The literal string ']]&gt;' is not allowed in element content.</source> <target state="translated">Ciąg literału „]]&gt;” jest niedozwolony w zawartości elementu.</target> <note /> </trans-unit> <trans-unit id="ERR_OverloadsModifierInModule"> <source>Inappropriate use of '{0}' keyword in a module.</source> <target state="translated">Nieodpowiednie użycie słowa kluczowego „{0}” w module.</target> <note /> </trans-unit> <trans-unit id="ERR_UndefinedTypeOrNamespace1"> <source>Type or namespace '{0}' is not defined.</source> <target state="translated">Nie zdefiniowano typu lub przestrzeni nazw „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_IdentityDirectCastForFloat"> <source>Using DirectCast operator to cast a floating-point value to the same type is not supported.</source> <target state="translated">Używanie operatora DirectCast do rzutowania wartości zmiennoprzecinkowych do tego samego typu nie jest obsługiwane.</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteIdentityDirectCastForValueType"> <source>Using DirectCast operator to cast a value-type to the same type is obsolete.</source> <target state="translated">Użycie operatora DirectCast do rzutowania typu wartości na ten sam typ jest przestarzałe.</target> <note /> </trans-unit> <trans-unit id="WRN_ObsoleteIdentityDirectCastForValueType_Title"> <source>Using DirectCast operator to cast a value-type to the same type is obsolete</source> <target state="translated">Użycie operatora DirectCast do rzutowania typu wartości na ten sam typ jest przestarzałe</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode"> <source>Unreachable code detected.</source> <target state="translated">Wykryto nieosiągalny kod.</target> <note /> </trans-unit> <trans-unit id="WRN_UnreachableCode_Title"> <source>Unreachable code detected</source> <target state="translated">Wykryto nieosiągalny kod</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncVal1"> <source>Function '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">Funkcja „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Czy nie brakuje instrukcji „Return”?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValFuncVal1_Title"> <source>Function doesn't return a value on all code paths</source> <target state="translated">Funkcja nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpVal1"> <source>Operator '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">Operator „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Czy nie brakuje instrukcji „Return”?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValOpVal1_Title"> <source>Operator doesn't return a value on all code paths</source> <target state="translated">Operator nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropVal1"> <source>Property '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">Właściwość „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Czy nie brakuje instrukcji „Return”?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValPropVal1_Title"> <source>Property doesn't return a value on all code paths</source> <target state="translated">Właściwość nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="ERR_NestedGlobalNamespace"> <source>Global namespace may not be nested in another namespace.</source> <target state="translated">Globalna przestrzeń nazw nie może być zagnieżdżona w innej przestrzeni nazw.</target> <note /> </trans-unit> <trans-unit id="ERR_AccessMismatch6"> <source>'{0}' cannot expose type '{1}' in {2} '{3}' through {4} '{5}'.</source> <target state="translated">'Element „{0}” nie może ujawnić typu „{1}” w zakresie od {2} „{3}” do {4} „{5}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadMetaDataReference1"> <source>'{0}' cannot be referenced because it is not a valid assembly.</source> <target state="translated">'Nie można odwołać się do elementu „{0}”, ponieważ nie jest to poprawny zestaw.</target> <note /> </trans-unit> <trans-unit id="ERR_PropertyDoesntImplementAllAccessors"> <source>'{0}' cannot be implemented by a {1} property.</source> <target state="translated">'Elementy „{0}” nie mogą zostać zaimplementowane przez właściwość {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_UnimplementedMustOverride"> <source> {0}: {1}</source> <target state="translated"> {0}: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_IfTooManyTypesObjectDisallowed"> <source>Cannot infer a common type because more than one type is possible.</source> <target state="translated">Nie można wywnioskować wspólnego typu, ponieważ jest możliwy więcej niż jeden typ.</target> <note /> </trans-unit> <trans-unit id="WRN_IfTooManyTypesObjectAssumed"> <source>Cannot infer a common type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować wspólnego typu, ponieważ jest możliwy więcej niż jeden typ; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_IfTooManyTypesObjectAssumed_Title"> <source>Cannot infer a common type because more than one type is possible</source> <target state="translated">Nie można wywnioskować wspólnego typu, ponieważ jest możliwy więcej niż jeden typ</target> <note /> </trans-unit> <trans-unit id="ERR_IfNoTypeObjectDisallowed"> <source>Cannot infer a common type, and Option Strict On does not allow 'Object' to be assumed.</source> <target state="translated">Nie można wywnioskować wspólnego typu, a ustawienie Option Strict On nie pozwala przyjąć obiektu „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_IfNoTypeObjectAssumed"> <source>Cannot infer a common type; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować wspólnego typu; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_IfNoTypeObjectAssumed_Title"> <source>Cannot infer a common type</source> <target state="translated">Nie można wywnioskować wspólnego typu</target> <note /> </trans-unit> <trans-unit id="ERR_IfNoType"> <source>Cannot infer a common type.</source> <target state="translated">Nie można wywnioskować wspólnego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyFileFailure"> <source>Error extracting public key from file '{0}': {1}</source> <target state="translated">Błąd podczas wyodrębniania klucza publicznego z pliku „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PublicKeyContainerFailure"> <source>Error extracting public key from container '{0}': {1}</source> <target state="translated">Błąd podczas wyodrębniania klucza publicznego z kontenera „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefNotEqualToThis"> <source>Friend access was granted by '{0}', but the public key of the output assembly does not match that specified by the attribute in the granting assembly.</source> <target state="translated">Dostęp do przyjaznego zestawu został udzielony przez „{0}”, ale klucz publiczny zestawu wyjściowego nie jest zgodny z kluczem określonym przez atrybut w zestawie udzielającym dostępu.</target> <note /> </trans-unit> <trans-unit id="ERR_FriendRefSigningMismatch"> <source>Friend access was granted by '{0}', but the strong name signing state of the output assembly does not match that of the granting assembly.</source> <target state="translated">Dostęp do przyjaznego zestawu został udzielony przez „{0}”, ale silna nazwa stanu podpisywania zestawu wyjściowego nie jest zgodna z nazwą określoną przez atrybut w zestawie udzielającym dostępu.</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNoKey"> <source>Public sign was specified and requires a public key, but no public key was specified</source> <target state="translated">Wybrano podpisywanie publiczne, co wymaga klucza publicznego, ale żaden taki klucz nie został określony</target> <note /> </trans-unit> <trans-unit id="ERR_PublicSignNetModule"> <source>Public signing is not supported for netmodules.</source> <target state="translated">Publiczne podpisywanie nie jest obsługiwane w przypadku modułów sieciowych.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning"> <source>Attribute '{0}' is ignored when public signing is specified.</source> <target state="translated">Atrybut „{0}” jest ignorowany w przypadku określenia podpisywania publicznego.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeIgnoredWhenPublicSigning_Title"> <source>Attribute is ignored when public signing is specified.</source> <target state="translated">Atrybut jest ignorowany w przypadku określenia podpisywania publicznego.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey"> <source>Delay signing was specified and requires a public key, but no public key was specified.</source> <target state="translated">Określono podpisywanie opóźnione, które wymaga klucza publicznego. Nie określono jednak żadnego klucza publicznego.</target> <note /> </trans-unit> <trans-unit id="WRN_DelaySignButNoKey_Title"> <source>Delay signing was specified and requires a public key, but no public key was specified</source> <target state="translated">Określono podpisywanie opóźnione wymagające klucza publicznego, ale nie określono klucza publicznego</target> <note /> </trans-unit> <trans-unit id="ERR_SignButNoPrivateKey"> <source>Key file '{0}' is missing the private key needed for signing.</source> <target state="translated">W pliku klucza „{0}” brak klucza prywatnego wymaganego do podpisu</target> <note /> </trans-unit> <trans-unit id="ERR_FailureSigningAssembly"> <source>Error signing assembly '{0}': {1}</source> <target state="translated">Wystąpił błąd podczas podpisywania zestawu „{0}”: {1}</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat"> <source>The specified version string does not conform to the required format - major[.minor[.build|*[.revision|*]]]</source> <target state="translated">Określony ciąg wersji nie jest zgodny z wymaganym formatem: wersja_główna[.wersja_podrzędna[.kompilacja|*[.poprawka|*]]].</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">Określony ciąg wersji nie jest zgodny z zalecanym formatem — wersja_główna.wersja_pomocnicza.kompilacja.poprawka</target> <note /> </trans-unit> <trans-unit id="WRN_InvalidVersionFormat_Title"> <source>The specified version string does not conform to the recommended format</source> <target state="translated">Określony ciąg wersji jest niezgodny z zalecanym formatem</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidVersionFormat2"> <source>The specified version string does not conform to the recommended format - major.minor.build.revision</source> <target state="translated">Określony ciąg wersji nie jest zgodny z zalecanym formatem — wersja_główna.wersja_pomocnicza.kompilacja.poprawka</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCultureForExe"> <source>Executables cannot be satellite assemblies; culture should always be empty</source> <target state="translated">Pliki wykonywalne nie mogą być zestawami satelity, element Culture powinien zawsze być pusty</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored"> <source>The entry point of the program is global script code; ignoring '{0}' entry point.</source> <target state="translated">Punkt wejścia programu to kod skryptu globalnego. Punkt wejścia „{0}” został zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_MainIgnored_Title"> <source>The entry point of the program is global script code; ignoring entry point</source> <target state="translated">Punkt wejścia programu to kod skryptu globalnego. Punkt wejścia został zignorowany</target> <note /> </trans-unit> <trans-unit id="WRN_EmptyPrefixAndXmlnsLocalName"> <source>The xmlns attribute has special meaning and should not be written with a prefix.</source> <target state="translated">Atrybut xmlns ma specjalne znaczenie i nie powinien być zapisywany z prefiksem.</target> <note /> </trans-unit> <trans-unit id="WRN_EmptyPrefixAndXmlnsLocalName_Title"> <source>The xmlns attribute has special meaning and should not be written with a prefix</source> <target state="translated">Atrybut xmlns ma specjalne znaczenie i nie powinien być zapisywany z prefiksem</target> <note /> </trans-unit> <trans-unit id="WRN_PrefixAndXmlnsLocalName"> <source>It is not recommended to have attributes named xmlns. Did you mean to write 'xmlns:{0}' to define a prefix named '{0}'?</source> <target state="translated">Zaleca się, aby atrybuty nie miały nazwy xmlns. Czy w celu zdefiniowania prefiksu o nazwie „{0}” nie miał zostać wprowadzony ciąg „xmlns:{0}”?</target> <note /> </trans-unit> <trans-unit id="WRN_PrefixAndXmlnsLocalName_Title"> <source>It is not recommended to have attributes named xmlns</source> <target state="translated">Zaleca się, aby atrybuty nie miały nazwy xmlns</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedSingleScript"> <source>Expected a single script (.vbx file)</source> <target state="translated">Oczekiwano pojedynczego skryptu (plik VBX)</target> <note /> </trans-unit> <trans-unit id="ERR_ReservedAssemblyName"> <source>The assembly name '{0}' is reserved and cannot be used as a reference in an interactive session</source> <target state="translated">Nazwa zestawu „{0}” jest zarezerwowana i nie można jej użyć jako odwołania w sesji interaktywnej</target> <note /> </trans-unit> <trans-unit id="ERR_ReferenceDirectiveOnlyAllowedInScripts"> <source>#R is only allowed in scripts</source> <target state="translated">Element #R jest dozwolony tylko w skryptach</target> <note /> </trans-unit> <trans-unit id="ERR_NamespaceNotAllowedInScript"> <source>You cannot declare Namespace in script code</source> <target state="translated">W kodzie skryptu nie można zadeklarować przestrzeni nazw</target> <note /> </trans-unit> <trans-unit id="ERR_KeywordNotAllowedInScript"> <source>You cannot use '{0}' in top-level script code</source> <target state="translated">Nie można używać słowa kluczowego „{0}” w kodzie skryptu najwyższego poziomu</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNoType"> <source>Cannot infer a return type. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Nie można wywnioskować zwracanego typu. Rozważ dodanie klauzuli „As” w celu określenia zwracanego typu.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaNoTypeObjectAssumed"> <source>Cannot infer a return type; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować zwracanego typu; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaNoTypeObjectAssumed_Title"> <source>Cannot infer a return type</source> <target state="translated">Nie można wywnioskować zwracanego typu</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaTooManyTypesObjectAssumed"> <source>Cannot infer a return type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować zwracanego typu, ponieważ jest możliwy więcej niż jeden typ; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_LambdaTooManyTypesObjectAssumed_Title"> <source>Cannot infer a return type because more than one type is possible</source> <target state="translated">Nie można wywnioskować zwracanego typu, ponieważ możliwe jest użycie więcej niż jednego typu</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaNoTypeObjectDisallowed"> <source>Cannot infer a return type. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Nie można wywnioskować zwracanego typu. Rozważ dodanie klauzuli „As” w celu określenia zwracanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_LambdaTooManyTypesObjectDisallowed"> <source>Cannot infer a return type because more than one type is possible. Consider adding an 'As' clause to specify the return type.</source> <target state="translated">Nie można wywnioskować zwracanego typu, ponieważ jest możliwy więcej niż jeden typ. Rozważ dodanie klauzuli „As” w celu określenia zwracanego typu.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch"> <source>The command line switch '{0}' is not yet implemented and was ignored.</source> <target state="translated">Przełącznik wiersza polecenia „{0}” nie został jeszcze wdrożony i został zignorowany.</target> <note /> </trans-unit> <trans-unit id="WRN_UnimplementedCommandLineSwitch_Title"> <source>Command line switch is not yet implemented</source> <target state="translated">Przełącznik wiersza polecenia nie jest jeszcze zaimplementowany</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitNoTypeObjectDisallowed"> <source>Cannot infer an element type, and Option Strict On does not allow 'Object' to be assumed. Specifying the type of the array might correct this error.</source> <target state="translated">Nie można wywnioskować typu elementu, a ustawienie Option Strict On nie pozwala przyjąć typu „Object”. Określenie typu tablicy może poprawić ten błąd.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitNoType"> <source>Cannot infer an element type. Specifying the type of the array might correct this error.</source> <target state="translated">Nie można wywnioskować typu elementu. Określenie typu tablicy może poprawić ten błąd.</target> <note /> </trans-unit> <trans-unit id="ERR_ArrayInitTooManyTypesObjectDisallowed"> <source>Cannot infer an element type because more than one type is possible. Specifying the type of the array might correct this error.</source> <target state="translated">Nie można wywnioskować typu elementu, ponieważ jest możliwy więcej niż jeden typ. Określenie typu tablicy może poprawić ten błąd.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitNoTypeObjectAssumed"> <source>Cannot infer an element type; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować typu elementu; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitNoTypeObjectAssumed_Title"> <source>Cannot infer an element type</source> <target state="translated">Nie można wywnioskować typu elementu</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitTooManyTypesObjectAssumed"> <source>Cannot infer an element type because more than one type is possible; 'Object' assumed.</source> <target state="translated">Nie można wywnioskować typu elementu, ponieważ jest możliwy więcej niż jeden typ; przyjęto „Object”.</target> <note /> </trans-unit> <trans-unit id="WRN_ArrayInitTooManyTypesObjectAssumed_Title"> <source>Cannot infer an element type because more than one type is possible</source> <target state="translated">Nie można wywnioskować typu elementu, ponieważ możliwe jest użycie więcej niż jednego typu</target> <note /> </trans-unit> <trans-unit id="WRN_TypeInferenceAssumed3"> <source>Data type of '{0}' in '{1}' could not be inferred. '{2}' assumed.</source> <target state="translated">Nie można wywnioskować typu danych „{0}” w „{1}”. Przyjęto „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_TypeInferenceAssumed3_Title"> <source>Data type could not be inferred</source> <target state="translated">Nie można wywnioskować typu danych</target> <note /> </trans-unit> <trans-unit id="ERR_AmbiguousCastConversion2"> <source>Option Strict On does not allow implicit conversions from '{0}' to '{1}' because the conversion is ambiguous.</source> <target state="translated">Ustawienie Option Strict On nie zezwala na niejawne konwersje z elementu „{0}” na „{1}”, ponieważ konwersja jest niejednoznaczna.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousCastConversion2"> <source>Conversion from '{0}' to '{1}' may be ambiguous.</source> <target state="translated">Konwersja z „{0}” na „{1}” może być niejednoznaczna.</target> <note /> </trans-unit> <trans-unit id="WRN_AmbiguousCastConversion2_Title"> <source>Conversion may be ambiguous</source> <target state="translated">Konwersja może być niejednoznaczna</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceIEnumerableSuggestion3"> <source>'{0}' cannot be converted to '{1}'. Consider using '{2}' instead.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ użycie zamiast tego elementu „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceIEnumerableSuggestion3"> <source>'{0}' cannot be converted to '{1}'. Consider using '{2}' instead.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ użycie zamiast tego elementu „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceIEnumerableSuggestion3_Title"> <source>Type cannot be converted to target collection type</source> <target state="translated">Nie można przekonwertować typu na docelowy typ kolekcji</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedIn6"> <source>'{4}' cannot be converted to '{5}' because '{0}' is not derived from '{1}', as required for the 'In' generic parameter '{2}' in '{3}'.</source> <target state="translated">'Element „{4}” nie może zostać skonwertowany na „{5}”, ponieważ element „{0}” nie dziedziczy od „{1}”, co jest wymagane dla parametru ogólnego „In” „{2}” w „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedOut6"> <source>'{4}' cannot be converted to '{5}' because '{0}' is not derived from '{1}', as required for the 'Out' generic parameter '{2}' in '{3}'.</source> <target state="translated">'Element „{4}” nie może zostać skonwertowany na „{5}”, ponieważ element „{0}” nie dziedziczy od „{1}”, co jest wymagane dla parametru ogólnego „Out” „{2}” w „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedIn6"> <source>Implicit conversion from '{4}' to '{5}'; this conversion may fail because '{0}' is not derived from '{1}', as required for the 'In' generic parameter '{2}' in '{3}'.</source> <target state="translated">Niejawna konwersja z „{4}” na „{5}”; ta konwersja może się nie powieść, ponieważ „{0}” nie dziedziczy od „{1}”, co jest wymagane dla parametru ogólnego „In” „{2}” w „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedIn6_Title"> <source>Implicit conversion; this conversion may fail because the target type is not derived from the source type, as required for 'In' generic parameter</source> <target state="translated">Niejawna konwersja; ta konwersja może się nie powieść, ponieważ typ docelowy nie pochodzi od typu źródłowego, co jest wymagane dla parametru ogólnego „In”</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedOut6"> <source>Implicit conversion from '{4}' to '{5}'; this conversion may fail because '{0}' is not derived from '{1}', as required for the 'Out' generic parameter '{2}' in '{3}'.</source> <target state="translated">Niejawna konwersja z „{4}” na „{5}”; ta konwersja może się nie powieść, ponieważ „{0}” nie dziedziczy od „{1}”, co jest wymagane dla parametru ogólnego „Out” „{2}” w „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedOut6_Title"> <source>Implicit conversion; this conversion may fail because the target type is not derived from the source type, as required for 'Out' generic parameter</source> <target state="translated">Niejawna konwersja; ta konwersja może się nie powieść, ponieważ typ docelowy nie pochodzi od typu źródłowego, co jest wymagane dla parametru ogólnego „Out”</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedTryIn4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an In type parameter, 'In {2}'.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ zmianę elementu „{2}” w definicji „{3}” na parametr typu In, „In {2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceConversionFailedTryOut4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an Out type parameter, 'Out {2}'.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ zmianę elementu „{2}” w definicji „{3}” na parametr typu Out, „Out {2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryIn4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an In type parameter, 'In {2}'.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ zmianę elementu „{2}” w definicji „{3}” na parametr typu In, „In {2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryIn4_Title"> <source>Type cannot be converted to target type</source> <target state="translated">Nie można przekonwertować typu na typ docelowy</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryOut4"> <source>'{0}' cannot be converted to '{1}'. Consider changing the '{2}' in the definition of '{3}' to an Out type parameter, 'Out {2}'.</source> <target state="translated">'Nie można skonwertować elementu „{0}” na „{1}”. Rozważ zmianę elementu „{2}” w definicji „{3}” na parametr typu Out, „Out {2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceConversionFailedTryOut4_Title"> <source>Type cannot be converted to target type</source> <target state="translated">Nie można przekonwertować typu na typ docelowy</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceDeclarationAmbiguous3"> <source>Interface '{0}' is ambiguous with another implemented interface '{1}' due to the 'In' and 'Out' parameters in '{2}'.</source> <target state="translated">Interfejs „{0}” jest niejednoznaczny z innym zaimplementowanym interfejsem „{1}” ze względu na parametry „In” i „Out” w „{2}”.</target> <note /> </trans-unit> <trans-unit id="WRN_VarianceDeclarationAmbiguous3_Title"> <source>Interface is ambiguous with another implemented interface due to 'In' and 'Out' parameters</source> <target state="translated">Interfejs jest niejednoznaczny z innym zaimplementowanym interfejsem ze względu na parametry „In” i „Out”</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInterfaceNesting"> <source>Enumerations, classes, and structures cannot be declared in an interface that has an 'In' or 'Out' type parameter.</source> <target state="translated">Wyliczenia, klasy i struktury nie mogą być deklarowane w interfejsie mającym parametr typu „In” lub „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VariancePreventsSynthesizedEvents2"> <source>Event definitions with parameters are not allowed in an interface such as '{0}' that has 'In' or 'Out' type parameters. Consider declaring the event by using a delegate type which is not defined within '{0}'. For example, 'Event {1} As Action(Of ...)'.</source> <target state="translated">Definicje zdarzeń z parametrami nie są dozwolone w interfejsie takim jak „{0}”, który ma parametry typu „In” lub „Out”. Rozważ zadeklarowanie zdarzenia przy użyciu typu delegowanego, który nie jest zdefiniowany w obrębie elementu „{0}”. Na przykład „Event {1} As Action(Of ...)”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInByRefDisallowed1"> <source>Type '{0}' cannot be used in this context because 'In' and 'Out' type parameters cannot be used for ByRef parameter types, and '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany w tym kontekście, ponieważ parametry typu „In” i „Out” nie mogą być używane dla typów parametrów ByRef, a „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInNullableDisallowed2"> <source>Type '{0}' cannot be used in '{1}' because 'In' and 'Out' type parameters cannot be made nullable, and '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany w elemencie „{1}”, ponieważ parametry typu „In” i „Out” nie mogą dopuszczać wartości null, a „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowed1"> <source>Type '{0}' cannot be used in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty w tym kontekście, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedForGeneric3"> <source>Type '{0}' cannot be used for the '{1}' in '{2}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{1}” w „{2}” w tym kontekście, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedHere2"> <source>Type '{0}' cannot be used in '{1}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty w elemencie „{1}” w tym kontekście, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInParamDisallowedHereForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' of '{3}' in '{1}' in this context because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{2}” należącego do „{3}” w elemencie „{1}” w tym kontekście, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInPropertyDisallowed1"> <source>Type '{0}' cannot be used as a property type in this context because '{0}' is an 'In' type parameter and the property is not marked WriteOnly.</source> <target state="translated">Typ „{0}” nie może być używany jako typ właściwości w tym kontekście, ponieważ „{0}” jest parametrem typu „In”, a właściwość nie jest oznaczona jako WriteOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInReadOnlyPropertyDisallowed1"> <source>Type '{0}' cannot be used as a ReadOnly property type because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako typ właściwości ReadOnly, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceInReturnDisallowed1"> <source>Type '{0}' cannot be used as a return type because '{0}' is an 'In' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako typ zwracany, ponieważ „{0}” jest parametrem typu „In”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutByRefDisallowed1"> <source>Type '{0}' cannot be used in this context because 'In' and 'Out' type parameters cannot be used for ByRef parameter types, and '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany w tym kontekście, ponieważ parametry typu „In” i „Out” nie mogą być używane dla typów parametrów ByRef, a „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutByValDisallowed1"> <source>Type '{0}' cannot be used as a ByVal parameter type because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako parametr typu ByVal, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutConstraintDisallowed1"> <source>Type '{0}' cannot be used as a generic type constraint because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako ograniczenie typu ogólnego, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutNullableDisallowed2"> <source>Type '{0}' cannot be used in '{1}' because 'In' and 'Out' type parameters cannot be made nullable, and '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany w elemencie „{1}”, ponieważ parametry typu „In” i „Out” nie mogą dopuszczać wartości null, a „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowed1"> <source>Type '{0}' cannot be used in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedForGeneric3"> <source>Type '{0}' cannot be used for the '{1}' in '{2}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{1}” w „{2}” w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedHere2"> <source>Type '{0}' cannot be used in '{1}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty w elemencie „{1}” w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutParamDisallowedHereForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' of '{3}' in '{1}' in this context because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{2}” należącego do elementu „{3}” w „{1}” w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutPropertyDisallowed1"> <source>Type '{0}' cannot be used as a property type in this context because '{0}' is an 'Out' type parameter and the property is not marked ReadOnly.</source> <target state="translated">Typ „{0}” nie może być używany jako typ właściwości w tym kontekście, ponieważ „{0}” jest parametrem typu „Out”, a ta właściwość nie jest oznaczona jako ReadOnly.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceOutWriteOnlyPropertyDisallowed1"> <source>Type '{0}' cannot be used as a WriteOnly property type because '{0}' is an 'Out' type parameter.</source> <target state="translated">Typ „{0}” nie może być używany jako typ właściwości WriteOnly, ponieważ „{0}” jest parametrem typu „Out”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowed2"> <source>Type '{0}' cannot be used in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Typ „{0}” nie może zostać użyty w tym kontekście, ponieważ zarówno kontekst, jak i definicja „{0}” są zagnieżdżone w obrębie interfejsu „{1}”, a „{1}” ma parametry typu „In” lub „Out”. Rozważ przeniesienie definicji „{0}” poza interfejs „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedForGeneric4"> <source>Type '{0}' cannot be used for the '{2}' in '{3}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{2}” w „{3}” w tym kontekście, ponieważ zarówno kontekst, jak i definicja elementu „{0}” są zagnieżdżone w obrębie interfejsu „{1}”, a „{1}” ma parametry typu „In” lub „Out”. Rozważ przeniesienie definicji „{0}” poza interfejs „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedHere3"> <source>Type '{0}' cannot be used in '{2}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Typ „{0}” nie może zostać użyty w elemencie „{2}” w tym kontekście, ponieważ zarówno kontekst, jak i definicja „{0}” są zagnieżdżone w obrębie interfejsu „{1}”, a „{1}” ma parametry typu „In” lub „Out”. Rozważ przeniesienie definicji „{0}” poza interfejs „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_VarianceTypeDisallowedHereForGeneric5"> <source>Type '{0}' cannot be used for the '{3}' of '{4}' in '{2}' in this context because both the context and the definition of '{0}' are nested within interface '{1}', and '{1}' has 'In' or 'Out' type parameters. Consider moving the definition of '{0}' outside of '{1}'.</source> <target state="translated">Typ „{0}” nie może zostać użyty dla elementu „{3}” należącego do elementu „{4}” w „{2}” w tym kontekście, ponieważ zarówno kontekst, jak i definicja „{0}” są zagnieżdżone w obrębie interfejsu „{1}”, a „{1}” ma parametry typu „In” lub „Out”. Rozważ przeniesienie definicji „{0}” poza interfejs „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ParameterNotValidForType"> <source>Parameter not valid for the specified unmanaged type.</source> <target state="translated">Parametr jest nieprawidłowy dla określonego niezarządzanego typu.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeNotValidForFields"> <source>Unmanaged type '{0}' not valid for fields.</source> <target state="translated">Niezarządzany typ „{0}” jest nieprawidłowy dla pól.</target> <note /> </trans-unit> <trans-unit id="ERR_MarshalUnmanagedTypeOnlyValidForFields"> <source>Unmanaged type '{0}' is only valid for fields.</source> <target state="translated">Niezarządzany typ „{0}” jest prawidłowy tylko dla pól.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired1"> <source>Attribute parameter '{0}' must be specified.</source> <target state="translated">Należy podać parametr atrybutu „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_AttributeParameterRequired2"> <source>Attribute parameter '{0}' or '{1}' must be specified.</source> <target state="translated">Należy podać parametr atrybutu „{0}” lub „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_MemberConflictWithSynth4"> <source>Conflicts with '{0}', which is implicitly declared for '{1}' in {2} '{3}'.</source> <target state="translated">Powoduje konflikt z elementem „{0}”, zadeklarowanym niejawnie dla elementu „{1}” w elemencie {2} „{3}”.</target> <note /> </trans-unit> <trans-unit id="IDS_ProjectSettingsLocationName"> <source>&lt;project settings&gt;</source> <target state="translated">&lt;ustawienia projektu&gt;</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeAttributeOnWriteOnlyProperty"> <source>Attributes applied on a return type of a WriteOnly Property have no effect.</source> <target state="translated">Zastosowanie atrybutów w typie zwracanym właściwości WriteOnly nie przyniosło żadnego skutku.</target> <note /> </trans-unit> <trans-unit id="WRN_ReturnTypeAttributeOnWriteOnlyProperty_Title"> <source>Attributes applied on a return type of a WriteOnly Property have no effect</source> <target state="translated">Zastosowanie atrybutów w typie zwracanym właściwości WriteOnly nie przyniosło żadnego skutku</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityAttributeInvalidTarget"> <source>Security attribute '{0}' is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations.</source> <target state="translated">Atrybut zabezpieczeń „{0}” jest nieprawidłowy w tym typie deklaracji. Atrybuty zabezpieczeń są prawidłowe tylko dla deklaracji zestawu, typu i metody.</target> <note /> </trans-unit> <trans-unit id="ERR_AbsentReferenceToPIA1"> <source>Cannot find the interop type that matches the embedded type '{0}'. Are you missing an assembly reference?</source> <target state="translated">Nie można znaleźć typu międzyoperacyjnego zgodnego z osadzonym typem „{0}”. Czy nie brakuje odwołania do zestawu?</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLinkClassWithNoPIA1"> <source>Reference to class '{0}' is not allowed when its assembly is configured to embed interop types.</source> <target state="translated">Odwołanie do klasy „{0}” jest niedozwolone, gdy jej zestaw jest skonfigurowany do osadzania typów międzyoperacyjnych.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidStructMemberNoPIA1"> <source>Embedded interop structure '{0}' can contain only public instance fields.</source> <target state="translated">Osadzona struktura międzyoperacyjna „{0}” może zawierać tylko publiczne pola wystąpień.</target> <note /> </trans-unit> <trans-unit id="ERR_NoPIAAttributeMissing2"> <source>Interop type '{0}' cannot be embedded because it is missing the required '{1}' attribute.</source> <target state="translated">Nie można osadzić typu międzyoperacyjnego „{0}”, ponieważ brakuje w nim wymaganego atrybutu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PIAHasNoAssemblyGuid1"> <source>Cannot embed interop types from assembly '{0}' because it is missing the '{1}' attribute.</source> <target state="translated">Nie można osadzić typów międzyoperacyjnych z zestawu „{0}”, ponieważ brakuje atrybutu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_DuplicateLocalTypes3"> <source>Cannot embed interop type '{0}' found in both assembly '{1}' and '{2}'. Consider disabling the embedding of interop types.</source> <target state="translated">Nie można osadzić typu międzyoperacyjnego „{0}” znalezionego w zestawie „{1}” i „{2}”. Rozważ wyłączenie osadzenia typów międzyoperacyjnych.</target> <note /> </trans-unit> <trans-unit id="ERR_PIAHasNoTypeLibAttribute1"> <source>Cannot embed interop types from assembly '{0}' because it is missing either the '{1}' attribute or the '{2}' attribute.</source> <target state="translated">Nie można osadzić typów międzyoperacyjnych z zestawu „{0}”, ponieważ brakuje atrybutu „{1}” lub „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceInterfaceMustBeInterface"> <source>Interface '{0}' has an invalid source interface which is required to embed event '{1}'.</source> <target state="translated">Interfejs „{0}” zawiera nieprawidłowy interfejs źródłowy wymagany do osadzenia zdarzenia „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EventNoPIANoBackingMember"> <source>Source interface '{0}' is missing method '{1}', which is required to embed event '{2}'.</source> <target state="translated">W interfejsie źródłowym „{0}” brak metody „{1}” wymaganej do osadzenia zdarzenia „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NestedInteropType"> <source>Nested type '{0}' cannot be embedded.</source> <target state="translated">Typ zagnieżdżony „{0}” nie może zostać osadzony.</target> <note /> </trans-unit> <trans-unit id="ERR_LocalTypeNameClash2"> <source>Embedding the interop type '{0}' from assembly '{1}' causes a name clash in the current assembly. Consider disabling the embedding of interop types.</source> <target state="translated">Osadzenie typu międzyoperacyjnego „{0}” z zestawu „{1}” spowoduje konflikt nazw w bieżącym zestawie. Rozważ wyłączenie osadzania typów międzyoperacyjnych.</target> <note /> </trans-unit> <trans-unit id="ERR_InteropMethodWithBody1"> <source>Embedded interop method '{0}' contains a body.</source> <target state="translated">Osadzona metoda międzyoperacyjna „{0}” zawiera treść.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncInQuery"> <source>'Await' may only be used in a query expression within the first collection expression of the initial 'From' clause or within the collection expression of a 'Join' clause.</source> <target state="translated">'Operatora „Await” można użyć tylko w wyrażeniu zapytania w pierwszym wyrażeniu kolekcji początkowej klauzuli „From” albo w wyrażeniu kolekcji klauzuli „Join”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadGetAwaiterMethod1"> <source>'Await' requires that the type '{0}' have a suitable GetAwaiter method.</source> <target state="translated">'Element „Await” wymaga, aby typ „{0}” miał odpowiednią metodę GetAwaiter.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIsCompletedOnCompletedGetResult2"> <source>'Await' requires that the return type '{0}' of '{1}.GetAwaiter()' have suitable IsCompleted, OnCompleted and GetResult members, and implement INotifyCompletion or ICriticalNotifyCompletion.</source> <target state="translated">'Element „Await” wymaga, aby zwracany typ „{0}” metody „{1}.GetAwaiter()” miał odpowiednie składowe IsCompleted, OnCompleted i GetResult oraz implementował interfejs INotifyCompletion lub ICriticalNotifyCompletion.</target> <note /> </trans-unit> <trans-unit id="ERR_DoesntImplementAwaitInterface2"> <source>'{0}' does not implement '{1}'.</source> <target state="translated">'Element „{0}” nie implementuje interfejsu „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitNothing"> <source>Cannot await Nothing. Consider awaiting 'Task.Yield()' instead.</source> <target state="translated">Nie można zdefiniować oczekiwania na wartość Nothing. Zamiast tego rozważ zdefiniowanie oczekiwania na funkcję „Task.Yield()”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncByRefParam"> <source>Async methods cannot have ByRef parameters.</source> <target state="translated">Metody asynchroniczne nie mogą mieć parametrów ByRef.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAsyncIteratorModifiers"> <source>'Async' and 'Iterator' modifiers cannot be used together.</source> <target state="translated">'Modyfikatory „Async” i „Iterator” nie mogą być używane razem.</target> <note /> </trans-unit> <trans-unit id="ERR_BadResumableAccessReturnVariable"> <source>The implicit return variable of an Iterator or Async method cannot be accessed.</source> <target state="translated">Nie można uzyskać dostępu do niejawnie zwracanej zmiennej metody iteracyjnej lub asynchronicznej.</target> <note /> </trans-unit> <trans-unit id="ERR_ReturnFromNonGenericTaskAsync"> <source>'Return' statements in this Async method cannot return a value since the return type of the function is 'Task'. Consider changing the function's return type to 'Task(Of T)'.</source> <target state="translated">'Instrukcje „Return” w tej metodzie asynchronicznej nie mogą zwracać wartości, ponieważ funkcja zwraca typ „Task”. Rozważ zmianę typu zwracanego przez funkcję na „Task(Of T)”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturnOperand1"> <source>Since this is an async method, the return expression must be of type '{0}' rather than 'Task(Of {0})'.</source> <target state="translated">Ze względu na to, że jest to metoda asynchroniczna, zwracane wyrażenie musi być typu „{0}”, a nie typu „Task(Of {0})”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAsyncReturn"> <source>The 'Async' modifier can only be used on Subs, or on Functions that return Task or Task(Of T).</source> <target state="translated">Modyfikatora „Async” można używać tylko dla procedur albo funkcji zwracających typ Task lub Task(Of T).</target> <note /> </trans-unit> <trans-unit id="ERR_CantAwaitAsyncSub1"> <source>'{0}' does not return a Task and cannot be awaited. Consider changing it to an Async Function.</source> <target state="translated">'Element „{0}” nie zwraca zadania i nie jest możliwe oczekiwanie na niego. Rozważ zmianę tego elementu na funkcję asynchroniczną.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidLambdaModifier"> <source>'Only the 'Async' or 'Iterator' modifier is valid on a lambda.</source> <target state="translated">'Tylko modyfikator „Async” lub „Iterator” jest poprawny w przypadku wyrażenia lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncMethod"> <source>'Await' can only be used within an Async method. Consider marking this method with the 'Async' modifier and changing its return type to 'Task(Of {0})'.</source> <target state="translated">'Słowo kluczowe „Await” może zostać użyte tylko wewnątrz metody asynchronicznej. Rozważ oznaczenie tej metody za pomocą modyfikatora „Async” i zmianę zwracanego przez nią typu na „Task(Of {0})”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncVoidMethod"> <source>'Await' can only be used within an Async method. Consider marking this method with the 'Async' modifier and changing its return type to 'Task'.</source> <target state="translated">'Słowo kluczowe „Await” może zostać użyte tylko wewnątrz metody asynchronicznej. Rozważ oznaczenie tej metody za pomocą modyfikatora „Async” i zmianę zwracanego przez nią typu na „Task”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInNonAsyncLambda"> <source>'Await' can only be used within an Async lambda expression. Consider marking this lambda expression with the 'Async' modifier.</source> <target state="translated">'Słowo kluczowe „Await” może zostać użyte tylko wewnątrz wyrażenia lambda. Rozważ oznaczenie tego wyrażenia lambda za pomocą modyfikatora „Async”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitNotInAsyncMethodOrLambda"> <source>'Await' can only be used when contained within a method or lambda expression marked with the 'Async' modifier.</source> <target state="translated">'Słowo kluczowe „Await” może zostać użyte tylko wewnątrz metody lub wyrażenia lambda oznaczonego modyfikatorem „Async”.</target> <note /> </trans-unit> <trans-unit id="ERR_StatementLambdaInExpressionTree"> <source>Statement lambdas cannot be converted to expression trees.</source> <target state="translated">Instrukcji lambda nie można konwertować na drzewa wyrażeń.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression"> <source>Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the Await operator to the result of the call.</source> <target state="translated">Ponieważ to wywołanie nie jest oczekiwane, wykonywanie bieżącej metody będzie kontynuowane do czasu ukończenia wywołania. Rozważ zastosowanie operatora Await do wyniku wywołania.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableExpression_Title"> <source>Because this call is not awaited, execution of the current method continues before the call is completed</source> <target state="translated">To wywołanie nie jest oczekiwane, dlatego wykonywanie bieżącej metody będzie kontynuowane do czasu ukończenia wywołania</target> <note /> </trans-unit> <trans-unit id="ERR_LoopControlMustNotAwait"> <source>Loop control variable cannot include an 'Await'.</source> <target state="translated">Zmienna sterująca pętli nie może zawierać słowa kluczowego „Await”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadStaticInitializerInResumable"> <source>Static variables cannot appear inside Async or Iterator methods.</source> <target state="translated">Zmienne statyczne nie mogą być używane w metodach Async lub Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_RestrictedResumableType1"> <source>'{0}' cannot be used as a parameter type for an Iterator or Async method.</source> <target state="translated">'Typ „{0}” nie może być używany jako parametr typu dla metody Iterator lub Async.</target> <note /> </trans-unit> <trans-unit id="ERR_ConstructorAsync"> <source>Constructor must not have the 'Async' modifier.</source> <target state="translated">Konstruktor nie może zawierać modyfikatora „Async”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodsMustNotBeAsync1"> <source>'{0}' cannot be declared 'Partial' because it has the 'Async' modifier.</source> <target state="translated">'Nie można zadeklarować metody „{0}” jako „Partial”, ponieważ ma ona modyfikator „Async”.</target> <note /> </trans-unit> <trans-unit id="ERR_ResumablesCannotContainOnError"> <source>'On Error' and 'Resume' cannot appear inside async or iterator methods.</source> <target state="translated">'W metodach asynchronicznych i iteracyjnych nie mogą występować instrukcje „On Error” ani „Resume”.</target> <note /> </trans-unit> <trans-unit id="ERR_ResumableLambdaInExpressionTree"> <source>Lambdas with the 'Async' or 'Iterator' modifiers cannot be converted to expression trees.</source> <target state="translated">Wyrażeń lambda z modyfikatorami „Async” i „Iterator” nie można konwertować na drzewa wyrażeń.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotLiftRestrictedTypeResumable1"> <source>Variable of restricted type '{0}' cannot be declared in an Async or Iterator method.</source> <target state="translated">Zmienna ograniczonego typu „{0}” nie może zostać zadeklarowana w metodzie asynchronicznej lub iteratora.</target> <note /> </trans-unit> <trans-unit id="ERR_BadAwaitInTryHandler"> <source>'Await' cannot be used inside a 'Catch' statement, a 'Finally' statement, or a 'SyncLock' statement.</source> <target state="translated">'Operator „Await” nie może być używany wewnątrz instrukcji „Catch”, „Finally” ani „SyncLock”.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits"> <source>This async method lacks 'Await' operators and so will run synchronously. Consider using the 'Await' operator to await non-blocking API calls, or 'Await Task.Run(...)' to do CPU-bound work on a background thread.</source> <target state="translated">W tej metodzie asynchronicznej brakuje operatorów „Await”, dlatego będzie wykonywana synchronicznie. Rozważ użycie operatora „Await” w celu zdefiniowania oczekiwania na nieblokujące wywołania interfejsów API albo wyrażenia „Await Task.Run(...)” w celu przeniesienia wykonywania zadań intensywnie angażujących procesor do wątku w tle.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncLacksAwaits_Title"> <source>This async method lacks 'Await' operators and so will run synchronously</source> <target state="translated">W tej metodzie asynchronicznej brakuje operatorów „Await” — zostanie ona uruchomiona synchronicznie</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableDelegate"> <source>The Task returned from this Async Function will be dropped, and any exceptions in it ignored. Consider changing it to an Async Sub so its exceptions are propagated.</source> <target state="translated">Zadanie zwrócone z tej funkcji asynchronicznej zostanie porzucone i wszelkie zawarte w nim wyjątki zostaną zignorowane. Rozważ zmianę tej funkcji na procedurę asynchroniczną, tak aby jej wyjątki były propagowane.</target> <note /> </trans-unit> <trans-unit id="WRN_UnobservedAwaitableDelegate_Title"> <source>The Task returned from this Async Function will be dropped, and any exceptions in it ignored</source> <target state="translated">Zadanie zwrócone przez tę funkcję asynchroniczną zostanie porzucone, a powiązane z nim wyjątki zostaną zignorowane</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalAsyncInClassOrStruct"> <source>Async and Iterator methods are not allowed in a [Class|Structure|Interface|Module] that has the 'SecurityCritical' or 'SecuritySafeCritical' attribute.</source> <target state="translated">Metody Async i Iterator nie są dozwolone w klasie, strukturze, interfejsie lub module, który ma atrybut „SecurityCritical” lub „SecuritySafeCritical”.</target> <note /> </trans-unit> <trans-unit id="ERR_SecurityCriticalAsync"> <source>Security attribute '{0}' cannot be applied to an Async or Iterator method.</source> <target state="translated">Nie można zastosować atrybutu zabezpieczeń „{0}” do metody Async lub Iterator.</target> <note /> </trans-unit> <trans-unit id="ERR_DllImportOnResumableMethod"> <source>'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to an Async or Iterator method.</source> <target state="translated">'Atrybutu „System.Runtime.InteropServices.DllImportAttribute” nie można zastosować do metody asynchronicznej ani iteracyjnej.</target> <note /> </trans-unit> <trans-unit id="ERR_SynchronizedAsyncMethod"> <source>'MethodImplOptions.Synchronized' cannot be applied to an Async method.</source> <target state="translated">'Atrybutu „MethodImplOptions.Synchronized” nie można zastosować do metody asynchronicznej.</target> <note /> </trans-unit> <trans-unit id="ERR_AsyncSubMain"> <source>The 'Main' method cannot be marked 'Async'.</source> <target state="translated">Metoda „Main” nie może być oznaczona atrybutem „Async”.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncSubCouldBeFunction"> <source>Some overloads here take an Async Function rather than an Async Sub. Consider either using an Async Function, or casting this Async Sub explicitly to the desired type.</source> <target state="translated">Niektóre widoczne tu przeciążenia korzystają z funkcji asynchronicznych, a nie procedur asynchronicznych. Rozważ użycie funkcji asynchronicznej albo rzutowanie tej procedury asynchronicznej jawnie na żądany typ.</target> <note /> </trans-unit> <trans-unit id="WRN_AsyncSubCouldBeFunction_Title"> <source>Some overloads here take an Async Function rather than an Async Sub</source> <target state="translated">Niektóre widoczne tu przeciążenia korzystają z funkcji asynchronicznych, a nie procedur asynchronicznych</target> <note /> </trans-unit> <trans-unit id="ERR_MyGroupCollectionAttributeCycle"> <source>MyGroupCollectionAttribute cannot be applied to itself.</source> <target state="translated">Atrybut MyGroupCollectionAttribute nie może zostać zastosowany do siebie samego.</target> <note /> </trans-unit> <trans-unit id="ERR_LiteralExpected"> <source>Literal expected.</source> <target state="translated">Oczekiwano literału.</target> <note /> </trans-unit> <trans-unit id="ERR_WinRTEventWithoutDelegate"> <source>Event declarations that target WinMD must specify a delegate type. Add an As clause to the event declaration.</source> <target state="translated">Deklaracje zdarzeń przeznaczone dla WinMD muszą określać typ delegata. Dodaj klauzulę As do deklaracji zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_MixingWinRTAndNETEvents"> <source>Event '{0}' cannot implement a Windows Runtime event '{1}' and a regular .NET event '{2}'</source> <target state="translated">Zdarzenie „{0}” nie może implementować zdarzenia wykonawczego systemu Windows „{1}” i zwykłego zdarzenia platformy .NET „{2}”.</target> <note /> </trans-unit> <trans-unit id="ERR_EventImplRemoveHandlerParamWrong"> <source>Event '{0}' cannot implement event '{1}' on interface '{2}' because the parameters of their 'RemoveHandler' methods do not match.</source> <target state="translated">Zdarzenie „{0}” nie może implementować zdarzenia „{1}” w interfejsie „{2}”, ponieważ parametry ich metod „RemoveHandler” są niezgodne.</target> <note /> </trans-unit> <trans-unit id="ERR_AddParamWrongForWinRT"> <source>The type of the 'AddHandler' method's parameter must be the same as the type of the event.</source> <target state="translated">Typ parametru metody „AddHandler” musi być taki sam jak typ zdarzenia.</target> <note /> </trans-unit> <trans-unit id="ERR_RemoveParamWrongForWinRT"> <source>In a Windows Runtime event, the type of the 'RemoveHandler' method parameter must be 'EventRegistrationToken'</source> <target state="translated">W zdarzeniu środowiska wykonawczego systemu Windows parametr metody „RemoveHandler” musi mieć wartość „EventRegistrationToken”</target> <note /> </trans-unit> <trans-unit id="ERR_ReImplementingWinRTInterface5"> <source>'{0}.{1}' from 'implements {2}' is already implemented by the base class '{3}'. Re-implementation of Windows Runtime Interface '{4}' is not allowed</source> <target state="translated">'Element „{0}.{1}” z elementu „implements {2}” został już zaimplementowany przez klasę bazową „{3}”. Ponowna implementacja interfejsu środowiska wykonawczego systemu Windows „{4}” jest niedozwolona</target> <note /> </trans-unit> <trans-unit id="ERR_ReImplementingWinRTInterface4"> <source>'{0}.{1}' is already implemented by the base class '{2}'. Re-implementation of Windows Runtime Interface '{3}' is not allowed</source> <target state="translated">'Element „{0}.{1}” został już zaimplementowany przez klasę bazową „{2}”. Ponowna implementacja interfejsu środowiska wykonawczego systemu Windows „{3}” jest niedozwolona</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorByRefParam"> <source>Iterator methods cannot have ByRef parameters.</source> <target state="translated">Metody iteracyjne nie mogą mieć parametrów ByRef.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorExpressionLambda"> <source>Single-line lambdas cannot have the 'Iterator' modifier. Use a multiline lambda instead.</source> <target state="translated">Jednowierszowe wyrażenia lambda nie mogą mieć modyfikatora „Iterator”. W takim przypadku należy używać wielowierszowych wyrażeń lambda.</target> <note /> </trans-unit> <trans-unit id="ERR_BadIteratorReturn"> <source>Iterator functions must return either IEnumerable(Of T), or IEnumerator(Of T), or the non-generic forms IEnumerable or IEnumerator.</source> <target state="translated">Funkcje iteracyjne muszą zwracać interfejsy IEnumerable(Of T) lub IEnumerator(Of T) albo nieogólne formy interfejsu IEnumerable lub IEnumerator.</target> <note /> </trans-unit> <trans-unit id="ERR_BadReturnValueInIterator"> <source>To return a value from an Iterator function, use 'Yield' rather than 'Return'.</source> <target state="translated">Aby była zwracana wartość z funkcji iteracyjnej, zamiast instrukcji „Return” należy użyć instrukcji „Yield”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInNonIteratorMethod"> <source>'Yield' can only be used in a method marked with the 'Iterator' modifier.</source> <target state="translated">'Instrukcji „Yield” można używać tylko w metodach oznaczonych modyfikatorem „Iterator”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadYieldInTryHandler"> <source>'Yield' cannot be used inside a 'Catch' statement or a 'Finally' statement.</source> <target state="translated">'Instrukcja „Yield” nie może być używana wewnątrz instrukcji „Catch” ani „Finally”.</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValWinRtEventVal1"> <source>The AddHandler for Windows Runtime event '{0}' doesn't return a value on all code paths. Are you missing a 'Return' statement?</source> <target state="translated">Element AddHandler dla zdarzenia środowiska uruchomieniowego systemu Windows „{0}” nie zwraca wartości na wszystkich ścieżkach w kodzie. Czy nie brakuje instrukcji „Return”?</target> <note /> </trans-unit> <trans-unit id="WRN_DefAsgNoRetValWinRtEventVal1_Title"> <source>The AddHandler for Windows Runtime event doesn't return a value on all code paths</source> <target state="translated">Element AddHandler dla zdarzenia środowiska uruchomieniowego systemu Windows nie zwraca wartości na wszystkich ścieżkach w kodzie</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodDefaultParameterValueMismatch2"> <source>Optional parameter of a method '{0}' does not have the same default value as the corresponding parameter of the partial method '{1}'.</source> <target state="translated">Parametr opcjonalny metody „{0}” nie ma tej samej wartości domyślnej co odpowiedni parametr metody częściowej „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_PartialMethodParamArrayMismatch2"> <source>Parameter of a method '{0}' differs by ParamArray modifier from the corresponding parameter of the partial method '{1}'.</source> <target state="translated">Parametr metody „{0}” różni się modyfikatorem ParamArray od odpowiedniego parametru metody częściowej „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMismatch"> <source>Module name '{0}' stored in '{1}' must match its filename.</source> <target state="translated">Nazwa modułu „{0}” przechowywana w elemencie „{1}” musi być zgodna z nazwą jego pliku.</target> <note /> </trans-unit> <trans-unit id="ERR_BadModuleName"> <source>Invalid module name: {0}</source> <target state="translated">Nieprawidłowa nazwa modułu: {0}</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden"> <source>Attribute '{0}' from module '{1}' will be ignored in favor of the instance appearing in source.</source> <target state="translated">Atrybut „{0}” z modułu „{1}” zostanie zignorowany na rzecz wystąpienia ze źródła.</target> <note /> </trans-unit> <trans-unit id="WRN_AssemblyAttributeFromModuleIsOverridden_Title"> <source>Attribute from module will be ignored in favor of the instance appearing in source</source> <target state="translated">Atrybut z modułu zostanie zignorowany na rzecz wystąpienia ze źródła</target> <note /> </trans-unit> <trans-unit id="ERR_CmdOptionConflictsSource"> <source>Attribute '{0}' given in a source file conflicts with option '{1}'.</source> <target state="translated">Atrybut „{0}” podany w pliku źródłowym jest w konflikcie z opcją „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName"> <source>Referenced assembly '{0}' does not have a strong name.</source> <target state="translated">Przywoływany zestaw „{0}” nie ma silnej nazwy.</target> <note /> </trans-unit> <trans-unit id="WRN_ReferencedAssemblyDoesNotHaveStrongName_Title"> <source>Referenced assembly does not have a strong name</source> <target state="translated">Przywoływany zestaw nie ma silnej nazwy</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidSignaturePublicKey"> <source>Invalid signature public key specified in AssemblySignatureKeyAttribute.</source> <target state="translated">W atrybucie AssemblySignatureKeyAttribute określono nieprawidłowy klucz publiczny sygnatury.</target> <note /> </trans-unit> <trans-unit id="ERR_CollisionWithPublicTypeInModule"> <source>Type '{0}' conflicts with public type defined in added module '{1}'.</source> <target state="translated">Typ „{0}” jest w konflikcie z typem publicznym zdefiniowanym w dodanym module „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypeConflictsWithDeclaration"> <source>Type '{0}' exported from module '{1}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Typ „{0}” wyeksportowany z modułu „{1}” powoduje konflikt z typem zadeklarowanym w podstawowym module tego zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_ExportedTypesConflict"> <source>Type '{0}' exported from module '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Typ „{0}” wyeksportowany z modułu „{1}” powoduje konflikt z typem „{2}” wyeksportowanym z modułu „{3}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch"> <source>Referenced assembly '{0}' has different culture setting of '{1}'.</source> <target state="translated">Przywoływany zestaw „{0}” ma inne ustawienie kultury — „{1}”.</target> <note /> </trans-unit> <trans-unit id="WRN_RefCultureMismatch_Title"> <source>Referenced assembly has different culture setting</source> <target state="translated">Przywoływany zestaw ma inne ustawienie kultury</target> <note /> </trans-unit> <trans-unit id="ERR_AgnosticToMachineModule"> <source>Agnostic assembly cannot have a processor specific module '{0}'.</source> <target state="translated">Zestaw agnostyczny nie może mieć modułu specyficznego dla procesora „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_ConflictingMachineModule"> <source>Assembly and module '{0}' cannot target different processors.</source> <target state="translated">Zestaw i moduł „{0}” nie mogą wskazywać różnych procesorów.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly"> <source>Referenced assembly '{0}' targets a different processor.</source> <target state="translated">Celem przywołanego zestawu „{0}” jest inny procesor.</target> <note /> </trans-unit> <trans-unit id="WRN_ConflictingMachineAssembly_Title"> <source>Referenced assembly targets a different processor</source> <target state="translated">Celem przywołanego zestawu jest inny procesor</target> <note /> </trans-unit> <trans-unit id="ERR_CryptoHashFailed"> <source>Cryptographic failure while creating hashes.</source> <target state="translated">Wystąpił błąd kryptograficzny w czasie tworzenia mieszań.</target> <note /> </trans-unit> <trans-unit id="ERR_CantHaveWin32ResAndManifest"> <source>Conflicting options specified: Win32 resource file; Win32 manifest.</source> <target state="translated">Określono opcje powodujące konflikt: plik zasobów Win32; manifest Win32.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithDeclaration"> <source>Forwarded type '{0}' conflicts with type declared in primary module of this assembly.</source> <target state="translated">Typ przesłany „{0}” powoduje konflikt z typem zadeklarowanym w podstawowym module tego zestawu.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypesConflict"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' forwarded to assembly '{3}'.</source> <target state="translated">Typ „{0}” przesłany do zestawu „{1}” powoduje konflikt z typem „{2}” przesłanym do zestawu „{3}”.</target> <note /> </trans-unit> <trans-unit id="ERR_TooLongMetadataName"> <source>Name '{0}' exceeds the maximum length allowed in metadata.</source> <target state="translated">Długość nazwy „{0}” przekracza maksymalną długość dozwoloną w metadanych.</target> <note /> </trans-unit> <trans-unit id="ERR_MissingNetModuleReference"> <source>Reference to '{0}' netmodule missing.</source> <target state="translated">Brak odwołania do modułu netmodule „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_NetModuleNameMustBeUnique"> <source>Module '{0}' is already defined in this assembly. Each module must have a unique filename.</source> <target state="translated">Moduł „{0}” jest już zdefiniowany w tym zestawie. Nazwa pliku każdego modułu musi być unikatowa.</target> <note /> </trans-unit> <trans-unit id="ERR_ForwardedTypeConflictsWithExportedType"> <source>Type '{0}' forwarded to assembly '{1}' conflicts with type '{2}' exported from module '{3}'.</source> <target state="translated">Typ „{0}” przesłany do zestawu „{1}” powoduje konflikt z typem „{2}” wyeksportowanym z modułu „{3}”.</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDREFERENCE"> <source>Adding assembly reference '{0}'</source> <target state="translated">Dodawanie odwołania do zestawu „{0}”</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDLINKREFERENCE"> <source>Adding embedded assembly reference '{0}'</source> <target state="translated">Dodawanie osadzonego odwołania do zestawu „{0}”</target> <note /> </trans-unit> <trans-unit id="IDS_MSG_ADDMODULE"> <source>Adding module reference '{0}'</source> <target state="translated">Dodawanie odwołania do modułu „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_NestingViolatesCLS1"> <source>Type '{0}' does not inherit the generic type parameters of its container.</source> <target state="translated">Typ „{0}” nie dziedziczy parametrów typu ogólnego ze swojego kontenera.</target> <note /> </trans-unit> <trans-unit id="ERR_PDBWritingFailed"> <source>Failure writing debug information: {0}</source> <target state="translated">Błąd podczas zapisu informacji o debugowaniu: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_ParamDefaultValueDiffersFromAttribute"> <source>The parameter has multiple distinct default values.</source> <target state="translated">Parametr ma wiele różnych domyślnych wartości.</target> <note /> </trans-unit> <trans-unit id="ERR_FieldHasMultipleDistinctConstantValues"> <source>The field has multiple distinct constant values.</source> <target state="translated">Pole ma wiele unikatowych wartości stałych.</target> <note /> </trans-unit> <trans-unit id="ERR_EncNoPIAReference"> <source>Cannot continue since the edit includes a reference to an embedded type: '{0}'.</source> <target state="translated">Nie można kontynuować, ponieważ edycja zawiera odwołanie do typu osadzonego: „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_EncReferenceToAddedMember"> <source>Member '{0}' added during the current debug session can only be accessed from within its declaring assembly '{1}'.</source> <target state="translated">Dostęp do składowej „{0}” dodanej podczas bieżącej sesji debugowania można uzyskać tylko w deklarowanym zestawie „{1}”.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedModule1"> <source>'{0}' is an unsupported .NET module.</source> <target state="translated">'Element „{0}” jest nieobsługiwanym modułem platformy .NET.</target> <note /> </trans-unit> <trans-unit id="ERR_UnsupportedEvent1"> <source>'{0}' is an unsupported event.</source> <target state="translated">'Element „{0}” jest nieobsługiwanym zdarzeniem.</target> <note /> </trans-unit> <trans-unit id="PropertiesCanNotHaveTypeArguments"> <source>Properties can not have type arguments</source> <target state="translated">Właściwości nie mogą mieć argumentów typu</target> <note /> </trans-unit> <trans-unit id="IdentifierSyntaxNotWithinSyntaxTree"> <source>IdentifierSyntax not within syntax tree</source> <target state="translated">Element IdentifierSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="AnonymousObjectCreationExpressionSyntaxNotWithinTree"> <source>AnonymousObjectCreationExpressionSyntax not within syntax tree</source> <target state="translated">Brak elementu AnonymousObjectCreationExpressionSyntax w drzewie składni</target> <note /> </trans-unit> <trans-unit id="FieldInitializerSyntaxNotWithinSyntaxTree"> <source>FieldInitializerSyntax not within syntax tree</source> <target state="translated">Element FieldInitializerSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="IDS_TheSystemCannotFindThePathSpecified"> <source>The system cannot find the path specified</source> <target state="translated">System nie może odnaleźć określonej ścieżki.</target> <note /> </trans-unit> <trans-unit id="ThereAreNoPointerTypesInVB"> <source>There are no pointer types in VB.</source> <target state="translated">Brak typów wskaźnikowych w języku Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ThereIsNoDynamicTypeInVB"> <source>There is no dynamic type in VB.</source> <target state="translated">Brak typów dynamicznych w języku Visual Basic.</target> <note /> </trans-unit> <trans-unit id="VariableSyntaxNotWithinSyntaxTree"> <source>variableSyntax not within syntax tree</source> <target state="translated">Element variableSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="AggregateSyntaxNotWithinSyntaxTree"> <source>AggregateSyntax not within syntax tree</source> <target state="translated">Brak elementu AggregateSyntax w drzewie składni</target> <note /> </trans-unit> <trans-unit id="FunctionSyntaxNotWithinSyntaxTree"> <source>FunctionSyntax not within syntax tree</source> <target state="translated">Element FunctionSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="PositionIsNotWithinSyntax"> <source>Position is not within syntax tree</source> <target state="translated">Pozycja nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="RangeVariableSyntaxNotWithinSyntaxTree"> <source>RangeVariableSyntax not within syntax tree</source> <target state="translated">Element RangeVariableSyntax nie znajduje się w obrębie drzewa składni</target> <note /> </trans-unit> <trans-unit id="DeclarationSyntaxNotWithinSyntaxTree"> <source>DeclarationSyntax not within syntax tree</source> <target state="translated">Brak elementu DeclarationSyntax w drzewie składni</target> <note /> </trans-unit> <trans-unit id="StatementOrExpressionIsNotAValidType"> <source>StatementOrExpression is not an ExecutableStatementSyntax or an ExpressionSyntax</source> <target state="translated">Element StatementOrExpression nie jest typu ExecutableStatementSyntax lub ExpressionSyntax</target> <note /> </trans-unit> <trans-unit id="DeclarationSyntaxNotWithinTree"> <source>DeclarationSyntax not within tree</source> <target state="translated">Brak elementu DeclarationSyntax w drzewie</target> <note /> </trans-unit> <trans-unit id="TypeParameterNotWithinTree"> <source>TypeParameter not within tree</source> <target state="translated">Element TypeParameter w nie znajduje się w obrębie drzewa</target> <note /> </trans-unit> <trans-unit id="NotWithinTree"> <source> not within tree</source> <target state="translated"> nie w obrębie drzewa</target> <note /> </trans-unit> <trans-unit id="LocationMustBeProvided"> <source>Location must be provided in order to provide minimal type qualification.</source> <target state="translated">Lokalizacja musi być określona, aby zapewnić minimalną kwalifikację typu.</target> <note /> </trans-unit> <trans-unit id="SemanticModelMustBeProvided"> <source>SemanticModel must be provided in order to provide minimal type qualification.</source> <target state="translated">Należy podać element SemanticModel w celu określenia minimalnej kwalifikacji typu.</target> <note /> </trans-unit> <trans-unit id="NumberOfTypeParametersAndArgumentsMustMatch"> <source>the number of type parameters and arguments should be the same</source> <target state="translated">liczba parametrów typu i argumentów typu powinna być taka sama</target> <note /> </trans-unit> <trans-unit id="ERR_ResourceInModule"> <source>Cannot link resource files when building a module</source> <target state="translated">Nie można połączyć plików zasobów podczas kompilowania modułu</target> <note /> </trans-unit> <trans-unit id="NotAVbSymbol"> <source>Not a VB symbol.</source> <target state="translated">Nie jest to symbol języka Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ElementsCannotBeNull"> <source>Elements cannot be null.</source> <target state="translated">Elementy nie mogą mieć wartości null.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportClause"> <source>Unused import clause.</source> <target state="translated">Nieużywana klauzula importu.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportStatement"> <source>Unused import statement.</source> <target state="translated">Nieużywana instrukcja importu.</target> <note /> </trans-unit> <trans-unit id="WrongSemanticModelType"> <source>Expected a {0} SemanticModel.</source> <target state="translated">Oczekiwano elementu SemanticModel {0}.</target> <note /> </trans-unit> <trans-unit id="PositionNotWithinTree"> <source>Position must be within span of the syntax tree.</source> <target state="translated">Pozycja musi znajdować się w zasięgu drzewa składni.</target> <note /> </trans-unit> <trans-unit id="SpeculatedSyntaxNodeCannotBelongToCurrentCompilation"> <source>Syntax node to be speculated cannot belong to a syntax tree from the current compilation.</source> <target state="translated">Drzewo składni do przeanalizowania nie może należeć do drzewa składni bieżącej kompilacji.</target> <note /> </trans-unit> <trans-unit id="ChainingSpeculativeModelIsNotSupported"> <source>Chaining speculative semantic model is not supported. You should create a speculative model from the non-speculative ParentModel.</source> <target state="translated">Tworzenie łańcuchów spekulacyjnego modelu semantycznego nie jest obsługiwane. Należy utworzyć model spekulacyjny z nadrzędnego modelu niespekulacyjnego.</target> <note /> </trans-unit> <trans-unit id="IDS_ToolName"> <source>Microsoft (R) Visual Basic Compiler</source> <target state="translated">Kompilator Microsoft (R) Visual Basic Compiler</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine1"> <source>{0} version {1}</source> <target state="translated">{0} w wersji {1}</target> <note /> </trans-unit> <trans-unit id="IDS_LogoLine2"> <source>Copyright (C) Microsoft Corporation. All rights reserved.</source> <target state="translated">Copyright (C) Microsoft Corporation. Wszelkie prawa zastrzeżone.</target> <note /> </trans-unit> <trans-unit id="IDS_LangVersions"> <source>Supported language versions:</source> <target state="translated">Obsługiwane wersje językowe:</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong"> <source>Local name '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">Lokalna nazwa „{0}” jest za długa dla pliku PDB. Rozważ skrócenie jej lub skompilowanie bez opcji /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbLocalNameTooLong_Title"> <source>Local name is too long for PDB</source> <target state="translated">Nazwa lokalna jest za długa dla pliku PDB</target> <note /> </trans-unit> <trans-unit id="WRN_PdbUsingNameTooLong"> <source>Import string '{0}' is too long for PDB. Consider shortening or compiling without /debug.</source> <target state="translated">Ciąg importu „{0}” jest zbyt długi dla pliku PDB. Rozważ skrócenie go lub skompilowanie bez opcji /debug.</target> <note /> </trans-unit> <trans-unit id="WRN_PdbUsingNameTooLong_Title"> <source>Import string is too long for PDB</source> <target state="translated">Ciąg importu jest za długi dla pliku PDB</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefToTypeParameter"> <source>XML comment has a tag with a 'cref' attribute '{0}' that bound to a type parameter. Use the &lt;typeparamref&gt; tag instead.</source> <target state="translated">Komentarz XML ma tag z atrybutem „cref” „{0}”, który jest wiązany z parametrem typu. Zamiast tego użyj tagu &lt;typeparamref&gt;.</target> <note /> </trans-unit> <trans-unit id="WRN_XMLDocCrefToTypeParameter_Title"> <source>XML comment has a tag with a 'cref' attribute that bound to a type parameter</source> <target state="translated">Komentarz XML ma tag z atrybutem „cref”, który jest wiązany z parametrem typu</target> <note /> </trans-unit> <trans-unit id="ERR_LinkedNetmoduleMetadataMustProvideFullPEImage"> <source>Linked netmodule metadata must provide a full PE image: '{0}'.</source> <target state="translated">Połączone metadane modułu netmodule muszą określać pełny obraz PE: „{0}”.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated"> <source>An instance of analyzer {0} cannot be created from {1} : {2}.</source> <target state="translated">Wystąpienia analizatora {0} nie można utworzyć z elementu {1}: {2}.</target> <note /> </trans-unit> <trans-unit id="WRN_AnalyzerCannotBeCreated_Title"> <source>Instance of analyzer cannot be created</source> <target state="translated">Nie można utworzyć wystąpienia analizatora</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly"> <source>The assembly {0} does not contain any analyzers.</source> <target state="translated">Zestaw {0} nie zawiera żadnych analizatorów.</target> <note /> </trans-unit> <trans-unit id="WRN_NoAnalyzerInAssembly_Title"> <source>Assembly does not contain any analyzers</source> <target state="translated">Zestaw nie zawiera analizatorów</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer"> <source>Unable to load analyzer assembly {0} : {1}.</source> <target state="translated">Nie można załadować zestawu analizatora {0}: {1}.</target> <note /> </trans-unit> <trans-unit id="WRN_UnableToLoadAnalyzer_Title"> <source>Unable to load analyzer assembly</source> <target state="translated">Nie można załadować zestawu analizatora</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer"> <source>Skipping some types in analyzer assembly {0} due to a ReflectionTypeLoadException : {1}.</source> <target state="translated">Niektóre typy zestawu analizatora {0} zostaną pominięte z powodu wyjątku ReflectionTypeLoadException: {1}.</target> <note /> </trans-unit> <trans-unit id="INF_UnableToLoadSomeTypesInAnalyzer_Title"> <source>Skip loading types in analyzer assembly that fail due to a ReflectionTypeLoadException</source> <target state="translated">Pomiń ładowanie typów w zestawie analizatora zakończonych niepowodzeniem z powodu wyjątku ReflectionTypeLoadException</target> <note /> </trans-unit> <trans-unit id="ERR_CantReadRulesetFile"> <source>Error reading ruleset file {0} - {1}</source> <target state="translated">Błąd podczas odczytywania pliku zestawu reguł {0} — {1}</target> <note /> </trans-unit> <trans-unit id="ERR_PlatformDoesntSupport"> <source>{0} is not supported in current project type.</source> <target state="translated">Element {0} nie jest obsługiwany w bieżącym typie projektu.</target> <note /> </trans-unit> <trans-unit id="ERR_CantUseRequiredAttribute"> <source>The RequiredAttribute attribute is not permitted on Visual Basic types.</source> <target state="translated">Atrybut RequiredAttribute nie jest dozwolony w typach programu Visual Basic.</target> <note /> </trans-unit> <trans-unit id="ERR_EncodinglessSyntaxTree"> <source>Cannot emit debug information for a source text without encoding.</source> <target state="translated">Nie można wyemitować informacji debugowania dla tekstu źródłowego bez kodowania.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidFormatSpecifier"> <source>'{0}' is not a valid format specifier</source> <target state="translated">„{0}” nie jest prawidłowym specyfikatorem formatu</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPreprocessorConstantType"> <source>Preprocessor constant '{0}' of type '{1}' is not supported, only primitive types are allowed.</source> <target state="translated">Stała preprocesora „{0}” typu „{1}” nie jest obsługiwana. Dozwolone są tylko typy pierwotne.</target> <note /> </trans-unit> <trans-unit id="ERR_ExpectedWarningKeyword"> <source>'Warning' expected.</source> <target state="translated">'Oczekiwano elementu „Warning”.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotBeMadeNullable1"> <source>'{0}' cannot be made nullable.</source> <target state="translated">'Nie można ustawić elementu „{0}” jako dopuszczającego wartość null.</target> <note /> </trans-unit> <trans-unit id="ERR_BadConditionalWithRef"> <source>Leading '?' can only appear inside a 'With' statement, but not inside an object member initializer.</source> <target state="translated">Wiodący znak „?” może występować tylko w instrukcji „With”. Nie może występować w inicjatorze składowej obiektu.</target> <note /> </trans-unit> <trans-unit id="ERR_NullPropagatingOpInExpressionTree"> <source>A null propagating operator cannot be converted into an expression tree.</source> <target state="translated">Nie można przekonwertować operatora propagowania wartości null na drzewo wyrażenia.</target> <note /> </trans-unit> <trans-unit id="ERR_TooLongOrComplexExpression"> <source>An expression is too long or complex to compile</source> <target state="translated">Wyrażenie jest zbyt długie lub zbyt złożone do skompilowania</target> <note /> </trans-unit> <trans-unit id="ERR_ExpressionDoesntHaveName"> <source>This expression does not have a name.</source> <target state="translated">To wyrażenie nie ma nazwy.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidNameOfSubExpression"> <source>This sub-expression cannot be used inside NameOf argument.</source> <target state="translated">Nie można użyć tego podwyrażenia wewnątrz argumentu NameOf.</target> <note /> </trans-unit> <trans-unit id="ERR_MethodTypeArgsUnexpected"> <source>Method type arguments unexpected.</source> <target state="translated">Nieoczekiwane argumenty typu metody.</target> <note /> </trans-unit> <trans-unit id="NoNoneSearchCriteria"> <source>SearchCriteria is expected.</source> <target state="translated">Oczekiwano elementu SearchCriteria.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidAssemblyCulture"> <source>Assembly culture strings may not contain embedded NUL characters.</source> <target state="translated">Ciągi kultury zestawu nie mogą zawierać osadzonych znaków NUL.</target> <note /> </trans-unit> <trans-unit id="ERR_InReferencedAssembly"> <source>There is an error in a referenced assembly '{0}'.</source> <target state="translated">Wystąpił błąd w przywoływanym zestawie „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolationFormatWhitespace"> <source>Format specifier may not contain trailing whitespace.</source> <target state="translated">Specyfikator formatu nie może kończyć się znakiem odstępu.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolationAlignmentOutOfRange"> <source>Alignment value is outside of the supported range.</source> <target state="translated">Wartość wyrównania przypada poza obsługiwanym zakresem.</target> <note /> </trans-unit> <trans-unit id="ERR_InterpolatedStringFactoryError"> <source>There were one or more errors emitting a call to {0}.{1}. Method or its return type may be missing or malformed.</source> <target state="translated">Wystąpił co najmniej jeden błąd podczas emitowania wywołania do elementu {0}.{1}. Brak metody lub jej typu zwracanego bądź zostały one źle sformułowane.</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportClause_Title"> <source>Unused import clause</source> <target state="translated">Nieużywana klauzula importu</target> <note /> </trans-unit> <trans-unit id="HDN_UnusedImportStatement_Title"> <source>Unused import statement</source> <target state="translated">Nieużywana instrukcja importu</target> <note /> </trans-unit> <trans-unit id="ERR_ConstantStringTooLong"> <source>Length of String constant resulting from concatenation exceeds System.Int32.MaxValue. Try splitting the string into multiple constants.</source> <target state="translated">Długość stałej typu String w wyniku łączenia przekracza wartość System.Int32.MaxValue. Spróbuj podzielić ciąg na wiele stałych.</target> <note /> </trans-unit> <trans-unit id="ERR_LanguageVersion"> <source>Visual Basic {0} does not support {1}.</source> <target state="translated">Język Visual Basic {0} nie obsługuje {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_BadPdbData"> <source>Error reading debug information for '{0}'</source> <target state="translated">Błąd podczas odczytywania informacji dotyczących debugowania elementu „{0}”</target> <note /> </trans-unit> <trans-unit id="FEATURE_ArrayLiterals"> <source>array literal expressions</source> <target state="translated">wyrażenia literału w tablicy</target> <note /> </trans-unit> <trans-unit id="FEATURE_AsyncExpressions"> <source>async methods or lambdas</source> <target state="translated">metody asynchroniczne lub wyrażenia lambda</target> <note /> </trans-unit> <trans-unit id="FEATURE_AutoProperties"> <source>auto-implemented properties</source> <target state="translated">właściwości zaimplementowane automatycznie</target> <note /> </trans-unit> <trans-unit id="FEATURE_ReadonlyAutoProperties"> <source>readonly auto-implemented properties</source> <target state="translated">automatycznie implementowane właściwości tylko do odczytu</target> <note /> </trans-unit> <trans-unit id="FEATURE_CoContraVariance"> <source>variance</source> <target state="translated">wariancja</target> <note /> </trans-unit> <trans-unit id="FEATURE_CollectionInitializers"> <source>collection initializers</source> <target state="translated">inicjatory kolekcji</target> <note /> </trans-unit> <trans-unit id="FEATURE_GlobalNamespace"> <source>declaring a Global namespace</source> <target state="translated">deklarowanie globalnej przestrzeni nazw</target> <note /> </trans-unit> <trans-unit id="FEATURE_Iterators"> <source>iterators</source> <target state="translated">iteratory</target> <note /> </trans-unit> <trans-unit id="FEATURE_LineContinuation"> <source>implicit line continuation</source> <target state="translated">niejawna kontynuacja wiersza</target> <note /> </trans-unit> <trans-unit id="FEATURE_StatementLambdas"> <source>multi-line lambda expressions</source> <target state="translated">wielowierszowe wyrażenia lambda</target> <note /> </trans-unit> <trans-unit id="FEATURE_SubLambdas"> <source>'Sub' lambda expressions</source> <target state="translated">'Wyrażenia lambda „Sub”</target> <note /> </trans-unit> <trans-unit id="FEATURE_NullPropagatingOperator"> <source>null conditional operations</source> <target state="translated">operacje warunkowe o wartości null</target> <note /> </trans-unit> <trans-unit id="FEATURE_NameOfExpressions"> <source>'nameof' expressions</source> <target state="translated">'wyrażenia „nameof”</target> <note /> </trans-unit> <trans-unit id="FEATURE_RegionsEverywhere"> <source>region directives within method bodies or regions crossing boundaries of declaration blocks</source> <target state="translated">dyrektywy regionu w treści metod lub regiony przekraczające granice bloków deklaracji</target> <note /> </trans-unit> <trans-unit id="FEATURE_MultilineStringLiterals"> <source>multiline string literals</source> <target state="translated">literały ciągów wielowierszowych</target> <note /> </trans-unit> <trans-unit id="FEATURE_CObjInAttributeArguments"> <source>CObj in attribute arguments</source> <target state="translated">CObj w argumentach atrybutów</target> <note /> </trans-unit> <trans-unit id="FEATURE_LineContinuationComments"> <source>line continuation comments</source> <target state="translated">komentarze dotyczące kontynuacji wiersza</target> <note /> </trans-unit> <trans-unit id="FEATURE_TypeOfIsNot"> <source>TypeOf IsNot expression</source> <target state="translated">Wyrażenie TypeOf IsNot</target> <note /> </trans-unit> <trans-unit id="FEATURE_YearFirstDateLiterals"> <source>year-first date literals</source> <target state="translated">literały daty z numerem roku na początku</target> <note /> </trans-unit> <trans-unit id="FEATURE_WarningDirectives"> <source>warning directives</source> <target state="translated">dyrektywy ostrzeżenia</target> <note /> </trans-unit> <trans-unit id="FEATURE_PartialModules"> <source>partial modules</source> <target state="translated">moduły częściowe</target> <note /> </trans-unit> <trans-unit id="FEATURE_PartialInterfaces"> <source>partial interfaces</source> <target state="translated">interfejsy częściowe</target> <note /> </trans-unit> <trans-unit id="FEATURE_ImplementingReadonlyOrWriteonlyPropertyWithReadwrite"> <source>implementing read-only or write-only property with read-write property</source> <target state="translated">implementowanie właściwości read-only lub write-only z właściwością read-write</target> <note /> </trans-unit> <trans-unit id="FEATURE_DigitSeparators"> <source>digit separators</source> <target state="translated">separatory cyfr</target> <note /> </trans-unit> <trans-unit id="FEATURE_BinaryLiterals"> <source>binary literals</source> <target state="translated">literały binarne</target> <note /> </trans-unit> <trans-unit id="FEATURE_Tuples"> <source>tuples</source> <target state="translated">krotki</target> <note /> </trans-unit> <trans-unit id="FEATURE_PrivateProtected"> <source>Private Protected</source> <target state="translated">Prywatny chroniony</target> <note /> </trans-unit> <trans-unit id="ERR_DebugEntryPointNotSourceMethodDefinition"> <source>Debug entry point must be a definition of a method declared in the current compilation.</source> <target state="translated">Punkt wejściowy debugowania musi być definicją metody zadeklarowanej w bieżącej kompilacji.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidPathMap"> <source>The pathmap option was incorrectly formatted.</source> <target state="translated">Opcja pathmap jest nieprawidłowo sformatowana.</target> <note /> </trans-unit> <trans-unit id="SyntaxTreeIsNotASubmission"> <source>Syntax tree should be created from a submission.</source> <target state="translated">Drzewo składni powinno zostać utworzone na podstawie przesłanych danych.</target> <note /> </trans-unit> <trans-unit id="ERR_TooManyUserStrings"> <source>Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string or XML literals.</source> <target state="translated">Całkowita długość ciągów użytkownika używanych przez program przekracza dozwolony limit. Spróbuj ograniczyć użycie literałów ciągów lub XML.</target> <note /> </trans-unit> <trans-unit id="ERR_PeWritingFailure"> <source>An error occurred while writing the output file: {0}</source> <target state="translated">Wystąpił błąd podczas zapisywania pliku wyjściowego: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_OptionMustBeAbsolutePath"> <source>Option '{0}' must be an absolute path.</source> <target state="translated">Opcja „{0}” musi być ścieżką bezwzględną.</target> <note /> </trans-unit> <trans-unit id="ERR_SourceLinkRequiresPdb"> <source>/sourcelink switch is only supported when emitting PDB.</source> <target state="translated">Przełącznik /sourcelink jest obsługiwany tylko w przypadku emitowania pliku PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleDuplicateElementName"> <source>Tuple element names must be unique.</source> <target state="translated">Nazwy elementów krotek muszą być unikatowe.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch"> <source>The tuple element name '{0}' is ignored because a different name or no name is specified by the target type '{1}'.</source> <target state="translated">Nazwa elementu krotki „{0}” została zignorowana, ponieważ typ elementu docelowego „{1}” określa inną nazwę lub nie określa żadnej nazwy.</target> <note /> </trans-unit> <trans-unit id="WRN_TupleLiteralNameMismatch_Title"> <source>The tuple element name is ignored because a different name or no name is specified by the assignment target.</source> <target state="translated">Nazwa elementu krotki została zignorowana, ponieważ element docelowy przypisania określa inną nazwę lub nie określa żadnej nazwy.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementName"> <source>Tuple element name '{0}' is only allowed at position {1}.</source> <target state="translated">Nazwa elementu krotki „{0}“ jest dozwolona tylko na pozycji {1}.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleReservedElementNameAnyPosition"> <source>Tuple element name '{0}' is disallowed at any position.</source> <target state="translated">Nazwa elementu krotki „{0}“ nie jest dozwolona na żadnej pozycji.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleTooFewElements"> <source>Tuple must contain at least two elements.</source> <target state="translated">Krotka musi zawierać co najmniej dwa elementy.</target> <note /> </trans-unit> <trans-unit id="ERR_TupleElementNamesAttributeMissing"> <source>Cannot define a class or member that utilizes tuples because the compiler required type '{0}' cannot be found. Are you missing a reference?</source> <target state="translated">Nie można zdefiniować klasy lub składowej, która wykorzystuje krotki, ponieważ nie można znaleźć wymaganego typu kompilatora „{0}”. Czy brakuje odwołania?</target> <note /> </trans-unit> <trans-unit id="ERR_ExplicitTupleElementNamesAttribute"> <source>Cannot reference 'System.Runtime.CompilerServices.TupleElementNamesAttribute' explicitly. Use the tuple syntax to define tuple names.</source> <target state="translated">Nie można odwołać się do atrybutu „System.Runtime.CompilerServices.TupleElementNamesAttribute” jawnie. Użyj składni krotek, aby zdefiniować nazwy krotek.</target> <note /> </trans-unit> <trans-unit id="ERR_RefReturningCallInExpressionTree"> <source>An expression tree may not contain a call to a method or property that returns by reference.</source> <target state="translated">Drzewo wyrażenia nie może zawierać wywołania metody lub właściwości zwracanego przez referencję.</target> <note /> </trans-unit> <trans-unit id="ERR_CannotEmbedWithoutPdb"> <source>/embed switch is only supported when emitting a PDB.</source> <target state="translated">Przełącznik /embed jest obsługiwany tylko w przypadku emitowania pliku PDB.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidInstrumentationKind"> <source>Invalid instrumentation kind: {0}</source> <target state="translated">Nieprawidłowy rodzaj instrumentacji: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_DocFileGen"> <source>Error writing to XML documentation file: {0}</source> <target state="translated">Błąd zapisu w pliku dokumentacji XML: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_BadAssemblyName"> <source>Invalid assembly name: {0}</source> <target state="translated">Nieprawidłowa nazwa zestawu: {0}</target> <note /> </trans-unit> <trans-unit id="ERR_TypeForwardedToMultipleAssemblies"> <source>Module '{0}' in assembly '{1}' is forwarding the type '{2}' to multiple assemblies: '{3}' and '{4}'.</source> <target state="translated">Moduł „{0}” w zestawie „{1}” przekazuje typ „{2}” do wielu zestawów: „{3}” i „{4}”.</target> <note /> </trans-unit> <trans-unit id="ERR_Merge_conflict_marker_encountered"> <source>Merge conflict marker encountered</source> <target state="translated">Napotkano znacznik konfliktu scalania</target> <note /> </trans-unit> <trans-unit id="ERR_NoRefOutWhenRefOnly"> <source>Do not use refout when using refonly.</source> <target state="translated">Nie używaj opcji refout, gdy używana jest opcja refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_NoNetModuleOutputWhenRefOutOrRefOnly"> <source>Cannot compile net modules when using /refout or /refonly.</source> <target state="translated">Nie można skompilować modułów sieciowych, gdy używana jest opcja /refout lub /refonly.</target> <note /> </trans-unit> <trans-unit id="ERR_BadNonTrailingNamedArgument"> <source>Named argument '{0}' is used out-of-position but is followed by an unnamed argument</source> <target state="translated">Nazwany argument „{0}” jest używany poza pozycją, ale następuje po nim nienazwany argument</target> <note /> </trans-unit> <trans-unit id="ERR_BadDocumentationMode"> <source>Provided documentation mode is unsupported or invalid: '{0}'.</source> <target state="translated">Podany tryb dokumentacji jest nieobsługiwany lub nieprawidłowy: „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadLanguageVersion"> <source>Provided language version is unsupported or invalid: '{0}'.</source> <target state="translated">Podana wersja języka jest nieobsługiwana lub nieprawidłowa: „{0}”.</target> <note /> </trans-unit> <trans-unit id="ERR_BadSourceCodeKind"> <source>Provided source code kind is unsupported or invalid: '{0}'</source> <target state="translated">Podany rodzaj kodu źródłowego jest nieobsługiwany lub nieprawidłowy: „{0}”</target> <note /> </trans-unit> <trans-unit id="ERR_TupleInferredNamesNotAvailable"> <source>Tuple element name '{0}' is inferred. Please use language version {1} or greater to access an element by its inferred name.</source> <target state="translated">Nazwa elementu krotki „{0}” została wywnioskowana. Użyj wersji języka {1} lub nowszej, aby uzyskać dostęp do elementu według jego wywnioskowanej nazwy.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental"> <source>'{0}' is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">'Element „{0}” jest przeznaczony wyłącznie do celów ewaluacyjnych i może zostać zmieniony albo usunięty w przyszłych aktualizacjach.</target> <note /> </trans-unit> <trans-unit id="WRN_Experimental_Title"> <source>Type is for evaluation purposes only and is subject to change or removal in future updates.</source> <target state="translated">Typ jest przeznaczony wyłącznie do celów ewaluacyjnych i może zostać zmieniony albo usunięty w przyszłych aktualizacjach.</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidDebugInfo"> <source>Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}'</source> <target state="translated">Nie można odczytać informacji debugowania metody „{0}” (token 0x{1}) z zestawu „{2}”</target> <note /> </trans-unit> <trans-unit id="IConversionExpressionIsNotVisualBasicConversion"> <source>{0} is not a valid Visual Basic conversion expression</source> <target state="translated">{0} nie jest prawidłowym wyrażeniem konwersji języka Visual Basic</target> <note /> </trans-unit> <trans-unit id="IArgumentIsNotVisualBasicArgument"> <source>{0} is not a valid Visual Basic argument</source> <target state="translated">{0} nie jest prawidłowym argumentem języka Visual Basic</target> <note /> </trans-unit> <trans-unit id="FEATURE_LeadingDigitSeparator"> <source>leading digit separator</source> <target state="translated">wiodący separator cyfr</target> <note /> </trans-unit> <trans-unit id="ERR_ValueTupleResolutionAmbiguous3"> <source>Predefined type '{0}' is declared in multiple referenced assemblies: '{1}' and '{2}'</source> <target state="translated">Wstępnie zdefiniowany typ „{0}” jest zadeklarowany w wielu przywoływanych zestawach: „{1}” i „{2}”</target> <note /> </trans-unit> <trans-unit id="ICompoundAssignmentOperationIsNotVisualBasicCompoundAssignment"> <source>{0} is not a valid Visual Basic compound assignment operation</source> <target state="translated">{0} nie jest prawidłową złożoną operacją przypisania w języku Visual Basic</target> <note /> </trans-unit> <trans-unit id="ERR_InvalidHashAlgorithmName"> <source>Invalid hash algorithm name: '{0}'</source> <target state="translated">Nieprawidłowa nazwa algorytmu wyznaczania wartości skrótu: „{0}”</target> <note /> </trans-unit> <trans-unit id="FEATURE_InterpolatedStrings"> <source>interpolated strings</source> <target state="translated">ciągi interpolowane</target> <note /> </trans-unit> <trans-unit id="FTL_InvalidInputFileName"> <source>File name '{0}' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long</source> <target state="translated">Nazwa pliku „{0}” jest pusta, zawiera nieprawidłowe znaki, zawiera specyfikację dysku bez bezwzględnej ścieżki lub jest za długa</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeNotSupportedInVB"> <source>'{0}' is not supported in VB.</source> <target state="translated">Element „{0}” nie jest obsługiwany w języku VB.</target> <note /> </trans-unit> <trans-unit id="WRN_AttributeNotSupportedInVB_Title"> <source>Attribute is not supported in VB</source> <target state="translated">Atrybut nie jest obsługiwany w języku VB</target> <note /> </trans-unit> </body> </file> </xliff>
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/Compilers/CSharp/Test/Symbol/Symbols/Metadata/PE/NoPiaInstantiationOfGenericClassAndStruct.cs
// 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. #nullable disable using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols.Metadata.PE { public class NoPiaInstantiationOfGenericClassAndStruct : CSharpTestBase { [Fact] public void NoPiaIllegalGenericInstantiationSymbolForClassThatInheritsGeneric() { //Test class that inherits Generic<NoPIAType> var localTypeSource = @"public class NoPIAGenerics { Class1 field = null; }"; var localConsumer1 = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer1.SourceModule.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType1.GetMembers("field").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, localField.Type.BaseType().Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(localField.Type.BaseType()); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForGenericType() { //Test field with Generic(Of NoPIAType()) var localTypeSource = @"public class NoPIAGenerics { NestedConstructs nested = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("nested").OfType<FieldSymbol>().Single(); var importedField = localField.Type.GetMembers("field2").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedField.Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedField.Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForFieldWithNestedGenericType() { //Test field with Generic(Of IGeneric(Of NoPIAType)) var localTypeSource = @"public class NoPIAGenerics { NestedConstructs nested = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("nested").OfType<FieldSymbol>().Single(); var importedField = localField.Type.GetMembers("field3").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedField.Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedField.Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForFieldWithTwoNestedGenericType() { //Test field with IGeneric(Of IGeneric(Of Generic(Of NoPIAType))) var localTypeSource = @"public class NoPIAGenerics { NestedConstructs nested = New NestedConstructs(); }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("nested").OfType<FieldSymbol>().Single(); var importedField = localField.Type.GetMembers("field5").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, importedField.Type.Kind); var outer = ((NamedTypeSymbol)importedField.Type).TypeArguments().Single(); Assert.Equal(SymbolKind.NamedType, outer.Kind); var inner = ((NamedTypeSymbol)outer).TypeArguments().Single(); Assert.Equal(SymbolKind.ErrorType, inner.Kind); } [Fact] public void NoPIAInterfaceInheritsGenericInterface() { //Test interface that inherits IGeneric(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { Interface1 i1 = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var var1 = classLocalType1.GetMembers("i1").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, var1.Type.Kind); Assert.IsAssignableFrom<PENamedTypeSymbol>(var1.Type); } [Fact] public void NoPIALocalClassInheritsGenericTypeWithPIATypeParameters() { //Test class that inherits Generic(Of NoPIAType) used as method return or arguments var localTypeSource1 = @"public class NoPIAGenerics { InheritsMethods inheritsMethods = null; }"; var localConsumer = CreateCompilation(localTypeSource1); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("inheritsMethods").OfType<FieldSymbol>().Single(); foreach (MethodSymbol m in localField.Type.GetMembers("Method1").OfType<MethodSymbol>()) { if (m.Parameters.Length > 0) { Assert.Equal(SymbolKind.ErrorType, m.Parameters.Where(arg => arg.Name == "c1").Select(arg => arg).Single().Type.BaseType().Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(m.Parameters.Where(arg => arg.Name == "c1").Select(arg => arg).Single().Type.BaseType()); } if (m.ReturnType.TypeKind != TypeKind.Struct) { Assert.Equal(SymbolKind.ErrorType, m.ReturnType.BaseType().Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(m.ReturnType.BaseType()); } } } [Fact] public void NoPIALocalStructImplementInterfaceThatInheritsGenericTypeWithPIATypeParameters() { //Test implementing an interface that inherits IGeneric(Of NoPIAType) var localTypeSource1 = @" public class NoPIAGenerics { Interface1 i1 = new Interface1Impl(); }"; var localConsumer = CreateCompilation(localTypeSource1); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var var1 = classLocalType.GetMembers("i1").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, var1.Type.Kind); Assert.IsAssignableFrom<PENamedTypeSymbol>(var1.Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForPropertyThatTakesGenericOfPIAType() { //Test a static property that takes Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedProperty = local.Type.GetMembers("Property1").OfType<PropertySymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedProperty.Parameters.Single(arg => arg.Name == "x").Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedProperty.Parameters.Single(arg => arg.Name == "x").Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForPropertyThatTakesGenericOfPIAType2() { //Test a static property that takes Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedProperty = local.Type.GetMembers("Property2").OfType<PropertySymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedProperty.Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedProperty.Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForStaticMethodThatTakesGenericOfPiaType() { //Test a static method that takes Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("Method1").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForStaticMethodThatTakesOptionalGenericOfPiaType() { //Test a static method that takes an Optional Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("Method2").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForMethodThatTakesGenericOfEnumPiaType() { // Test an interface method that takes Generic(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { TypeRefs1.Interface2 i2 = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("i2").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("Method3").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForStaticMethodThatTakesGenericOfInterfacePiaType() { // Test a static method that returns Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("Method4").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.ReturnType.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.ReturnType); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForConstructorThatTakesGenericOfStructPiaType() { // Test a constructor that takes Generic(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { TypeRefs2 tr2a = new TypeRefs2(null); }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("tr2a").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers(".ctor").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForOperatorThatTakesGenericOfPiaType() { // Test an operator that takes Generic(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { TypeRefs2 tr2a = new TypeRefs2(null); }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("tr2a").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("op_Implicit").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Single(arg => arg.Name == "x").Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Single(arg => arg.Name == "x").Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForEventThatTakesGenericOfPiaType() { // Test hooking an event that takes Generic(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { TypeRefs2 tr2b = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("tr2b").OfType<FieldSymbol>().Single(); var importedField = local.Type.GetMembers("Event1").OfType<EventSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedField.Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedField.Type); } [Fact] public void NoPiaIllegalGenericInstantiationForEventWithDelegateTypeThatTakesGenericOfPiaType() { //Test declaring event with delegate type that takes generic argument var localTypeSource = @" public class NoPIAGenerics { private event TypeRefs2.Delegate1 Event2; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var var1 = classLocalType.GetMembers("Event2").OfType<EventSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, var1.Type.Kind); } [Fact] public void NoPiaIllegalGenericInstantiationForFieldWithDelegateTypeThatReturnGenericOfPiaType() { //Test declaring field with delegate type that takes generic argument var localTypeSource = @" public class NoPIAGenerics { private static TypeRefs2.Delegate2 Event3; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var var1 = classLocalType.GetMembers("Event3").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, var1.Type.Kind); } [Fact] public void NoPiaIllegalGenericInstantiationForStaticMethodAccessedThroughImports() { //Test static method accessed through Imports var localTypeSource = @" using MyClass1 = Class1; public class NoPIAGenerics { MyClass1 myclass = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("myclass").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, localField.Type.BaseType().Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(localField.Type.BaseType()); } [Fact] public void NoPiaStaticMethodAccessedThroughImportsOfGenericClass() { //Test static method accessed through Imports of generic class var localTypeSource = @" using MyGenericClass2 = Class2<ISubFuncProp>; public class NoPIAGenerics { MyGenericClass2 mygeneric = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("mygeneric").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, localField.Type.Kind); Assert.IsType<ConstructedNamedTypeSymbol>(localField.Type); } [Fact] public void NoPIAClassThatInheritsGenericOfNoPIAType() { //Test class that inherits Generic(Of NoPIAType) var localTypeSource1 = @"public class BaseClass : System.Collections.Generic.List<FooStruct> { } public class DrivedClass { public static void Method1(BaseClass c1) { } public static BaseClass Method1() { return null; } }"; var localConsumer = CreateCompilation(localTypeSource1); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("DrivedClass").Single(); foreach (MethodSymbol m in classLocalType.GetMembers("Method1").OfType<MethodSymbol>()) { if (m.Parameters.Length > 0) { Assert.Equal(SymbolKind.Parameter, m.Parameters.Where(arg => arg.Name == "c1").Select(arg => arg).Single().Kind); Assert.True(m.Parameters.Where(arg => arg.Name == "c1").Select(arg => arg).Single().Type.IsFromCompilation(localConsumer)); } if (m.ReturnType.TypeKind != TypeKind.Struct) { Assert.Equal(SymbolKind.NamedType, m.ReturnType.Kind); Assert.True(m.ReturnType.IsFromCompilation(localConsumer)); } } } [Fact] public void NoPIATypeImplementingAnInterfaceThatInheritsIGenericOfNoPiaType() { //Test implementing an interface that inherits IGeneric(Of NoPIAType) var localTypeSource = @"public struct Interface1Impl2 : Interface4 { }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("Interface1Impl2").Single(); Assert.Equal(SymbolKind.NamedType, classLocalType.Kind); Assert.True(classLocalType.IsFromCompilation(localConsumer)); Assert.True(classLocalType.IsValueType); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForAssemblyRefsWithClassThatInheritsGenericOfNoPiaType() { //Test class that inherits Generic(Of NoPIAType) var localConsumer = CreateCompilationWithMscorlib40(assemblyName: "Dummy", source: (string[])null, references: new[] { TestReferences.SymbolsTests.NoPia.NoPIAGenericsAsm1, }); var localConsumerRefsAsm = localConsumer.Assembly.GetNoPiaResolutionAssemblies(); var nestedType = localConsumerRefsAsm.Where(a => a.Name == "NoPIAGenerics1-Asm1").Single().GlobalNamespace.GetTypeMembers("NestedConstructs").Single(); var localField = nestedType.GetMembers("field1").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ArrayType, localField.Type.Kind); Assert.Equal(SymbolKind.ErrorType, ((ArrayTypeSymbol)localField.Type).ElementType.Kind); } [ConditionalFact(typeof(DesktopOnly))] public void NoPIAGenericsAssemblyRefsWithClassThatInheritsGenericOfNoPiaType() { //Test class that inherits Generic(Of NoPIAType) var localConsumer = CreateCompilation(null); var localConsumerRefsAsm = localConsumer.Assembly.GetNoPiaResolutionAssemblies(); var nestedType = localConsumerRefsAsm[1].GlobalNamespace.GetTypeMembers("NestedConstructs").Single(); var localField = nestedType.GetMembers("field1").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ArrayType, localField.Type.Kind); Assert.True(localField.Type is ArrayTypeSymbol); } [ConditionalFact(typeof(DesktopOnly))] public void NoPIAGenericsAssemblyRefs3() { //Test a static method that returns Generic(Of NoPIAType) var localConsumer = CreateCompilation(null); var localConsumerRefsAsm = localConsumer.Assembly.GetNoPiaResolutionAssemblies(); var nestedType = localConsumerRefsAsm[1].GlobalNamespace.GetTypeMembers("TypeRefs1").Single(); var localMethod = nestedType.GetMembers("Method4").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, localMethod.ReturnType.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(localMethod.ReturnType); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolforStaticMethodThatReturnsGenericOfNoPiaType() { //Test a static method that returns Generic(Of NoPIAType) var localTypeSource = @" using System.Collections.Generic; public class TypeRefs1 { public void Method1(List<FooStruct> x) { } public void Method2(List<ISubFuncProp> x = null) { } public interface Interface2 { void Method3(List<FooEnum> x); } public List<ISubFuncProp> Method4() { return new List<ISubFuncProp>(); } public List<FooStruct> Method4() { return null; } }"; var localType = CreateCompilation(assemblyName: "Dummy", source: localTypeSource, references: new[] { TestReferences.SymbolsTests.NoPia.GeneralPia.WithEmbedInteropTypes(true) }); var localConsumer = CreateCompilation(assemblyName: "Dummy", source: (string[])null, references: new MetadataReference[] { TestReferences.SymbolsTests.NoPia.GeneralPiaCopy, new CSharpCompilationReference(localType) }); var localConsumerRefsAsm = localConsumer.Assembly.GetNoPiaResolutionAssemblies(); var nestedType = localConsumerRefsAsm.First(arg => arg.Name == "Dummy").GlobalNamespace.GetTypeMembers("TypeRefs1").Single(); var methodSymbol = nestedType.GetMembers("Method4").OfType<MethodSymbol>(); foreach (MethodSymbol m in methodSymbol) { Assert.Equal(SymbolKind.ErrorType, m.ReturnType.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(m.ReturnType); } } public CSharpCompilation CreateCompilation(string source) { return CreateCompilationWithMscorlib46( assemblyName: "Dummy", source: (null == source) ? null : new string[] { source }, references: new[] { TestReferences.SymbolsTests.NoPia.NoPIAGenericsAsm1, TestReferences.SymbolsTests.NoPia.GeneralPiaCopy }); } } }
// 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. #nullable disable using System.Collections.Generic; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Symbols.Metadata.PE { public class NoPiaInstantiationOfGenericClassAndStruct : CSharpTestBase { [Fact] public void NoPiaIllegalGenericInstantiationSymbolForClassThatInheritsGeneric() { //Test class that inherits Generic<NoPIAType> var localTypeSource = @"public class NoPIAGenerics { Class1 field = null; }"; var localConsumer1 = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer1.SourceModule.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType1.GetMembers("field").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, localField.Type.BaseType().Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(localField.Type.BaseType()); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForGenericType() { //Test field with Generic(Of NoPIAType()) var localTypeSource = @"public class NoPIAGenerics { NestedConstructs nested = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("nested").OfType<FieldSymbol>().Single(); var importedField = localField.Type.GetMembers("field2").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedField.Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedField.Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForFieldWithNestedGenericType() { //Test field with Generic(Of IGeneric(Of NoPIAType)) var localTypeSource = @"public class NoPIAGenerics { NestedConstructs nested = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("nested").OfType<FieldSymbol>().Single(); var importedField = localField.Type.GetMembers("field3").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedField.Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedField.Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForFieldWithTwoNestedGenericType() { //Test field with IGeneric(Of IGeneric(Of Generic(Of NoPIAType))) var localTypeSource = @"public class NoPIAGenerics { NestedConstructs nested = New NestedConstructs(); }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("nested").OfType<FieldSymbol>().Single(); var importedField = localField.Type.GetMembers("field5").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, importedField.Type.Kind); var outer = ((NamedTypeSymbol)importedField.Type).TypeArguments().Single(); Assert.Equal(SymbolKind.NamedType, outer.Kind); var inner = ((NamedTypeSymbol)outer).TypeArguments().Single(); Assert.Equal(SymbolKind.ErrorType, inner.Kind); } [Fact] public void NoPIAInterfaceInheritsGenericInterface() { //Test interface that inherits IGeneric(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { Interface1 i1 = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var var1 = classLocalType1.GetMembers("i1").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, var1.Type.Kind); Assert.IsAssignableFrom<PENamedTypeSymbol>(var1.Type); } [Fact] public void NoPIALocalClassInheritsGenericTypeWithPIATypeParameters() { //Test class that inherits Generic(Of NoPIAType) used as method return or arguments var localTypeSource1 = @"public class NoPIAGenerics { InheritsMethods inheritsMethods = null; }"; var localConsumer = CreateCompilation(localTypeSource1); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("inheritsMethods").OfType<FieldSymbol>().Single(); foreach (MethodSymbol m in localField.Type.GetMembers("Method1").OfType<MethodSymbol>()) { if (m.Parameters.Length > 0) { Assert.Equal(SymbolKind.ErrorType, m.Parameters.Where(arg => arg.Name == "c1").Select(arg => arg).Single().Type.BaseType().Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(m.Parameters.Where(arg => arg.Name == "c1").Select(arg => arg).Single().Type.BaseType()); } if (m.ReturnType.TypeKind != TypeKind.Struct) { Assert.Equal(SymbolKind.ErrorType, m.ReturnType.BaseType().Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(m.ReturnType.BaseType()); } } } [Fact] public void NoPIALocalStructImplementInterfaceThatInheritsGenericTypeWithPIATypeParameters() { //Test implementing an interface that inherits IGeneric(Of NoPIAType) var localTypeSource1 = @" public class NoPIAGenerics { Interface1 i1 = new Interface1Impl(); }"; var localConsumer = CreateCompilation(localTypeSource1); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var var1 = classLocalType.GetMembers("i1").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, var1.Type.Kind); Assert.IsAssignableFrom<PENamedTypeSymbol>(var1.Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForPropertyThatTakesGenericOfPIAType() { //Test a static property that takes Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedProperty = local.Type.GetMembers("Property1").OfType<PropertySymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedProperty.Parameters.Single(arg => arg.Name == "x").Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedProperty.Parameters.Single(arg => arg.Name == "x").Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForPropertyThatTakesGenericOfPIAType2() { //Test a static property that takes Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedProperty = local.Type.GetMembers("Property2").OfType<PropertySymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedProperty.Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedProperty.Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForStaticMethodThatTakesGenericOfPiaType() { //Test a static method that takes Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("Method1").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForStaticMethodThatTakesOptionalGenericOfPiaType() { //Test a static method that takes an Optional Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType1 = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType1.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("Method2").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForMethodThatTakesGenericOfEnumPiaType() { // Test an interface method that takes Generic(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { TypeRefs1.Interface2 i2 = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("i2").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("Method3").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForStaticMethodThatTakesGenericOfInterfacePiaType() { // Test a static method that returns Generic(Of NoPIAType) var localTypeSource = @"public class NoPIAGenerics { TypeRefs1 typeRef = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("typeRef").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("Method4").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.ReturnType.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.ReturnType); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForConstructorThatTakesGenericOfStructPiaType() { // Test a constructor that takes Generic(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { TypeRefs2 tr2a = new TypeRefs2(null); }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("tr2a").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers(".ctor").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Where(arg => arg.Name == "x").Select(arg => arg).Single().Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForOperatorThatTakesGenericOfPiaType() { // Test an operator that takes Generic(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { TypeRefs2 tr2a = new TypeRefs2(null); }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("tr2a").OfType<FieldSymbol>().Single(); var importedMethod = local.Type.GetMembers("op_Implicit").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedMethod.Parameters.Single(arg => arg.Name == "x").Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedMethod.Parameters.Single(arg => arg.Name == "x").Type); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForEventThatTakesGenericOfPiaType() { // Test hooking an event that takes Generic(Of NoPIAType) var localTypeSource = @" public class NoPIAGenerics { TypeRefs2 tr2b = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var local = classLocalType.GetMembers("tr2b").OfType<FieldSymbol>().Single(); var importedField = local.Type.GetMembers("Event1").OfType<EventSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, importedField.Type.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(importedField.Type); } [Fact] public void NoPiaIllegalGenericInstantiationForEventWithDelegateTypeThatTakesGenericOfPiaType() { //Test declaring event with delegate type that takes generic argument var localTypeSource = @" public class NoPIAGenerics { private event TypeRefs2.Delegate1 Event2; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var var1 = classLocalType.GetMembers("Event2").OfType<EventSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, var1.Type.Kind); } [Fact] public void NoPiaIllegalGenericInstantiationForFieldWithDelegateTypeThatReturnGenericOfPiaType() { //Test declaring field with delegate type that takes generic argument var localTypeSource = @" public class NoPIAGenerics { private static TypeRefs2.Delegate2 Event3; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var var1 = classLocalType.GetMembers("Event3").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, var1.Type.Kind); } [Fact] public void NoPiaIllegalGenericInstantiationForStaticMethodAccessedThroughImports() { //Test static method accessed through Imports var localTypeSource = @" using MyClass1 = Class1; public class NoPIAGenerics { MyClass1 myclass = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("myclass").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, localField.Type.BaseType().Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(localField.Type.BaseType()); } [Fact] public void NoPiaStaticMethodAccessedThroughImportsOfGenericClass() { //Test static method accessed through Imports of generic class var localTypeSource = @" using MyGenericClass2 = Class2<ISubFuncProp>; public class NoPIAGenerics { MyGenericClass2 mygeneric = null; }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("NoPIAGenerics").Single(); var localField = classLocalType.GetMembers("mygeneric").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.NamedType, localField.Type.Kind); Assert.IsType<ConstructedNamedTypeSymbol>(localField.Type); } [Fact] public void NoPIAClassThatInheritsGenericOfNoPIAType() { //Test class that inherits Generic(Of NoPIAType) var localTypeSource1 = @"public class BaseClass : System.Collections.Generic.List<FooStruct> { } public class DrivedClass { public static void Method1(BaseClass c1) { } public static BaseClass Method1() { return null; } }"; var localConsumer = CreateCompilation(localTypeSource1); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("DrivedClass").Single(); foreach (MethodSymbol m in classLocalType.GetMembers("Method1").OfType<MethodSymbol>()) { if (m.Parameters.Length > 0) { Assert.Equal(SymbolKind.Parameter, m.Parameters.Where(arg => arg.Name == "c1").Select(arg => arg).Single().Kind); Assert.True(m.Parameters.Where(arg => arg.Name == "c1").Select(arg => arg).Single().Type.IsFromCompilation(localConsumer)); } if (m.ReturnType.TypeKind != TypeKind.Struct) { Assert.Equal(SymbolKind.NamedType, m.ReturnType.Kind); Assert.True(m.ReturnType.IsFromCompilation(localConsumer)); } } } [Fact] public void NoPIATypeImplementingAnInterfaceThatInheritsIGenericOfNoPiaType() { //Test implementing an interface that inherits IGeneric(Of NoPIAType) var localTypeSource = @"public struct Interface1Impl2 : Interface4 { }"; var localConsumer = CreateCompilation(localTypeSource); NamedTypeSymbol classLocalType = localConsumer.GlobalNamespace.GetTypeMembers("Interface1Impl2").Single(); Assert.Equal(SymbolKind.NamedType, classLocalType.Kind); Assert.True(classLocalType.IsFromCompilation(localConsumer)); Assert.True(classLocalType.IsValueType); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolForAssemblyRefsWithClassThatInheritsGenericOfNoPiaType() { //Test class that inherits Generic(Of NoPIAType) var localConsumer = CreateCompilationWithMscorlib40(assemblyName: "Dummy", source: (string[])null, references: new[] { TestReferences.SymbolsTests.NoPia.NoPIAGenericsAsm1, }); var localConsumerRefsAsm = localConsumer.Assembly.GetNoPiaResolutionAssemblies(); var nestedType = localConsumerRefsAsm.Where(a => a.Name == "NoPIAGenerics1-Asm1").Single().GlobalNamespace.GetTypeMembers("NestedConstructs").Single(); var localField = nestedType.GetMembers("field1").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ArrayType, localField.Type.Kind); Assert.Equal(SymbolKind.ErrorType, ((ArrayTypeSymbol)localField.Type).ElementType.Kind); } [ConditionalFact(typeof(DesktopOnly))] public void NoPIAGenericsAssemblyRefsWithClassThatInheritsGenericOfNoPiaType() { //Test class that inherits Generic(Of NoPIAType) var localConsumer = CreateCompilation(null); var localConsumerRefsAsm = localConsumer.Assembly.GetNoPiaResolutionAssemblies(); var nestedType = localConsumerRefsAsm[1].GlobalNamespace.GetTypeMembers("NestedConstructs").Single(); var localField = nestedType.GetMembers("field1").OfType<FieldSymbol>().Single(); Assert.Equal(SymbolKind.ArrayType, localField.Type.Kind); Assert.True(localField.Type is ArrayTypeSymbol); } [ConditionalFact(typeof(DesktopOnly))] public void NoPIAGenericsAssemblyRefs3() { //Test a static method that returns Generic(Of NoPIAType) var localConsumer = CreateCompilation(null); var localConsumerRefsAsm = localConsumer.Assembly.GetNoPiaResolutionAssemblies(); var nestedType = localConsumerRefsAsm[1].GlobalNamespace.GetTypeMembers("TypeRefs1").Single(); var localMethod = nestedType.GetMembers("Method4").OfType<MethodSymbol>().Single(); Assert.Equal(SymbolKind.ErrorType, localMethod.ReturnType.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(localMethod.ReturnType); } [Fact] public void NoPiaIllegalGenericInstantiationSymbolforStaticMethodThatReturnsGenericOfNoPiaType() { //Test a static method that returns Generic(Of NoPIAType) var localTypeSource = @" using System.Collections.Generic; public class TypeRefs1 { public void Method1(List<FooStruct> x) { } public void Method2(List<ISubFuncProp> x = null) { } public interface Interface2 { void Method3(List<FooEnum> x); } public List<ISubFuncProp> Method4() { return new List<ISubFuncProp>(); } public List<FooStruct> Method4() { return null; } }"; var localType = CreateCompilation(assemblyName: "Dummy", source: localTypeSource, references: new[] { TestReferences.SymbolsTests.NoPia.GeneralPia.WithEmbedInteropTypes(true) }); var localConsumer = CreateCompilation(assemblyName: "Dummy", source: (string[])null, references: new MetadataReference[] { TestReferences.SymbolsTests.NoPia.GeneralPiaCopy, new CSharpCompilationReference(localType) }); var localConsumerRefsAsm = localConsumer.Assembly.GetNoPiaResolutionAssemblies(); var nestedType = localConsumerRefsAsm.First(arg => arg.Name == "Dummy").GlobalNamespace.GetTypeMembers("TypeRefs1").Single(); var methodSymbol = nestedType.GetMembers("Method4").OfType<MethodSymbol>(); foreach (MethodSymbol m in methodSymbol) { Assert.Equal(SymbolKind.ErrorType, m.ReturnType.Kind); Assert.IsType<NoPiaIllegalGenericInstantiationSymbol>(m.ReturnType); } } public CSharpCompilation CreateCompilation(string source) { return CreateCompilationWithMscorlib46( assemblyName: "Dummy", source: (null == source) ? null : new string[] { source }, references: new[] { TestReferences.SymbolsTests.NoPia.NoPIAGenericsAsm1, TestReferences.SymbolsTests.NoPia.GeneralPiaCopy }); } } }
-1
dotnet/roslyn
55,686
Options refactoring
Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
tmat
2021-08-18T01:10:34Z
2021-09-03T22:40:30Z
9e0b1adf36ff313a8e5374b401352b927ef3fb59
9525fa502e6ac4eabf012b47a6c764bb1b316242
Options refactoring. Separate global client options from solution options - see https://github.com/dotnet/roslyn/issues/55728. KeybindingResetDetector refactoring: Remove dependency on (VisualStudio)Workspace, remove IExperiment.
./src/VisualStudio/Setup.Dependencies/Roslyn.VisualStudio.Setup.Dependencies.csproj
<?xml version="1.0" encoding="utf-8"?> <!-- 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. --> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Library</OutputType> <RootNamespace>Roslyn.VisualStudio.Setup.Dependencies</RootNamespace> <TargetFramework>net472</TargetFramework> <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> <!-- VSIX --> <GeneratePkgDefFile>true</GeneratePkgDefFile> <IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer> <IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer> <IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment> <ExtensionInstallationRoot>$(CommonExtensionInstallationRoot)</ExtensionInstallationRoot> <ExtensionInstallationFolder>Microsoft\ManagedLanguages\VBCSharp\Dependencies</ExtensionInstallationFolder> </PropertyGroup> <ItemGroup Label="PkgDef"> <PkgDefBindingRedirect Include="System.ValueTuple.dll" FusionName="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/> </ItemGroup> <ItemGroup> <!-- Roslyn dependencies that are installed by other VS components. This project deploys them to RoslynDev hive to enable F5 scenario, but the resulting VSIX not inserted into VS. --> <NuGetPackageToIncludeInVsix Include="Microsoft.Bcl.AsyncInterfaces" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="Microsoft.DiaSymReader" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="Microsoft.DiaSymReader.PortablePdb" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Buffers" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Collections.Immutable" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Memory" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Numerics.Vectors" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Reflection.Metadata" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Runtime.CompilerServices.Unsafe" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Text.Encoding.CodePages" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Threading.Tasks.Extensions" PkgDefEntry="BindingRedirect" /> </ItemGroup> <ItemGroup> <None Include="source.extension.vsixmanifest"> <SubType>Designer</SubType> </None> </ItemGroup> <ItemGroup> <!-- Needed to use RegistrationAttribute --> <PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="$(MicrosoftVisualStudioShell150Version)" /> <!-- All packages that we depend on, either as facades or implementations --> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesVersion)" /> <PackageReference Include="Microsoft.DiaSymReader" Version="$(MicrosoftDiaSymReaderVersion)" /> <PackageReference Include="Microsoft.DiaSymReader.PortablePdb" Version="$(MicrosoftDiaSymReaderPortablePdbVersion)" /> <PackageReference Include="Microsoft.ServiceHub.Framework" Version="$(MicrosoftServiceHubFrameworkVersion)" /> <PackageReference Include="Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime" Version="$(MicrosoftVisualStudioImagingInterop140DesignTimeVersion)" /> <PackageReference Include="Microsoft.VisualStudio.SDK.Analyzers" Version="$(MicrosoftVisualStudioSDKAnalyzersVersion)" PrivateAssets="all" /> <PackageReference Include="Microsoft.VisualStudio.Threading" Version="$(MicrosoftVisualStudioThreadingVersion)" /> <PackageReference Include="Microsoft.VisualStudio.Validation" Version="$(MicrosoftVisualStudioValidationVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" /> <PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" /> <PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" /> <PackageReference Include="System.Text.Encoding.CodePages" Version="$(SystemTextEncodingCodePagesVersion)" /> <PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" /> <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" /> <PackageReference Include="Microsoft.ServiceHub.Framework" Version="$(MicrosoftServiceHubFrameworkVersion)" /> <PackageReference Include="Nerdbank.Streams" Version="$(NerdbankStreamsVersion)" /> </ItemGroup> <!-- Workaround to make Roslyn work on Dev15. Deploys System.ValueTuple 4.0.3.0 and binding redirects to override System.ValueTuple 4.0.1.0 in PrivateAssemblies. Roslyn binaries are compiled against net472 and netstandard2.0. They reference ValueTuple types from mscorlib.dll and netstandard.dll, respectively. netstandard.dll forwards to System.ValueTuple.dll 4.0.0.0, which in turn forwards to an implementation in mscorlib.dll. System.ValueTuple.dll 4.0.1.0, which ships in PrivateAssemblies, also has an implementation of ValueTuple types (it does not forward to mscorlib.dll). We need to prevent this assembly from loading since that would result in two different ValueTuple types loaded by different Roslyn components. The binding redirects are specified manually since ProvideDependencyBindingRedirection attribute doesn't generate the right version for some reason. Using System.ValueTuple.dll from Framework directory does not work since we'd need a downgrading redirect 0.0.0.0-4.0.1.0 -> 4.0.0.0, which VS doesn't apply since it already has a redirect 0.0.0.0-4.0.1.0 -> 4.0.1.0. TODO: Remove once we move to Dev16 (https://github.com/dotnet/roslyn/issues/29705) --> <ItemGroup> <PackageReference Include="System.ValueTuple" Version="$(SystemValueTupleVersion)" /> <NuGetPackageToIncludeInVsix Include="System.ValueTuple" /> </ItemGroup> </Project>
<?xml version="1.0" encoding="utf-8"?> <!-- 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. --> <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Library</OutputType> <RootNamespace>Roslyn.VisualStudio.Setup.Dependencies</RootNamespace> <TargetFramework>net472</TargetFramework> <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> <!-- VSIX --> <GeneratePkgDefFile>true</GeneratePkgDefFile> <IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer> <IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer> <IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment> <ExtensionInstallationRoot>$(CommonExtensionInstallationRoot)</ExtensionInstallationRoot> <ExtensionInstallationFolder>Microsoft\ManagedLanguages\VBCSharp\Dependencies</ExtensionInstallationFolder> </PropertyGroup> <ItemGroup Label="PkgDef"> <PkgDefBindingRedirect Include="System.ValueTuple.dll" FusionName="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/> </ItemGroup> <ItemGroup> <!-- Roslyn dependencies that are installed by other VS components. This project deploys them to RoslynDev hive to enable F5 scenario, but the resulting VSIX not inserted into VS. --> <NuGetPackageToIncludeInVsix Include="Microsoft.Bcl.AsyncInterfaces" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="Microsoft.DiaSymReader" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="Microsoft.DiaSymReader.PortablePdb" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Buffers" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Collections.Immutable" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Memory" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Numerics.Vectors" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Reflection.Metadata" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Runtime.CompilerServices.Unsafe" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Text.Encoding.CodePages" PkgDefEntry="BindingRedirect" /> <NuGetPackageToIncludeInVsix Include="System.Threading.Tasks.Extensions" PkgDefEntry="BindingRedirect" /> </ItemGroup> <ItemGroup> <None Include="source.extension.vsixmanifest"> <SubType>Designer</SubType> </None> </ItemGroup> <ItemGroup> <!-- Needed to use RegistrationAttribute --> <PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="$(MicrosoftVisualStudioShell150Version)" /> <!-- All packages that we depend on, either as facades or implementations --> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesVersion)" /> <PackageReference Include="Microsoft.DiaSymReader" Version="$(MicrosoftDiaSymReaderVersion)" /> <PackageReference Include="Microsoft.DiaSymReader.PortablePdb" Version="$(MicrosoftDiaSymReaderPortablePdbVersion)" /> <PackageReference Include="Microsoft.ServiceHub.Framework" Version="$(MicrosoftServiceHubFrameworkVersion)" /> <PackageReference Include="Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime" Version="$(MicrosoftVisualStudioImagingInterop140DesignTimeVersion)" /> <PackageReference Include="Microsoft.VisualStudio.SDK.Analyzers" Version="$(MicrosoftVisualStudioSDKAnalyzersVersion)" PrivateAssets="all" /> <PackageReference Include="Microsoft.VisualStudio.Threading" Version="$(MicrosoftVisualStudioThreadingVersion)" /> <PackageReference Include="Microsoft.VisualStudio.Validation" Version="$(MicrosoftVisualStudioValidationVersion)" /> <PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" /> <PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" /> <PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" /> <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" /> <PackageReference Include="System.Text.Encoding.CodePages" Version="$(SystemTextEncodingCodePagesVersion)" /> <PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" /> <PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" /> <PackageReference Include="Microsoft.ServiceHub.Framework" Version="$(MicrosoftServiceHubFrameworkVersion)" /> <PackageReference Include="Nerdbank.Streams" Version="$(NerdbankStreamsVersion)" /> </ItemGroup> <!-- Workaround to make Roslyn work on Dev15. Deploys System.ValueTuple 4.0.3.0 and binding redirects to override System.ValueTuple 4.0.1.0 in PrivateAssemblies. Roslyn binaries are compiled against net472 and netstandard2.0. They reference ValueTuple types from mscorlib.dll and netstandard.dll, respectively. netstandard.dll forwards to System.ValueTuple.dll 4.0.0.0, which in turn forwards to an implementation in mscorlib.dll. System.ValueTuple.dll 4.0.1.0, which ships in PrivateAssemblies, also has an implementation of ValueTuple types (it does not forward to mscorlib.dll). We need to prevent this assembly from loading since that would result in two different ValueTuple types loaded by different Roslyn components. The binding redirects are specified manually since ProvideDependencyBindingRedirection attribute doesn't generate the right version for some reason. Using System.ValueTuple.dll from Framework directory does not work since we'd need a downgrading redirect 0.0.0.0-4.0.1.0 -> 4.0.0.0, which VS doesn't apply since it already has a redirect 0.0.0.0-4.0.1.0 -> 4.0.1.0. TODO: Remove once we move to Dev16 (https://github.com/dotnet/roslyn/issues/29705) --> <ItemGroup> <PackageReference Include="System.ValueTuple" Version="$(SystemValueTupleVersion)" /> <NuGetPackageToIncludeInVsix Include="System.ValueTuple" /> </ItemGroup> </Project>
-1