diff --git a/BuildAndTest.proj b/BuildAndTest.proj index 362ce85a3aae0..e6b27797e3c7e 100644 --- a/BuildAndTest.proj +++ b/BuildAndTest.proj @@ -96,7 +96,7 @@ - + diff --git a/README.md b/README.md index 48c70c19d5e3b..6b210ee7a61f0 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,18 @@ |:--:|:--:|:--:|:--:|:--:|:--:| |**stabilization**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_win_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_win_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_win_dbg_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_win_dbg_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_win_rel_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_win_rel_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_win_rel_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_win_rel_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_determinism/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_determinism/)| |**master**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_master_win_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_master_win_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_master_win_dbg_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_master_win_dbg_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_master_win_rel_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_master_win_rel_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_master_win_rel_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_master_win_rel_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_master_determinism/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_master_determinism/)| +|**future-stabilization**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_win_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_win_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_win_dbg_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_win_dbg_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_win_rel_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_win_rel_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_win_rel_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_win_rel_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_determinism/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_determinism/)| |**future**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future_win_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future_win_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future_win_dbg_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future_win_dbg_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future_win_rel_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future_win_rel_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future_win_rel_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future_win_rel_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future_determinism/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future_determinism/)| - +|**hotfix**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_win_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_win_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_win_dbg_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_win_dbg_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_win_rel_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_win_rel_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_win_rel_unit64/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_win_rel_unit64/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_determinism/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_determinism/)| ### Linux/Mac - Unit Tests ||Linux|Mac OSX| |:--:|:--:|:--:| |**stabilization**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_lin_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_lin_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_mac_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_stabil_mac_dbg_unit32/)| |**master**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_master_lin_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_master_lin_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_master_mac_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_master_mac_dbg_unit32/)| +|**future-stabilization**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_lin_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_lin_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_mac_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future-stabilization_mac_dbg_unit32/)| |**future**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future_lin_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future_lin_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_future_mac_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_future_mac_dbg_unit32/)| - +|**hotfix**|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_lin_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_lin_dbg_unit32/)|[![Build Status](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_mac_dbg_unit32/badge/icon)](http://dotnet-ci.cloudapp.net/job/roslyn_hotfix_mac_dbg_unit32/)| [![Join the chat at https://gitter.im/dotnet/roslyn](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dotnet/roslyn?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) diff --git a/build/Targets/VSL.Versions.targets b/build/Targets/VSL.Versions.targets index 355ccaf50db16..55e4c897189d8 100644 --- a/build/Targets/VSL.Versions.targets +++ b/build/Targets/VSL.Versions.targets @@ -5,7 +5,7 @@ 1.1.37 2.8.5 1.0.27 - $(SystemReflectionMetadataAssemblyVersion)-rc3-23811 + $(SystemReflectionMetadataAssemblyVersion)-rc2-23826 $(SystemCollectionsImmutableAssemblyVersion) 1.3.3 $(NuGetCommandLineAssemblyVersion) diff --git a/docs/contributing/Building, Debugging, and Testing on Windows.md b/docs/contributing/Building, Debugging, and Testing on Windows.md index 653f4e97dedab..e08970c5da84f 100644 --- a/docs/contributing/Building, Debugging, and Testing on Windows.md +++ b/docs/contributing/Building, Debugging, and Testing on Windows.md @@ -1,7 +1,20 @@ # Required Software 1. [Visual Studio 2015 with Update 1](http://go.microsoft.com/fwlink/?LinkId=691129). _You need Update 1_. -2. Visual Studio 2015 Extensibility Tools. If you already installed Visual Studio, choose "Modify" from the Programs and Features control panel, and check "Visual Studio Extensibility". +2. Visual Studio 2015 Extensibility Tools. + + If you already installed Visual Studio, the Extensibility Tools can be added as follows: + - Open Control Panel -> Programs and Features + - Select the entry for your installation of Microsoft Visual Studio. Depending on your version, it may appear as follows: + - Microsoft Visual Studio Community 2015 with Update 1 + - Microsoft Visual Studio Professional 2015 + - Microsoft Visual Studio Enterprise 2015 + - Press the 'Change' button + - In the resulting window, press the 'Modify' button + - Check the "Visual Studio Extensibility Tools Update 1" item and press the 'Next' button + - Press the 'Update' button + + # Getting the Code diff --git a/netci.groovy b/netci.groovy index da9ab477ff927..b1710e37f1fb6 100644 --- a/netci.groovy +++ b/netci.groovy @@ -174,16 +174,21 @@ static void addStandardJob(def myJob, String jobName, String branchName, String } } +def branchNames = [] ['master', 'future', 'stabilization', 'future-stabilization', 'hotfixes', 'prtest'].each { branchName -> - // folder("${branchName.substring(0, 6)}") + def shortBranchName = branchName.substring(0, 6) + def jobBranchName = shortBranchName in branchNames ? branchName : shortBranchName + branchNames << jobBranchName + + // folder("${jobBranchName}") ['win', 'linux', 'mac'].each { opsys -> - // folder("${branchName.substring(0, 6)}/${opsys.substring(0, 3)}") + // folder("${jobBranchName}/${opsys.substring(0, 3)}") ['dbg', 'rel'].each { configuration -> if ((configuration == 'dbg') || ((branchName != 'prtest') && (opsys == 'win'))) { - // folder("${branchName.substring(0, 6)}/${opsys.substring(0, 3)}/${configuration}") + // folder("${jobBranchName}/${opsys.substring(0, 3)}/${configuration}") ['unit32', 'unit64'].each { buildTarget -> if ((opsys == 'win') || (buildTarget == 'unit32')) { - def jobName = "roslyn_${branchName.substring(0, 6)}_${opsys.substring(0, 3)}_${configuration}_${buildTarget}" + def jobName = "roslyn_${jobBranchName}_${opsys.substring(0, 3)}_${configuration}_${buildTarget}" def myJob = job(jobName) { description('') } @@ -231,7 +236,7 @@ set TMP=%TEMP% } if (branchName != 'prtest') { - def determinismJobName = "roslyn_${branchName.substring(0, 6)}_determinism" + def determinismJobName = "roslyn_${jobBranchName}_determinism" def determinismJob = job(determinismJobName) { description('') } diff --git a/src/Compilers/CSharp/CscCore/project.lock.json b/src/Compilers/CSharp/CscCore/project.lock.json index ee58614bc3365..80184c55b42d1 100644 --- a/src/Compilers/CSharp/CscCore/project.lock.json +++ b/src/Compilers/CSharp/CscCore/project.lock.json @@ -511,7 +511,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1795,7 +1795,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -3149,7 +3149,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -4654,7 +4654,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -7735,11 +7735,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/CSharp/Portable/Binder/Binder.cs b/src/Compilers/CSharp/Portable/Binder/Binder.cs index 46a11c8661533..954d6f3cf026a 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder.cs @@ -760,5 +760,24 @@ internal Binder WithPatternVariablesIfAny(ExpressionSyntax scopeOpt) Debug.Assert(Locals.Length == 0); return new PatternVariableBinder(scopeOpt, scopeOpt, this); } + + internal Binder WithPatternVariablesIfAny(ArgumentListSyntax initializerArgumentListOpt) + { + Debug.Assert(Locals.Length == 0); + + if (initializerArgumentListOpt == null || initializerArgumentListOpt.Arguments.Count == 0) + { + return this; + } + + return new PatternVariableBinder(initializerArgumentListOpt, initializerArgumentListOpt.Arguments, this); + } + + internal BoundExpression WrapWithVariablesIfAny(BoundExpression expression) + { + return (Locals.Length == 0) + ? expression + : new BoundSequence(expression.Syntax, Locals, ImmutableArray.Empty, expression, expression.Type) { WasCompilerGenerated = true }; + } } } diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Attributes.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Attributes.cs index a3650ee581e5f..89c7a2d524b05 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Attributes.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Attributes.cs @@ -94,7 +94,7 @@ internal static void GetAttributes( internal CSharpAttributeData GetAttribute(AttributeSyntax node, NamedTypeSymbol boundAttributeType, DiagnosticBag diagnostics) { - var boundAttribute = BindAttribute(node, boundAttributeType, diagnostics); + var boundAttribute = new PatternVariableBinder(node, this).BindAttribute(node, boundAttributeType, diagnostics); return GetAttribute(boundAttribute, diagnostics); } diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index af7fb0fd38f3f..ba5bf41681606 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -339,7 +339,8 @@ internal Binder CreateBinderForParameterDefaultValue( ParameterSymbol parameter, EqualsValueClauseSyntax defaultValueSyntax) { - return new LocalScopeBinder(this.WithContainingMemberOrLambda(parameter.ContainingSymbol).WithAdditionalFlags(BinderFlags.ParameterDefaultValue)); + return new LocalScopeBinder(this.WithContainingMemberOrLambda(parameter.ContainingSymbol).WithAdditionalFlags(BinderFlags.ParameterDefaultValue)). + WithPatternVariablesIfAny(defaultValueSyntax.Value); } internal BoundExpression BindParameterDefaultValue( @@ -357,7 +358,7 @@ internal BoundExpression BindParameterDefaultValue( // Always generate the conversion, even if the expression is not convertible to the given type. // We want the erroneous conversion in the tree. - return GenerateConversionForAssignment(parameterType, valueBeforeConversion, diagnostics, isDefaultParameter: true); + return WrapWithVariablesIfAny(GenerateConversionForAssignment(parameterType, valueBeforeConversion, diagnostics, isDefaultParameter: true)); } internal BoundExpression BindEnumConstantInitializer( @@ -2644,12 +2645,8 @@ internal BoundExpression BindConstructorInitializer( MethodSymbol constructor, DiagnosticBag diagnostics) { - // Handle scoping for possible pattern variables declared in the initializer - PatternVariableBinder patBinder = (initializerArgumentListOpt != null) - ? new PatternVariableBinder(initializerArgumentListOpt, initializerArgumentListOpt.Arguments, this) - : null; - var result = (patBinder ?? this).BindConstructorInitializerCore(initializerArgumentListOpt, constructor, diagnostics); - return patBinder?.WrapWithPatternVariables(result) ?? result; + var result = BindConstructorInitializerCore(initializerArgumentListOpt, constructor, diagnostics); + return WrapWithVariablesIfAny(result); } private BoundExpression BindConstructorInitializerCore( diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Initializers.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Initializers.cs index 198e84ea9560d..15a0d4bad3ec4 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Initializers.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Initializers.cs @@ -270,7 +270,7 @@ private static BoundFieldInitializer BindFieldInitializer(Binder binder, FieldSy var collisionDetector = new LocalScopeBinder(binder); var patternBinder = new PatternVariableBinder(equalsValueClauseNode, equalsValueClauseNode.Value, collisionDetector); var boundInitValue = patternBinder.BindVariableOrAutoPropInitializer(equalsValueClauseNode, RefKind.None, fieldSymbol.GetFieldType(fieldsBeingBound), initializerDiagnostics); - boundInitValue = patternBinder.WrapWithPatternVariables(boundInitValue); + boundInitValue = patternBinder.WrapWithVariablesIfAny(boundInitValue); if (isImplicitlyTypedField) { diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs index 9e1430cd6b813..492e1b7bda823 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs @@ -3450,7 +3450,7 @@ private BoundExpression BindCatchFilter(CatchFilterClauseSyntax filter, Diagnost Error(diagnostics, ErrorCode.WRN_FilterIsConstant, filter.FilterExpression); } - boundFilter = patternBinder.WrapWithPatternVariables(boundFilter); + boundFilter = patternBinder.WrapWithVariablesIfAny(boundFilter); boundFilter = new BoundSequencePointExpression(filter, boundFilter, boundFilter.Type); return boundFilter; } diff --git a/src/Compilers/CSharp/Portable/Binder/LocalScopeBinder.cs b/src/Compilers/CSharp/Portable/Binder/LocalScopeBinder.cs index afd9d7b185e72..2c759b176e4fe 100644 --- a/src/Compilers/CSharp/Portable/Binder/LocalScopeBinder.cs +++ b/src/Compilers/CSharp/Portable/Binder/LocalScopeBinder.cs @@ -183,7 +183,7 @@ protected ImmutableArray BuildLocals(SyntaxList st if (decl.Pattern != null) { // Patterns from the let statement introduce bindings into the enclosing scope. - var patterns = PatternVariableFinder.FindPatternVariables(patterns: ImmutableArray.Create(decl.Pattern)); + var patterns = PatternVariableFinder.FindPatternVariables(decl.Pattern); foreach (var pattern in patterns) { var localSymbol = SourceLocalSymbol.MakeLocal(this.ContainingMemberOrLambda, this, RefKind.None, pattern.Type, pattern.Identifier, LocalDeclarationKind.PatternVariable); diff --git a/src/Compilers/CSharp/Portable/Binder/PatternVariableBinder.cs b/src/Compilers/CSharp/Portable/Binder/PatternVariableBinder.cs index 3c78775638904..2021468f72e7a 100644 --- a/src/Compilers/CSharp/Portable/Binder/PatternVariableBinder.cs +++ b/src/Compilers/CSharp/Portable/Binder/PatternVariableBinder.cs @@ -11,77 +11,73 @@ namespace Microsoft.CodeAnalysis.CSharp { internal sealed class PatternVariableBinder : LocalScopeBinder { - private readonly ExpressionSyntax Expression; - private readonly ImmutableArray Expressions; - private readonly ImmutableArray Patterns; + private readonly CSharpSyntaxNode _node; + private readonly ImmutableArray _nodes; public readonly SyntaxNode Syntax; internal PatternVariableBinder(SyntaxNode syntax, ImmutableArray expressions, Binder next) : base(next) { this.Syntax = syntax; - this.Expressions = expressions; + this._nodes = StaticCast.From(expressions); } internal PatternVariableBinder(SyntaxNode syntax, IEnumerable declarations, Binder next) : base(next) { this.Syntax = syntax; - var expressions = ArrayBuilder.GetInstance(); + var nodes = ArrayBuilder.GetInstance(); foreach (var decl in declarations) { var value = decl.Initializer?.Value; - if (value != null) expressions.Add(value); + if (value != null) nodes.Add(value); } - this.Expressions = expressions.ToImmutableAndFree(); + this._nodes = nodes.ToImmutableAndFree(); } internal PatternVariableBinder(SyntaxNode syntax, IEnumerable arguments, Binder next) : base(next) { this.Syntax = syntax; - var expressions = ArrayBuilder.GetInstance(); + var nodes = ArrayBuilder.GetInstance(); foreach (var arg in arguments) { var value = arg.Expression; - if (value != null) expressions.Add(value); + if (value != null) nodes.Add(value); } - this.Expressions = expressions.ToImmutableAndFree(); + this._nodes = nodes.ToImmutableAndFree(); } internal PatternVariableBinder(SwitchSectionSyntax syntax, Binder next) : base(next) { this.Syntax = syntax; - var expressions = ArrayBuilder.GetInstance(); - var patterns = ArrayBuilder.GetInstance(); + var nodes = ArrayBuilder.GetInstance(); foreach (var label in syntax.Labels) { var match = label as CasePatternSwitchLabelSyntax; if (match != null) { - patterns.Add(match.Pattern); + nodes.Add(match.Pattern); if (match.WhenClause != null) { - expressions.Add(match.WhenClause.Condition); + nodes.Add(match.WhenClause.Condition); } } } - this.Expressions = expressions.ToImmutableAndFree(); - this.Patterns = patterns.ToImmutableAndFree(); + this._nodes = nodes.ToImmutableAndFree(); } internal PatternVariableBinder(MatchSectionSyntax syntax, Binder next) : base(next) { this.Syntax = syntax; - this.Patterns = ImmutableArray.Create(syntax.Pattern); - this.Expressions = syntax.WhenClause != null - ? ImmutableArray.Create(syntax.Expression, syntax.WhenClause.Condition) - : ImmutableArray.Create(syntax.Expression) + this._nodes = syntax.WhenClause != null + ? ImmutableArray.Create(syntax.Pattern, syntax.WhenClause.Condition, syntax.Expression) + : ImmutableArray.Create(syntax.Pattern, syntax.Expression) ; } internal PatternVariableBinder(ForStatementSyntax syntax, Binder next) : base(next) { this.Syntax = syntax; - var expressions = ArrayBuilder.GetInstance(); + var expressions = ArrayBuilder.GetInstance(); if (syntax.Declaration != null) foreach(var decl in syntax.Declaration.Variables) { var value = decl.Initializer?.Value; @@ -91,18 +87,35 @@ internal PatternVariableBinder(ForStatementSyntax syntax, Binder next) : base(ne if (syntax.Initializers != null) expressions.AddRange(syntax.Initializers); if (syntax.Condition != null) expressions.Add(syntax.Condition); if (syntax.Incrementors != null) expressions.AddRange(syntax.Incrementors); - this.Expressions = expressions.ToImmutableAndFree(); + this._nodes = expressions.ToImmutableAndFree(); } internal PatternVariableBinder(SyntaxNode syntax, ExpressionSyntax expression, Binder next) : base(next) { - this.Expression = expression; + this._node = expression; + this.Syntax = syntax; + } + + internal PatternVariableBinder(AttributeSyntax syntax, Binder next) : base(next) + { this.Syntax = syntax; + + if (syntax.ArgumentList?.Arguments.Count > 0) + { + var expressions = ArrayBuilder.GetInstance(syntax.ArgumentList.Arguments.Count); + + foreach (var argument in syntax.ArgumentList.Arguments) + { + expressions.Add(argument.Expression); + } + + this._nodes = expressions.ToImmutableAndFree(); + } } protected override ImmutableArray BuildLocals() { - var patterns = PatternVariableFinder.FindPatternVariables(Expression, Expressions, this.Patterns); + var patterns = PatternVariableFinder.FindPatternVariables(_node, _nodes); var builder = ArrayBuilder.GetInstance(); foreach (var pattern in patterns) { @@ -111,12 +124,5 @@ protected override ImmutableArray BuildLocals() patterns.Free(); return builder.ToImmutableAndFree(); } - - internal BoundExpression WrapWithPatternVariables(BoundExpression expression) - { - return (Locals.Length == 0) - ? expression - : new BoundSequence(expression.Syntax, Locals, ImmutableArray.Empty, expression, expression.Type); - } } } diff --git a/src/Compilers/CSharp/Portable/Binder/PatternVariableFinder.cs b/src/Compilers/CSharp/Portable/Binder/PatternVariableFinder.cs index 5ff7c377feed5..f08102d642678 100644 --- a/src/Compilers/CSharp/Portable/Binder/PatternVariableFinder.cs +++ b/src/Compilers/CSharp/Portable/Binder/PatternVariableFinder.cs @@ -13,48 +13,42 @@ namespace Microsoft.CodeAnalysis.CSharp class PatternVariableFinder : CSharpSyntaxWalker { ArrayBuilder declarationPatterns; - ArrayBuilder expressionsToVisit = ArrayBuilder.GetInstance(); + ArrayBuilder nodesToVisit = ArrayBuilder.GetInstance(); internal static ArrayBuilder FindPatternVariables( - ExpressionSyntax expression = null, - ImmutableArray expressions = default(ImmutableArray), - ImmutableArray patterns = default(ImmutableArray)) + CSharpSyntaxNode node = null, + ImmutableArray nodes = default(ImmutableArray)) { var finder = s_poolInstance.Allocate(); finder.declarationPatterns = ArrayBuilder.GetInstance(); - // push expressions to be visited onto a stack - var expressionsToVisit = finder.expressionsToVisit; - if (expression != null) expressionsToVisit.Add(expression); - if (!expressions.IsDefaultOrEmpty) + // push nodes to be visited onto a stack + var nodesToVisit = finder.nodesToVisit; + if (node != null) nodesToVisit.Add(node); + if (!nodes.IsDefaultOrEmpty) { - foreach (var subExpression in expressions) + foreach (var subExpression in nodes) { - if (subExpression != null) expressionsToVisit.Add(subExpression); + if (subExpression != null) nodesToVisit.Add(subExpression); } } - finder.VisitExpressions(); - if (!patterns.IsDefaultOrEmpty) - { - foreach (var pattern in patterns) - { - finder.Visit(pattern); - } - } + nodesToVisit.ReverseContents(); + + finder.VisitNodes(); var result = finder.declarationPatterns; finder.declarationPatterns = null; - Debug.Assert(finder.expressionsToVisit.Count == 0); + Debug.Assert(finder.nodesToVisit.Count == 0); s_poolInstance.Free(finder); return result; } - private void VisitExpressions() + private void VisitNodes() { - while (expressionsToVisit.Count != 0) + while (nodesToVisit.Count != 0) { - var e = expressionsToVisit[expressionsToVisit.Count - 1]; - expressionsToVisit.RemoveLast(); + var e = nodesToVisit[nodesToVisit.Count - 1]; + nodesToVisit.RemoveLast(); Visit(e); } } @@ -85,16 +79,16 @@ public override void VisitQueryExpression(QueryExpressionSyntax node) public override void VisitBinaryExpression(BinaryExpressionSyntax node) { - expressionsToVisit.Add(node.Right); - expressionsToVisit.Add(node.Left); + nodesToVisit.Add(node.Right); + nodesToVisit.Add(node.Left); } public override void VisitPostfixUnaryExpression(PostfixUnaryExpressionSyntax node) { - expressionsToVisit.Add(node.Operand); + nodesToVisit.Add(node.Operand); } public override void VisitPrefixUnaryExpression(PrefixUnaryExpressionSyntax node) { - expressionsToVisit.Add(node.Operand); + nodesToVisit.Add(node.Operand); } public override void VisitMatchExpression(MatchExpressionSyntax node) { diff --git a/src/Compilers/CSharp/Portable/Binder/SwitchBinder_BindPatternSwitch.cs b/src/Compilers/CSharp/Portable/Binder/SwitchBinder_BindPatternSwitch.cs index b405b62ff51b0..cac936332bf0d 100644 --- a/src/Compilers/CSharp/Portable/Binder/SwitchBinder_BindPatternSwitch.cs +++ b/src/Compilers/CSharp/Portable/Binder/SwitchBinder_BindPatternSwitch.cs @@ -16,7 +16,8 @@ internal partial class SwitchBinder { private BoundPatternSwitchStatement BindPatternSwitch(SwitchStatementSyntax node, DiagnosticBag diagnostics) { - var boundSwitchExpression = BindValue(node.Expression, diagnostics, BindValueKind.RValue); + // See BindSwitchExpression for an explanation why we should use Next binder here. + var boundSwitchExpression = this.Next.BindValue(node.Expression, diagnostics, BindValueKind.RValue); // TODO: any constraints on a switch expression must be enforced here. For example, // it must have a type (not be target-typed, lambda, null, etc) diff --git a/src/Compilers/CSharp/Portable/BoundTree/Expression.cs b/src/Compilers/CSharp/Portable/BoundTree/Expression.cs index 5c015833b52b2..91ee254823ca8 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/Expression.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/Expression.cs @@ -706,7 +706,7 @@ Semantics.ConversionKind IConversionExpression.ConversionKind return Semantics.ConversionKind.CSharp; default: - throw ExceptionUtilities.UnexpectedValue(this.ConversionKind); + return Semantics.ConversionKind.Invalid; } } } diff --git a/src/Compilers/CSharp/Portable/CSharpCompilationOptions.cs b/src/Compilers/CSharp/Portable/CSharpCompilationOptions.cs index e12be547b1a8b..383df9726d301 100644 --- a/src/Compilers/CSharp/Portable/CSharpCompilationOptions.cs +++ b/src/Compilers/CSharp/Portable/CSharpCompilationOptions.cs @@ -520,6 +520,8 @@ protected override CompilationOptions CommonWithFeatures(ImmutableArray internal override void ValidateOptions(ArrayBuilder builder) { + ValidateOptions(builder, MessageProvider.Instance); + // /main & /target:{library|netmodule|winmdobj} if (this.MainTypeName != null) { @@ -581,24 +583,6 @@ internal override void ValidateOptions(ArrayBuilder builder) // TODO: add check for // (kind == 'arm' || kind == 'appcontainer' || kind == 'winmdobj') && // (version >= "6.2") - - if (!CryptoPublicKey.IsEmpty) - { - if (CryptoKeyFile != null) - { - builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_MutuallyExclusiveOptions, nameof(CryptoPublicKey), nameof(CryptoKeyFile))); - } - - if (CryptoKeyContainer != null) - { - builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_MutuallyExclusiveOptions, nameof(CryptoPublicKey), nameof(CryptoKeyContainer))); - } - } - - if (PublicSign && DelaySign == true) - { - builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_MutuallyExclusiveOptions, nameof(PublicSign), nameof(DelaySign))); - } } public bool Equals(CSharpCompilationOptions other) diff --git a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs index b5bde2a1091b1..0b47c5cbf5533 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs +++ b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs @@ -7261,6 +7261,15 @@ internal static string ERR_PermissionSetAttributeInvalidFile { } } + /// + /// Looks up a localized string similar to An error occurred while writing the output file: {0}. + /// + internal static string ERR_PeWritingFailure { + get { + return ResourceManager.GetString("ERR_PeWritingFailure", resourceCulture); + } + } + /// /// Looks up a localized string similar to Neither 'is' nor 'as' is valid on pointer types. /// diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index bfe3c87f26992..5226a66ef158c 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -4849,6 +4849,9 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ An 'else' clause is required when a 'when' clause is present. + + An error occurred while writing the output file: {0} + { or ; or => expected diff --git a/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs b/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs index d81a620d99607..2d1d01e7f9c79 100644 --- a/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs +++ b/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs @@ -1118,6 +1118,12 @@ internal sealed override CommandLineArguments CommonParse(IEnumerable ar keyFileSearchPaths.Add(outputDirectory); } + // Public sign doesn't use the legacy search path settings + if (publicSign && !string.IsNullOrWhiteSpace(keyFileSetting)) + { + keyFileSetting = ParseGenericPathToFile(keyFileSetting, diagnostics, baseDirectory); + } + var parsedFeatures = CompilerOptionParseUtilities.ParseFeatures(features); string compilationName; diff --git a/src/Compilers/CSharp/Portable/Compilation/AttributeSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/AttributeSemanticModel.cs index cf4e0605e046c..ec53f621fdd93 100644 --- a/src/Compilers/CSharp/Portable/Compilation/AttributeSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/AttributeSemanticModel.cs @@ -28,7 +28,7 @@ private AttributeSemanticModel(CSharpCompilation compilation, AttributeSyntax sy public static AttributeSemanticModel Create(CSharpCompilation compilation, AttributeSyntax syntax, NamedTypeSymbol attributeType, AliasSymbol aliasOpt, Binder rootBinder) { var executableBinder = new ExecutableCodeBinder(syntax, attributeType, rootBinder); - return new AttributeSemanticModel(compilation, syntax, attributeType, aliasOpt, new LocalScopeBinder(executableBinder)); + return new AttributeSemanticModel(compilation, syntax, attributeType, aliasOpt, new PatternVariableBinder(syntax, executableBinder)); } /// diff --git a/src/Compilers/CSharp/Portable/Compilation/InitializerSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/InitializerSemanticModel.cs index 71c27c6e62c9c..3327c376884ed 100644 --- a/src/Compilers/CSharp/Portable/Compilation/InitializerSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/InitializerSemanticModel.cs @@ -194,6 +194,7 @@ private BoundEqualsValue BindEqualsValue(Binder binder, EqualsValueClauseSyntax } if (result != null) { + result = binder.WrapWithVariablesIfAny(result); return new BoundFieldEqualsValue(equalsValue, field, result); } break; @@ -205,6 +206,7 @@ private BoundEqualsValue BindEqualsValue(Binder binder, EqualsValueClauseSyntax BoundExpression result = binder.BindVariableOrAutoPropInitializer(equalsValue, RefKind.None, property.Type, diagnostics); if (result != null) { + result = binder.WrapWithVariablesIfAny(result); return new BoundPropertyEqualsValue(equalsValue, property, result); } break; diff --git a/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs index 1120d46e783c2..dbbfcc928a1e2 100644 --- a/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/MemberSemanticModel.cs @@ -141,10 +141,14 @@ internal sealed override bool TryGetSpeculativeSemanticModelCore(SyntaxTreeSeman private Binder GetEnclosingBinder(CSharpSyntaxNode node, int position) { AssertPositionAdjusted(position); + return GetEnclosingBinder(node, position, RootBinder, _root).WithAdditionalFlags(GetSemanticModelBinderFlags()); + } - if (node == _root) + private static Binder GetEnclosingBinder(CSharpSyntaxNode node, int position, Binder rootBinder, CSharpSyntaxNode root) + { + if (node == root) { - return RootBinder; + return rootBinder; } ExpressionSyntax typeOfArgument = null; @@ -166,7 +170,7 @@ private Binder GetEnclosingBinder(CSharpSyntaxNode node, int position) { if (LookupPosition.IsInStatementScope(position, stmt)) { - binder = RootBinder.GetBinder(current); + binder = rootBinder.GetBinder(current); if (binder != null) { @@ -178,27 +182,27 @@ private Binder GetEnclosingBinder(CSharpSyntaxNode node, int position) { if (LookupPosition.IsInCatchBlockScope(position, (CatchClauseSyntax)current)) { - binder = RootBinder.GetBinder(current); + binder = rootBinder.GetBinder(current); } } else if (current.Kind() == SyntaxKind.CatchFilterClause) { if (LookupPosition.IsInCatchFilterScope(position, (CatchFilterClauseSyntax)current)) { - binder = RootBinder.GetBinder(current); + binder = rootBinder.GetBinder(current); } } else if (current.IsAnonymousFunction()) { if (LookupPosition.IsInAnonymousFunctionOrQuery(position, current)) { - binder = RootBinder.GetBinder(current); + binder = rootBinder.GetBinder(current); // This should only happen in error scenarios. For example, C# does not allow array rank // specifiers in types, (e.g. int[1] x;), but the syntax model does. In order to construct // an appropriate binder chain for the anonymous method body, we need to construct an // ExecutableCodeBinder. - if (binder == null && unexpectedAnonymousFunction == null) + if (binder == null && unexpectedAnonymousFunction == null && current != root) { unexpectedAnonymousFunction = current; } @@ -218,28 +222,28 @@ private Binder GetEnclosingBinder(CSharpSyntaxNode node, int position) { if (LookupPosition.IsInSwitchSectionScope(position, (SwitchSectionSyntax)current)) { - binder = RootBinder.GetBinder(current); + binder = rootBinder.GetBinder(current); } } else if (current.Kind() == SyntaxKind.ArrowExpressionClause && current.Parent?.Kind() == SyntaxKind.LocalFunctionStatement) { - binder = RootBinder.GetBinder(current); + binder = rootBinder.GetBinder(current); } else { // If this ever breaks, make sure that all callers of // CanHaveAssociatedLocalBinder are in sync. Debug.Assert(!current.CanHaveAssociatedLocalBinder() || - (current == _root && current.Kind() == SyntaxKind.ArrowExpressionClause)); + (current == root && current.Kind() == SyntaxKind.ArrowExpressionClause)); } - if (current == _root) + if (current == root) { break; } } - binder = binder ?? RootBinder; + binder = binder ?? rootBinder; Debug.Assert(binder != null); if (typeOfArgument != null && !typeOfEncounteredBeforeUnexpectedAnonymousFunction) @@ -266,11 +270,23 @@ private Binder GetEnclosingBinder(CSharpSyntaxNode node, int position) binder = new TypeofBinder(typeOfArgument, binder); } - return binder.WithAdditionalFlags(GetSemanticModelBinderFlags()); + return binder; } private static Binder AdjustBinderForPositionWithinStatement(int position, Binder binder, StatementSyntax stmt) { + switch (stmt.Kind()) + { + case SyntaxKind.SwitchStatement: + var switchStmt = (SwitchStatementSyntax)stmt; + if (LookupPosition.IsBetweenTokens(position, switchStmt.OpenParenToken, switchStmt.OpenBraceToken)) + { + binder = binder.Next; + Debug.Assert(binder is PatternVariableBinder); + } + break; + } + return binder; } @@ -1392,78 +1408,7 @@ private static Binder GetLambdaEnclosingBinder(int position, CSharpSyntaxNode st Debug.Assert(containingLambda.IsAnonymousFunction()); Debug.Assert(LookupPosition.IsInAnonymousFunctionOrQuery(position, containingLambda)); - var current = startingNode; - while (current != containingLambda) - { - Debug.Assert(current != null); - - StatementSyntax stmt = current as StatementSyntax; - if (stmt != null) - { - if (LookupPosition.IsInStatementScope(position, stmt)) - { - Binder binder = lambdaBinder.GetBinder(current); - if (binder != null) - { - return AdjustBinderForPositionWithinStatement(position, binder, stmt); - } - } - } - else if (current.Kind() == SyntaxKind.CatchClause) - { - if (LookupPosition.IsInCatchBlockScope(position, (CatchClauseSyntax)current)) - { - Binder binder = lambdaBinder.GetBinder(current); - if (binder != null) - { - return binder; - } - } - } - else if (current.Kind() == SyntaxKind.CatchFilterClause) - { - if (LookupPosition.IsInCatchFilterScope(position, (CatchFilterClauseSyntax)current)) - { - Binder binder = lambdaBinder.GetBinder(current); - if (binder != null) - { - return binder; - } - } - } - else if (current.IsAnonymousFunction()) - { - if (LookupPosition.IsInAnonymousFunctionOrQuery(position, current)) - { - Binder binder = lambdaBinder.GetBinder(current); - if (binder != null) - { - return binder; - } - } - } - else if (current.Kind() == SyntaxKind.SwitchSection) - { - if (LookupPosition.IsInSwitchSectionScope(position, (SwitchSectionSyntax)current)) - { - Binder binder = lambdaBinder.GetBinder(current); - if (binder != null) - { - return binder; - } - } - } - else - { - // If this ever breaks, make sure that all callers of - // CanHaveAssociatedLocalBinder are in sync. - Debug.Assert(!current.CanHaveAssociatedLocalBinder()); - } - - current = current.ParentOrStructuredTriviaParent; - } - - return lambdaBinder; + return GetEnclosingBinder(startingNode, position, lambdaBinder, containingLambda); } /// diff --git a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs index a250584c8654d..9b6ca91c43d1f 100644 --- a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs @@ -927,7 +927,7 @@ private MemberSemanticModel CreateMemberModel(CSharpSyntaxNode node) variableDecl, //pass in the entire field initializer to permit region analysis. fieldSymbol, //if we're in regular C#, then insert an extra binder to perform field initialization checks - GetFieldOrPropertyInitializerBinder(fieldSymbol, outer)); + GetFieldOrPropertyInitializerBinder(fieldSymbol, outer, variableDecl.Initializer?.Value)); } case SyntaxKind.PropertyDeclaration: @@ -938,7 +938,7 @@ private MemberSemanticModel CreateMemberModel(CSharpSyntaxNode node) this.Compilation, propertyDecl, propertySymbol, - GetFieldOrPropertyInitializerBinder(propertySymbol.BackingField, outer)); + GetFieldOrPropertyInitializerBinder(propertySymbol.BackingField, outer, propertyDecl.Initializer?.Value)); } case SyntaxKind.Parameter: @@ -969,7 +969,7 @@ private MemberSemanticModel CreateMemberModel(CSharpSyntaxNode node) this.Compilation, enumDecl, enumSymbol, - GetFieldOrPropertyInitializerBinder(enumSymbol, outer)); + GetFieldOrPropertyInitializerBinder(enumSymbol, outer, enumDecl.EqualsValue?.Value)); } default: throw ExceptionUtilities.UnexpectedValue(node.Parent.Kind()); @@ -1043,7 +1043,9 @@ private MemberSemanticModel CreateMemberModel(CSharpSyntaxNode node) (ConstructorInitializerSyntax)node, constructorSymbol, //insert an extra binder to perform constructor initialization checks - outer.WithAdditionalFlagsAndContainingMemberOrLambda(BinderFlags.ConstructorInitializer, constructorSymbol)); + // Handle scoping for possible pattern variables declared in the initializer + outer.WithAdditionalFlagsAndContainingMemberOrLambda(BinderFlags.ConstructorInitializer, constructorSymbol). + WithPatternVariablesIfAny(((ConstructorInitializerSyntax)node).ArgumentList)); } case SyntaxKind.Attribute: @@ -1085,7 +1087,7 @@ private SourceMemberFieldSymbol GetDeclaredFieldSymbol(VariableDeclaratorSyntax return null; } - private Binder GetFieldOrPropertyInitializerBinder(FieldSymbol symbol, Binder outer) + private Binder GetFieldOrPropertyInitializerBinder(FieldSymbol symbol, Binder outer, ExpressionSyntax valueSyntaxOpt) { BinderFlags flags = BinderFlags.None; @@ -1095,7 +1097,13 @@ private Binder GetFieldOrPropertyInitializerBinder(FieldSymbol symbol, Binder ou flags |= BinderFlags.FieldInitializer; } - return new LocalScopeBinder(outer).WithAdditionalFlagsAndContainingMemberOrLambda(flags, symbol); + Binder result = new LocalScopeBinder(outer).WithAdditionalFlagsAndContainingMemberOrLambda(flags, symbol); + if (valueSyntaxOpt != null) + { + result = result.WithPatternVariablesIfAny(valueSyntaxOpt); + } + + return result; } private static bool IsMemberDeclaration(CSharpSyntaxNode node) diff --git a/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs b/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs index 73a594caa8f0a..91b7f73ab1414 100644 --- a/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs +++ b/src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs @@ -1726,7 +1726,9 @@ internal static BoundExpression BindConstructorInitializer(MethodSymbol construc } // wrap in ConstructorInitializerBinder for appropriate errors - Binder initializerBinder = outerBinder.WithAdditionalFlagsAndContainingMemberOrLambda(BinderFlags.ConstructorInitializer, constructor); + // Handle scoping for possible pattern variables declared in the initializer + Binder initializerBinder = outerBinder.WithAdditionalFlagsAndContainingMemberOrLambda(BinderFlags.ConstructorInitializer, constructor). + WithPatternVariablesIfAny(initializerArgumentListOpt); return initializerBinder.BindConstructorInitializer(initializerArgumentListOpt, constructor, diagnostics); } diff --git a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpDefinitionMap.cs b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpDefinitionMap.cs index 702a5a061755b..897fa039fe7a0 100644 --- a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpDefinitionMap.cs +++ b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpDefinitionMap.cs @@ -1,17 +1,14 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Linq; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Reflection.Metadata; -using System.Reflection.Metadata.Ecma335; using Microsoft.CodeAnalysis.CodeGen; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE; using Microsoft.CodeAnalysis.Emit; -using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Emit { @@ -36,6 +33,8 @@ public CSharpDefinitionMap( _metadataDecoder = metadataDecoder; } + internal override CommonMessageProvider MessageProvider => CSharp.MessageProvider.Instance; + internal bool TryGetAnonymousTypeName(NamedTypeSymbol template, out string name, out int index) { return this.mapToPrevious.TryGetAnonymousTypeName(template, out name, out index); diff --git a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpSymbolMatcher.cs b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpSymbolMatcher.cs index 931ad582ea633..4da73640c543d 100644 --- a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpSymbolMatcher.cs +++ b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/CSharpSymbolMatcher.cs @@ -402,15 +402,10 @@ public override Symbol VisitAssembly(AssemblySymbol symbol) return _otherAssembly; } - // find a referenced assembly with the exactly same source identity: + // find a referenced assembly with the exactly same identity: foreach (var otherReferencedAssembly in _otherAssembly.Modules[0].ReferencedAssemblySymbols) { - var identity = symbol.Identity; - var otherIdentity = otherReferencedAssembly.Identity; - - if (AssemblyIdentityComparer.SimpleNameComparer.Equals(identity.Name, otherIdentity.Name) && - (symbol.AssemblyVersionPattern ?? symbol.Identity.Version).Equals(otherReferencedAssembly.AssemblyVersionPattern ?? otherReferencedAssembly.Identity.Version) && - AssemblyIdentity.EqualIgnoringNameAndVersion(identity, otherIdentity)) + if (symbol.Identity.Equals(otherReferencedAssembly.Identity)) { return otherReferencedAssembly; } diff --git a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/EmitHelpers.cs b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/EmitHelpers.cs index f0487a888ce05..6b30d222e93c0 100644 --- a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/EmitHelpers.cs +++ b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/EmitHelpers.cs @@ -35,7 +35,7 @@ internal static EmitDifferenceResult EmitDifference( } catch (BadImageFormatException) { - // TODO (https://github.com/dotnet/roslyn/issues/8910): + // TODO: // return MakeEmitResult(success: false, diagnostics: ..., baseline: null); throw; } @@ -47,25 +47,15 @@ internal static EmitDifferenceResult EmitDifference( var serializationProperties = compilation.ConstructModuleSerializationProperties(emitOptions, runtimeMDVersion, moduleVersionId); var manifestResources = SpecializedCollections.EmptyEnumerable(); - PEDeltaAssemblyBuilder moduleBeingBuilt; - try - { - moduleBeingBuilt = new PEDeltaAssemblyBuilder( - compilation.SourceAssembly, - emitOptions: emitOptions, - outputKind: compilation.Options.OutputKind, - serializationProperties: serializationProperties, - manifestResources: manifestResources, - previousGeneration: baseline, - edits: edits, - isAddedSymbol: isAddedSymbol); - } - catch (NotSupportedException) - { - // TODO: better error code (https://github.com/dotnet/roslyn/issues/8910) - diagnostics.Add(ErrorCode.ERR_ModuleEmitFailure, NoLocation.Singleton, compilation.AssemblyName); - return new EmitDifferenceResult(success: false, diagnostics: diagnostics.ToReadOnlyAndFree(), baseline: null); - } + var moduleBeingBuilt = new PEDeltaAssemblyBuilder( + compilation.SourceAssembly, + emitOptions: emitOptions, + outputKind: compilation.Options.OutputKind, + serializationProperties: serializationProperties, + manifestResources: manifestResources, + previousGeneration: baseline, + edits: edits, + isAddedSymbol: isAddedSymbol); if (testData != null) { diff --git a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/PEDeltaAssemblyBuilder.cs b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/PEDeltaAssemblyBuilder.cs index dae2c36ad454a..cb392ea6eca4d 100644 --- a/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/PEDeltaAssemblyBuilder.cs +++ b/src/Compilers/CSharp/Portable/Emitter/EditAndContinue/PEDeltaAssemblyBuilder.cs @@ -102,11 +102,10 @@ private EmitBaseline.MetadataSymbols GetOrCreateMetadataSymbols(EmitBaseline ini // We need to transfer the references from the current source compilation but don't need its syntax trees. var metadataCompilation = compilation.RemoveAllSyntaxTrees(); - ImmutableDictionary assemblyReferenceIdentityMap; - var metadataAssembly = metadataCompilation.GetBoundReferenceManager().CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata.Create(originalMetadata), MetadataImportOptions.All, out assemblyReferenceIdentityMap); + var metadataAssembly = metadataCompilation.GetBoundReferenceManager().CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata.Create(originalMetadata), MetadataImportOptions.All); var metadataDecoder = new MetadataDecoder(metadataAssembly.PrimaryModule); var metadataAnonymousTypes = GetAnonymousTypeMapFromMetadata(originalMetadata.MetadataReader, metadataDecoder); - var metadataSymbols = new EmitBaseline.MetadataSymbols(metadataAnonymousTypes, metadataDecoder, assemblyReferenceIdentityMap); + var metadataSymbols = new EmitBaseline.MetadataSymbols(metadataAnonymousTypes, metadataDecoder); return InterlockedOperations.Initialize(ref initialBaseline.LazyMetadataSymbols, metadataSymbols); } diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/AssemblyReference.cs b/src/Compilers/CSharp/Portable/Emitter/Model/AssemblyReference.cs index a2696330f4ac4..ffc07b2bebb50 100644 --- a/src/Compilers/CSharp/Portable/Emitter/Model/AssemblyReference.cs +++ b/src/Compilers/CSharp/Portable/Emitter/Model/AssemblyReference.cs @@ -22,7 +22,6 @@ internal AssemblyReference(AssemblySymbol assemblySymbol) } public AssemblyIdentity Identity => _targetAssembly.Identity; - public Version AssemblyVersionPattern => _targetAssembly.AssemblyVersionPattern; public override string ToString() { diff --git a/src/Compilers/CSharp/Portable/Emitter/Model/PEAssemblyBuilder.cs b/src/Compilers/CSharp/Portable/Emitter/Model/PEAssemblyBuilder.cs index 5cd19c3983b0c..abf660116f32a 100644 --- a/src/Compilers/CSharp/Portable/Emitter/Model/PEAssemblyBuilder.cs +++ b/src/Compilers/CSharp/Portable/Emitter/Model/PEAssemblyBuilder.cs @@ -162,7 +162,6 @@ protected override void AddEmbeddedResourcesFromAddedModules(ArrayBuilder _sourceAssembly.Identity; - Version Cci.IAssemblyReference.AssemblyVersionPattern => _sourceAssembly.AssemblyVersionPattern; internal override string Name { diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index 13bf1593588e0..8448e5fc8ae05 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -1322,7 +1322,7 @@ internal enum ErrorCode ERR_InvalidPathMap = 8101, ERR_PublicSignButNoKey = 8102, ERR_TooManyUserStrings = 8103, - ERR_ExpressionTreeContainsLocalFunction = 8104, + ERR_PeWritingFailure = 8104, ERR_ReturnTypesDontMatch = 8105, ERR_DynamicLocalFunctionParameter = 8106, ERR_CantInferVoid = 8107, @@ -1332,6 +1332,7 @@ internal enum ErrorCode ERR_AmbigMatch1 = 8111, ERR_ThrowMisplaced = 8112, ERR_ElseClauseRequiredWithWhenClause = 8113, + ERR_ExpressionTreeContainsLocalFunction = 8114, // huge gap here??? diff --git a/src/Compilers/CSharp/Portable/Errors/MessageProvider.cs b/src/Compilers/CSharp/Portable/Errors/MessageProvider.cs index 4a4d0ff96aac2..68f9753fea429 100644 --- a/src/Compilers/CSharp/Portable/Errors/MessageProvider.cs +++ b/src/Compilers/CSharp/Portable/Errors/MessageProvider.cs @@ -143,6 +143,7 @@ public override ReportDiagnostic GetDiagnosticReport(DiagnosticInfo diagnosticIn // compilation options: public override int ERR_BadCompilationOptionValue { get { return (int)ErrorCode.ERR_BadCompilationOptionValue; } } + public override int ERR_MutuallyExclusiveOptions => (int)ErrorCode.ERR_MutuallyExclusiveOptions; // emit options: public override int ERR_InvalidDebugInformationFormat { get { return (int)ErrorCode.ERR_InvalidDebugInformationFormat; } } @@ -202,6 +203,8 @@ public override void ReportDuplicateMetadataReferenceWeak(DiagnosticBag diagnost public override int ERR_MetadataNameTooLong { get { return (int)ErrorCode.ERR_MetadataNameTooLong; } } public override int ERR_EncReferenceToAddedMember { get { return (int)ErrorCode.ERR_EncReferenceToAddedMember; } } public override int ERR_TooManyUserStrings { get { return (int)ErrorCode.ERR_TooManyUserStrings; } } + public override int ERR_PeWritingFailure { get { return (int)ErrorCode.ERR_PeWritingFailure; } } + public override int ERR_ModuleEmitFailure { get { return (int)ErrorCode.ERR_ModuleEmitFailure; } } public override void ReportInvalidAttributeArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, AttributeData attribute) { diff --git a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs index dfe0f77fffddf..93831b611e71d 100644 --- a/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncMethodToStateMachineRewriter.cs @@ -96,7 +96,7 @@ private FieldSymbol GetAwaiterField(TypeSymbol awaiterType) if (!_awaiterFields.TryGetValue(awaiterType, out result)) { int slotIndex; - if (slotAllocatorOpt == null || !slotAllocatorOpt.TryGetPreviousAwaiterSlotIndex(F.ModuleBuilderOpt.Translate(awaiterType, F.Syntax, F.Diagnostics), out slotIndex)) + if (slotAllocatorOpt == null || !slotAllocatorOpt.TryGetPreviousAwaiterSlotIndex(F.ModuleBuilderOpt.Translate(awaiterType, F.Syntax, F.Diagnostics), F.Diagnostics, out slotIndex)) { slotIndex = _nextAwaiterId++; } diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_MatchStatement.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_MatchStatement.cs index 7d58757ad9e0e..68671cf32275a 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_MatchStatement.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_MatchStatement.cs @@ -18,7 +18,7 @@ public override BoundNode VisitPatternSwitchStatement(BoundPatternSwitchStatemen // copy the original switch expression into a temp BoundAssignmentOperator initialStore; - var switchExpressionTemp = _factory.StoreToTemp(node.Expression, out initialStore, syntaxOpt: node.Expression.Syntax); + var switchExpressionTemp = _factory.StoreToTemp(VisitExpression(node.Expression), out initialStore, syntaxOpt: node.Expression.Syntax); statements.Add(_factory.ExpressionStatement(initialStore)); // save the default label, if and when we find it. diff --git a/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs index 31f06fbd294e0..1c4f600358117 100644 --- a/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/MethodToStateMachineRewriter.cs @@ -550,7 +550,14 @@ private BoundExpression HoistExpression( // Editing await expression is not allowed. Thus all spilled fields will be present in the previous state machine. // However, it may happen that the type changes, in which case we need to allocate a new slot. int slotIndex; - if (slotAllocatorOpt == null || !slotAllocatorOpt.TryGetPreviousHoistedLocalSlotIndex(awaitSyntaxOpt, F.ModuleBuilderOpt.Translate(fieldType, awaitSyntaxOpt, Diagnostics), kind, id, out slotIndex)) + if (slotAllocatorOpt == null || + !slotAllocatorOpt.TryGetPreviousHoistedLocalSlotIndex( + awaitSyntaxOpt, + F.ModuleBuilderOpt.Translate(fieldType, awaitSyntaxOpt, Diagnostics), + kind, + id, + Diagnostics, + out slotIndex)) { slotIndex = _nextFreeHoistedLocalSlot++; } diff --git a/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/StateMachineRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/StateMachineRewriter.cs index 9f759785579e1..ff524a9800219 100644 --- a/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/StateMachineRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/StateMachineRewriter.cs @@ -172,7 +172,13 @@ private void CreateNonReusableLocalProxies( // map local id to the previous id, if available: int previousSlotIndex; - if (mapToPreviousFields && slotAllocatorOpt.TryGetPreviousHoistedLocalSlotIndex(declaratorSyntax, F.ModuleBuilderOpt.Translate(fieldType, declaratorSyntax, diagnostics), synthesizedKind, id, out previousSlotIndex)) + if (mapToPreviousFields && slotAllocatorOpt.TryGetPreviousHoistedLocalSlotIndex( + declaratorSyntax, + F.ModuleBuilderOpt.Translate(fieldType, declaratorSyntax, diagnostics), + synthesizedKind, + id, + diagnostics, + out previousSlotIndex)) { slotIndex = previousSlotIndex; } diff --git a/src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs index bd29e48ab7eb0..7c01a7432e0f9 100644 --- a/src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Symbols /// /// Represents a .NET assembly, consisting of one or more modules. /// - internal abstract class AssemblySymbol : Symbol, IAssemblySymbolInternal + internal abstract class AssemblySymbol : Symbol, IAssemblySymbol { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Changes to the public interface of this class should remain synchronized with the VB version. @@ -78,16 +78,6 @@ public override string Name /// public abstract AssemblyIdentity Identity { get; } - /// - /// Assembly version pattern with wildcards represented by , - /// or null if the version string specified in the doesn't contain a wildcard. - /// - /// For example, - /// AssemblyVersion("1.2.*") is represented as 1.2.65535.65535, - /// AssemblyVersion("1.2.3.*") is represented as 1.2.3.65535. - /// - public abstract Version AssemblyVersionPattern { get; } - /// /// Target architecture of the machine. /// diff --git a/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs b/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs index c16ccf8151c27..f7414593a6be6 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Compilation_WellKnownMembers.cs @@ -300,7 +300,9 @@ internal SynthesizedAttributeData TrySynthesizeAttribute( ImmutableArray arguments = default(ImmutableArray), ImmutableArray> namedArguments = default(ImmutableArray>)) { - var ctorSymbol = (MethodSymbol)GetWellKnownTypeMember(constructor); + DiagnosticInfo diagnosticInfo; + var ctorSymbol = (MethodSymbol)Binder.GetWellKnownTypeMember(this, constructor, out diagnosticInfo, isOptional: true); + if ((object)ctorSymbol == null) { // if this assert fails, UseSiteErrors for "member" have not been checked before emitting ... @@ -323,7 +325,7 @@ internal SynthesizedAttributeData TrySynthesizeAttribute( var builder = new ArrayBuilder>(namedArguments.Length); foreach (var arg in namedArguments) { - var wellKnownMember = GetWellKnownTypeMember(arg.Key); + var wellKnownMember = Binder.GetWellKnownTypeMember(this, arg.Key, out diagnosticInfo, isOptional: true); if (wellKnownMember == null || wellKnownMember is ErrorTypeSymbol) { // if this assert fails, UseSiteErrors for "member" have not been checked before emitting ... diff --git a/src/Compilers/CSharp/Portable/Symbols/ConstantValueUtils.cs b/src/Compilers/CSharp/Portable/Symbols/ConstantValueUtils.cs index e3497a7e2c572..a3af63e58499e 100644 --- a/src/Compilers/CSharp/Portable/Symbols/ConstantValueUtils.cs +++ b/src/Compilers/CSharp/Portable/Symbols/ConstantValueUtils.cs @@ -52,15 +52,21 @@ private static BoundExpression BindFieldOrEnumInitializer( DiagnosticBag diagnostics) { var enumConstant = fieldSymbol as SourceEnumConstantSymbol; - var collisionDetector = new LocalScopeBinder(binder); + Binder collisionDetector = new LocalScopeBinder(binder); + collisionDetector = collisionDetector.WithPatternVariablesIfAny(initializer.Value); + BoundExpression result; + if ((object)enumConstant != null) { - return collisionDetector.BindEnumConstantInitializer(enumConstant, initializer.Value, diagnostics); + result = collisionDetector.BindEnumConstantInitializer(enumConstant, initializer.Value, diagnostics); } else { - return collisionDetector.BindVariableOrAutoPropInitializer(initializer, RefKind.None, fieldSymbol.Type, diagnostics); + result = collisionDetector.BindVariableOrAutoPropInitializer(initializer, RefKind.None, fieldSymbol.Type, diagnostics); } + + result = collisionDetector.WrapWithVariablesIfAny(result); + return result; } internal static ConstantValue GetAndValidateConstantValue( diff --git a/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEAssemblySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEAssemblySymbol.cs index 044061e6f58db..6749f3423c73c 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEAssemblySymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEAssemblySymbol.cs @@ -1,12 +1,10 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.Collections.Immutable; +using Roslyn.Utilities; using System.Diagnostics; - using System.Linq; -using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Symbols.Metadata.PE { @@ -92,9 +90,6 @@ public override AssemblyIdentity Identity } } - // TODO: https://github.com/dotnet/roslyn/issues/9000 - public override Version AssemblyVersionPattern => null; - public override ImmutableArray Modules { get diff --git a/src/Compilers/CSharp/Portable/Symbols/MissingAssemblySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/MissingAssemblySymbol.cs index a50cb3cc4f334..9ed0fc40642c4 100644 --- a/src/Compilers/CSharp/Portable/Symbols/MissingAssemblySymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/MissingAssemblySymbol.cs @@ -60,8 +60,6 @@ public override AssemblyIdentity Identity } } - public override Version AssemblyVersionPattern => null; - internal override ImmutableArray PublicKey { get { return Identity.PublicKey; } diff --git a/src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs b/src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs index b0d9604bbb015..282948d69ad04 100644 --- a/src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs +++ b/src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs @@ -219,52 +219,27 @@ public void CreateSourceAssemblyForCompilation(CSharpCompilation compilation) /// Used by EnC to create symbols for emit baseline. The PE symbols are used by . /// /// The assembly references listed in the metadata AssemblyRef table are matched to the resolved references - /// stored on this . We assume that the dependencies of the baseline metadata are - /// the same as the dependencies of the current compilation. This is not exactly true when the dependencies use - /// time-based versioning pattern, e.g. AssemblyVersion("1.0.*"). In that case we assume only the version - /// changed and nothing else. - /// - /// Each AssemblyRef is matched against the assembly identities using an exact equality comparison modulo version. - /// AssemblyRef with lower version in metadata is matched to a PE assembly symbol with the higher version - /// (provided that the assembly name, culture, PKT and flags are the same) if there is no symbol with the exactly matching version. - /// If there are multiple symbols with higher versions selects the one with the minimal version among them. - /// - /// Matching to a higher version is necessary to support EnC for projects whose P2P dependencies use time-based versioning pattern. - /// The versions of the dependent projects seen from the IDE will be higher than - /// the one written in the metadata at the time their respective baselines are built. - /// - /// No other unification or further resolution is performed. + /// stored on this . Each AssemblyRef is matched against the assembly identities + /// using an exact equality comparison. No unification or further resolution is performed. /// - /// - /// - /// - /// A map of the PE assembly symbol identities to the identities of the original metadata AssemblyRefs. - /// This map will be used in emit when serializing AssemblyRef table of the delta. For the delta to be compatible with - /// the original metadata we need to map the identities of the PE assembly symbols back to the original AssemblyRefs (if different). - /// In other words, we pretend that the versions of the dependencies haven't changed. - /// - public PEAssemblySymbol CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata metadata, MetadataImportOptions importOptions, out ImmutableDictionary assemblyReferenceIdentityMap) + public PEAssemblySymbol CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata metadata, MetadataImportOptions importOptions) { AssertBound(); // If the compilation has a reference from metadata to source assembly we can't share the referenced PE symbols. Debug.Assert(!HasCircularReference); - var referencedAssembliesByIdentity = new AssemblyIdentityMap(); + var referencedAssembliesByIdentity = new Dictionary(); foreach (var symbol in this.ReferencedAssemblies) { referencedAssembliesByIdentity.Add(symbol.Identity, symbol); } var assembly = metadata.GetAssembly(); - var peReferences = assembly.AssemblyReferences.SelectAsArray(MapAssemblyIdentityToResolvedSymbol, referencedAssembliesByIdentity); - - assemblyReferenceIdentityMap = GetAssemblyReferenceIdentityBaselineMap(peReferences, assembly.AssemblyReferences); - var assemblySymbol = new PEAssemblySymbol(assembly, DocumentationProvider.Default, isLinked: false, importOptions: importOptions); - var unifiedAssemblies = this.UnifiedAssemblies.WhereAsArray(unified => referencedAssembliesByIdentity.Contains(unified.OriginalReference, allowHigherVersion: false)); + var unifiedAssemblies = this.UnifiedAssemblies.WhereAsArray(unified => referencedAssembliesByIdentity.ContainsKey(unified.OriginalReference)); InitializeAssemblyReuseData(assemblySymbol, peReferences, unifiedAssemblies); if (assembly.ContainsNoPiaLocalTypes()) @@ -275,20 +250,13 @@ public PEAssemblySymbol CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata met return assemblySymbol; } - private static AssemblySymbol MapAssemblyIdentityToResolvedSymbol(AssemblyIdentity identity, AssemblyIdentityMap map) + private static AssemblySymbol MapAssemblyIdentityToResolvedSymbol(AssemblyIdentity identity, Dictionary map) { AssemblySymbol symbol; - if (map.TryGetValue(identity, out symbol, CompareVersionPartsSpecifiedInSource)) + if (map.TryGetValue(identity, out symbol)) { return symbol; } - - if (map.TryGetValue(identity, out symbol, (v1, v2, s) => true)) - { - // TODO: https://github.com/dotnet/roslyn/issues/9004 - throw new NotSupportedException($"Changing the version of an assembly reference is not allowed during debugging: '{identity}' changed version to {symbol.Identity.Version}"); - } - return new MissingAssemblySymbol(identity); } diff --git a/src/Compilers/CSharp/Portable/Symbols/Retargeting/RetargetingAssemblySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Retargeting/RetargetingAssemblySymbol.cs index e63c55e6fa4d3..5667c30c78b32 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Retargeting/RetargetingAssemblySymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Retargeting/RetargetingAssemblySymbol.cs @@ -148,8 +148,6 @@ public override AssemblyIdentity Identity } } - public override Version AssemblyVersionPattern => _underlyingAssembly.AssemblyVersionPattern; - internal override ImmutableArray PublicKey { get { return _underlyingAssembly.PublicKey; } diff --git a/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs b/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs index e516036f5ae50..93b1db8b66a8c 100644 --- a/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs +++ b/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs @@ -352,10 +352,6 @@ internal string SignatureKey } } - /// - /// Raw assembly version as specified in the AssemblyVersionAttribute, or null if none specified. - /// If the string passed to AssemblyVersionAttribute contains * the version build and/or revision numbers are set to . - /// private Version AssemblyVersionAttributeSetting { get @@ -382,15 +378,6 @@ private Version AssemblyVersionAttributeSetting } } - public override Version AssemblyVersionPattern - { - get - { - var attributeValue = AssemblyVersionAttributeSetting; - return (object)attributeValue == null || (attributeValue.Build != ushort.MaxValue && attributeValue.Revision != ushort.MaxValue) ? null : attributeValue; - } - } - internal AssemblyHashAlgorithm AssemblyHashAlgorithm { get @@ -462,6 +449,26 @@ private StrongNameKeys ComputeStrongNameKeys() // when both attributes and command-line options specified, cmd line wins. string keyFile = _compilation.Options.CryptoKeyFile; + // Public sign requires a keyfile + if (DeclaringCompilation.Options.PublicSign) + { + // TODO(https://github.com/dotnet/roslyn/issues/9150): + // Provide better error message if keys are provided by + // the attributes. Right now we'll just fall through to the + // "no key available" error. + + if (!string.IsNullOrEmpty(keyFile) && !PathUtilities.IsAbsolute(keyFile)) + { + // If keyFile has a relative path then there should be a diagnostic + // about it + Debug.Assert(!DeclaringCompilation.Options.Errors.IsEmpty); + return StrongNameKeys.None; + } + + // If we're public signing, we don't need a strong name provider + return StrongNameKeys.Create(keyFile, MessageProvider.Instance); + } + if (string.IsNullOrEmpty(keyFile)) { keyFile = this.AssemblyKeyFileAttributeSetting; @@ -484,16 +491,7 @@ private StrongNameKeys ComputeStrongNameKeys() } } - // If we're public signing, we don't need a strong name provider, just - // the file containing the public key - if (DeclaringCompilation.Options.PublicSign && keyFile != null) - { - return StrongNameKeys.Create(keyFile, MessageProvider.Instance); - } - else - { - return StrongNameKeys.Create(DeclaringCompilation.Options.StrongNameProvider, keyFile, keyContainer, MessageProvider.Instance); - } + return StrongNameKeys.Create(DeclaringCompilation.Options.StrongNameProvider, keyFile, keyContainer, MessageProvider.Instance); } // A collection of assemblies to which we were granted internals access by only checking matches for assembly name @@ -1898,7 +1896,7 @@ private AssemblyIdentity ComputeIdentity() { return new AssemblyIdentity( _assemblySimpleName, - VersionHelper.GenerateVersionFromPatternAndCurrentTime(this.AssemblyVersionAttributeSetting), + this.AssemblyVersionAttributeSetting, this.AssemblyCultureAttributeSetting, StrongNameKeys.PublicKey, hasPublicKey: !StrongNameKeys.PublicKey.IsDefault); @@ -2126,7 +2124,7 @@ private void DecodeWellKnownAttribute(ref DecodeWellKnownAttributeArguments GetIntAsync() AssertEx.SetEqual(new[] { "CompilerGeneratedAttribute", "DebuggerHiddenAttribute" }, GetAttributeNames(baseMethodWrapper.GetAttributes())); } } + + [Fact, WorkItem(7809, "https://github.com/dotnet/roslyn/issues/7809")] + public void SynthesizeAttributeWithUseSiteErrorFails() + { + #region "mslib" + var mslibNoString = @" +namespace System +{ + public class Object { } + public struct Int32 { } + public class ValueType { } + public class Attribute { } + public struct Void { } +}"; + var mslib = mslibNoString + @" +namespace System +{ + public class String { } +}"; + #endregion + + // Build an mscorlib including String + var mslibComp = CreateCompilation(new string[] { mslib }).VerifyDiagnostics(); + var mslibRef = mslibComp.EmitToImageReference(); + + // Build an mscorlib without String + var mslibNoStringComp = CreateCompilation(new string[] { mslibNoString }).VerifyDiagnostics(); + var mslibNoStringRef = mslibNoStringComp.EmitToImageReference(); + + var diagLibSource = @" +namespace System.Diagnostics +{ + public class DebuggerDisplayAttribute : System.Attribute + { + public DebuggerDisplayAttribute(System.String s) { } + public System.String Type { get { return null; } set { } } + } +} +namespace System.Runtime.CompilerServices +{ + public class CompilerGeneratedAttribute { } +}"; + // Build Diagnostics referencing mscorlib with String + var diagLibComp = CreateCompilation(new string[] { diagLibSource }, references: new[] { mslibRef }).VerifyDiagnostics(); + var diagLibRef = diagLibComp.EmitToImageReference(); + + // Create compilation using Diagnostics but referencing mscorlib without String + var comp = CreateCompilation(new SyntaxTree[] { Parse("") }, references: new[] { diagLibRef, mslibNoStringRef }); + + // Attribute cannot be synthesized because ctor has a use-site error (String type missing) + var attribute = comp.TrySynthesizeAttribute(WellKnownMember.System_Diagnostics_DebuggerDisplayAttribute__ctor); + Assert.Equal(null, attribute); + + // Attribute cannot be synthesized because type in named argument has use-site error (String type missing) + var attribute2 = comp.TrySynthesizeAttribute( + WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor, + namedArguments: ImmutableArray.Create(new KeyValuePair( + WellKnownMember.System_Diagnostics_DebuggerDisplayAttribute__Type, + new TypedConstant(comp.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, "unused")))); + Assert.Equal(null, attribute2); + } } } diff --git a/src/Compilers/CSharp/Test/Emit/Attributes/EmitTestStrongNameProvider.cs b/src/Compilers/CSharp/Test/Emit/Attributes/EmitTestStrongNameProvider.cs index 6f67bc26092b7..64c2df914c614 100644 --- a/src/Compilers/CSharp/Test/Emit/Attributes/EmitTestStrongNameProvider.cs +++ b/src/Compilers/CSharp/Test/Emit/Attributes/EmitTestStrongNameProvider.cs @@ -16,6 +16,9 @@ public partial class InternalsVisibleToAndStrongNameTests : CSharpTestBase private class StrongNameProviderWithBadInputStream : StrongNameProvider { private StrongNameProvider _underlyingProvider; + + public Exception ThrownException; + public StrongNameProviderWithBadInputStream(StrongNameProvider underlyingProvider) { _underlyingProvider = underlyingProvider; @@ -27,7 +30,8 @@ public StrongNameProviderWithBadInputStream(StrongNameProvider underlyingProvide internal override Stream CreateInputStream() { - throw new IOException("This is a test IOException"); + ThrownException = new IOException("This is a test IOException"); + throw ThrownException; } internal override StrongNameKeys CreateKeys(string keyFilePath, string keyContainerName, CommonMessageProvider messageProvider) => @@ -53,9 +57,9 @@ public static void Main(string[] args) { } var comp = CreateCompilationWithMscorlib(src, options: options); - comp.VerifyEmitDiagnostics( - // error CS7028: Error signing output with public key from container 'RoslynTestContainer' -- This is a test IOException - Diagnostic(ErrorCode.ERR_PublicKeyContainerFailure).WithArguments("RoslynTestContainer", "This is a test IOException").WithLocation(1, 1)); + comp.Emit(new MemoryStream()).Diagnostics.Verify( + // error CS8104: An error occurred while writing the Portable Executable file. + Diagnostic(ErrorCode.ERR_PeWritingFailure).WithArguments(testProvider.ThrownException.ToString()).WithLocation(1, 1)); } } } diff --git a/src/Compilers/CSharp/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.cs b/src/Compilers/CSharp/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.cs index 8f1bffddee139..0a2b3f2b411aa 100644 --- a/src/Compilers/CSharp/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.cs @@ -420,6 +420,36 @@ public class C {} Assert.Equal(CorFlags.ILOnly | CorFlags.StrongNameSigned, metadata.Module.PEReaderOpt.PEHeaders.CorHeader.Flags); } + [Fact] + public void KeyFileFromAttributes_PublicSign() + { + string source = @" +[assembly: System.Reflection.AssemblyKeyFile(""test.snk"")] +public class C {} +"; + var c = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseDll.WithPublicSign(true)); + c.VerifyDiagnostics( + // error CS8102: Public signing was specified and requires a public key, but no public key was specified. + Diagnostic(ErrorCode.ERR_PublicSignButNoKey).WithLocation(1, 1)); + + Assert.True(c.Options.PublicSign); + } + + [Fact] + public void KeyContainerFromAttributes_PublicSign() + { + string source = @" +[assembly: System.Reflection.AssemblyKeyName(""roslynTestContainer"")] +public class C {} +"; + var c = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseDll.WithPublicSign(true)); + c.VerifyDiagnostics( + // error CS8102: Public signing was specified and requires a public key, but no public key was specified. + Diagnostic(ErrorCode.ERR_PublicSignButNoKey).WithLocation(1, 1)); + + Assert.True(c.Options.PublicSign); + } + private void VerifySignedBitSetAfterEmit(Compilation comp) { var outStrm = new MemoryStream(); @@ -511,8 +541,8 @@ public void KeyContainerNoSNProvider_PublicSign() .WithPublicSign(true)); comp.VerifyDiagnostics( - // error CS7028: Error signing output with public key from container 'roslynTestContainer' -- Assembly signing not supported. - Diagnostic(ErrorCode.ERR_PublicKeyContainerFailure).WithArguments("roslynTestContainer", "Assembly signing not supported.").WithLocation(1, 1), + // error CS7102: Compilation options 'PublicSign' and 'CryptoKeyContainer' can't both be specified at the same time. + Diagnostic(ErrorCode.ERR_MutuallyExclusiveOptions).WithArguments("PublicSign", "CryptoKeyContainer").WithLocation(1, 1), // error CS8102: Public signing was specified and requires a public key, but no public key was specified. Diagnostic(ErrorCode.ERR_PublicSignButNoKey).WithLocation(1, 1)); } @@ -526,14 +556,16 @@ public void KeyContainerDesktopProvider_PublicSign() .WithStrongNameProvider(s_defaultProvider) .WithPublicSign(true)); - comp.VerifyDiagnostics(); + comp.VerifyDiagnostics( + // error CS7102: Compilation options 'PublicSign' and 'CryptoKeyContainer' can't both be specified at the same time. + Diagnostic(ErrorCode.ERR_MutuallyExclusiveOptions).WithArguments("PublicSign", "CryptoKeyContainer").WithLocation(1, 1), + // error CS8102: Public signing was specified and requires a public key, but no public key was specified. + Diagnostic(ErrorCode.ERR_PublicSignButNoKey).WithLocation(1, 1)); Assert.True(comp.Options.PublicSign); Assert.Null(comp.Options.DelaySign); Assert.False(comp.IsRealSigned); Assert.NotNull(comp.Options.CryptoKeyContainer); - - VerifySignedBitSetAfterEmit(comp); } [Fact] diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenIterators.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenIterators.cs index 45606201a51fd..33b7635ca8d6b 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenIterators.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenIterators.cs @@ -2326,5 +2326,73 @@ .locals init (bool V_0, }"); Assert.True(expectedIL.IndexOf("<>_", StringComparison.Ordinal) < 0); } + + [Fact, WorkItem(9167, "https://github.com/dotnet/roslyn/issues/9167")] + public void IteratorShouldCompileWithoutOptionalAttributes() + { + #region IL for corlib without CompilerGeneratedAttribute or DebuggerNonUserCodeAttribute + var corlib = @" +namespace System +{ + public class Object { } + public struct Int32 { } + public struct Boolean { } + public class String { } + public class Exception { } + public class NotSupportedException : Exception { } + public class ValueType { } + public class Enum { } + public struct Void { } + + public interface IDisposable + { + void Dispose(); + } +} + +namespace System.Collections +{ + public interface IEnumerable + { + IEnumerator GetEnumerator(); + } + + public interface IEnumerator + { + bool MoveNext(); + object Current { get; } + void Reset(); + } + + namespace Generic + { + public interface IEnumerable : IEnumerable + { + new IEnumerator GetEnumerator(); + } + + public interface IEnumerator : IEnumerator + { + new T Current { get; } + } + } +}"; + #endregion + + var source = @" +public class C +{ + public System.Collections.IEnumerable SomeNumbers() + { + yield return 42; + } +}"; + // The compilation succeeds even though CompilerGeneratedAttribute and DebuggerNonUserCodeAttribute are not available. + var compilation = CreateCompilation(new[] { Parse(source), Parse(corlib) }); + var verifier = CompileAndVerify(compilation, verify: false); + verifier.VerifyDiagnostics( + // warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options. + Diagnostic(ErrorCode.WRN_NoRuntimeMetadataVersion).WithLocation(1, 1)); + } } } diff --git a/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs index d32cf1cd11a64..4b6d6ca83bde5 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Immutable; using System.IO; using System.Linq; using System.Reflection; @@ -2699,10 +2698,16 @@ public void BrokenOutStream() var compilation = CreateCompilationWithMscorlib(source); var output = new BrokenStream(); - Assert.Throws(() => compilation.Emit(output)); + var result = compilation.Emit(output); + result.Diagnostics.Verify( + // error CS8104: An error occurred while writing the Portable Executable file. + Diagnostic(ErrorCode.ERR_PeWritingFailure).WithArguments(output.ThrownException.ToString()).WithLocation(1, 1)); - output.BreakHow = 1; - Assert.Throws(() => compilation.Emit(output)); + output.BreakHow = BrokenStream.BreakHowType.ThrowOnSetPosition; + result = compilation.Emit(output); + result.Diagnostics.Verify( + // error CS8104: An error occurred while writing the Portable Executable file. + Diagnostic(ErrorCode.ERR_PeWritingFailure).WithArguments(output.ThrownException.ToString()).WithLocation(1, 1)); // disposed stream is not writable var outReal = new MemoryStream(); @@ -2718,7 +2723,7 @@ public void BrokenPDBStream() var output = new MemoryStream(); var pdb = new BrokenStream(); - pdb.BreakHow = 2; + pdb.BreakHow = BrokenStream.BreakHowType.ThrowOnSetLength; var result = compilation.Emit(output, pdb); // error CS0041: Unexpected error writing debug information -- 'Exception from HRESULT: 0x806D0004' @@ -2949,5 +2954,27 @@ static int M(dynamic d, object o) AssertEx.Equal(expectedNames, actualNames); } } + + [Fact] + [WorkItem(3240, "https://github.com/dotnet/roslyn/pull/8227")] + public void FailingEmitter() + { + string source = @" +public class X +{ + public static void Main() + { + + } +}"; + var compilation = CreateCompilationWithMscorlib(source); + var broken = new BrokenStream(); + broken.BreakHow = BrokenStream.BreakHowType.ThrowOnWrite; + var result = compilation.Emit(broken); + Assert.False(result.Success); + result.Diagnostics.Verify( + // error CS8104: An error occurred while writing the Portable Executable file. + Diagnostic(ErrorCode.ERR_PeWritingFailure).WithArguments(broken.ThrownException.ToString()).WithLocation(1, 1)); + } } } diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.cs index 192ba4c37d308..a6478e760639f 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.cs @@ -1,14 +1,10 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection.Metadata; -using System.Reflection.Metadata.Ecma335; -using System.Threading; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.CSharp.UnitTests; @@ -22,9 +18,6 @@ namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests { public class AssemblyReferencesTests : EditAndContinueTestBase { - private static readonly CSharpCompilationOptions s_signedDll = - TestOptions.ReleaseDll.WithCryptoPublicKey(TestResources.TestKeys.PublicKey_ce65828c82a341f2); - /// /// The baseline metadata might have less (or even different) references than /// the current compilation. We shouldn't assume that the reference sets are the same. @@ -231,269 +224,5 @@ class C diff2.EmitResult.Diagnostics.Verify(); } - - [Fact] - public void DependencyVersionWildcards_Compilation() - { - TestDependencyVersionWildcards( - "1.0.0.*", - new Version(1, 0, 2000, 1001), - new Version(1, 0, 2000, 1001), - new Version(1, 0, 2000, 1002)); - - TestDependencyVersionWildcards( - "1.0.0.*", - new Version(1, 0, 2000, 1001), - new Version(1, 0, 2000, 1002), - new Version(1, 0, 2000, 1002)); - - TestDependencyVersionWildcards( - "1.0.0.*", - new Version(1, 0, 2000, 1003), - new Version(1, 0, 2000, 1002), - new Version(1, 0, 2000, 1001)); - - TestDependencyVersionWildcards( - "1.0.*", - new Version(1, 0, 2000, 1001), - new Version(1, 0, 2000, 1002), - new Version(1, 0, 2000, 1003)); - - TestDependencyVersionWildcards( - "1.0.*", - new Version(1, 0, 2000, 1001), - new Version(1, 0, 2000, 1005), - new Version(1, 0, 2000, 1002)); - } - - private void TestDependencyVersionWildcards(string sourceVersion, Version version0, Version version1, Version version2) - { - string srcLib = $@" -[assembly: System.Reflection.AssemblyVersion(""{sourceVersion}"")] - -public class D {{ }} -"; - - string src0 = @" -class C -{ - public static int F(D a) { return 1; } -} -"; - string src1 = @" -class C -{ - public static int F(D a) { return 2; } -} -"; - string src2 = @" -class C -{ - public static int F(D a) { return 3; } - public static int G(D a) { return 4; } -} -"; - var lib0 = CreateCompilationWithMscorlib(srcLib, assemblyName: "Lib", options: TestOptions.DebugDll); - - ((SourceAssemblySymbol)lib0.Assembly).lazyAssemblyIdentity = new AssemblyIdentity("Lib", version0); - lib0.VerifyDiagnostics(); - - var lib1 = CreateCompilationWithMscorlib(srcLib, assemblyName: "Lib", options: TestOptions.DebugDll); - ((SourceAssemblySymbol)lib1.Assembly).lazyAssemblyIdentity = new AssemblyIdentity("Lib", version1); - lib1.VerifyDiagnostics(); - - var lib2 = CreateCompilationWithMscorlib(srcLib, assemblyName: "Lib", options: TestOptions.DebugDll); - ((SourceAssemblySymbol)lib2.Assembly).lazyAssemblyIdentity = new AssemblyIdentity("Lib", version2); - - lib2.VerifyDiagnostics(); - - var compilation0 = CreateCompilation(src0, new[] { MscorlibRef, lib0.ToMetadataReference() }, assemblyName: "C", options: TestOptions.DebugDll); - var compilation1 = compilation0.WithSource(src1).WithReferences(new[] { MscorlibRef, lib1.ToMetadataReference() }); - var compilation2 = compilation1.WithSource(src2).WithReferences(new[] { MscorlibRef, lib2.ToMetadataReference() }); - - var v0 = CompileAndVerify(compilation0); - var v1 = CompileAndVerify(compilation1); - var v2 = CompileAndVerify(compilation2); - - var f0 = compilation0.GetMember("C.F"); - var f1 = compilation1.GetMember("C.F"); - var f2 = compilation2.GetMember("C.F"); - var g2 = compilation2.GetMember("C.G"); - - var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); - var generation0 = EmitBaseline.CreateInitialBaseline(md0, EmptyLocalsProvider); - - var diff1 = compilation1.EmitDifference( - generation0, - ImmutableArray.Create(new SemanticEdit(SemanticEditKind.Update, f0, f1))); - - var diff2 = compilation2.EmitDifference( - diff1.NextGeneration, - ImmutableArray.Create( - new SemanticEdit(SemanticEditKind.Update, f1, f2), - new SemanticEdit(SemanticEditKind.Insert, null, g2))); - - var md1 = diff1.GetMetadata(); - var md2 = diff2.GetMetadata(); - - var aggReader = new AggregatedMetadataReader(md0.MetadataReader, md1.Reader, md2.Reader); - - // all references to Lib should be to the baseline version: - VerifyAssemblyReferences(aggReader, new[] - { - "mscorlib, 4.0.0.0", - "Lib, " + lib0.Assembly.Identity.Version, - "mscorlib, 4.0.0.0", - "Lib, " + lib0.Assembly.Identity.Version, - "mscorlib, 4.0.0.0", - "Lib, " + lib0.Assembly.Identity.Version, - }); - } - - [Fact] - public void DependencyVersionWildcards_Metadata() - { - string srcLib = @" -[assembly: System.Reflection.AssemblyVersion(""1.0.*"")] - -public class D { } -"; - - string src0 = @" -class C -{ - public static int F(D a) { return 1; } -} -"; - string src1 = @" -class C -{ - public static int F(D a) { return 2; } -} -"; - string src2 = @" -class C -{ - public static int F(D a) { return 3; } - public static int G(D a) { return 4; } -} -"; - var lib0 = CreateCompilationWithMscorlib(srcLib, assemblyName: "Lib", options: TestOptions.DebugDll); - ((SourceAssemblySymbol)lib0.Assembly).lazyAssemblyIdentity = new AssemblyIdentity("Lib", new Version(1, 0, 2000, 1001)); - lib0.VerifyDiagnostics(); - - var lib1 = CreateCompilationWithMscorlib(srcLib, assemblyName: "Lib", options: TestOptions.DebugDll); - ((SourceAssemblySymbol)lib1.Assembly).lazyAssemblyIdentity = new AssemblyIdentity("Lib", new Version(1, 0, 2000, 1002)); - lib1.VerifyDiagnostics(); - - var lib2 = CreateCompilationWithMscorlib(srcLib, assemblyName: "Lib", options: TestOptions.DebugDll); - ((SourceAssemblySymbol)lib2.Assembly).lazyAssemblyIdentity = new AssemblyIdentity("Lib", new Version(1, 0, 2000, 1003)); - lib2.VerifyDiagnostics(); - - var compilation0 = CreateCompilation(src0, new[] { MscorlibRef, lib0.EmitToImageReference() }, assemblyName: "C", options: TestOptions.DebugDll); - var compilation1 = compilation0.WithSource(src1).WithReferences(new[] { MscorlibRef, lib1.EmitToImageReference() }); - var compilation2 = compilation1.WithSource(src2).WithReferences(new[] { MscorlibRef, lib2.EmitToImageReference() }); - - var v0 = CompileAndVerify(compilation0); - var v1 = CompileAndVerify(compilation1); - var v2 = CompileAndVerify(compilation2); - - var f0 = compilation0.GetMember("C.F"); - var f1 = compilation1.GetMember("C.F"); - var f2 = compilation2.GetMember("C.F"); - var g2 = compilation2.GetMember("C.G"); - - var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); - var generation0 = EmitBaseline.CreateInitialBaseline(md0, EmptyLocalsProvider); - - var diff1 = compilation1.EmitDifference( - generation0, - ImmutableArray.Create(new SemanticEdit(SemanticEditKind.Update, f0, f1))); - - diff1.EmitResult.Diagnostics.Verify( - // error CS7038: Failed to emit module 'C'. - Diagnostic(ErrorCode.ERR_ModuleEmitFailure).WithArguments("C")); - } - - [Fact, WorkItem(9004, "https://github.com/dotnet/roslyn/issues/9004")] - public void DependencyVersionWildcardsCollisions() - { - string srcLib01 = @" -[assembly: System.Reflection.AssemblyVersion(""1.0.0.1"")] - -public class D { } -"; - string srcLib02 = @" -[assembly: System.Reflection.AssemblyVersion(""1.0.0.2"")] - -public class D { } -"; - - string srcLib11 = @" -[assembly: System.Reflection.AssemblyVersion(""1.0.1.1"")] - -public class D { } -"; - string srcLib12 = @" -[assembly: System.Reflection.AssemblyVersion(""1.0.1.2"")] - -public class D { } -"; - - string src0 = @" -extern alias L0; -extern alias L1; - -class C -{ - public static int F(L0::D a, L1::D b) => 1; -} -"; - string src1 = @" -extern alias L0; -extern alias L1; - -class C -{ - public static int F(L0::D a, L1::D b) => 2; -} -"; - var lib01 = CreateCompilationWithMscorlib(srcLib01, assemblyName: "Lib", options: s_signedDll).VerifyDiagnostics(); - var ref01 = lib01.ToMetadataReference(ImmutableArray.Create("L0")); - - var lib02 = CreateCompilationWithMscorlib(srcLib02, assemblyName: "Lib", options: s_signedDll).VerifyDiagnostics(); - var ref02 = lib02.ToMetadataReference(ImmutableArray.Create("L0")); - - var lib11 = CreateCompilationWithMscorlib(srcLib11, assemblyName: "Lib", options: s_signedDll).VerifyDiagnostics(); - var ref11 = lib11.ToMetadataReference(ImmutableArray.Create("L1")); - - var lib12 = CreateCompilationWithMscorlib(srcLib12, assemblyName: "Lib", options: s_signedDll).VerifyDiagnostics(); - var ref12 = lib12.ToMetadataReference(ImmutableArray.Create("L1")); - - var compilation0 = CreateCompilation(src0, new[] { MscorlibRef, ref01, ref11 }, assemblyName: "C", options: TestOptions.DebugDll); - var compilation1 = compilation0.WithSource(src1).WithReferences(new[] { MscorlibRef, ref02, ref12 }); - - var v0 = CompileAndVerify(compilation0); - - var f0 = compilation0.GetMember("C.F"); - var f1 = compilation1.GetMember("C.F"); - - var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); - var generation0 = EmitBaseline.CreateInitialBaseline(md0, EmptyLocalsProvider); - - var diff1 = compilation1.EmitDifference( - generation0, - ImmutableArray.Create(new SemanticEdit(SemanticEditKind.Update, f0, f1))); - - // TODO: message should be: Changing the version of an assembly reference is not allowed during debugging - diff1.EmitResult.Diagnostics.Verify( - // error CS7038: Failed to emit module 'C'. - Diagnostic(ErrorCode.ERR_ModuleEmitFailure).WithArguments("C")); - } - - public void VerifyAssemblyReferences(AggregatedMetadataReader reader, string[] expected) - { - AssertEx.Equal(expected, reader.GetAssemblyReferences().Select(aref => $"{reader.GetString(aref.Name)}, {aref.Version}")); - } } } diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs index 118319e6dbf2c..206c4255744ff 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs @@ -4702,5 +4702,119 @@ .locals init (int V_0, "<>f__AnonymousType5<<<>h__TransparentIdentifier0>j__TPar, j__TPar>: {Equals, GetHashCode, ToString}", "<>f__AnonymousType2<<<>h__TransparentIdentifier0>j__TPar, j__TPar>: {Equals, GetHashCode, ToString}"); } + + [Fact, WorkItem(9119, "https://github.com/dotnet/roslyn/issues/9119")] + public void MissingIteratorStateMachineAttribute() + { + var source0 = MarkedSource(@" +using System; +using System.Collections.Generic; + +class C +{ + public IEnumerable F() + { + int a = 0; + yield return 0; + Console.WriteLine(a); + } +} +"); + var source1 = MarkedSource(@" +using System; +using System.Collections.Generic; + +class C +{ + public IEnumerable F() + { + int a = 1; + yield return 1; + Console.WriteLine(a); + } +} +"); + + var compilation0 = CreateCompilationWithMscorlib(new[] { source0.Tree }, options: ComSafeDebugDll); + var compilation1 = compilation0.WithSource(source1.Tree); + + // older versions of mscorlib don't contain IteratorStateMachineAttribute + Assert.Null(compilation0.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_IteratorStateMachineAttribute__ctor)); + + var v0 = CompileAndVerify(compilation0); + v0.VerifyDiagnostics(); + var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); + + var f0 = compilation0.GetMember("C.F"); + var f1 = compilation1.GetMember("C.F"); + + var generation0 = EmitBaseline.CreateInitialBaseline(md0, v0.CreateSymReader().GetEncMethodDebugInfo); + + var diff1 = compilation1.EmitDifference( + generation0, + ImmutableArray.Create( + new SemanticEdit(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1), preserveLocalVariables: true))); + + diff1.EmitResult.Diagnostics.Verify( + // error CS7038: Failed to emit module '{0}'. + Diagnostic(ErrorCode.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name)); + } + + [Fact, WorkItem(9119, "https://github.com/dotnet/roslyn/issues/9119")] + public void MissingAsyncStateMachineAttribute() + { + var source0 = MarkedSource(@" +using System.Threading.Tasks; + +class C +{ + public async Task F() + { + int a = 0; + await new Task(); + return a; + } +} +"); + var source1 = MarkedSource(@" +using System.Threading.Tasks; + +class C +{ + public async Task F() + { + int a = 1; + await new Task(); + return a; + } +} +"); + + var compilation0 = CreateCompilation(new[] { source0.Tree }, new[] { TestReferences.NetFx.Minimal.mincorlib, TestReferences.NetFx.Minimal.minasync }, options: ComSafeDebugDll); + var compilation1 = compilation0.WithSource(source1.Tree); + + // older versions of mscorlib don't contain AsyncStateMachineAttribute, IteratorStateMachineAttribute + Assert.Null(compilation0.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_AsyncStateMachineAttribute__ctor)); + Assert.Null(compilation0.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_IteratorStateMachineAttribute__ctor)); + + var v0 = CompileAndVerify(compilation0, verify: false); + var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); + + var f0 = compilation0.GetMember("C.F"); + var f1 = compilation1.GetMember("C.F"); + + var generation0 = EmitBaseline.CreateInitialBaseline(md0, v0.CreateSymReader().GetEncMethodDebugInfo); + + var diff1 = compilation1.EmitDifference( + generation0, + ImmutableArray.Create( + new SemanticEdit(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1), preserveLocalVariables: true))); + + diff1.EmitResult.Diagnostics.Verify( + // error CS7038: Failed to emit module '{0}'. + Diagnostic(ErrorCode.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name), + // error CS7038: Failed to emit module '{0}'. + Diagnostic(ErrorCode.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name)); + } } } diff --git a/src/Compilers/CSharp/Test/Emit/Emit/OutputStreams.cs b/src/Compilers/CSharp/Test/Emit/Emit/OutputStreams.cs index 26880dfaa98e7..674fd11abe81b 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/OutputStreams.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/OutputStreams.cs @@ -20,71 +20,4 @@ public Stream GetXmlInclude(SyntaxTree syntaxTree, string xmlIncludeFile) throw new NotImplementedException(); } } - - internal class BrokenStream : Stream - { - public int BreakHow; - - public override bool CanRead - { - get { return true; } - } - - public override bool CanSeek - { - get { return true; } - } - - public override bool CanWrite - { - get { return true; } - } - - public override void Flush() - { - } - - public override long Length - { - get - { - return 0; - } - } - - public override long Position - { - get - { - return 0; - } - set - { - if (BreakHow == 1) - throw new NotSupportedException(); - } - } - - public override int Read(byte[] buffer, int offset, int count) - { - return 0; - } - - public override long Seek(long offset, SeekOrigin origin) - { - return 0; - } - - public override void SetLength(long value) - { - if (BreakHow == 2) - throw new IOException(); - } - - public override void Write(byte[] buffer, int offset, int count) - { - if (BreakHow == 0) - throw new IOException(); - } - } } diff --git a/src/Compilers/CSharp/Test/Emit/project.lock.json b/src/Compilers/CSharp/Test/Emit/project.lock.json index 8e273a551710d..0be6e5524107a 100644 --- a/src/Compilers/CSharp/Test/Emit/project.lock.json +++ b/src/Compilers/CSharp/Test/Emit/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/CSharp/Test/Performance/project.lock.json b/src/Compilers/CSharp/Test/Performance/project.lock.json index 222661284f954..24c270eaf73fb 100644 --- a/src/Compilers/CSharp/Test/Performance/project.lock.json +++ b/src/Compilers/CSharp/Test/Performance/project.lock.json @@ -156,7 +156,7 @@ "lib/net46/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -428,7 +428,7 @@ "lib/net46/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -700,7 +700,7 @@ "lib/net46/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1170,11 +1170,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs index de5b3a1c0badf..bd6aecf03aa05 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs @@ -1529,6 +1529,41 @@ public void M1() Diagnostic(NullOperationSyntaxTestAnalyzer.ParamsArrayOperationDescriptor.Id, "1").WithLocation(12, 12)); } + [WorkItem(9113, "https://github.com/dotnet/roslyn/issues/9113")] + [Fact] + public void ConversionExpressionCSharp() + { + const string source = @" +class X +{ + static void Main() + { + string three = 3.ToString(); + + int x = null.Length; + + int y = string.Empty; + + int i = global::MyType(); + } +}"; + CreateCompilationWithMscorlib45(source) + .VerifyDiagnostics( + // (8,17): error CS0023: Operator '.' cannot be applied to operand of type '' + // int x = null.Length; + Diagnostic(ErrorCode.ERR_BadUnaryOp, "null.Length").WithArguments(".", "").WithLocation(8, 17), + // (10,17): error CS0029: Cannot implicitly convert type 'string' to 'int' + // int y = string.Empty; + Diagnostic(ErrorCode.ERR_NoImplicitConv, "string.Empty").WithArguments("string", "int").WithLocation(10, 17), + // (12,25): error CS0400: The type or namespace name 'MyType' could not be found in the global namespace (are you missing an assembly reference?) + // int i = global::MyType(); + Diagnostic(ErrorCode.ERR_GlobalSingleTypeNameNotFound, "MyType").WithArguments("MyType", "").WithLocation(12, 25)) + .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ConversionExpressionCSharpTestAnalyzer() }, null, null, false, + Diagnostic(ConversionExpressionCSharpTestAnalyzer.InvalidConversionExpressionDescriptor.Id, "null.Length").WithLocation(8, 17), + Diagnostic(ConversionExpressionCSharpTestAnalyzer.InvalidConversionExpressionDescriptor.Id, "string.Empty").WithLocation(10, 17), + Diagnostic(ConversionExpressionCSharpTestAnalyzer.InvalidConversionExpressionDescriptor.Id, "global::MyType()").WithLocation(12, 17)); + } + [WorkItem(8114, "https://github.com/dotnet/roslyn/issues/8114")] [Fact] public void InvalidOperatorCSharp() diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/ExpressionBodiedMemberTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/ExpressionBodiedMemberTests.cs index d87f37e3c93d6..12d767cf5656d 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/ExpressionBodiedMemberTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/ExpressionBodiedMemberTests.cs @@ -774,5 +774,88 @@ public class C Assert.Equal($"System.Int32 y{i}", model.LookupSymbols(nodes[i].SpanStart, name: $"y{i}").Single().ToTestDisplayString()); } } + + [Fact, WorkItem(8594, "https://github.com/dotnet/roslyn/pull/8594")] + public void ExpressionBodyDeclaredSymbols_01() + { + var comp = CreateCompilationWithMscorlib(@" +class C +{ + int _p1 = 0; + int P1 { + get => _p1; + set => _p1 = value; + } + C(int x) => P1 = x; + C(int y) : this(y) => _p1 = y; + ~C() => _p1 = 0; +} +"); + var tree = comp.SyntaxTrees[0]; + var model = comp.GetSemanticModel(tree); + var dn = tree.GetRoot().DescendantNodes(); + + var node = tree.GetRoot() + .DescendantNodes() + .OfType() + .ElementAt(0); + + var fooDef = model.GetDeclaredSymbol(node) as SourcePropertyAccessorSymbol; + Assert.NotNull(fooDef); + Assert.Equal(SymbolKind.Method, fooDef.Kind); + Assert.Equal("get_P1", fooDef.Name); + + + node = tree.GetRoot() + .DescendantNodes() + .OfType() + .ElementAt(1); + + fooDef = model.GetDeclaredSymbol(node) as SourcePropertyAccessorSymbol; + Assert.NotNull(fooDef); + Assert.Equal(SymbolKind.Method, fooDef.Kind); + Assert.Equal("set_P1", fooDef.Name); + + + } + [Fact, WorkItem(8594, "https://github.com/dotnet/roslyn/pull/8594")] + public void ExpressionBodyDeclaredSymbols_02() + { + var comp = CreateCompilationWithMscorlib(@" +class C +{ + int _p1 = 0; + int P1 { + get => _p1; + set => _p1 = value; + } +} +"); + var tree = comp.SyntaxTrees[0]; + var model = comp.GetSemanticModel(tree); + + var node = tree.GetRoot() + .DescendantNodes() + .OfType() + .ElementAt(0); + + var fooDef = model.GetDeclaredSymbol(node) as SourcePropertyAccessorSymbol; + Assert.NotNull(fooDef); + Assert.Equal(SymbolKind.Method, fooDef.Kind); + Assert.Equal("get_P1", fooDef.Name); + + + node = tree.GetRoot() + .DescendantNodes() + .OfType() + .ElementAt(1); + + fooDef = model.GetDeclaredSymbol(node) as SourcePropertyAccessorSymbol; + Assert.NotNull(fooDef); + Assert.Equal(SymbolKind.Method, fooDef.Kind); + Assert.Equal("set_P1", fooDef.Name); + + } + } } diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs index 4702e939acb70..7078d2cd90bf8 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/PatternMatchingTests.cs @@ -481,15 +481,12 @@ private static void M(string p = """" is object o ? o.ToString() : """") "; var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); compilation.VerifyDiagnostics( - // (2,28): error CS0103: The name 's' does not exist in the current context + // (2,11): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type // [Obsolete("" is string s ? s : "")] - Diagnostic(ErrorCode.ERR_NameNotInContext, "s").WithArguments("s").WithLocation(2, 28), - // (8,55): error CS0103: The name 'o' does not exist in the current context + Diagnostic(ErrorCode.ERR_BadAttributeArgument, @""""" is string s ? s : """"").WithLocation(2, 11), + // (8,38): error CS1736: Default parameter value for 'p' must be a compile-time constant // private static void M(string p = "" is object o ? o.ToString() : "") - Diagnostic(ErrorCode.ERR_NameNotInContext, "o").WithArguments("o").WithLocation(8, 55), - // (8,34): error CS1750: A value of type '?' cannot be used as a default parameter because there are no standard conversions to type 'string' - // private static void M(string p = "" is object o ? o.ToString() : "") - Diagnostic(ErrorCode.ERR_NoConversionForDefaultParam, "p").WithArguments("?", "string").WithLocation(8, 34) + Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, @""""" is object o ? o.ToString() : """"").WithArguments("p").WithLocation(8, 38) ); } @@ -1543,7 +1540,18 @@ private static void VerifyModelForDeclarationPattern(SemanticModel model, LetSta foreach (var reference in references) { - Assert.Same(symbol, model.GetSymbolInfo(reference).Symbol); + var symbolInfo = model.GetSymbolInfo(reference); + + if ((object)symbolInfo.Symbol != null) + { + Assert.Same(symbol, symbolInfo.Symbol); + } + else + { + Assert.Same(symbol, symbolInfo.CandidateSymbols.Single()); + Assert.Equal(CandidateReason.NotAVariable, symbolInfo.CandidateReason); + } + Assert.Same(symbol, model.LookupSymbols(reference.SpanStart, name: decl.Identifier.ValueText).Single()); Assert.True(model.LookupNames(reference.SpanStart).Contains(decl.Identifier.ValueText)); } @@ -3561,6 +3569,15 @@ bool f (object o) => o is int x12 && Dummy(x12); f(null); } + + System.Action Test13() + { + return () => + { + bool f (object o) => o is int x13 && x13 > 0; + f(null); + }; + } } "; var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions.WithLocalFunctionsFeature()); @@ -3657,6 +3674,10 @@ bool f (object o) => o is int x12 && Assert.Equal(2, x12Ref.Length); VerifyModelForDeclarationPattern(model, x12Decl, x12Ref[0]); VerifyNotAPatternLocal(model, x12Ref[1]); + + var x13Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x13").Single(); + var x13Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x13").Single(); + VerifyModelForDeclarationPattern(model, x13Decl, x13Ref); } [Fact] @@ -3695,7 +3716,7 @@ bool Test11(object x11) => 1 is int x11 && bool Dummy(params object[] x) {return true;} } "; - var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions.WithLocalFunctionsFeature()); + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); compilation.VerifyDiagnostics( // (9,33): error CS1002: ; expected // void Test1(object o) => let x1 = o; @@ -3825,7 +3846,7 @@ 52 is int x5 && bool Dummy(params object[] x) {return true;} } "; - var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions.WithLocalFunctionsFeature()); + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); compilation.VerifyDiagnostics( // (9,33): error CS1002: ; expected // bool Test1(object o) => let x1 = o; @@ -3909,5 +3930,2071 @@ 52 is int x5 && var x11Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x11").Single(); VerifyModelForDeclarationPattern(model, x11Decl, x11Ref); } + + [Fact] + public void ScopeOfPatternVariables_FieldInitializers_01() + { + var source = +@" +public class X +{ + public static void Main() + { + System.Console.WriteLine(Test1); + } + + static bool Test1 = 1 is int x1 && Dummy(x1); + + static bool Dummy(int x) + { + System.Console.WriteLine(x); + return true; + } +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + CompileAndVerify(compilation, expectedOutput: @"1 +True"); + } + + [Fact] + public void ScopeOfPatternVariables_FieldInitializers_02() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + bool Test3 = 3 is int x3 && x3 > 0; + + bool Test4 = x4 && 4 is int x4; + + bool Test5 = 51 is int x5 && + 52 is int x5 && + x5 > 0; + + bool Test61 = 6 is int x6 && x6 > 0, Test62 = 6 is int x6 && x6 > 0; + + bool Test71 = 7 is int x7 && x7 > 0; + bool Test72 = Dummy(x7, 2); + void Test73() { Dummy(x7, 3); } + + bool Dummy(params object[] x) {return true;} +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (10,18): error CS0841: Cannot use local variable 'x4' before it is declared + // bool Test4 = x4 && 4 is int x4; + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(10, 18), + // (13,28): error CS0128: A local variable named 'x5' is already defined in this scope + // 52 is int x5 && + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(13, 28), + // (19,25): error CS0103: The name 'x7' does not exist in the current context + // bool Test72 = Dummy(x7, 2); + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(19, 25), + // (20,27): error CS0103: The name 'x7' does not exist in the current context + // void Test73() { Dummy(x7, 3); } + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(20, 27) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").Single(); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").Single(); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").ToArray(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").Single(); + Assert.Equal(2, x5Decl.Length); + VerifyModelForDeclarationPattern(model, x5Decl[0], x5Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x5Decl[1]); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").ToArray(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(2, x6Decl.Length); + Assert.Equal(2, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl[0], x6Ref[0]); + VerifyModelForDeclarationPattern(model, x6Decl[1], x6Ref[1]); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotInScope(model, x7Ref[1]); + VerifyNotInScope(model, x7Ref[2]); + } + + [Fact] + public void ScopeOfPatternVariables_FieldInitializers_03() + { + var source = +@" +public enum X +{ + Test3 = 3 is int x3 ? x3 : 0, + + Test4 = x4 && 4 is int x4 ? 1 : 0, + + Test5 = 51 is int x5 && + 52 is int x5 && + x5 > 0 ? 1 : 0, + + Test61 = 6 is int x6 && x6 > 0 ? 1 : 0, Test62 = 6 is int x6 && x6 > 0 ? 1 : 0, + + Test71 = 7 is int x7 && x7 > 0 ? 1 : 0, + Test72 = x7, +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugDll, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (6,13): error CS0841: Cannot use local variable 'x4' before it is declared + // Test4 = x4 && 4 is int x4 ? 1 : 0, + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(6, 13), + // (9,23): error CS0128: A local variable named 'x5' is already defined in this scope + // 52 is int x5 && + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(9, 23), + // (12,14): error CS0133: The expression being assigned to 'X.Test61' must be constant + // Test61 = 6 is int x6 && x6 > 0 ? 1 : 0, Test62 = 6 is int x6 && x6 > 0 ? 1 : 0, + Diagnostic(ErrorCode.ERR_NotConstantExpression, "6 is int x6 && x6 > 0 ? 1 : 0").WithArguments("X.Test61").WithLocation(12, 14), + // (12,54): error CS0133: The expression being assigned to 'X.Test62' must be constant + // Test61 = 6 is int x6 && x6 > 0 ? 1 : 0, Test62 = 6 is int x6 && x6 > 0 ? 1 : 0, + Diagnostic(ErrorCode.ERR_NotConstantExpression, "6 is int x6 && x6 > 0 ? 1 : 0").WithArguments("X.Test62").WithLocation(12, 54), + // (14,14): error CS0133: The expression being assigned to 'X.Test71' must be constant + // Test71 = 7 is int x7 && x7 > 0 ? 1 : 0, + Diagnostic(ErrorCode.ERR_NotConstantExpression, "7 is int x7 && x7 > 0 ? 1 : 0").WithArguments("X.Test71").WithLocation(14, 14), + // (15,14): error CS0103: The name 'x7' does not exist in the current context + // Test72 = x7, + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(15, 14), + // (4,13): error CS0133: The expression being assigned to 'X.Test3' must be constant + // Test3 = 3 is int x3 ? x3 : 0, + Diagnostic(ErrorCode.ERR_NotConstantExpression, "3 is int x3 ? x3 : 0").WithArguments("X.Test3").WithLocation(4, 13) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").Single(); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").Single(); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").ToArray(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").Single(); + Assert.Equal(2, x5Decl.Length); + VerifyModelForDeclarationPattern(model, x5Decl[0], x5Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x5Decl[1]); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").ToArray(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(2, x6Decl.Length); + Assert.Equal(2, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl[0], x6Ref[0]); + VerifyModelForDeclarationPattern(model, x6Decl[1], x6Ref[1]); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(2, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotInScope(model, x7Ref[1]); + } + + [Fact] + public void ScopeOfPatternVariables_FieldInitializers_04() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + const bool Test3 = 3 is int x3 && x3 > 0; + + const bool Test4 = x4 && 4 is int x4; + + const bool Test5 = 51 is int x5 && + 52 is int x5 && + x5 > 0; + + const bool Test61 = 6 is int x6 && x6 > 0, Test62 = 6 is int x6 && x6 > 0; + + const bool Test71 = 7 is int x7 && x7 > 0; + const bool Test72 = x7 > 2; + void Test73() { Dummy(x7, 3); } + + bool Dummy(params object[] x) {return true;} +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (8,24): error CS0133: The expression being assigned to 'X.Test3' must be constant + // const bool Test3 = 3 is int x3 && x3 > 0; + Diagnostic(ErrorCode.ERR_NotConstantExpression, "3 is int x3 && x3 > 0").WithArguments("X.Test3").WithLocation(8, 24), + // (10,24): error CS0841: Cannot use local variable 'x4' before it is declared + // const bool Test4 = x4 && 4 is int x4; + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(10, 24), + // (13,34): error CS0128: A local variable named 'x5' is already defined in this scope + // 52 is int x5 && + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(13, 34), + // (16,25): error CS0133: The expression being assigned to 'X.Test61' must be constant + // const bool Test61 = 6 is int x6 && x6 > 0, Test62 = 6 is int x6 && x6 > 0; + Diagnostic(ErrorCode.ERR_NotConstantExpression, "6 is int x6 && x6 > 0").WithArguments("X.Test61").WithLocation(16, 25), + // (16,57): error CS0133: The expression being assigned to 'X.Test62' must be constant + // const bool Test61 = 6 is int x6 && x6 > 0, Test62 = 6 is int x6 && x6 > 0; + Diagnostic(ErrorCode.ERR_NotConstantExpression, "6 is int x6 && x6 > 0").WithArguments("X.Test62").WithLocation(16, 57), + // (18,25): error CS0133: The expression being assigned to 'X.Test71' must be constant + // const bool Test71 = 7 is int x7 && x7 > 0; + Diagnostic(ErrorCode.ERR_NotConstantExpression, "7 is int x7 && x7 > 0").WithArguments("X.Test71").WithLocation(18, 25), + // (19,25): error CS0103: The name 'x7' does not exist in the current context + // const bool Test72 = x7 > 2; + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(19, 25), + // (20,27): error CS0103: The name 'x7' does not exist in the current context + // void Test73() { Dummy(x7, 3); } + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(20, 27) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").Single(); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").Single(); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").ToArray(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").Single(); + Assert.Equal(2, x5Decl.Length); + VerifyModelForDeclarationPattern(model, x5Decl[0], x5Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x5Decl[1]); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").ToArray(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(2, x6Decl.Length); + Assert.Equal(2, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl[0], x6Ref[0]); + VerifyModelForDeclarationPattern(model, x6Decl[1], x6Ref[1]); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotInScope(model, x7Ref[1]); + VerifyNotInScope(model, x7Ref[2]); + } + + [Fact] + public void ScopeOfPatternVariables_PropertyInitializers_01() + { + var source = +@" +public class X +{ + public static void Main() + { + System.Console.WriteLine(Test1); + } + + static bool Test1 {get;} = 1 is int x1 && Dummy(x1); + + static bool Dummy(int x) + { + System.Console.WriteLine(x); + return true; + } +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + CompileAndVerify(compilation, expectedOutput: @"1 +True"); + } + + [Fact] + public void ScopeOfPatternVariables_PropertyInitializers_02() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + bool Test3 {get;} = 3 is int x3 && x3 > 0; + + bool Test4 {get;} = x4 && 4 is int x4; + + bool Test5 {get;} = 51 is int x5 && + 52 is int x5 && + x5 > 0; + + bool Test61 {get;} = 6 is int x6 && x6 > 0; bool Test62 {get;} = 6 is int x6 && x6 > 0; + + bool Test71 {get;} = 7 is int x7 && x7 > 0; + bool Test72 {get;} = Dummy(x7, 2); + void Test73() { Dummy(x7, 3); } + + bool Dummy(params object[] x) {return true;} +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (10,25): error CS0841: Cannot use local variable 'x4' before it is declared + // bool Test4 {get;} = x4 && 4 is int x4; + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(10, 25), + // (13,28): error CS0128: A local variable named 'x5' is already defined in this scope + // 52 is int x5 && + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(13, 28), + // (19,32): error CS0103: The name 'x7' does not exist in the current context + // bool Test72 {get;} = Dummy(x7, 2); + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(19, 32), + // (20,27): error CS0103: The name 'x7' does not exist in the current context + // void Test73() { Dummy(x7, 3); } + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(20, 27) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").Single(); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").Single(); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").ToArray(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").Single(); + Assert.Equal(2, x5Decl.Length); + VerifyModelForDeclarationPattern(model, x5Decl[0], x5Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x5Decl[1]); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").ToArray(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(2, x6Decl.Length); + Assert.Equal(2, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl[0], x6Ref[0]); + VerifyModelForDeclarationPattern(model, x6Decl[1], x6Ref[1]); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotInScope(model, x7Ref[1]); + VerifyNotInScope(model, x7Ref[2]); + } + + [Fact] + public void ScopeOfPatternVariables_ParameterDefault_01() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + void Test3(bool p = 3 is int x3 && x3 > 0) + {} + + void Test4(bool p = x4 && 4 is int x4) + {} + + void Test5(bool p = 51 is int x5 && + 52 is int x5 && + x5 > 0) + {} + + void Test61(bool p1 = 6 is int x6 && x6 > 0, bool p2 = 6 is int x6 && x6 > 0) + {} + + void Test71(bool p = 7 is int x7 && x7 > 0) + { + } + + void Test72(bool p = x7 > 2) + {} + + void Test73() { Dummy(x7, 3); } + + bool Dummy(params object[] x) {return true;} +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (8,25): error CS1736: Default parameter value for 'p' must be a compile-time constant + // void Test3(bool p = 3 is int x3 && x3 > 0) + Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "3 is int x3 && x3 > 0").WithArguments("p").WithLocation(8, 25), + // (11,25): error CS0841: Cannot use local variable 'x4' before it is declared + // void Test4(bool p = x4 && 4 is int x4) + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(11, 25), + // (11,21): error CS1750: A value of type '?' cannot be used as a default parameter because there are no standard conversions to type 'bool' + // void Test4(bool p = x4 && 4 is int x4) + Diagnostic(ErrorCode.ERR_NoConversionForDefaultParam, "p").WithArguments("?", "bool").WithLocation(11, 21), + // (15,35): error CS0128: A local variable named 'x5' is already defined in this scope + // 52 is int x5 && + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(15, 35), + // (14,21): error CS1750: A value of type '?' cannot be used as a default parameter because there are no standard conversions to type 'bool' + // void Test5(bool p = 51 is int x5 && + Diagnostic(ErrorCode.ERR_NoConversionForDefaultParam, "p").WithArguments("?", "bool").WithLocation(14, 21), + // (19,27): error CS1736: Default parameter value for 'p1' must be a compile-time constant + // void Test61(bool p1 = 6 is int x6 && x6 > 0, bool p2 = 6 is int x6 && x6 > 0) + Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "6 is int x6 && x6 > 0").WithArguments("p1").WithLocation(19, 27), + // (19,60): error CS1736: Default parameter value for 'p2' must be a compile-time constant + // void Test61(bool p1 = 6 is int x6 && x6 > 0, bool p2 = 6 is int x6 && x6 > 0) + Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "6 is int x6 && x6 > 0").WithArguments("p2").WithLocation(19, 60), + // (22,26): error CS1736: Default parameter value for 'p' must be a compile-time constant + // void Test71(bool p = 7 is int x7 && x7 > 0) + Diagnostic(ErrorCode.ERR_DefaultValueMustBeConstant, "7 is int x7 && x7 > 0").WithArguments("p").WithLocation(22, 26), + // (26,26): error CS0103: The name 'x7' does not exist in the current context + // void Test72(bool p = x7 > 2) + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(26, 26), + // (29,27): error CS0103: The name 'x7' does not exist in the current context + // void Test73() { Dummy(x7, 3); } + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(29, 27) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").Single(); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").Single(); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").ToArray(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").Single(); + Assert.Equal(2, x5Decl.Length); + VerifyModelForDeclarationPattern(model, x5Decl[0], x5Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x5Decl[1]); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").ToArray(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(2, x6Decl.Length); + Assert.Equal(2, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl[0], x6Ref[0]); + VerifyModelForDeclarationPattern(model, x6Decl[1], x6Ref[1]); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotInScope(model, x7Ref[1]); + VerifyNotInScope(model, x7Ref[2]); + } + + [Fact] + public void ScopeOfPatternVariables_Attribute_01() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + [Test(p = 3 is int x3 && x3 > 0)] + [Test(p = x4 && 4 is int x4)] + [Test(p = 51 is int x5 && + 52 is int x5 && + x5 > 0)] + [Test(p1 = 6 is int x6 && x6 > 0, p2 = 6 is int x6 && x6 > 0)] + [Test(p = 7 is int x7 && x7 > 0)] + [Test(p = x7 > 2)] + void Test73() { Dummy(x7, 3); } + + bool Dummy(params object[] x) {return true;} +} + +class Test : System.Attribute +{ + public bool p {get; set;} + public bool p1 {get; set;} + public bool p2 {get; set;} +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (8,15): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type + // [Test(p = 3 is int x3 && x3 > 0)] + Diagnostic(ErrorCode.ERR_BadAttributeArgument, "3 is int x3 && x3 > 0").WithLocation(8, 15), + // (9,15): error CS0841: Cannot use local variable 'x4' before it is declared + // [Test(p = x4 && 4 is int x4)] + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(9, 15), + // (11,25): error CS0128: A local variable named 'x5' is already defined in this scope + // 52 is int x5 && + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(11, 25), + // (13,53): error CS0128: A local variable named 'x6' is already defined in this scope + // [Test(p1 = 6 is int x6 && x6 > 0, p2 = 6 is int x6 && x6 > 0)] + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x6").WithArguments("x6").WithLocation(13, 53), + // (13,16): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type + // [Test(p1 = 6 is int x6 && x6 > 0, p2 = 6 is int x6 && x6 > 0)] + Diagnostic(ErrorCode.ERR_BadAttributeArgument, "6 is int x6 && x6 > 0").WithLocation(13, 16), + // (14,15): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type + // [Test(p = 7 is int x7 && x7 > 0)] + Diagnostic(ErrorCode.ERR_BadAttributeArgument, "7 is int x7 && x7 > 0").WithLocation(14, 15), + // (15,15): error CS0103: The name 'x7' does not exist in the current context + // [Test(p = x7 > 2)] + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(15, 15), + // (16,27): error CS0103: The name 'x7' does not exist in the current context + // void Test73() { Dummy(x7, 3); } + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(16, 27) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").Single(); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").Single(); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").ToArray(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").Single(); + Assert.Equal(2, x5Decl.Length); + VerifyModelForDeclarationPattern(model, x5Decl[0], x5Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x5Decl[1]); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").ToArray(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(2, x6Decl.Length); + Assert.Equal(2, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl[0], x6Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x6Decl[1]); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotInScope(model, x7Ref[1]); + VerifyNotInScope(model, x7Ref[2]); + } + + [Fact] + public void ScopeOfPatternVariables_Attribute_02() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + [Test(3 is int x3 && x3 > 0)] + [Test(x4 && 4 is int x4)] + [Test(51 is int x5 && + 52 is int x5 && + x5 > 0)] + [Test(6 is int x6 && x6 > 0, 6 is int x6 && x6 > 0)] + [Test(7 is int x7 && x7 > 0)] + [Test(x7 > 2)] + void Test73() { Dummy(x7, 3); } + + bool Dummy(params object[] x) {return true;} +} + +class Test : System.Attribute +{ + public Test(bool p) {} + public Test(bool p1, bool p2) {} +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (8,11): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type + // [Test(3 is int x3 && x3 > 0)] + Diagnostic(ErrorCode.ERR_BadAttributeArgument, "3 is int x3 && x3 > 0").WithLocation(8, 11), + // (9,11): error CS0841: Cannot use local variable 'x4' before it is declared + // [Test(x4 && 4 is int x4)] + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(9, 11), + // (11,21): error CS0128: A local variable named 'x5' is already defined in this scope + // 52 is int x5 && + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(11, 21), + // (13,43): error CS0128: A local variable named 'x6' is already defined in this scope + // [Test(6 is int x6 && x6 > 0, 6 is int x6 && x6 > 0)] + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x6").WithArguments("x6").WithLocation(13, 43), + // (14,11): error CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type + // [Test(7 is int x7 && x7 > 0)] + Diagnostic(ErrorCode.ERR_BadAttributeArgument, "7 is int x7 && x7 > 0").WithLocation(14, 11), + // (15,11): error CS0103: The name 'x7' does not exist in the current context + // [Test(x7 > 2)] + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(15, 11), + // (16,27): error CS0103: The name 'x7' does not exist in the current context + // void Test73() { Dummy(x7, 3); } + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(16, 27) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").Single(); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").Single(); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").ToArray(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").Single(); + Assert.Equal(2, x5Decl.Length); + VerifyModelForDeclarationPattern(model, x5Decl[0], x5Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x5Decl[1]); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").ToArray(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(2, x6Decl.Length); + Assert.Equal(2, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl[0], x6Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x6Decl[1]); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotInScope(model, x7Ref[1]); + VerifyNotInScope(model, x7Ref[2]); + } + + [Fact] + public void ScopeOfPatternVariables_ConstructorInitializers_01() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + X(byte x) + : this(3 is int x3 && x3 > 0) + {} + + X(sbyte x) + : this(x4 && 4 is int x4) + {} + + X(short x) + : this(51 is int x5 && + 52 is int x5 && + x5 > 0) + {} + + X(ushort x) + : this(6 is int x6 && x6 > 0, 6 is int x6 && x6 > 0) + {} + + X(int x) + : this(7 is int x7 && x7 > 0) + {} + X(uint x) + : this(x7, 2) + {} + void Test73() { Dummy(x7, 3); } + + X(params object[] x) {} + bool Dummy(params object[] x) {return true;} +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (13,16): error CS0841: Cannot use local variable 'x4' before it is declared + // : this(x4 && 4 is int x4) + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(13, 16), + // (18,26): error CS0128: A local variable named 'x5' is already defined in this scope + // 52 is int x5 && + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(18, 26), + // (23,48): error CS0128: A local variable named 'x6' is already defined in this scope + // : this(6 is int x6 && x6 > 0, 6 is int x6 && x6 > 0) + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x6").WithArguments("x6").WithLocation(23, 48), + // (30,16): error CS0103: The name 'x7' does not exist in the current context + // : this(x7, 2) + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(30, 16), + // (32,27): error CS0103: The name 'x7' does not exist in the current context + // void Test73() { Dummy(x7, 3); } + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(32, 27) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").Single(); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").Single(); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").ToArray(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").Single(); + Assert.Equal(2, x5Decl.Length); + VerifyModelForDeclarationPattern(model, x5Decl[0], x5Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x5Decl[1]); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").ToArray(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(2, x6Decl.Length); + Assert.Equal(2, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl[0], x6Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x6Decl[1]); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotInScope(model, x7Ref[1]); + VerifyNotInScope(model, x7Ref[2]); + } + + [Fact] + public void ScopeOfPatternVariables_ConstructorInitializers_02() + { + var source = +@" +public class X : Y +{ + public static void Main() + { + } + + X(byte x) + : base(3 is int x3 && x3 > 0) + {} + + X(sbyte x) + : base(x4 && 4 is int x4) + {} + + X(short x) + : base(51 is int x5 && + 52 is int x5 && + x5 > 0) + {} + + X(ushort x) + : base(6 is int x6 && x6 > 0, 6 is int x6 && x6 > 0) + {} + + X(int x) + : base(7 is int x7 && x7 > 0) + {} + X(uint x) + : base(x7, 2) + {} + void Test73() { Dummy(x7, 3); } + + bool Dummy(params object[] x) {return true;} +} + +public class Y +{ + public Y(params object[] x) {} +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (13,16): error CS0841: Cannot use local variable 'x4' before it is declared + // : base(x4 && 4 is int x4) + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x4").WithArguments("x4").WithLocation(13, 16), + // (18,26): error CS0128: A local variable named 'x5' is already defined in this scope + // 52 is int x5 && + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x5").WithArguments("x5").WithLocation(18, 26), + // (23,48): error CS0128: A local variable named 'x6' is already defined in this scope + // : base(6 is int x6 && x6 > 0, 6 is int x6 && x6 > 0) + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x6").WithArguments("x6").WithLocation(23, 48), + // (30,16): error CS0103: The name 'x7' does not exist in the current context + // : base(x7, 2) + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(30, 16), + // (32,27): error CS0103: The name 'x7' does not exist in the current context + // void Test73() { Dummy(x7, 3); } + Diagnostic(ErrorCode.ERR_NameNotInContext, "x7").WithArguments("x7").WithLocation(32, 27) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").Single(); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").Single(); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").ToArray(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").Single(); + Assert.Equal(2, x5Decl.Length); + VerifyModelForDeclarationPattern(model, x5Decl[0], x5Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x5Decl[1]); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").ToArray(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(2, x6Decl.Length); + Assert.Equal(2, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl[0], x6Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x6Decl[1]); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotInScope(model, x7Ref[1]); + VerifyNotInScope(model, x7Ref[2]); + } + + [Fact] + public void ScopeOfPatternVariables_ConstructorInitializers_03() + { + var source = +@"using System; +public class X +{ + public static void Main() + { + new D(1); + new D(10); + new D(1.2); + } +} +class D +{ + public D(object o) : this(o is int x && x >= 5) + { + Console.WriteLine(x); + } + + public D(bool b) { Console.WriteLine(b); } +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (15,27): error CS0103: The name 'x' does not exist in the current context + // Console.WriteLine(x); + Diagnostic(ErrorCode.ERR_NameNotInContext, "x").WithArguments("x").WithLocation(15, 27) + ); + } + + [Fact] + public void ScopeOfPatternVariables_ConstructorInitializers_04() + { + var source = +@"using System; +public class X +{ + public static void Main() + { + new D(1); + new D(10); + new D(1.2); + } +} +class D : C +{ + public D(object o) : base(o is int x && x >= 5) + { + Console.WriteLine(x); + } +} + +class C +{ + public C(bool b) { Console.WriteLine(b); } +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (15,27): error CS0103: The name 'x' does not exist in the current context + // Console.WriteLine(x); + Diagnostic(ErrorCode.ERR_NameNotInContext, "x").WithArguments("x").WithLocation(15, 27) + ); + } + + [Fact] + public void ScopeOfPatternVariables_SwitchLabelGuard_01() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + bool Dummy(params object[] x) { return true; } + + void Test1(int val) + { + switch (val) + { + case 0 when Dummy(true is var x1, x1): + Dummy(x1); + break; + case 1 when Dummy(true is var x1, x1): + Dummy(x1); + break; + case 2 when Dummy(true is var x1, x1): + Dummy(x1); + break; + } + } + + void Test2(int val) + { + switch (val) + { + case 0 when Dummy(x2, true is var x2): + Dummy(x2); + break; + } + } + + void Test3(int x3, int val) + { + switch (val) + { + case 0 when Dummy(true is var x3, x3): + Dummy(x3); + break; + } + } + + void Test4(int val) + { + var x4 = 11; + switch (val) + { + case 0 when Dummy(true is var x4, x4): + Dummy(x4); + break; + case 1 when Dummy(x4): Dummy(x4); break; + } + } + + void Test5(int val) + { + switch (val) + { + case 0 when Dummy(true is var x5, x5): + Dummy(x5); + break; + } + + var x5 = 11; + Dummy(x5); + } + + void Test6(int val) + { + let x6 = 11; + switch (val) + { + case 0 when Dummy(x6): + Dummy(x6); + break; + case 1 when Dummy(true is var x6, x6): + Dummy(x6); + break; + } + } + + void Test7(int val) + { + switch (val) + { + case 0 when Dummy(true is var x7, x7): + Dummy(x7); + break; + } + + let x7 = 11; + Dummy(x7); + } + + void Test8(int val) + { + switch (val) + { + case 0 when Dummy(true is var x8, x8, false is var x8, x8): + Dummy(x8); + break; + } + } + + void Test9(int val) + { + switch (val) + { + case 0 when Dummy(x9): + int x9 = 9; + Dummy(x9); + break; + case 2 when Dummy(x9 = 9): + Dummy(x9); + break; + case 1 when Dummy(true is var x9, x9): + Dummy(x9); + break; + } + } + + void Test10(int val) + { + switch (val) + { + case 1 when Dummy(true is var x10, x10): + Dummy(x10); + break; + case 0 when Dummy(x10): + let x10 = 10; + Dummy(x10); + break; + case 2 when Dummy(x10 = 10, x10): + Dummy(x10); + break; + } + } + + void Test11(int val) + { + switch (x11 ? val : 0) + { + case 0 when Dummy(x11): + Dummy(x11, 0); + break; + case 1 when Dummy(true is var x11, x11): + Dummy(x11, 1); + break; + } + } + + void Test12(int val) + { + switch (x12 ? val : 0) + { + case 0 when Dummy(true is var x12, x12): + Dummy(x12, 0); + break; + case 1 when Dummy(x12): + Dummy(x12, 1); + break; + } + } + + void Test13() + { + switch (1 is var x13 ? x13 : 0) + { + case 0 when Dummy(x13): + Dummy(x13); + break; + case 1 when Dummy(true is var x13, x13): + Dummy(x13); + break; + } + } + + void Test14(int val) + { + switch (val) + { + case 1 when Dummy(true is var x14, x14): + Dummy(x14); + Dummy(true is var x14, x14); + Dummy(x14); + break; + } + } + + void Test15(int val) + { + switch (val) + { + case 0 when Dummy(true is var x15, x15): + case 1 when Dummy(true is var x15, x15): + Dummy(x15); + break; + } + } +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + + compilation.VerifyDiagnostics( + // (30,31): error CS0841: Cannot use local variable 'x2' before it is declared + // case 0 when Dummy(x2, true is var x2): + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x2").WithArguments("x2").WithLocation(30, 31), + // (40,43): error CS0136: A local or parameter named 'x3' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case 0 when Dummy(true is var x3, x3): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x3").WithArguments("x3").WithLocation(40, 43), + // (51,43): error CS0136: A local or parameter named 'x4' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case 0 when Dummy(true is var x4, x4): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x4").WithArguments("x4").WithLocation(51, 43), + // (62,43): error CS0136: A local or parameter named 'x5' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case 0 when Dummy(true is var x5, x5): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x5").WithArguments("x5").WithLocation(62, 43), + // (79,43): error CS0136: A local or parameter named 'x6' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case 1 when Dummy(true is var x6, x6): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x6").WithArguments("x6").WithLocation(79, 43), + // (89,43): error CS0136: A local or parameter named 'x7' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case 0 when Dummy(true is var x7, x7): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x7").WithArguments("x7").WithLocation(89, 43), + // (102,64): error CS0128: A local variable named 'x8' is already defined in this scope + // case 0 when Dummy(true is var x8, x8, false is var x8, x8): + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x8").WithArguments("x8").WithLocation(102, 64), + // (112,31): error CS0841: Cannot use local variable 'x9' before it is declared + // case 0 when Dummy(x9): + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x9").WithArguments("x9").WithLocation(112, 31), + // (119,43): error CS0136: A local or parameter named 'x9' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case 1 when Dummy(true is var x9, x9): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x9").WithArguments("x9").WithLocation(119, 43), + // (129,43): error CS0136: A local or parameter named 'x10' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case 1 when Dummy(true is var x10, x10): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x10").WithArguments("x10").WithLocation(129, 43), + // (132,31): error CS0841: Cannot use local variable 'x10' before it is declared + // case 0 when Dummy(x10): + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x10").WithArguments("x10").WithLocation(132, 31), + // (136,31): error CS0131: The left-hand side of an assignment must be a variable, property or indexer + // case 2 when Dummy(x10 = 10): + Diagnostic(ErrorCode.ERR_AssgLvalueExpected, "x10").WithLocation(136, 31), + // (144,17): error CS0103: The name 'x11' does not exist in the current context + // switch (x11 ? val : 0) + Diagnostic(ErrorCode.ERR_NameNotInContext, "x11").WithArguments("x11").WithLocation(144, 17), + // (146,31): error CS0103: The name 'x11' does not exist in the current context + // case 0 when Dummy(x11): + Diagnostic(ErrorCode.ERR_NameNotInContext, "x11").WithArguments("x11").WithLocation(146, 31), + // (147,23): error CS0103: The name 'x11' does not exist in the current context + // Dummy(x11, 0); + Diagnostic(ErrorCode.ERR_NameNotInContext, "x11").WithArguments("x11").WithLocation(147, 23), + // (157,17): error CS0103: The name 'x12' does not exist in the current context + // switch (x12 ? val : 0) + Diagnostic(ErrorCode.ERR_NameNotInContext, "x12").WithArguments("x12").WithLocation(157, 17), + // (162,31): error CS0103: The name 'x12' does not exist in the current context + // case 1 when Dummy(x12): + Diagnostic(ErrorCode.ERR_NameNotInContext, "x12").WithArguments("x12").WithLocation(162, 31), + // (163,23): error CS0103: The name 'x12' does not exist in the current context + // Dummy(x12, 1); + Diagnostic(ErrorCode.ERR_NameNotInContext, "x12").WithArguments("x12").WithLocation(163, 23), + // (175,43): error CS0136: A local or parameter named 'x13' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case 1 when Dummy(true is var x13, x13): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x13").WithArguments("x13").WithLocation(175, 43), + // (187,35): error CS0136: A local or parameter named 'x14' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // Dummy(true is var x14, x14); + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x14").WithArguments("x14").WithLocation(187, 35), + // (198,43): error CS0128: A local variable named 'x15' is already defined in this scope + // case 1 when Dummy(true is var x15, x15): + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x15").WithArguments("x15").WithLocation(198, 43), + // (198,48): error CS0165: Use of unassigned local variable 'x15' + // case 1 when Dummy(true is var x15, x15): + Diagnostic(ErrorCode.ERR_UseDefViolation, "x15").WithArguments("x15").WithLocation(198, 48) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x1Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x1").ToArray(); + var x1Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x1").ToArray(); + Assert.Equal(3, x1Decl.Length); + Assert.Equal(6, x1Ref.Length); + for (int i = 0; i < x1Decl.Length; i++) + { + VerifyModelForDeclarationPattern(model, x1Decl[i], x1Ref[i*2], x1Ref[i * 2 + 1]); + } + + var x2Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x2").Single(); + var x2Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x2").ToArray(); + Assert.Equal(2, x2Ref.Length); + VerifyModelForDeclarationPattern(model, x2Decl, x2Ref); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").ToArray(); + Assert.Equal(2, x3Ref.Length); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").ToArray(); + Assert.Equal(4, x4Ref.Length); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref[0], x4Ref[1]); + VerifyNotAPatternLocal(model, x4Ref[2]); + VerifyNotAPatternLocal(model, x4Ref[3]); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").Single(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").ToArray(); + Assert.Equal(3, x5Ref.Length); + VerifyModelForDeclarationPattern(model, x5Decl, x5Ref[0], x5Ref[1]); + VerifyNotAPatternLocal(model, x5Ref[2]); + + var x6Decl_1 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").Single(); + var x6Decl_2 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").Single(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(4, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl_1, x6Ref[0], x6Ref[1]); + VerifyModelForDeclarationPattern(model, x6Decl_2, x6Ref[2], x6Ref[3]); + + var x7Decl_1 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Decl_2 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl_1, x7Ref[0], x7Ref[1]); + VerifyModelForDeclarationPattern(model, x7Decl_2, x7Ref[2]); + + var x8Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x8").ToArray(); + var x8Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x8").ToArray(); + Assert.Equal(2, x8Decl.Length); + Assert.Equal(3, x8Ref.Length); + for (int i = 0; i < x8Ref.Length; i++) + { + VerifyModelForDeclarationPattern(model, x8Decl[0], x8Ref[i]); + } + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x8Decl[1]); + + var x9Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x9").Single(); + var x9Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x9").ToArray(); + Assert.Equal(6, x9Ref.Length); + VerifyNotAPatternLocal(model, x9Ref[0]); + VerifyNotAPatternLocal(model, x9Ref[1]); + VerifyNotAPatternLocal(model, x9Ref[2]); + VerifyNotAPatternLocal(model, x9Ref[3]); + VerifyModelForDeclarationPattern(model, x9Decl, x9Ref[4], x9Ref[5]); + + var x10Decl_1 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x10").Single(); + var x10Decl_2 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x10").Single(); + var x10Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x10").ToArray(); + Assert.Equal(7, x10Ref.Length); + VerifyModelForDeclarationPattern(model, x10Decl_1, x10Ref[0], x10Ref[1]); + VerifyModelForDeclarationPattern(model, x10Decl_2, x10Ref[2], x10Ref[3], x10Ref[4], x10Ref[5], x10Ref[6]); + + var x11Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x11").Single(); + var x11Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x11").ToArray(); + Assert.Equal(5, x11Ref.Length); + VerifyNotInScope(model, x11Ref[0]); + VerifyNotInScope(model, x11Ref[1]); + VerifyNotInScope(model, x11Ref[2]); + VerifyModelForDeclarationPattern(model, x11Decl, x11Ref[3], x11Ref[4]); + + var x12Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x12").Single(); + var x12Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x12").ToArray(); + Assert.Equal(5, x12Ref.Length); + VerifyNotInScope(model, x12Ref[0]); + VerifyModelForDeclarationPattern(model, x12Decl, x12Ref[1], x12Ref[2]); + VerifyNotInScope(model, x12Ref[3]); + VerifyNotInScope(model, x12Ref[4]); + + var x13Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x13").ToArray(); + var x13Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x13").ToArray(); + Assert.Equal(2, x13Decl.Length); + Assert.Equal(5, x13Ref.Length); + VerifyModelForDeclarationPattern(model, x13Decl[0], x13Ref[0], x13Ref[1], x13Ref[2]); + VerifyModelForDeclarationPattern(model, x13Decl[1], x13Ref[3], x13Ref[4]); + + var x14Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x14").ToArray(); + var x14Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x14").ToArray(); + Assert.Equal(2, x14Decl.Length); + Assert.Equal(4, x14Ref.Length); + VerifyModelForDeclarationPattern(model, x14Decl[0], x14Ref[0], x14Ref[1], x14Ref[3]); + VerifyModelForDeclarationPattern(model, x14Decl[1], x14Ref[2]); + + var x15Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x15").ToArray(); + var x15Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x15").ToArray(); + Assert.Equal(2, x15Decl.Length); + Assert.Equal(3, x15Ref.Length); + for (int i = 0; i < x15Ref.Length; i++) + { + VerifyModelForDeclarationPattern(model, x15Decl[0], x15Ref[i]); + } + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x15Decl[1]); + } + + [Fact] + public void ScopeOfPatternVariables_SwitchLabelPattern_01() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + bool Dummy(params object[] x) { return true; } + + void Test1(object val) + { + switch (val) + { + case byte x1 when Dummy(x1): + Dummy(x1); + break; + case int x1 when Dummy(x1): + Dummy(x1); + break; + case long x1 when Dummy(x1): + Dummy(x1); + break; + } + } + + void Test2(object val) + { + switch (val) + { + case 0 when Dummy(x2): + case int x2: + Dummy(x2); + break; + } + } + + void Test3(int x3, object val) + { + switch (val) + { + case int x3 when Dummy(x3): + Dummy(x3); + break; + } + } + + void Test4(object val) + { + var x4 = 11; + switch (val) + { + case int x4 when Dummy(x4): + Dummy(x4); + break; + case 1 when Dummy(x4): + Dummy(x4); + break; + } + } + + void Test5(object val) + { + switch (val) + { + case int x5 when Dummy(x5): + Dummy(x5); + break; + } + + var x5 = 11; + Dummy(x5); + } + + void Test6(object val) + { + let x6 = 11; + switch (val) + { + case 0 when Dummy(x6): + Dummy(x6); + break; + case int x6 when Dummy(x6): + Dummy(x6); + break; + } + } + + void Test7(object val) + { + switch (val) + { + case int x7 when Dummy(x7): + Dummy(x7); + break; + } + + let x7 = 11; + Dummy(x7); + } + + void Test8(object val) + { + switch (val) + { + case int x8 + when Dummy(x8, false is var x8, x8): + Dummy(x8); + break; + } + } + + void Test9(object val) + { + switch (val) + { + case 0 when Dummy(x9): + int x9 = 9; + Dummy(x9); + break; + case 2 when Dummy(x9 = 9): + Dummy(x9); + break; + case int x9 when Dummy(x9): + Dummy(x9); + break; + } + } + + void Test10(object val) + { + switch (val) + { + case int x10 when Dummy(x10): + Dummy(x10); + break; + case 0 when Dummy(x10): + let x10 = 10; + Dummy(x10); + break; + case 2 when Dummy(x10 = 10, x10): + Dummy(x10); + break; + } + } + + void Test11(object val) + { + switch (x11 ? val : 0) + { + case 0 when Dummy(x11): + Dummy(x11, 0); + break; + case int x11 when Dummy(x11): + Dummy(x11, 1); + break; + } + } + + void Test12(object val) + { + switch (x12 ? val : 0) + { + case int x12 when Dummy(x12): + Dummy(x12, 0); + break; + case 1 when Dummy(x12): + Dummy(x12, 1); + break; + } + } + + void Test13() + { + switch (1 is var x13 ? x13 : 0) + { + case 0 when Dummy(x13): + Dummy(x13); + break; + case int x13 when Dummy(x13): + Dummy(x13); + break; + } + } + + void Test14(object val) + { + switch (val) + { + case int x14 when Dummy(x14): + Dummy(x14); + Dummy(true is var x14, x14); + Dummy(x14); + break; + } + } + + void Test15(object val) + { + switch (val) + { + case int x15 when Dummy(x15): + case long x15 when Dummy(x15): + Dummy(x15); + break; + } + } + + void Test16(object val) + { + switch (val) + { + case int x16 when Dummy(x16): + case 1 when Dummy(true is var x16, x16): + Dummy(x16); + break; + } + } + + void Test17(object val) + { + switch (val) + { + case 0 when Dummy(true is var x17, x17): + case int x17 when Dummy(x17): + Dummy(x17); + break; + } + } +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + + compilation.VerifyDiagnostics( + // (30,31): error CS0841: Cannot use local variable 'x2' before it is declared + // case 0 when Dummy(x2): + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x2").WithArguments("x2").WithLocation(30, 31), + // (41,22): error CS0136: A local or parameter named 'x3' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case int x3 when Dummy(x3): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x3").WithArguments("x3").WithLocation(41, 22), + // (52,22): error CS0136: A local or parameter named 'x4' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case int x4 when Dummy(x4): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x4").WithArguments("x4").WithLocation(52, 22), + // (65,22): error CS0136: A local or parameter named 'x5' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case int x5 when Dummy(x5): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x5").WithArguments("x5").WithLocation(65, 22), + // (82,22): error CS0136: A local or parameter named 'x6' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case int x6 when Dummy(x6): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x6").WithArguments("x6").WithLocation(82, 22), + // (92,22): error CS0136: A local or parameter named 'x7' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case int x7 when Dummy(x7): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x7").WithArguments("x7").WithLocation(92, 22), + // (106,49): error CS0128: A local variable named 'x8' is already defined in this scope + // when Dummy(x8, false is var x8, x8): + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x8").WithArguments("x8").WithLocation(106, 49), + // (116,31): error CS0841: Cannot use local variable 'x9' before it is declared + // case 0 when Dummy(x9): + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x9").WithArguments("x9").WithLocation(116, 31), + // (123,22): error CS0136: A local or parameter named 'x9' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case int x9 when Dummy(x9): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x9").WithArguments("x9").WithLocation(123, 22), + // (133,22): error CS0136: A local or parameter named 'x10' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case int x10 when Dummy(x10): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x10").WithArguments("x10").WithLocation(133, 22), + // (136,31): error CS0841: Cannot use local variable 'x10' before it is declared + // case 0 when Dummy(x10): + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x10").WithArguments("x10").WithLocation(136, 31), + // (140,31): error CS0131: The left-hand side of an assignment must be a variable, property or indexer + // case 2 when Dummy(x10 = 10, x10): + Diagnostic(ErrorCode.ERR_AssgLvalueExpected, "x10").WithLocation(140, 31), + // (148,17): error CS0103: The name 'x11' does not exist in the current context + // switch (x11 ? val : 0) + Diagnostic(ErrorCode.ERR_NameNotInContext, "x11").WithArguments("x11").WithLocation(148, 17), + // (150,31): error CS0103: The name 'x11' does not exist in the current context + // case 0 when Dummy(x11): + Diagnostic(ErrorCode.ERR_NameNotInContext, "x11").WithArguments("x11").WithLocation(150, 31), + // (151,23): error CS0103: The name 'x11' does not exist in the current context + // Dummy(x11, 0); + Diagnostic(ErrorCode.ERR_NameNotInContext, "x11").WithArguments("x11").WithLocation(151, 23), + // (161,17): error CS0103: The name 'x12' does not exist in the current context + // switch (x12 ? val : 0) + Diagnostic(ErrorCode.ERR_NameNotInContext, "x12").WithArguments("x12").WithLocation(161, 17), + // (166,31): error CS0103: The name 'x12' does not exist in the current context + // case 1 when Dummy(x12): + Diagnostic(ErrorCode.ERR_NameNotInContext, "x12").WithArguments("x12").WithLocation(166, 31), + // (167,23): error CS0103: The name 'x12' does not exist in the current context + // Dummy(x12, 1); + Diagnostic(ErrorCode.ERR_NameNotInContext, "x12").WithArguments("x12").WithLocation(167, 23), + // (179,22): error CS0136: A local or parameter named 'x13' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // case int x13 when Dummy(x13): + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x13").WithArguments("x13").WithLocation(179, 22), + // (191,35): error CS0136: A local or parameter named 'x14' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // Dummy(true is var x14, x14); + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x14").WithArguments("x14").WithLocation(191, 35), + // (202,23): error CS0128: A local variable named 'x15' is already defined in this scope + // case long x15 when Dummy(x15): + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x15").WithArguments("x15").WithLocation(202, 23), + // (202,38): error CS0165: Use of unassigned local variable 'x15' + // case long x15 when Dummy(x15): + Diagnostic(ErrorCode.ERR_UseDefViolation, "x15").WithArguments("x15").WithLocation(202, 38), + // (213,43): error CS0128: A local variable named 'x16' is already defined in this scope + // case 1 when Dummy(true is var x16, x16): + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x16").WithArguments("x16").WithLocation(213, 43), + // (213,48): error CS0165: Use of unassigned local variable 'x16' + // case 1 when Dummy(true is var x16, x16): + Diagnostic(ErrorCode.ERR_UseDefViolation, "x16").WithArguments("x16").WithLocation(213, 48), + // (224,22): error CS0128: A local variable named 'x17' is already defined in this scope + // case int x17 when Dummy(x17): + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x17").WithArguments("x17").WithLocation(224, 22), + // (224,37): error CS0165: Use of unassigned local variable 'x17' + // case int x17 when Dummy(x17): + Diagnostic(ErrorCode.ERR_UseDefViolation, "x17").WithArguments("x17").WithLocation(224, 37) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x1Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x1").ToArray(); + var x1Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x1").ToArray(); + Assert.Equal(3, x1Decl.Length); + Assert.Equal(6, x1Ref.Length); + for (int i = 0; i < x1Decl.Length; i++) + { + VerifyModelForDeclarationPattern(model, x1Decl[i], x1Ref[i * 2], x1Ref[i * 2 + 1]); + } + + var x2Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x2").Single(); + var x2Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x2").ToArray(); + Assert.Equal(2, x2Ref.Length); + VerifyModelForDeclarationPattern(model, x2Decl, x2Ref); + + var x3Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x3").Single(); + var x3Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x3").ToArray(); + Assert.Equal(2, x3Ref.Length); + VerifyModelForDeclarationPattern(model, x3Decl, x3Ref); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").ToArray(); + Assert.Equal(4, x4Ref.Length); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref[0], x4Ref[1]); + VerifyNotAPatternLocal(model, x4Ref[2]); + VerifyNotAPatternLocal(model, x4Ref[3]); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").Single(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").ToArray(); + Assert.Equal(3, x5Ref.Length); + VerifyModelForDeclarationPattern(model, x5Decl, x5Ref[0], x5Ref[1]); + VerifyNotAPatternLocal(model, x5Ref[2]); + + var x6Decl_1 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").Single(); + var x6Decl_2 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").Single(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(4, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl_1, x6Ref[0], x6Ref[1]); + VerifyModelForDeclarationPattern(model, x6Decl_2, x6Ref[2], x6Ref[3]); + + var x7Decl_1 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Decl_2 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(3, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl_1, x7Ref[0], x7Ref[1]); + VerifyModelForDeclarationPattern(model, x7Decl_2, x7Ref[2]); + + var x8Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x8").ToArray(); + var x8Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x8").ToArray(); + Assert.Equal(2, x8Decl.Length); + Assert.Equal(3, x8Ref.Length); + for (int i = 0; i < x8Ref.Length; i++) + { + VerifyModelForDeclarationPattern(model, x8Decl[0], x8Ref[i]); + } + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x8Decl[1]); + + var x9Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x9").Single(); + var x9Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x9").ToArray(); + Assert.Equal(6, x9Ref.Length); + VerifyNotAPatternLocal(model, x9Ref[0]); + VerifyNotAPatternLocal(model, x9Ref[1]); + VerifyNotAPatternLocal(model, x9Ref[2]); + VerifyNotAPatternLocal(model, x9Ref[3]); + VerifyModelForDeclarationPattern(model, x9Decl, x9Ref[4], x9Ref[5]); + + var x10Decl_1 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x10").Single(); + var x10Decl_2 = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x10").Single(); + var x10Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x10").ToArray(); + Assert.Equal(7, x10Ref.Length); + VerifyModelForDeclarationPattern(model, x10Decl_1, x10Ref[0], x10Ref[1]); + VerifyModelForDeclarationPattern(model, x10Decl_2, x10Ref[2], x10Ref[3], x10Ref[4], x10Ref[5], x10Ref[6]); + + var x11Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x11").Single(); + var x11Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x11").ToArray(); + Assert.Equal(5, x11Ref.Length); + VerifyNotInScope(model, x11Ref[0]); + VerifyNotInScope(model, x11Ref[1]); + VerifyNotInScope(model, x11Ref[2]); + VerifyModelForDeclarationPattern(model, x11Decl, x11Ref[3], x11Ref[4]); + + var x12Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x12").Single(); + var x12Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x12").ToArray(); + Assert.Equal(5, x12Ref.Length); + VerifyNotInScope(model, x12Ref[0]); + VerifyModelForDeclarationPattern(model, x12Decl, x12Ref[1], x12Ref[2]); + VerifyNotInScope(model, x12Ref[3]); + VerifyNotInScope(model, x12Ref[4]); + + var x13Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x13").ToArray(); + var x13Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x13").ToArray(); + Assert.Equal(2, x13Decl.Length); + Assert.Equal(5, x13Ref.Length); + VerifyModelForDeclarationPattern(model, x13Decl[0], x13Ref[0], x13Ref[1], x13Ref[2]); + VerifyModelForDeclarationPattern(model, x13Decl[1], x13Ref[3], x13Ref[4]); + + var x14Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x14").ToArray(); + var x14Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x14").ToArray(); + Assert.Equal(2, x14Decl.Length); + Assert.Equal(4, x14Ref.Length); + VerifyModelForDeclarationPattern(model, x14Decl[0], x14Ref[0], x14Ref[1], x14Ref[3]); + VerifyModelForDeclarationPattern(model, x14Decl[1], x14Ref[2]); + + var x15Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x15").ToArray(); + var x15Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x15").ToArray(); + Assert.Equal(2, x15Decl.Length); + Assert.Equal(3, x15Ref.Length); + for (int i = 0; i < x15Ref.Length; i++) + { + VerifyModelForDeclarationPattern(model, x15Decl[0], x15Ref[i]); + } + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x15Decl[1]); + + var x16Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x16").ToArray(); + var x16Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x16").ToArray(); + Assert.Equal(2, x16Decl.Length); + Assert.Equal(3, x16Ref.Length); + for (int i = 0; i < x16Ref.Length; i++) + { + VerifyModelForDeclarationPattern(model, x16Decl[0], x16Ref[i]); + } + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x16Decl[1]); + + var x17Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x17").ToArray(); + var x17Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x17").ToArray(); + Assert.Equal(2, x17Decl.Length); + Assert.Equal(3, x17Ref.Length); + for (int i = 0; i < x17Ref.Length; i++) + { + VerifyModelForDeclarationPattern(model, x17Decl[0], x17Ref[i]); + } + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x17Decl[1]); + } + + [Fact] + public void ScopeOfPatternVariables_Switch_01() + { + var source = +@" +public class X +{ + public static void Main() + { + } + + bool Dummy(params object[] x) {return true;} + + void Test1() + { + switch (1 is var x1 ? x1 : 0) + { + case 0: + Dummy(x1, 0); + break; + } + + Dummy(x1, 1); + } + + void Test4() + { + var x4 = 11; + Dummy(x4); + + switch (4 is var x4 ? x4 : 0) + { + case 4: + Dummy(x4); + break; + } + } + + void Test5(int x5) + { + switch (5 is var x5 ? x5 : 0) + { + case 5: + Dummy(x5); + break; + } + } + + void Test6() + { + switch (x6 + 6 is var x6 ? x6 : 0) + { + case 6: + Dummy(x6); + break; + } + } + + void Test7() + { + switch (7 is var x7 ? x7 : 0) + { + case 7: + var x7 = 12; + Dummy(x7); + break; + } + } + + void Test9() + { + switch (9 is var x9 ? x9 : 0) + { + case 9: + Dummy(x9, 0); + switch (9 is var x9 ? x9 : 0) + { + case 9: + Dummy(x9, 1); + break; + } + break; + } + + } + + void Test10() + { + switch (y10 + 10 is var x10 ? x10 : 0) + { + case 0 when y10: + break; + case y10: + var y10 = 12; + Dummy(y10); + break; + } + } + + void Test11() + { + switch (y11 + 11 is var x11 ? x11 : 0) + { + case 0 when y11 > 0: + break; + case y11: + let y11 = 12; + Dummy(y11); + break; + } + } + + void Test14() + { + switch (Dummy(1 is var x14, + 2 is var x14, + x14) ? 1 : 0) + { + case 0: + Dummy(x14); + break; + } + } + + void Test15(int val) + { + switch (val) + { + case 0 when y15 > 0: + break; + case y15: + var y15 = 15; + Dummy(y15); + break; + } + } + + void Test16(int val) + { + switch (val) + { + case 0 when y16 > 0: + break; + case y16: + let y16 = 16; + Dummy(y16); + break; + } + } +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + compilation.VerifyDiagnostics( + // (19,15): error CS0103: The name 'x1' does not exist in the current context + // Dummy(x1, 1); + Diagnostic(ErrorCode.ERR_NameNotInContext, "x1").WithArguments("x1").WithLocation(19, 15), + // (27,26): error CS0136: A local or parameter named 'x4' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // switch (4 is var x4 ? x4 : 0) + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x4").WithArguments("x4").WithLocation(27, 26), + // (37,26): error CS0136: A local or parameter named 'x5' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // switch (5 is var x5 ? x5 : 0) + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x5").WithArguments("x5").WithLocation(37, 26), + // (47,17): error CS0841: Cannot use local variable 'x6' before it is declared + // switch (x6 + 6 is var x6 ? x6 : 0) + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "x6").WithArguments("x6").WithLocation(47, 17), + // (60,21): error CS0136: A local or parameter named 'x7' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // var x7 = 12; + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x7").WithArguments("x7").WithLocation(60, 21), + // (72,34): error CS0136: A local or parameter named 'x9' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter + // switch (9 is var x9 ? x9 : 0) + Diagnostic(ErrorCode.ERR_LocalIllegallyOverrides, "x9").WithArguments("x9").WithLocation(72, 34), + // (85,17): error CS0103: The name 'y10' does not exist in the current context + // switch (y10 + 10 is var x10 ? x10 : 0) + Diagnostic(ErrorCode.ERR_NameNotInContext, "y10").WithArguments("y10").WithLocation(85, 17), + // (87,25): error CS0841: Cannot use local variable 'y10' before it is declared + // case 0 when y10: + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "y10").WithArguments("y10").WithLocation(87, 25), + // (89,18): error CS0841: Cannot use local variable 'y10' before it is declared + // case y10: + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "y10").WithArguments("y10").WithLocation(89, 18), + // (98,17): error CS0103: The name 'y11' does not exist in the current context + // switch (y11 + 11 is var x11 ? x11 : 0) + Diagnostic(ErrorCode.ERR_NameNotInContext, "y11").WithArguments("y11").WithLocation(98, 17), + // (100,25): error CS0841: Cannot use local variable 'y11' before it is declared + // case 0 when y11 > 0: + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "y11").WithArguments("y11").WithLocation(100, 25), + // (102,18): error CS0841: Cannot use local variable 'y11' before it is declared + // case y11: + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "y11").WithArguments("y11").WithLocation(102, 18), + // (112,28): error CS0128: A local variable named 'x14' is already defined in this scope + // 2 is var x14, + Diagnostic(ErrorCode.ERR_LocalDuplicate, "x14").WithArguments("x14").WithLocation(112, 28), + // (125,25): error CS0841: Cannot use local variable 'y15' before it is declared + // case 0 when y15 > 0: + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "y15").WithArguments("y15").WithLocation(125, 25), + // (127,18): error CS0841: Cannot use local variable 'y15' before it is declared + // case y15: + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "y15").WithArguments("y15").WithLocation(127, 18), + // (138,25): error CS0841: Cannot use local variable 'y16' before it is declared + // case 0 when y16 > 0: + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "y16").WithArguments("y16").WithLocation(138, 25), + // (140,18): error CS0841: Cannot use local variable 'y16' before it is declared + // case y16: + Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "y16").WithArguments("y16").WithLocation(140, 18) + ); + + var tree = compilation.SyntaxTrees.Single(); + var model = compilation.GetSemanticModel(tree); + + var x1Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x1").Single(); + var x1Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x1").ToArray(); + Assert.Equal(3, x1Ref.Length); + VerifyModelForDeclarationPattern(model, x1Decl, x1Ref[0], x1Ref[1]); + VerifyNotInScope(model, x1Ref[2]); + + var x4Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x4").Single(); + var x4Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x4").ToArray(); + Assert.Equal(3, x4Ref.Length); + VerifyModelForDeclarationPattern(model, x4Decl, x4Ref[1], x4Ref[2]); + VerifyNotAPatternLocal(model, x4Ref[0]); + + var x5Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x5").Single(); + var x5Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x5").ToArray(); + Assert.Equal(2, x5Ref.Length); + VerifyModelForDeclarationPattern(model, x5Decl, x5Ref); + + var x6Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x6").Single(); + var x6Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x6").ToArray(); + Assert.Equal(3, x6Ref.Length); + VerifyModelForDeclarationPattern(model, x6Decl, x6Ref); + + var x7Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x7").Single(); + var x7Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x7").ToArray(); + Assert.Equal(2, x7Ref.Length); + VerifyModelForDeclarationPattern(model, x7Decl, x7Ref[0]); + VerifyNotAPatternLocal(model, x7Ref[1]); + + var x9Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x9").ToArray(); + var x9Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x9").ToArray(); + Assert.Equal(2, x9Decl.Length); + Assert.Equal(4, x9Ref.Length); + VerifyModelForDeclarationPattern(model, x9Decl[0], x9Ref[0], x9Ref[1]); + VerifyModelForDeclarationPattern(model, x9Decl[1], x9Ref[2], x9Ref[3]); + + var y10Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "y10").ToArray(); + Assert.Equal(4, y10Ref.Length); + VerifyNotInScope(model, y10Ref[0]); + VerifyNotAPatternLocal(model, y10Ref[1]); + VerifyNotAPatternLocal(model, y10Ref[2]); + VerifyNotAPatternLocal(model, y10Ref[3]); + + var y11Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "y11").Single(); + var y11Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "y11").ToArray(); + Assert.Equal(4, y11Ref.Length); + VerifyNotInScope(model, y11Ref[0]); + VerifyModelForDeclarationPattern(model, y11Decl, y11Ref[1], y11Ref[2], y11Ref[3]); + + var x14Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "x14").ToArray(); + var x14Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "x14").ToArray(); + Assert.Equal(2, x14Decl.Length); + Assert.Equal(2, x14Ref.Length); + VerifyModelForDeclarationPattern(model, x14Decl[0], x14Ref); + VerifyModelForDeclarationPatternDuplicateInSameScope(model, x14Decl[1]); + + var y15Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "y15").ToArray(); + Assert.Equal(3, y15Ref.Length); + VerifyNotAPatternLocal(model, y15Ref[0]); + VerifyNotAPatternLocal(model, y15Ref[1]); + VerifyNotAPatternLocal(model, y15Ref[2]); + + var y16Decl = tree.GetRoot().DescendantNodes().OfType().Where(p => p.Identifier.ValueText == "y16").Single(); + var y16Ref = tree.GetRoot().DescendantNodes().OfType().Where(id => id.Identifier.ValueText == "y16").ToArray(); + Assert.Equal(3, y16Ref.Length); + VerifyModelForDeclarationPattern(model, y16Decl, y16Ref); + } + + [Fact] + public void Switch_01() + { + var source = +@" +public class X +{ + public static void Main() + { + Test1(0); + Test1(1); + } + + static bool Dummy1(bool val, params object[] x) {return val;} + static T Dummy2(T val, params object[] x) {return val;} + + static void Test1(int val) + { + switch (Dummy2(val, ""Test1 {0}"" is var x1)) + { + case 0 when Dummy1(true, ""case 0"" is var y1): + System.Console.WriteLine(x1, y1); + break; + case int z1: + System.Console.WriteLine(x1, z1); + break; + } + } +} +"; + var compilation = CreateCompilationWithMscorlib45(source, options: TestOptions.DebugExe, parseOptions: patternParseOptions); + CompileAndVerify(compilation, expectedOutput: +@"Test1 case 0 +Test1 1"); + + } } } diff --git a/src/Compilers/CSharp/Test/Semantic/project.lock.json b/src/Compilers/CSharp/Test/Semantic/project.lock.json index 9d5fb2042916b..2c1658b8a43de 100644 --- a/src/Compilers/CSharp/Test/Semantic/project.lock.json +++ b/src/Compilers/CSharp/Test/Semantic/project.lock.json @@ -78,7 +78,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -249,7 +249,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -580,11 +580,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/CSharp/Test/Symbol/Compilation/CompilationAPITests.cs b/src/Compilers/CSharp/Test/Symbol/Compilation/CompilationAPITests.cs index 6dd27d1ace17e..2672b46c74628 100644 --- a/src/Compilers/CSharp/Test/Symbol/Compilation/CompilationAPITests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Compilation/CompilationAPITests.cs @@ -26,6 +26,20 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests { public class CompilationAPITests : CSharpTestBase { + [WorkItem(8360, "https://github.com/dotnet/roslyn/issues/8360")] + [Fact] + public void PublicSignWithRelativeKeyPath() + { + var options = new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary) + .WithPublicSign(true).WithCryptoKeyFile("test.snk"); + var comp = CSharpCompilation.Create("test", options: options); + comp.VerifyDiagnostics( + // error CS7088: Invalid 'CryptoKeyFile' value: 'test.snk'. + Diagnostic(ErrorCode.ERR_BadCompilationOptionValue).WithArguments("CryptoKeyFile", "test.snk").WithLocation(1, 1), + // error CS8102: Public signing was specified and requires a public key, but no public key was specified. + Diagnostic(ErrorCode.ERR_PublicSignButNoKey).WithLocation(1, 1)); + } + [Fact] public void CompilationName() { diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/MockAssemblySymbol.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/MockAssemblySymbol.cs index 4ff2d0215c551..8d257c69b045c 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/MockAssemblySymbol.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/MockAssemblySymbol.cs @@ -24,8 +24,6 @@ public override AssemblyIdentity Identity get { return new AssemblyIdentity(_name); } } - public override Version AssemblyVersionPattern => null; - internal override ImmutableArray PublicKey { get { throw new NotImplementedException(); } diff --git a/src/Compilers/CSharp/Test/Symbol/project.lock.json b/src/Compilers/CSharp/Test/Symbol/project.lock.json index 9d274517c8b37..fc89de5fb5530 100644 --- a/src/Compilers/CSharp/Test/Symbol/project.lock.json +++ b/src/Compilers/CSharp/Test/Symbol/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/CSharp/Test/Syntax/project.lock.json b/src/Compilers/CSharp/Test/Syntax/project.lock.json index e34bb83bf13d5..6f7d22b5d8391 100644 --- a/src/Compilers/CSharp/Test/Syntax/project.lock.json +++ b/src/Compilers/CSharp/Test/Syntax/project.lock.json @@ -245,7 +245,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1240,11 +1240,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/CSharp/Test/WinRT/project.lock.json b/src/Compilers/CSharp/Test/WinRT/project.lock.json index 9d274517c8b37..fc89de5fb5530 100644 --- a/src/Compilers/CSharp/Test/WinRT/project.lock.json +++ b/src/Compilers/CSharp/Test/WinRT/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/CSharp/csc/Program.cs b/src/Compilers/CSharp/csc/Program.cs index 586645bb7c457..42885c8c11c8e 100644 --- a/src/Compilers/CSharp/csc/Program.cs +++ b/src/Compilers/CSharp/csc/Program.cs @@ -12,7 +12,11 @@ public static int Main(string[] args) => Main(args, SpecializedCollections.EmptyArray()); public static int Main(string[] args, string[] extraArgs) - => DesktopBuildClient.Run(args, extraArgs, RequestLanguage.CSharpCompile, Csc.Run, new SimpleAnalyzerAssemblyLoader()); + { + var result = DesktopBuildClient.Run(args, extraArgs, RequestLanguage.CSharpCompile, Csc.Run, new SimpleAnalyzerAssemblyLoader()); + if (System.Diagnostics.Debugger.IsAttached) System.Console.ReadLine(); + return result; + } public static int Run(string[] args, string clientDir, string workingDir, string sdkDir, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader) => Csc.Run(args, new BuildPaths(clientDir: clientDir, workingDir: workingDir, sdkDir: sdkDir), textWriter, analyzerLoader); diff --git a/src/Compilers/CSharp/csc/project.json b/src/Compilers/CSharp/csc/project.json index f1d1e75a49e1e..5b76cf6eca5f7 100644 --- a/src/Compilers/CSharp/csc/project.json +++ b/src/Compilers/CSharp/csc/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.DiaSymReader.Native": "1.3.3", + "Microsoft.DiaSymReader.Native": "1.3.3" }, "frameworks": { "net45": { } diff --git a/src/Compilers/CSharp/csc/project.lock.json b/src/Compilers/CSharp/csc/project.lock.json index 79008efc9411a..0ce428f12b00e 100644 --- a/src/Compilers/CSharp/csc/project.lock.json +++ b/src/Compilers/CSharp/csc/project.lock.json @@ -54,7 +54,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -150,7 +150,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -246,7 +246,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -342,7 +342,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -438,7 +438,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -534,7 +534,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -630,7 +630,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -875,11 +875,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Core/CodeAnalysisTest/CodeAnalysisTest.csproj b/src/Compilers/Core/CodeAnalysisTest/CodeAnalysisTest.csproj index fdab701d9ab9c..89a4f64f141cc 100644 --- a/src/Compilers/Core/CodeAnalysisTest/CodeAnalysisTest.csproj +++ b/src/Compilers/Core/CodeAnalysisTest/CodeAnalysisTest.csproj @@ -42,7 +42,6 @@ - diff --git a/src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs b/src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs index df99210a0abf2..b4b065d6f870e 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; using System.Linq; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Semantics; @@ -1592,6 +1593,37 @@ public sealed override void Initialize(AnalysisContext context) } } + public class BinaryOperatorVBTestAnalyzer : DiagnosticAnalyzer + { + public static readonly DiagnosticDescriptor BinaryUserDefinedOperatorDescriptor = new DiagnosticDescriptor( + "BinaryUserDefinedOperator", + "Binary user defined operator found", + "A Binary user defined operator {0} is found", + "Testing", + DiagnosticSeverity.Warning, + isEnabledByDefault: true); + + public sealed override ImmutableArray SupportedDiagnostics + => ImmutableArray.Create(BinaryUserDefinedOperatorDescriptor); + + public sealed override void Initialize(AnalysisContext context) + { + context.RegisterOperationAction( + (operationContext) => + { + var binary = (IBinaryOperatorExpression)operationContext.Operation; + if (binary.GetBinaryOperandsKind() == BinaryOperandsKind.OperatorMethod) + { + operationContext.ReportDiagnostic( + Diagnostic.Create(BinaryUserDefinedOperatorDescriptor, + binary.Syntax.GetLocation(), + binary.BinaryOperationKind.ToString())); + } + }, + OperationKind.BinaryOperatorExpression); + } + } + public class NullOperationSyntaxTestAnalyzer : DiagnosticAnalyzer { private const string ReliabilityCategory = "Reliability"; @@ -1800,7 +1832,40 @@ public sealed override void Initialize(AnalysisContext context) }, OperationKind.PlaceholderExpression); } - } + } + + public class ConversionExpressionCSharpTestAnalyzer : DiagnosticAnalyzer + { + private const string ReliabilityCategory = "Reliability"; + + public static readonly DiagnosticDescriptor InvalidConversionExpressionDescriptor = new DiagnosticDescriptor( + "InvalidConversionExpression", + "Invalid conversion expression", + "Invalid conversion expression.", + ReliabilityCategory, + DiagnosticSeverity.Warning, + isEnabledByDefault: true); + + public sealed override ImmutableArray SupportedDiagnostics + { + get { return ImmutableArray.Create(InvalidConversionExpressionDescriptor); } + } + + public sealed override void Initialize(AnalysisContext context) + { + context.RegisterOperationAction( + (operationContext) => + { + var conversion = (IConversionExpression)operationContext.Operation; + if (conversion.ConversionKind == ConversionKind.Invalid) + { + Debug.Assert(conversion.IsInvalid == true); + operationContext.ReportDiagnostic(Diagnostic.Create(InvalidConversionExpressionDescriptor, conversion.Syntax.GetLocation())); + } + }, + OperationKind.ConversionExpression); + } + } public class ForLoopConditionCrashVBTestAnalyzer : DiagnosticAnalyzer { diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityMapTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityMapTests.cs deleted file mode 100644 index 84867893a4d16..0000000000000 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/AssemblyIdentityMapTests.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using Xunit; - -namespace Microsoft.CodeAnalysis.UnitTests -{ - public class AssemblyIdentityMapTests - { - [Fact] - public void Map() - { - var map = new AssemblyIdentityMap(); - map.Add(new AssemblyIdentity("a", new Version(1, 0, 0, 0)), 10); - map.Add(new AssemblyIdentity("a", new Version(1, 8, 0, 0)), 18); - map.Add(new AssemblyIdentity("a", new Version(1, 5, 0, 0)), 15); - - map.Add(new AssemblyIdentity("b", new Version(1, 0, 0, 0)), 10); - map.Add(new AssemblyIdentity("b", new Version(1, 0, 0, 0)), 20); - - int value; - Assert.True(map.Contains(new AssemblyIdentity("a", new Version(1, 0, 0, 0)))); - Assert.True(map.TryGetValue(new AssemblyIdentity("a", new Version(1, 0, 0, 0)), out value)); - Assert.Equal(10, value); - - Assert.True(map.Contains(new AssemblyIdentity("a", new Version(1, 1, 0, 0)))); - Assert.True(map.TryGetValue(new AssemblyIdentity("a", new Version(1, 1, 0, 0)), out value)); - Assert.Equal(15, value); - - Assert.True(map.Contains(new AssemblyIdentity("a", new Version(1, 0, 0, 0)), allowHigherVersion: false)); - Assert.True(map.TryGetValue(new AssemblyIdentity("a", new Version(1, 0, 0, 0)), out value, allowHigherVersion: false)); - Assert.Equal(10, value); - - Assert.False(map.Contains(new AssemblyIdentity("a", new Version(1, 1, 0, 0)), allowHigherVersion: false)); - Assert.False(map.TryGetValue(new AssemblyIdentity("a", new Version(1, 1, 0, 0)), out value, allowHigherVersion: false)); - Assert.Equal(0, value); - - Assert.False(map.Contains(new AssemblyIdentity("b", new Version(1, 1, 0, 0)), allowHigherVersion: true)); - Assert.False(map.Contains(new AssemblyIdentity("b", new Version(1, 1, 0, 0)), allowHigherVersion: false)); - - // returns the first value added to the map if there are multiple matching identities: - Assert.True(map.TryGetValue(new AssemblyIdentity("b", new Version(1, 0, 0, 0)), out value)); - Assert.Equal(10, value); - } - } -} diff --git a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferenceTests.cs b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferenceTests.cs index 4fe984397d5c3..d7f9a571006eb 100644 --- a/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferenceTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataReferenceTests.cs @@ -453,7 +453,7 @@ protected override PortableExecutableReference WithPropertiesImpl(MetadataRefere [Fact] public void Equivalence() { - var comparer = CommonReferenceManager.MetadataReferenceEqualityComparer.Instance; + var comparer = CommonReferenceManager.MetadataReferenceEqualityComparer.Instance; var f1 = MscorlibRef; var f2 = SystemCoreRef; @@ -498,7 +498,7 @@ public void Equivalence() [Fact] public void PortableReference_Display() { - var comparer = CommonReferenceManager.MetadataReferenceEqualityComparer.Instance; + var comparer = CommonReferenceManager.MetadataReferenceEqualityComparer.Instance; var f1 = MscorlibRef; var f2 = SystemCoreRef; diff --git a/src/Compilers/Core/CodeAnalysisTest/PEWriter/UsedNamespaceOrTypeTests.cs b/src/Compilers/Core/CodeAnalysisTest/PEWriter/UsedNamespaceOrTypeTests.cs index 429733fc559a0..02c228d7e270e 100644 --- a/src/Compilers/Core/CodeAnalysisTest/PEWriter/UsedNamespaceOrTypeTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/PEWriter/UsedNamespaceOrTypeTests.cs @@ -120,9 +120,9 @@ public void EqualsNamespace() [Fact] public void EqualsNamespaceAndAssembly() { - var assembly1 = CreateEqualsInterface("assembly"); - var assembly2 = CreateEqualsInterface("assembly"); - var assembly3 = CreateEqualsInterface("other assembly"); + var assembly1 = CreateEqualsInterface("assembly"); + var assembly2 = CreateEqualsInterface("assembly"); + var assembly3 = CreateEqualsInterface("other assembly"); var ns1 = CreateEqualsInterface("namespace"); var ns2 = CreateEqualsInterface("namespace"); var ns3 = CreateEqualsInterface("other namespace"); diff --git a/src/Compilers/Core/CodeAnalysisTest/VersionHelperTests.cs b/src/Compilers/Core/CodeAnalysisTest/VersionHelperTests.cs index 7931cbbcfec30..08021e351f0cd 100644 --- a/src/Compilers/Core/CodeAnalysisTest/VersionHelperTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/VersionHelperTests.cs @@ -1,6 +1,10 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.CodeAnalysis.Text; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests @@ -15,25 +19,12 @@ public void ParseGood() Assert.True(VersionHelper.TryParseAssemblyVersion("3.2.*", allowWildcard: true, version: out version)); Assert.Equal(3, version.Major); Assert.Equal(2, version.Minor); - Assert.Equal(65535, version.Build); - Assert.Equal(65535, version.Revision); - Assert.True(VersionHelper.TryParseAssemblyVersion("1.2.3.*", allowWildcard: true, version: out version)); - Assert.Equal(3, version.Build); - Assert.Equal(65535, version.Revision); - } - - [Fact] - public void TimeBased() - { - var version = VersionHelper.GenerateVersionFromPatternAndCurrentTime(new Version(3, 2, 65535, 65535)); - //number of days since Jan 1, 2000 Assert.Equal((int)(DateTime.Now - new DateTime(2000, 1, 1)).TotalDays, version.Build); //number of seconds since midnight divided by two int s = (int)DateTime.Now.TimeOfDay.TotalSeconds / 2; Assert.InRange(version.Revision, s - 2, s + 2); - - version = VersionHelper.GenerateVersionFromPatternAndCurrentTime(new Version(1, 2, 3, 65535)); + Assert.True(VersionHelper.TryParseAssemblyVersion("1.2.3.*", allowWildcard: true, version: out version)); s = (int)DateTime.Now.TimeOfDay.TotalSeconds / 2; Assert.InRange(version.Revision, s - 2, s + 2); } diff --git a/src/Compilers/Core/CodeAnalysisTest/project.lock.json b/src/Compilers/Core/CodeAnalysisTest/project.lock.json index a107c1cd624cb..7d0ddfe217bb6 100644 --- a/src/Compilers/Core/CodeAnalysisTest/project.lock.json +++ b/src/Compilers/Core/CodeAnalysisTest/project.lock.json @@ -78,7 +78,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -249,7 +249,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -580,11 +580,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Core/MSBuildTask/Desktop/project.lock.json b/src/Compilers/Core/MSBuildTask/Desktop/project.lock.json index fbcd021105a4b..6fb118cca7d9a 100644 --- a/src/Compilers/Core/MSBuildTask/Desktop/project.lock.json +++ b/src/Compilers/Core/MSBuildTask/Desktop/project.lock.json @@ -53,7 +53,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -148,7 +148,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -243,7 +243,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -473,11 +473,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Core/MSBuildTask/Portable/project.lock.json b/src/Compilers/Core/MSBuildTask/Portable/project.lock.json index 1c49bd49914da..6da8f9a8c5907 100644 --- a/src/Compilers/Core/MSBuildTask/Portable/project.lock.json +++ b/src/Compilers/Core/MSBuildTask/Portable/project.lock.json @@ -367,7 +367,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1424,11 +1424,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Core/MSBuildTaskTests/project.lock.json b/src/Compilers/Core/MSBuildTaskTests/project.lock.json index 9534096f46a7c..98c5720ded45d 100644 --- a/src/Compilers/Core/MSBuildTaskTests/project.lock.json +++ b/src/Compilers/Core/MSBuildTaskTests/project.lock.json @@ -78,7 +78,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -249,7 +249,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -580,11 +580,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Core/Portable/CodeAnalysis.csproj b/src/Compilers/Core/Portable/CodeAnalysis.csproj index 903049ab0d6ab..6d727ca8682a3 100644 --- a/src/Compilers/Core/Portable/CodeAnalysis.csproj +++ b/src/Compilers/Core/Portable/CodeAnalysis.csproj @@ -62,7 +62,6 @@ - @@ -83,7 +82,6 @@ - diff --git a/src/Compilers/Core/Portable/CodeGen/VariableSlotAllocator.cs b/src/Compilers/Core/Portable/CodeGen/VariableSlotAllocator.cs index d80c455a6ff99..db0f892243c3d 100644 --- a/src/Compilers/Core/Portable/CodeGen/VariableSlotAllocator.cs +++ b/src/Compilers/Core/Portable/CodeGen/VariableSlotAllocator.cs @@ -30,6 +30,7 @@ public abstract bool TryGetPreviousHoistedLocalSlotIndex( Cci.ITypeReference currentType, SynthesizedLocalKind synthesizedKind, LocalDebugId currentId, + DiagnosticBag diagnostics, out int slotIndex); /// @@ -44,7 +45,7 @@ public abstract bool TryGetPreviousHoistedLocalSlotIndex( /// /// Returns true and an index of a slot that stores an awaiter of a specified type in the previous generation, if any. /// - public abstract bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentType, out int slotIndex); + public abstract bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentType, DiagnosticBag diagnostics, out int slotIndex); /// /// Number of slots reserved for awaiters. diff --git a/src/Compilers/Core/Portable/Compilation/Compilation.cs b/src/Compilers/Core/Portable/Compilation/Compilation.cs index 59d287c537a3e..9fdbdef715c6e 100644 --- a/src/Compilers/Core/Portable/Compilation/Compilation.cs +++ b/src/Compilers/Core/Portable/Compilation/Compilation.cs @@ -1844,17 +1844,8 @@ internal bool SerializeToPeStream( { Debug.Assert(Options.StrongNameProvider != null); - // Targeted try-catch for errors during CreateInputStream as found in TFS 1140649 - // TODO: Put this wrapping in PeWriter to catch all potential PE writing exceptions - try - { - signingInputStream = Options.StrongNameProvider.CreateInputStream(); - retStream = signingInputStream; - } - catch (Exception e) - { - throw new Cci.PeWritingException(e); - } + signingInputStream = Options.StrongNameProvider.CreateInputStream(); + retStream = signingInputStream; } else { @@ -1917,9 +1908,8 @@ internal bool SerializeToPeStream( } catch (Cci.PeWritingException e) { - // Targeted fix for TFS 1140649 - // TODO: Add resource and better error message for a variety of PE exceptions - diagnostics.Add(StrongNameKeys.GetError(StrongNameKeys.KeyFilePath, StrongNameKeys.KeyContainer, e.Message, MessageProvider)); + diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PeWritingFailure, Location.None, e.InnerException.ToString())); + return false; } catch (ResourceException e) { diff --git a/src/Compilers/Core/Portable/Compilation/CompilationOptions.cs b/src/Compilers/Core/Portable/Compilation/CompilationOptions.cs index 45ac7e0130df7..fbed3c2ebbf21 100644 --- a/src/Compilers/Core/Portable/Compilation/CompilationOptions.cs +++ b/src/Compilers/Core/Portable/Compilation/CompilationOptions.cs @@ -65,9 +65,8 @@ public abstract class CompilationOptions /// but not both. If both are specified is ignored. /// /// - /// This setting is obsolete and only supported on Microsoft Windows platform. - /// Use to generate assemblies with strong name and - /// a signing tool (Microsoft .NET Framework Strong Name Utility (sn.exe) or equivalent) to sign them. + /// If is also set, must be the absolute + /// path to key file. /// /// public string CryptoKeyFile { get; protected set; } @@ -107,7 +106,13 @@ public abstract class CompilationOptions /// Mark the compilation assembly as fully signed, but only sign with the public key. /// /// + /// /// If true, the assembly is marked as signed, but is only signed with the public key. + /// + /// + /// The key must be provided through either an absolute path in + /// or directly via . + /// /// public bool PublicSign { get; protected set; } @@ -466,6 +471,47 @@ public CompilationOptions WithStrongNameProvider(StrongNameProvider provider) /// internal abstract void ValidateOptions(ArrayBuilder builder); + internal void ValidateOptions(ArrayBuilder builder, CommonMessageProvider messageProvider) + { + if (!CryptoPublicKey.IsEmpty) + { + if (CryptoKeyFile != null) + { + builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions, + Location.None, nameof(CryptoPublicKey), nameof(CryptoKeyFile))); + } + + if (CryptoKeyContainer != null) + { + builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions, + Location.None, nameof(CryptoPublicKey), nameof(CryptoKeyContainer))); + } + } + + if (PublicSign) + { + if (CryptoKeyFile != null && !PathUtilities.IsAbsolute(CryptoKeyFile)) + { + // TODO(https://github.com/dotnet/roslyn/issues/9153): + // Produce better diagnostic message for passing a key file with a relative path + builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_BadCompilationOptionValue, + Location.None, nameof(CryptoKeyFile), CryptoKeyFile)); + } + + if (CryptoKeyContainer != null) + { + builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions, + Location.None, nameof(PublicSign), nameof(CryptoKeyContainer))); + } + + if (DelaySign == true) + { + builder.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MutuallyExclusiveOptions, + Location.None, nameof(PublicSign), nameof(DelaySign))); + } + } + } + /// /// Errors collection related to an incompatible set of compilation options /// diff --git a/src/Compilers/Core/Portable/Compilation/IExpression.cs b/src/Compilers/Core/Portable/Compilation/IExpression.cs index a340f69818b61..91129ce658285 100644 --- a/src/Compilers/Core/Portable/Compilation/IExpression.cs +++ b/src/Compilers/Core/Portable/Compilation/IExpression.cs @@ -563,6 +563,7 @@ public enum BinaryOperationKind OperatorMethodSubtract = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Subtract, OperatorMethodMultiply = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Multiply, OperatorMethodDivide = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Divide, + OperatorMethodIntegerDivide = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.IntegerDivide, OperatorMethodRemainder = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Remainder, OperatorMethodLeftShift = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.LeftShift, OperatorMethodRightShift = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.RightShift, @@ -870,7 +871,11 @@ public enum ConversionKind /// /// Conversion is implemented by a conversion operator method. /// - OperatorMethod = 0x5 + OperatorMethod = 0x5, + /// + /// Conversion is invalid. + /// + Invalid = 0xf } /// diff --git a/src/Compilers/Core/Portable/Compilation/OperationVisitor.cs b/src/Compilers/Core/Portable/Compilation/OperationVisitor.cs index 3b1ac11e3510e..c747359c8991d 100644 --- a/src/Compilers/Core/Portable/Compilation/OperationVisitor.cs +++ b/src/Compilers/Core/Portable/Compilation/OperationVisitor.cs @@ -20,7 +20,7 @@ public virtual void DefaultVisit(IOperation operation) // no-op } - internal void VisitNoneOperation(IOperation operation) + internal virtual void VisitNoneOperation(IOperation operation) { // no-op } @@ -420,7 +420,7 @@ public virtual TResult DefaultVisit(IOperation operation, TArgument argument) return default(TResult); } - internal TResult VisitNoneOperation(IOperation operation, TArgument argument) + internal virtual TResult VisitNoneOperation(IOperation operation, TArgument argument) { return default(TResult); } diff --git a/src/Compilers/Core/Portable/Compilation/OperationWalker.cs b/src/Compilers/Core/Portable/Compilation/OperationWalker.cs index 3a6b910b39585..f98a7905aa441 100644 --- a/src/Compilers/Core/Portable/Compilation/OperationWalker.cs +++ b/src/Compilers/Core/Portable/Compilation/OperationWalker.cs @@ -165,6 +165,7 @@ public override void VisitUsingStatement(IUsingStatement operation) { Visit(operation.Declaration); Visit(operation.Value); + Visit(operation.Body); } public override void VisitFixedStatement(IFixedStatement operation) @@ -257,8 +258,8 @@ public override void VisitEventAssignmentExpression(IEventAssignmentExpression o public override void VisitConditionalAccessExpression(IConditionalAccessExpression operation) { - Visit(operation.ConditionalValue); Visit(operation.ConditionalInstance); + Visit(operation.ConditionalValue); } public override void VisitConditionalAccessInstanceExpression(IConditionalAccessInstanceExpression operation) diff --git a/src/Compilers/Core/Portable/Diagnostic/CommonMessageProvider.cs b/src/Compilers/Core/Portable/Diagnostic/CommonMessageProvider.cs index 573ecf52a0cc2..3754056736e2c 100644 --- a/src/Compilers/Core/Portable/Diagnostic/CommonMessageProvider.cs +++ b/src/Compilers/Core/Portable/Diagnostic/CommonMessageProvider.cs @@ -155,6 +155,7 @@ public DiagnosticInfo FilterDiagnosticInfo(DiagnosticInfo diagnosticInfo, Compil // compilation options: public abstract int ERR_BadCompilationOptionValue { get; } + public abstract int ERR_MutuallyExclusiveOptions { get; } // emit options: public abstract int ERR_InvalidDebugInformationFormat { get; } @@ -203,6 +204,8 @@ public DiagnosticInfo FilterDiagnosticInfo(DiagnosticInfo diagnosticInfo, Compil public abstract int ERR_MetadataNameTooLong { get; } public abstract int ERR_EncReferenceToAddedMember { get; } public abstract int ERR_TooManyUserStrings { get; } + public abstract int ERR_PeWritingFailure { get; } + public abstract int ERR_ModuleEmitFailure { get; } public abstract void ReportInvalidAttributeArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, AttributeData attribute); public abstract void ReportInvalidNamedArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int namedArgumentIndex, ITypeSymbol attributeClass, string parameterName); diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisState.PerAnalyzerState.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisState.PerAnalyzerState.cs index e7ec3df457421..8ab6bf298de07 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisState.PerAnalyzerState.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisState.PerAnalyzerState.cs @@ -15,6 +15,7 @@ internal partial class AnalysisState { private class PerAnalyzerState { + private const int SymbolLimitForPooling = 100; private readonly object _gate = new object(); private readonly Dictionary _pendingEvents = new Dictionary(); private readonly Dictionary _pendingSymbols = new Dictionary(); @@ -37,6 +38,48 @@ public PerAnalyzerState( _currentlyAnalyzingDeclarationsMapPool = currentlyAnalyzingDeclarationsMapPool; } + /// + /// Returns true if the object should be returned to the pool. + /// + public bool Free() + { + lock (_gate) + { + foreach (var analyzerStateData in _pendingEvents.Values) + { + FreeState_NoLock(analyzerStateData, _analyzerStateDataPool); + } + + foreach (var analyzerStateData in _pendingSymbols.Values) + { + FreeState_NoLock(analyzerStateData, _analyzerStateDataPool); + } + + foreach (var declarationDataMap in _pendingDeclarations.Values) + { + foreach (var declarationStateData in declarationDataMap.Values) + { + FreeDeclarationAnalyzerState_NoLock(declarationStateData); + } + + FreeDeclarationDataMap_NoLock(declarationDataMap); + } + + // If we have too many symbols then just discard the state object from the pool - we don't want to hold onto really large dictionaries. + if (_pendingSymbols.Count > SymbolLimitForPooling) + { + return false; + } + + _pendingEvents.Clear(); + _pendingSymbols.Clear(); + _pendingDeclarations.Clear(); + _lazySyntaxTreesWithAnalysisData = null; + _pendingSyntaxAnalysisTreesCount = 0; + return true; + } + } + public void AddPendingEvents(HashSet uniqueEvents) { lock (_gate) @@ -275,7 +318,7 @@ private void FreeDeclarationAnalyzerState_NoLock(DeclarationAnalyzerStateData st private static void FreeState_NoLock(TAnalyzerStateData state, ObjectPool pool) where TAnalyzerStateData : AnalyzerStateData { - if (state != null) + if (state != null && !ReferenceEquals(state, AnalyzerStateData.FullyProcessedInstance)) { state.Free(); pool.Free(state); diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisState.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisState.cs index 21f0c04280aec..a642d24adc3f7 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisState.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalysisState.cs @@ -63,6 +63,13 @@ internal partial class AnalysisState private readonly ObjectPool> _compilationEventsPool; private readonly HashSet _pooledEventsWithAnyActionsSet; + // Create static pools for heavily allocated per-analyzer state objects - this helps in reducing allocations across CompilationWithAnalyzer instances. + private const int PoolSize = 5000; + private static readonly ObjectPool s_analyzerStateDataPool = new ObjectPool(() => new AnalyzerStateData(), PoolSize); + private static readonly ObjectPool s_declarationAnalyzerStateDataPool = new ObjectPool(() => new DeclarationAnalyzerStateData(), PoolSize); + private static readonly ObjectPool> s_currentlyAnalyzingDeclarationsMapPool = new ObjectPool>(() => new Dictionary(), PoolSize); + private static readonly ObjectPool s_perAnalyzerStatePool = new ObjectPool(() => new PerAnalyzerState(s_analyzerStateDataPool, s_declarationAnalyzerStateDataPool, s_currentlyAnalyzingDeclarationsMapPool), PoolSize); + public AnalysisState(ImmutableArray analyzers, CompilationData compilationData) { _gate = new object(); @@ -80,19 +87,33 @@ public AnalysisState(ImmutableArray analyzers, CompilationDa _pooledEventsWithAnyActionsSet = new HashSet(); } - private static ImmutableDictionary CreateAnalyzerStateMap(ImmutableArray analyzers, out ImmutableArray analyzerStates) + ~AnalysisState() { - var analyzerStateDataPool = new ObjectPool(() => new AnalyzerStateData()); - var declarationAnalyzerStateDataPool = new ObjectPool(() => new DeclarationAnalyzerStateData()); - var currentlyAnalyzingDeclarationsMapPool = new ObjectPool>( - () => new Dictionary()); + // Free the per-analyzer state tracking objects. + foreach (var analyzerState in _analyzerStates) + { + var shouldReturnToPool = analyzerState.Free(); + + // If we have too many symbols then just discard the state object from the pool - we don't want to hold onto really large dictionaries. + if (shouldReturnToPool) + { + s_perAnalyzerStatePool.Free(analyzerState); + } + else + { + s_perAnalyzerStatePool.ForgetTrackedObject(analyzerState); + } + } + } + private static ImmutableDictionary CreateAnalyzerStateMap(ImmutableArray analyzers, out ImmutableArray analyzerStates) + { var statesBuilder = ImmutableArray.CreateBuilder(); var map = ImmutableDictionary.CreateBuilder(); var index = 0; foreach (var analyzer in analyzers) { - statesBuilder.Add(new PerAnalyzerState(analyzerStateDataPool, declarationAnalyzerStateDataPool, currentlyAnalyzingDeclarationsMapPool)); + statesBuilder.Add(s_perAnalyzerStatePool.Allocate()); map[analyzer] = index; index++; } diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs index 0ab01bbad32c3..473c8a7ba069f 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs @@ -85,6 +85,7 @@ internal bool DefinitionExists(Cci.IDefinition definition) internal abstract bool TryGetFieldHandle(Cci.IFieldDefinition def, out FieldDefinitionHandle handle); internal abstract bool TryGetMethodHandle(Cci.IMethodDefinition def, out MethodDefinitionHandle handle); internal abstract bool TryGetPropertyHandle(Cci.IPropertyDefinition def, out PropertyDefinitionHandle handle); + internal abstract CommonMessageProvider MessageProvider { get; } } internal abstract class DefinitionMap : DefinitionMap @@ -260,6 +261,7 @@ internal VariableSlotAllocator TryCreateVariableSlotAllocator(EmitBaseline basel } return new EncVariableSlotAllocator( + MessageProvider, symbolMap, mappedMethod.SyntaxMap, mappedMethod.PreviousMethod, diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs index c13be8be6e4b6..6730ed3185ba6 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/DeltaMetadataWriter.cs @@ -35,7 +35,7 @@ internal sealed class DeltaMetadataWriter : MetadataWriter private readonly EventOrPropertyMapIndex _propertyMap; private readonly MethodImplIndex _methodImpls; - private readonly HeapOrReferenceIndex _assemblyRefIndex; + private readonly HeapOrReferenceIndex _assemblyRefIndex; private readonly HeapOrReferenceIndex _moduleRefIndex; private readonly InstanceAndStructuralReferenceIndex _memberRefIndex; private readonly InstanceAndStructuralReferenceIndex _methodSpecIndex; @@ -77,7 +77,7 @@ public DeltaMetadataWriter( _propertyMap = new EventOrPropertyMapIndex(this.TryGetExistingPropertyMapIndex, sizes[(int)TableIndex.PropertyMap]); _methodImpls = new MethodImplIndex(this, sizes[(int)TableIndex.MethodImpl]); - _assemblyRefIndex = new HeapOrReferenceIndex(this, lastRowId: sizes[(int)TableIndex.AssemblyRef]); + _assemblyRefIndex = new HeapOrReferenceIndex(this, AssemblyReferenceComparer.Instance, lastRowId: sizes[(int)TableIndex.AssemblyRef]); _moduleRefIndex = new HeapOrReferenceIndex(this, lastRowId: sizes[(int)TableIndex.ModuleRef]); _memberRefIndex = new InstanceAndStructuralReferenceIndex(this, new MemberRefComparer(this), lastRowId: sizes[(int)TableIndex.MemberRef]); _methodSpecIndex = new InstanceAndStructuralReferenceIndex(this, new MethodSpecComparer(this), lastRowId: sizes[(int)TableIndex.MethodSpec]); @@ -340,18 +340,10 @@ protected override int GetParameterDefIndex(IMethodDefinition methodDef) protected override int GetOrAddAssemblyRefIndex(IAssemblyReference reference) { - var identity = reference.Identity; - var versionPattern = reference.AssemblyVersionPattern; - - if ((object)versionPattern != null) - { - identity = _previousGeneration.InitialBaseline.LazyMetadataSymbols.AssemblyReferenceIdentityMap[identity.WithVersion(versionPattern)]; - } - - return _assemblyRefIndex.GetOrAdd(identity); + return _assemblyRefIndex.GetOrAdd(reference); } - protected override IReadOnlyList GetAssemblyRefs() + protected override IReadOnlyList GetAssemblyRefs() { return _assemblyRefIndex.Rows; } diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/EmitBaseline.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/EmitBaseline.cs index 454f1c786f97e..9f1a4cc0ab1cc 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/EmitBaseline.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/EmitBaseline.cs @@ -59,24 +59,15 @@ public sealed class EmitBaseline internal sealed class MetadataSymbols { public readonly IReadOnlyDictionary AnonymousTypes; - - /// - /// A map of the assembly identities of the baseline compilation to the identities of the original metadata AssemblyRefs. - /// Only includes identities that differ between these two. - /// - public readonly ImmutableDictionary AssemblyReferenceIdentityMap; - public readonly object MetadataDecoder; - public MetadataSymbols(IReadOnlyDictionary anonymousTypes, object metadataDecoder, ImmutableDictionary assemblyReferenceIdentityMap) + public MetadataSymbols(IReadOnlyDictionary anonymousTypes, object metadataDecoder) { Debug.Assert(anonymousTypes != null); Debug.Assert(metadataDecoder != null); - Debug.Assert(assemblyReferenceIdentityMap != null); this.AnonymousTypes = anonymousTypes; this.MetadataDecoder = metadataDecoder; - this.AssemblyReferenceIdentityMap = assemblyReferenceIdentityMap; } } diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs index fe6ac425b9c8a..18cf8b2c50140 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs @@ -13,6 +13,8 @@ namespace Microsoft.CodeAnalysis.Emit { internal sealed class EncVariableSlotAllocator : VariableSlotAllocator { + private readonly CommonMessageProvider _messageProvider; + // symbols: private readonly SymbolMatcher _symbolMap; @@ -37,6 +39,7 @@ internal sealed class EncVariableSlotAllocator : VariableSlotAllocator private readonly IReadOnlyDictionary _closureMapOpt; // SyntaxOffset -> Id public EncVariableSlotAllocator( + CommonMessageProvider messageProvider, SymbolMatcher symbolMap, Func syntaxMapOpt, IMethodSymbolInternal previousTopLevelMethod, @@ -50,10 +53,12 @@ public EncVariableSlotAllocator( int awaiterCount, IReadOnlyDictionary awaiterMapOpt) { + Debug.Assert(messageProvider != null); Debug.Assert(symbolMap != null); Debug.Assert(previousTopLevelMethod != null); Debug.Assert(!previousLocals.IsDefault); + _messageProvider = messageProvider; _symbolMap = symbolMap; _syntaxMapOpt = syntaxMapOpt; _previousLocals = previousLocals; @@ -177,9 +182,23 @@ public override LocalDefinition GetPreviousLocal( public override string PreviousStateMachineTypeName => _stateMachineTypeNameOpt; - public override bool TryGetPreviousHoistedLocalSlotIndex(SyntaxNode currentDeclarator, Cci.ITypeReference currentType, SynthesizedLocalKind synthesizedKind, LocalDebugId currentId, out int slotIndex) + public override bool TryGetPreviousHoistedLocalSlotIndex( + SyntaxNode currentDeclarator, + Cci.ITypeReference currentType, + SynthesizedLocalKind synthesizedKind, + LocalDebugId currentId, + DiagnosticBag diagnostics, + out int slotIndex) { - Debug.Assert(_hoistedLocalSlotsOpt != null); + // Well-formed state machine attribute wasn't found in the baseline (the type is missing or bad). + // Should rarely happen since the IDE reports a rude edit if the attribute type doesn't exist. + if (_hoistedLocalSlotsOpt == null) + { + // TODO: better error message https://github.com/dotnet/roslyn/issues/9196 + diagnostics.Add(_messageProvider.CreateDiagnostic(_messageProvider.ERR_ModuleEmitFailure, NoLocation.Singleton, _previousTopLevelMethod.ContainingModule.Name)); + slotIndex = -1; + return false; + } LocalDebugId previousId; if (!TryGetPreviousLocalId(currentDeclarator, currentId, out previousId)) @@ -205,9 +224,18 @@ public override bool TryGetPreviousHoistedLocalSlotIndex(SyntaxNode currentDecla public override int PreviousHoistedLocalSlotCount => _hoistedLocalSlotCount; public override int PreviousAwaiterSlotCount => _awaiterCount; - public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentType, out int slotIndex) + public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentType, DiagnosticBag diagnostics, out int slotIndex) { - Debug.Assert(_awaiterMapOpt != null); + // Well-formed state machine attribute wasn't found in the baseline (the type is missing or bad). + // Should rarely happen since the IDE reports a rude edit if the attribute type doesn't exist. + if (_awaiterMapOpt == null) + { + // TODO: better error message https://github.com/dotnet/roslyn/issues/9196 + diagnostics.Add(_messageProvider.CreateDiagnostic(_messageProvider.ERR_ModuleEmitFailure, NoLocation.Singleton, _previousTopLevelMethod.ContainingModule.Name)); + slotIndex = -1; + return false; + } + return _awaiterMapOpt.TryGetValue(_symbolMap.MapReference(currentType), out slotIndex); } diff --git a/src/Compilers/Core/Portable/Emit/ErrorType.cs b/src/Compilers/Core/Portable/Emit/ErrorType.cs index d7860661a7d42..776a7272a627c 100644 --- a/src/Compilers/Core/Portable/Emit/ErrorType.cs +++ b/src/Compilers/Core/Portable/Emit/ErrorType.cs @@ -191,7 +191,6 @@ private sealed class ErrorAssembly : Cci.IAssemblyReference contentType: AssemblyContentType.Default); AssemblyIdentity Cci.IAssemblyReference.Identity => s_identity; - Version Cci.IAssemblyReference.AssemblyVersionPattern => null; Cci.IAssemblyReference Cci.IModuleReference.GetContainingAssembly(EmitContext context) { diff --git a/src/Compilers/Core/Portable/InternalUtilities/OneOrMany.cs b/src/Compilers/Core/Portable/InternalUtilities/OneOrMany.cs index e70a3e442867d..c4263ea1450c3 100644 --- a/src/Compilers/Core/Portable/InternalUtilities/OneOrMany.cs +++ b/src/Compilers/Core/Portable/InternalUtilities/OneOrMany.cs @@ -62,11 +62,6 @@ public int Count return _many.IsDefault ? 1 : _many.Length; } } - - public OneOrMany Add(T item) - { - return new OneOrMany(_many.IsDefault ? ImmutableArray.Create(_one, item) : _many.Add(item)); - } } internal static class OneOrMany diff --git a/src/Compilers/Core/Portable/MetadataReference/AssemblyIdentity.cs b/src/Compilers/Core/Portable/MetadataReference/AssemblyIdentity.cs index a151369706929..461c071065de9 100644 --- a/src/Compilers/Core/Portable/MetadataReference/AssemblyIdentity.cs +++ b/src/Compilers/Core/Portable/MetadataReference/AssemblyIdentity.cs @@ -50,25 +50,6 @@ public sealed partial class AssemblyIdentity : IEquatable internal const int PublicKeyTokenSize = 8; - private AssemblyIdentity(AssemblyIdentity other, Version version) - { - Debug.Assert((object)other != null); - Debug.Assert((object)version != null); - - _contentType = other.ContentType; - _name = other._name; - _cultureName = other._cultureName; - _publicKey = other._publicKey; - _lazyPublicKeyToken = other._lazyPublicKeyToken; - _isRetargetable = other._isRetargetable; - - _version = version; - _lazyDisplayName = null; - _lazyHashCode = 0; - } - - internal AssemblyIdentity WithVersion(Version version) => (version == _version) ? this : new AssemblyIdentity(this, version); - /// /// Constructs an from its constituent parts. /// @@ -407,22 +388,16 @@ public override int GetHashCode() { // Do not include PK/PKT in the hash - collisions on PK/PKT are rare (assembly identities differ only in PKT/PK) // and we can't calculate hash of PKT if only PK is available - _lazyHashCode = - Hash.Combine(AssemblyIdentityComparer.SimpleNameComparer.GetHashCode(_name), - Hash.Combine(_version.GetHashCode(), GetHashCodeIgnoringNameAndVersion())); + _lazyHashCode = Hash.Combine(AssemblyIdentityComparer.SimpleNameComparer.GetHashCode(_name), + Hash.Combine(_version.GetHashCode(), + Hash.Combine((int)_contentType, + Hash.Combine(_isRetargetable, + AssemblyIdentityComparer.CultureComparer.GetHashCode(_cultureName))))); } return _lazyHashCode; } - internal int GetHashCodeIgnoringNameAndVersion() - { - return - Hash.Combine((int)_contentType, - Hash.Combine(_isRetargetable, - AssemblyIdentityComparer.CultureComparer.GetHashCode(_cultureName))); - } - // internal for testing internal static ImmutableArray CalculatePublicKeyToken(ImmutableArray publicKey) { @@ -459,7 +434,11 @@ internal static ImmutableArray CalculatePublicKeyToken(ImmutableArray CalculatePublicKeyToken(ImmutableArray - /// Implements a map from an assembly identity to a value. The map allows to look up the value by an identity - /// that either exactly matches the original identity key, or corresponds to a key with the lowest version among identities - /// with higher version than the requested identity key. - /// - internal sealed class AssemblyIdentityMap - { - private readonly Dictionary>> _map; - - public AssemblyIdentityMap() - { - _map = new Dictionary>>(AssemblyIdentityComparer.SimpleNameComparer); - } - - public bool Contains(AssemblyIdentity identity, bool allowHigherVersion = true) - { - TValue value; - return TryGetValue(identity, out value, allowHigherVersion); - } - - public bool TryGetValue(AssemblyIdentity identity, out TValue value, bool allowHigherVersion = true) - { - OneOrMany> sameName; - if (_map.TryGetValue(identity.Name, out sameName)) - { - int minHigherVersionCandidate = -1; - - for (int i = 0; i < sameName.Count; i++) - { - AssemblyIdentity currentIdentity = sameName[i].Key; - - if (AssemblyIdentity.EqualIgnoringNameAndVersion(currentIdentity, identity)) - { - if (currentIdentity.Version == identity.Version) - { - value = sameName[i].Value; - return true; - } - - // only higher version candidates are considered for match: - if (!allowHigherVersion || currentIdentity.Version < identity.Version) - { - continue; - } - - if (minHigherVersionCandidate == -1 || currentIdentity.Version < sameName[minHigherVersionCandidate].Key.Version) - { - minHigherVersionCandidate = i; - } - } - } - - if (minHigherVersionCandidate >= 0) - { - value = sameName[minHigherVersionCandidate].Value; - return true; - } - } - - value = default(TValue); - return false; - } - - public bool TryGetValue(AssemblyIdentity identity, out TValue value, Func comparer) - { - OneOrMany> sameName; - if (_map.TryGetValue(identity.Name, out sameName)) - { - for (int i = 0; i < sameName.Count; i++) - { - AssemblyIdentity currentIdentity = sameName[i].Key; - - if (comparer(identity.Version, currentIdentity.Version, sameName[i].Value) && - AssemblyIdentity.EqualIgnoringNameAndVersion(currentIdentity, identity)) - { - value = sameName[i].Value; - return true; - } - } - } - - value = default(TValue); - return false; - } - - public void Add(AssemblyIdentity identity, TValue value) - { - var pair = KeyValuePair.Create(identity, value); - - OneOrMany> sameName; - _map[identity.Name] = _map.TryGetValue(identity.Name, out sameName) ? sameName.Add(pair) : OneOrMany.Create(pair); - } - } -} diff --git a/src/Compilers/Core/Portable/PEWriter/FullMetadataWriter.cs b/src/Compilers/Core/Portable/PEWriter/FullMetadataWriter.cs index aeff80ff8b01f..00d5b52f8f644 100644 --- a/src/Compilers/Core/Portable/PEWriter/FullMetadataWriter.cs +++ b/src/Compilers/Core/Portable/PEWriter/FullMetadataWriter.cs @@ -24,7 +24,7 @@ internal sealed class FullMetadataWriter : MetadataWriter private readonly Dictionary _methodDefIndex; private readonly Dictionary _parameterListIndex; - private readonly HeapOrReferenceIndex _assemblyRefIndex; + private readonly HeapOrReferenceIndex _assemblyRefIndex; private readonly HeapOrReferenceIndex _moduleRefIndex; private readonly InstanceAndStructuralReferenceIndex _memberRefIndex; private readonly InstanceAndStructuralReferenceIndex _methodSpecIndex; @@ -88,7 +88,7 @@ private FullMetadataWriter( _methodDefIndex = new Dictionary(numTypeDefsGuess); _parameterListIndex = new Dictionary(numMethods); - _assemblyRefIndex = new HeapOrReferenceIndex(this); + _assemblyRefIndex = new HeapOrReferenceIndex(this, AssemblyReferenceComparer.Instance); _moduleRefIndex = new HeapOrReferenceIndex(this); _memberRefIndex = new InstanceAndStructuralReferenceIndex(this, new MemberRefComparer(this)); _methodSpecIndex = new InstanceAndStructuralReferenceIndex(this, new MethodSpecComparer(this)); @@ -214,10 +214,10 @@ protected override int GetParameterDefIndex(IMethodDefinition methodDef) protected override int GetOrAddAssemblyRefIndex(IAssemblyReference reference) { - return _assemblyRefIndex.GetOrAdd(reference.Identity); + return _assemblyRefIndex.GetOrAdd(reference); } - protected override IReadOnlyList GetAssemblyRefs() + protected override IReadOnlyList GetAssemblyRefs() { return _assemblyRefIndex.Rows; } diff --git a/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs b/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs index 333d1d3ef5f6b..59107054af85a 100644 --- a/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs +++ b/src/Compilers/Core/Portable/PEWriter/MetadataWriter.cs @@ -274,7 +274,7 @@ private bool IsMinimalDelta /// The assembly references to be emitted, in row order. These /// are just the assembly references from the current generation. /// - protected abstract IReadOnlyList GetAssemblyRefs(); + protected abstract IReadOnlyList GetAssemblyRefs(); // ModuleRef table contains module names for TypeRefs that target types in netmodules (represented by IModuleReference), // and module names specified by P/Invokes (plain strings). Names in the table must be unique and are case sensitive. @@ -2582,15 +2582,16 @@ private void PopulateAssemblyRefTableRows() var assemblyRefs = this.GetAssemblyRefs(); _assemblyRefTable.Capacity = assemblyRefs.Count; - foreach (var identity in assemblyRefs) + foreach (var assemblyRef in assemblyRefs) { AssemblyRefTableRow r = new AssemblyRefTableRow(); + var identity = assemblyRef.Identity; r.Version = identity.Version; r.PublicKeyToken = heaps.GetBlobIndex(identity.PublicKeyToken); - Debug.Assert(!string.IsNullOrEmpty(identity.Name)); - r.Name = this.GetStringIndexForPathAndCheckLength(identity.Name); + Debug.Assert(!string.IsNullOrEmpty(assemblyRef.Name)); + r.Name = this.GetStringIndexForPathAndCheckLength(assemblyRef.Name, assemblyRef); r.Culture = heaps.GetStringIndex(identity.CultureName); @@ -2600,6 +2601,27 @@ private void PopulateAssemblyRefTableRows() } } + /// + /// Compares quality of assembly references to achieve unique rows in AssemblyRef table. + /// Metadata spec: "The AssemblyRef table shall contain no duplicates (where duplicate rows are deemed to + /// be those having the same MajorVersion, MinorVersion, BuildNumber, RevisionNumber, PublicKeyOrToken, + /// Name, and Culture)". + /// + protected sealed class AssemblyReferenceComparer : IEqualityComparer + { + internal static readonly AssemblyReferenceComparer Instance = new AssemblyReferenceComparer(); + + public bool Equals(IAssemblyReference x, IAssemblyReference y) + { + return x.Identity == y.Identity; + } + + public int GetHashCode(IAssemblyReference reference) + { + return reference.Identity.GetHashCode(); + } + } + private readonly List _assemblyRefTable = new List(); private void PopulateAssemblyTableRows() @@ -5411,6 +5433,11 @@ public HeapOrReferenceIndex(MetadataWriter writer, int lastRowId = 0) { } + public HeapOrReferenceIndex(MetadataWriter writer, IEqualityComparer comparer, int lastRowId = 0) + : this(writer, new Dictionary(comparer), lastRowId) + { + } + private HeapOrReferenceIndex(MetadataWriter writer, Dictionary index, int lastRowId) : base(writer, lastRowId) { diff --git a/src/Compilers/Core/Portable/PEWriter/PeWriter.cs b/src/Compilers/Core/Portable/PEWriter/PeWriter.cs index c04bd639ab0a0..a42fb3c599bf8 100644 --- a/src/Compilers/Core/Portable/PEWriter/PeWriter.cs +++ b/src/Compilers/Core/Portable/PEWriter/PeWriter.cs @@ -12,6 +12,7 @@ using Microsoft.CodeAnalysis; using Roslyn.Utilities; using EmitContext = Microsoft.CodeAnalysis.Emit.EmitContext; +using Microsoft.CodeAnalysis.CodeGen; namespace Microsoft.Cci { @@ -88,10 +89,17 @@ public static bool WritePeToStream( // If PDB writer is given, we have to have PDB path. Debug.Assert(nativePdbWriterOpt == null || pdbPathOpt != null); - var peWriter = new PeWriter(context.Module.Properties, context.Module.Win32Resources, context.Module.Win32ResourceSection, pdbPathOpt, deterministic); - var mdWriter = FullMetadataWriter.Create(context, messageProvider, allowMissingMethodBodies, deterministic, getPortablePdbStreamOpt != null, cancellationToken); + try + { + var peWriter = new PeWriter(context.Module.Properties, context.Module.Win32Resources, context.Module.Win32ResourceSection, pdbPathOpt, deterministic); + var mdWriter = FullMetadataWriter.Create(context, messageProvider, allowMissingMethodBodies, deterministic, getPortablePdbStreamOpt != null, cancellationToken); - return peWriter.WritePeToStream(mdWriter, getPeStream, getPortablePdbStreamOpt, nativePdbWriterOpt); + return peWriter.WritePeToStream(mdWriter, getPeStream, getPortablePdbStreamOpt, nativePdbWriterOpt); + } + catch (Exception ex) when (!(ex is PdbWritingException || ex is ResourceException || ex is PermissionSetFileReadException)) + { + throw new PeWritingException(ex); + } } private bool WritePeToStream(MetadataWriter mdWriter, Func getPeStream, Func getPortablePdbStreamOpt, PdbWriter nativePdbWriterOpt) diff --git a/src/Compilers/Core/Portable/PEWriter/Units.cs b/src/Compilers/Core/Portable/PEWriter/Units.cs index 2d0061a177921..2cf3d83455dd1 100644 --- a/src/Compilers/Core/Portable/PEWriter/Units.cs +++ b/src/Compilers/Core/Portable/PEWriter/Units.cs @@ -52,7 +52,6 @@ internal interface IAssembly : IModule, IAssemblyReference internal interface IAssemblyReference : IModuleReference { AssemblyIdentity Identity { get; } - Version AssemblyVersionPattern { get; } } /// diff --git a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt index 6a79374aa8e37..ca246702b3939 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -285,6 +285,7 @@ Microsoft.CodeAnalysis.Semantics.BinaryOperationKind.OperatorMethodEquals = 272 Microsoft.CodeAnalysis.Semantics.BinaryOperationKind.OperatorMethodExclusiveOr = 268 -> Microsoft.CodeAnalysis.Semantics.BinaryOperationKind Microsoft.CodeAnalysis.Semantics.BinaryOperationKind.OperatorMethodGreaterThan = 279 -> Microsoft.CodeAnalysis.Semantics.BinaryOperationKind Microsoft.CodeAnalysis.Semantics.BinaryOperationKind.OperatorMethodGreaterThanOrEqual = 278 -> Microsoft.CodeAnalysis.Semantics.BinaryOperationKind +Microsoft.CodeAnalysis.Semantics.BinaryOperationKind.OperatorMethodIntegerDivide = 261 -> Microsoft.CodeAnalysis.Semantics.BinaryOperationKind Microsoft.CodeAnalysis.Semantics.BinaryOperationKind.OperatorMethodLeftShift = 264 -> Microsoft.CodeAnalysis.Semantics.BinaryOperationKind Microsoft.CodeAnalysis.Semantics.BinaryOperationKind.OperatorMethodLessThan = 276 -> Microsoft.CodeAnalysis.Semantics.BinaryOperationKind Microsoft.CodeAnalysis.Semantics.BinaryOperationKind.OperatorMethodLessThanOrEqual = 277 -> Microsoft.CodeAnalysis.Semantics.BinaryOperationKind @@ -336,6 +337,7 @@ Microsoft.CodeAnalysis.Semantics.ConversionKind Microsoft.CodeAnalysis.Semantics.ConversionKind.Basic = 3 -> Microsoft.CodeAnalysis.Semantics.ConversionKind Microsoft.CodeAnalysis.Semantics.ConversionKind.CSharp = 4 -> Microsoft.CodeAnalysis.Semantics.ConversionKind Microsoft.CodeAnalysis.Semantics.ConversionKind.Cast = 1 -> Microsoft.CodeAnalysis.Semantics.ConversionKind +Microsoft.CodeAnalysis.Semantics.ConversionKind.Invalid = 15 -> Microsoft.CodeAnalysis.Semantics.ConversionKind Microsoft.CodeAnalysis.Semantics.ConversionKind.None = 0 -> Microsoft.CodeAnalysis.Semantics.ConversionKind Microsoft.CodeAnalysis.Semantics.ConversionKind.OperatorMethod = 5 -> Microsoft.CodeAnalysis.Semantics.ConversionKind Microsoft.CodeAnalysis.Semantics.ConversionKind.TryCast = 2 -> Microsoft.CodeAnalysis.Semantics.ConversionKind diff --git a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs index 44f670f4da029..74bc7bb5d4192 100644 --- a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs +++ b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.Resolution.cs @@ -22,7 +22,7 @@ namespace Microsoft.CodeAnalysis /// Language specific representation for an assembly symbol. internal abstract partial class CommonReferenceManager where TCompilation : Compilation - where TAssemblySymbol : class, IAssemblySymbolInternal + where TAssemblySymbol : class, IAssemblySymbol { protected abstract CommonMessageProvider MessageProvider { get; } diff --git a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs index 37a4c052a7ce7..15a70fee3bac9 100644 --- a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs +++ b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs @@ -485,77 +485,6 @@ protected static void BuildReferencedAssembliesAndModulesMaps( aliasesOfReferencedAssemblies = aliasesOfReferencedAssembliesBuilder.ToImmutableAndFree(); } - /// - /// 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. - /// - /// Assembly symbols for references of the current compilation. - /// Identities in the baseline. [i] corresponds to [i]. - internal ImmutableDictionary GetAssemblyReferenceIdentityBaselineMap(ImmutableArray symbols, ImmutableArray originalIdentities) - { - Debug.Assert(originalIdentities.Length == symbols.Length); - - ImmutableDictionary.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 ((object)versionPattern != null) - { - Debug.Assert(versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); - - lazyBuilder = lazyBuilder ?? ImmutableDictionary.CreateBuilder(); - - var sourceIdentity = symbolIdentity.WithVersion(versionPattern); - - if (lazyBuilder.ContainsKey(sourceIdentity)) - { - // TODO: localize message, report as diagnostic (https://github.com/dotnet/roslyn/issues/8910) - throw new NotSupportedException("The compilation references multiple assemblies whose versions only differ in auto-generated build and/or revision numbers."); - } - - lazyBuilder.Add(sourceIdentity, originalIdentity); - } - else - { - // by construction of the arguments: - Debug.Assert(originalIdentity == symbolIdentity); - } - } - - return lazyBuilder?.ToImmutable() ?? ImmutableDictionary.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((object)versionPattern == null || versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); - - if (((object)versionPattern == null || versionPattern.Build < ushort.MaxValue) && version.Build != candidateVersion.Build) - { - return false; - } - - if ((object)versionPattern == 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, diff --git a/src/Compilers/Core/Portable/Symbols/IAssemblySymbolInternal.cs b/src/Compilers/Core/Portable/Symbols/IAssemblySymbolInternal.cs deleted file mode 100644 index 0f8e44b620c7c..0000000000000 --- a/src/Compilers/Core/Portable/Symbols/IAssemblySymbolInternal.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.CodeAnalysis -{ - internal interface IAssemblySymbolInternal : IAssemblySymbol - { - Version AssemblyVersionPattern { get; } - } -} diff --git a/src/Compilers/Core/Portable/VersionHelper.cs b/src/Compilers/Core/Portable/VersionHelper.cs index 4751b99f51209..42801324ee888 100644 --- a/src/Compilers/Core/Portable/VersionHelper.cs +++ b/src/Compilers/Core/Portable/VersionHelper.cs @@ -61,7 +61,7 @@ private static bool TryParse(string s, bool allowWildcard, ushort maxValue, out return false; } - ushort[] values = new ushort[] { 0, 0, ushort.MaxValue, ushort.MaxValue }; + ushort[] values = new ushort[4]; int lastExplicitValue = hasWildcard ? elements.Length - 1 : elements.Length; for (int i = 0; i < lastExplicitValue; i++) { @@ -72,36 +72,37 @@ private static bool TryParse(string s, bool allowWildcard, ushort maxValue, out } } - version = new Version(values[0], values[1], values[2], values[3]); - return true; - } - - /// - /// If build and/or revision numbers are 65535 they are replaced with time-based values. - /// - public static Version GenerateVersionFromPatternAndCurrentTime(Version pattern) - { - if (pattern == null || pattern.Revision != ushort.MaxValue) + if (hasWildcard) { - return pattern; - } - - int revision = (int)DateTime.Now.TimeOfDay.TotalSeconds / 2; + int seconds = ((int)(DateTime.Now.TimeOfDay.TotalSeconds)) / 2; + if (seconds > (int)maxValue) + { + version = null; + return false; + } + values[3] = (ushort)seconds; - // 24 * 60 * 60 / 2 = 43200 < 65534 - Debug.Assert(revision < 0xffff); + if (elements.Length == 3) + { + TimeSpan days = DateTime.Today - new DateTime(2000, 1, 1); + int build = (int)days.TotalDays; - if (pattern.Build == ushort.MaxValue) - { - TimeSpan days = DateTime.Today - new DateTime(2000, 1, 1); - int build = Math.Min(ushort.MaxValue, (int)days.TotalDays); + if (build < 0 || build > (int)maxValue) + { + //alink would generate an error here saying "Cannot auto-generate build and + //revision version numbers for dates previous to January 1, 2000." Without + //some refactoring here to relay the date problem, Roslyn + //will generate an inaccurate error about the version string being of the wrong format. - return new Version(pattern.Major, pattern.Minor, (ushort)build, (ushort)revision); - } - else - { - return new Version(pattern.Major, pattern.Minor, pattern.Build, (ushort)revision); + version = null; + return false; + } + values[2] = (ushort)build; + } } + + version = new Version(values[0], values[1], values[2], values[3]); + return true; } } } diff --git a/src/Compilers/Core/Portable/project.json b/src/Compilers/Core/Portable/project.json index 68c8247a5739d..0341374f6c075 100644 --- a/src/Compilers/Core/Portable/project.json +++ b/src/Compilers/Core/Portable/project.json @@ -2,9 +2,9 @@ "supports": {}, "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { ".NETPortable,Version=v4.5,Profile=Profile7": {} } -} \ No newline at end of file +} diff --git a/src/Compilers/Core/Portable/project.lock.json b/src/Compilers/Core/Portable/project.lock.json index f8ccb3855cbef..25bc55a4b1b7d 100644 --- a/src/Compilers/Core/Portable/project.lock.json +++ b/src/Compilers/Core/Portable/project.lock.json @@ -12,7 +12,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "type": "package", "dependencies": { "System.Collections.Immutable": "1.1.37" @@ -39,11 +39,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -57,7 +57,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETPortable,Version=v4.5,Profile=Profile7": [] } diff --git a/src/Compilers/Extension/project.lock.json b/src/Compilers/Extension/project.lock.json index eca7954122fbc..d0ba2ee2ea4dc 100644 --- a/src/Compilers/Extension/project.lock.json +++ b/src/Compilers/Extension/project.lock.json @@ -54,7 +54,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -150,7 +150,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -246,7 +246,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -491,11 +491,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Server/PortableServer/project.lock.json b/src/Compilers/Server/PortableServer/project.lock.json index ee58614bc3365..80184c55b42d1 100644 --- a/src/Compilers/Server/PortableServer/project.lock.json +++ b/src/Compilers/Server/PortableServer/project.lock.json @@ -511,7 +511,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1795,7 +1795,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -3149,7 +3149,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -4654,7 +4654,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -7735,11 +7735,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Server/VBCSCompiler/project.json b/src/Compilers/Server/VBCSCompiler/project.json index 06f158e132eaf..2dbdf19460b59 100644 --- a/src/Compilers/Server/VBCSCompiler/project.json +++ b/src/Compilers/Server/VBCSCompiler/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", }, "frameworks": { "net45": { } diff --git a/src/Compilers/Server/VBCSCompiler/project.lock.json b/src/Compilers/Server/VBCSCompiler/project.lock.json index b60f460f6fb01..821ebc4dcd4ae 100644 --- a/src/Compilers/Server/VBCSCompiler/project.lock.json +++ b/src/Compilers/Server/VBCSCompiler/project.lock.json @@ -53,7 +53,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -148,7 +148,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -243,7 +243,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -338,7 +338,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -433,7 +433,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -528,7 +528,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -623,7 +623,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -853,11 +853,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -1044,7 +1044,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5": [] } diff --git a/src/Compilers/Server/VBCSCompilerTests/project.lock.json b/src/Compilers/Server/VBCSCompilerTests/project.lock.json index 48ea4b5f31a6e..dab7d2447d92c 100644 --- a/src/Compilers/Server/VBCSCompilerTests/project.lock.json +++ b/src/Compilers/Server/VBCSCompilerTests/project.lock.json @@ -78,7 +78,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -249,7 +249,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -580,11 +580,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Test/Resources/Core/CompilerTestResources.csproj b/src/Compilers/Test/Resources/Core/CompilerTestResources.csproj index d572123afd688..718fe44246662 100644 --- a/src/Compilers/Test/Resources/Core/CompilerTestResources.csproj +++ b/src/Compilers/Test/Resources/Core/CompilerTestResources.csproj @@ -129,10 +129,15 @@ + + + + + - + @@ -413,7 +418,6 @@ - diff --git a/src/Compilers/Test/Resources/Core/NetFX/Minimal/build.cmd b/src/Compilers/Test/Resources/Core/NetFX/Minimal/build.cmd index c072b187ae228..ba14a626bc9ea 100644 --- a/src/Compilers/Test/Resources/Core/NetFX/Minimal/build.cmd +++ b/src/Compilers/Test/Resources/Core/NetFX/Minimal/build.cmd @@ -1,3 +1,4 @@ -REM Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +@REM Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. csc /target:library /nostdlib /noconfig /keyfile:Key.snk /out:mincorlib.dll mincorlib.cs +csc /target:library /nostdlib /noconfig /keyfile:Key.snk /r:mincorlib.dll /out:minasync.dll minasync.cs diff --git a/src/Compilers/Test/Resources/Core/NetFX/Minimal/minasync.cs b/src/Compilers/Test/Resources/Core/NetFX/Minimal/minasync.cs new file mode 100644 index 0000000000000..d31e1f78056f8 --- /dev/null +++ b/src/Compilers/Test/Resources/Core/NetFX/Minimal/minasync.cs @@ -0,0 +1,125 @@ +using System; +using System.Threading.Tasks; +using System.Runtime.CompilerServices; + +namespace System +{ + public delegate void Action(); +} + +namespace System.Threading.Tasks +{ + public class Task : IAsyncResult, IDisposable + { + public Awaiter GetAwaiter() => null; + } + + public class Task : IAsyncResult, IDisposable + { + public Awaiter GetAwaiter() => null; + } + + public class Awaiter : INotifyCompletion + { + public void OnCompleted(Action continuation) { } + public bool IsCompleted => false; + public void GetResult() { } + } + + public class Awaiter : INotifyCompletion + { + public void OnCompleted(Action continuation) { } + public bool IsCompleted => false; + public T GetResult() => default(T); + } +} + +namespace System.Runtime.CompilerServices +{ + public interface INotifyCompletion + { + void OnCompleted(Action continuation); + } + + public interface ICriticalNotifyCompletion : INotifyCompletion + { + void UnsafeOnCompleted(Action continuation); + } + + public interface IAsyncStateMachine + { + void MoveNext(); + void SetStateMachine(IAsyncStateMachine stateMachine); + } + + public struct AsyncVoidMethodBuilder + { + public static AsyncVoidMethodBuilder Create() { throw null; } + public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine { } + public void SetStateMachine(IAsyncStateMachine stateMachine) { } + public void AwaitOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) + where TAwaiter : INotifyCompletion + where TStateMachine : IAsyncStateMachine + { + } + + public void AwaitUnsafeOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) + where TAwaiter : ICriticalNotifyCompletion + where TStateMachine : IAsyncStateMachine + { + } + + public void SetResult() { } + public void SetException(Exception exception) { } + } + + public struct AsyncTaskMethodBuilder + { + public static AsyncTaskMethodBuilder Create() { throw null; } + + public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine { } + + public void SetStateMachine(IAsyncStateMachine stateMachine) { } + + public void AwaitOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) + where TAwaiter : INotifyCompletion + where TStateMachine : IAsyncStateMachine + { + } + + public void AwaitUnsafeOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) + where TAwaiter : ICriticalNotifyCompletion + where TStateMachine : IAsyncStateMachine + { + } + + public Task Task => null; + public void SetResult() { } + public void SetException(Exception exception) { } + } + + public struct AsyncTaskMethodBuilder + { + public static AsyncTaskMethodBuilder Create() => default(AsyncTaskMethodBuilder); + + public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine { } + public void SetStateMachine(IAsyncStateMachine stateMachine) { } + public void AwaitOnCompleted( + ref TAwaiter awaiter, ref TStateMachine stateMachine) + where TAwaiter : INotifyCompletion + where TStateMachine : IAsyncStateMachine + { + } + + public void AwaitUnsafeOnCompleted( + ref TAwaiter awaiter, ref TStateMachine stateMachine) + where TAwaiter : ICriticalNotifyCompletion + where TStateMachine : IAsyncStateMachine + { + } + + public Task Task => null; + public void SetResult(TResult result) { } + public void SetException(Exception exception) { } + } +} diff --git a/src/Compilers/Test/Resources/Core/NetFX/Minimal/minasync.dll b/src/Compilers/Test/Resources/Core/NetFX/Minimal/minasync.dll new file mode 100644 index 0000000000000..f9e08aaab6530 Binary files /dev/null and b/src/Compilers/Test/Resources/Core/NetFX/Minimal/minasync.dll differ diff --git a/src/Compilers/Test/Resources/Core/TestResources.cs b/src/Compilers/Test/Resources/Core/TestResources.cs index 70962e72f1d07..efe625ef10834 100644 --- a/src/Compilers/Test/Resources/Core/TestResources.cs +++ b/src/Compilers/Test/Resources/Core/TestResources.cs @@ -162,6 +162,9 @@ public static class Minimal { private static byte[] s_mincorlib; public static byte[] mincorlib => ResourceLoader.GetOrCreateResource(ref s_mincorlib, "NetFX.Minimal.mincorlib.dll"); + + private static byte[] s_minasync; + public static byte[] minasync => ResourceLoader.GetOrCreateResource(ref s_minasync, "NetFX.Minimal.minasync.dll"); } } diff --git a/src/Compilers/Test/Resources/Core/project.lock.json b/src/Compilers/Test/Resources/Core/project.lock.json index 242fa6b4ff20b..c613ea62dee4f 100644 --- a/src/Compilers/Test/Resources/Core/project.lock.json +++ b/src/Compilers/Test/Resources/Core/project.lock.json @@ -11,7 +11,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -37,11 +37,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Test/Utilities/CSharp.Desktop/project.lock.json b/src/Compilers/Test/Utilities/CSharp.Desktop/project.lock.json index 947ebf51e538a..87f296a3c717e 100644 --- a/src/Compilers/Test/Utilities/CSharp.Desktop/project.lock.json +++ b/src/Compilers/Test/Utilities/CSharp.Desktop/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -386,11 +386,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs index 066e2df9cec87..c11f36191e8e7 100644 --- a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs +++ b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs @@ -20,6 +20,7 @@ using Xunit; using Roslyn.Test.Utilities; using Roslyn.Test.MetadataUtilities; +using Microsoft.CodeAnalysis.CSharp.Syntax; namespace Microsoft.CodeAnalysis.CSharp.Test.Utilities { @@ -520,6 +521,16 @@ public static CSharpCompilation CreateCompilation( options = options.WithConcurrentBuild(false); } +#if Test_IOperation_Interface + // Create a compilation for the purpose of verifying operation tree only, + // so this won't interfere with test. + var compilationForOperationWalking = CSharpCompilation.Create( + assemblyName == "" ? GetUniqueName() : assemblyName, + trees, + references, + options); + WalkOperationTree(compilationForOperationWalking); +#endif return CSharpCompilation.Create( assemblyName == "" ? GetUniqueName() : assemblyName, trees, @@ -535,13 +546,50 @@ public static CSharpCompilation CreateCompilation( CSharpParseOptions parseOptions = null) { var trees = (sources == null) ? null : sources.Select(s => Parse(s, options: parseOptions)).ToArray(); - var c = CSharpCompilation.Create(identity.Name, options: options ?? TestOptions.ReleaseDll, references: references, syntaxTrees: trees); + var compilationOptions = options ?? TestOptions.ReleaseDll; + +#if Test_IOperation_Interface + // Create a compilation for the purpose of verifying operation tree only, + // so this won't interfere with test. + var compilationForOperationWalking = CSharpCompilation.Create( + identity.Name, + options: compilationOptions, + references: references, + syntaxTrees: trees); + WalkOperationTree(compilationForOperationWalking); +#endif + + var c = CSharpCompilation.Create(identity.Name, options: compilationOptions, references: references, syntaxTrees: trees); Assert.NotNull(c.Assembly); // force creation of SourceAssemblySymbol ((SourceAssemblySymbol)c.Assembly).lazyAssemblyIdentity = identity; return c; } +#if Test_IOperation_Interface + private static void WalkOperationTree(CSharpCompilation compilation) + { + var operationWalker = TestOperationWalker.GetInstance(); + + foreach (var tree in compilation.SyntaxTrees) + { + var semanticModel = compilation.GetSemanticModel(tree); + var root = tree.GetRoot(); + + // TODO: check other operation root as well (property, etc.) + foreach (BaseMethodDeclarationSyntax methodNode in root.DescendantNodesAndSelf().OfType()) + { + var bodyNode = methodNode.Body; + if (bodyNode != null) + { + var operation = semanticModel.GetOperation(bodyNode); + operationWalker.Visit(operation); + } + } + } + } +#endif + public static CSharpCompilation CreateSubmissionWithExactReferences( string code, IEnumerable references = null, diff --git a/src/Compilers/Test/Utilities/CSharp/project.lock.json b/src/Compilers/Test/Utilities/CSharp/project.lock.json index 76bd3536ac2a6..5533067c2401e 100644 --- a/src/Compilers/Test/Utilities/CSharp/project.lock.json +++ b/src/Compilers/Test/Utilities/CSharp/project.lock.json @@ -245,7 +245,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1240,11 +1240,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb b/src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb index 0af87c75cd731..f902f694e2cd7 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/CompilationTestUtils.vb @@ -15,18 +15,55 @@ Imports Xunit Friend Module CompilationUtils + Public Function CreateCompilation(trees As IEnumerable(Of SyntaxTree), + Optional references As IEnumerable(Of MetadataReference) = Nothing, + Optional options As VisualBasicCompilationOptions = Nothing, + Optional assemblyName As String = Nothing) As VisualBasicCompilation + If options Is Nothing Then + options = TestOptions.ReleaseDll + End If + + ' Using single-threaded build if debugger attached, to simplify debugging. + If Debugger.IsAttached Then + options = options.WithConcurrentBuild(False) + End If + + Return VisualBasicCompilation.Create( + If(assemblyName, GetUniqueName()), + trees, + references, + options) + End Function + Public Function CreateCompilationWithMscorlib(sourceTrees As IEnumerable(Of String), Optional references As IEnumerable(Of MetadataReference) = Nothing, Optional options As VisualBasicCompilationOptions = Nothing, Optional assemblyName As String = Nothing, Optional parseOptions As VisualBasicParseOptions = Nothing) As VisualBasicCompilation - Return VisualBasicCompilation.Create(If(assemblyName, "Test"), sourceTrees.Select(Function(s) VisualBasicSyntaxTree.ParseText(s, parseOptions)), If(references Is Nothing, {MscorlibRef}, {MscorlibRef}.Concat(references)), options) + + Dim syntaxTrees = sourceTrees.Select(Function(s) VisualBasicSyntaxTree.ParseText(s, parseOptions)) + Dim metadataReferences = If(references Is Nothing, {MscorlibRef}, {MscorlibRef}.Concat(references)) + +#If Test_IOperation_Interface Then + Dim compilationForOperationWalking = VisualBasicCompilation.Create(If(assemblyName, "TestOperation"), syntaxTrees, metadataReferences, options) + WalkOperationTrees(compilationForOperationWalking) +#End If + + Return VisualBasicCompilation.Create(If(assemblyName, "Test"), syntaxTrees, metadataReferences, options) End Function Public Function CreateCompilationWithMscorlib(sourceTrees As IEnumerable(Of SyntaxTree), Optional references As IEnumerable(Of MetadataReference) = Nothing, Optional options As VisualBasicCompilationOptions = Nothing) As VisualBasicCompilation - Return VisualBasicCompilation.Create(GetUniqueName(), sourceTrees, If(references Is Nothing, {MscorlibRef}, {MscorlibRef}.Concat(references)), options) + + Dim metadataReferences = If(references Is Nothing, {MscorlibRef}, {MscorlibRef}.Concat(references)) + +#If Test_IOperation_Interface Then + Dim compilationForOperationWalking = VisualBasicCompilation.Create(GetUniqueName(), sourceTrees, metadataReferences, options) + WalkOperationTrees(compilationForOperationWalking) +#End If + + Return VisualBasicCompilation.Create(GetUniqueName(), sourceTrees, metadataReferences, options) End Function Public Function CreateCompilationWithMscorlib45(sourceTrees As IEnumerable(Of SyntaxTree), @@ -223,6 +260,11 @@ Friend Module CompilationUtils End If End If +#If Test_IOperation_Interface Then + Dim compilationForOperationWalking = VisualBasicCompilation.Create(If(assemblyName, GetUniqueName()), sourceTrees, references, options) + WalkOperationTrees(compilationForOperationWalking) +#End If + Return VisualBasicCompilation.Create(If(assemblyName, GetUniqueName()), sourceTrees, references, options) End Function @@ -254,6 +296,27 @@ Friend Module CompilationUtils Return c End Function +#If Test_IOperation_Interface Then + Private Sub WalkOperationTrees(compilation As VisualBasicCompilation) + Dim operationWalker = TestOperationWalker.GetInstance() + + For Each tree In compilation.SyntaxTrees + Dim semanticModel = compilation.GetSemanticModel(tree) + Dim root = tree.GetRoot() + + ' need to check other operation root as well (property, etc) + For Each methodNode As MethodBlockBaseSyntax In root.DescendantNodesAndSelf().OfType(Of MethodBlockBaseSyntax) + ' Have to iterate through statements because a bug: + ' https://github.com/dotnet/roslyn/issues/8919 + For Each statement In methodNode.Statements + Dim operation = semanticModel.GetOperation(statement) + operationWalker.Visit(operation) + Next + Next + Next + End Sub +#End If + ''' ''' ''' diff --git a/src/Compilers/Test/Utilities/VisualBasic/MockSymbols.vb b/src/Compilers/Test/Utilities/VisualBasic/MockSymbols.vb index edc5bdef89521..3ebd309e2dc63 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/MockSymbols.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/MockSymbols.vb @@ -735,12 +735,6 @@ Friend Class MockAssemblySymbol End Get End Property - Public Overrides ReadOnly Property AssemblyVersionPattern As Version - Get - Return Nothing - End Get - End Property - Public Overloads Overrides Function GetAttributes() As ImmutableArray(Of VisualBasicAttributeData) Return ImmutableArray.Create(Of VisualBasicAttributeData)() End Function diff --git a/src/Compilers/Test/Utilities/VisualBasic/project.lock.json b/src/Compilers/Test/Utilities/VisualBasic/project.lock.json index 947ebf51e538a..87f296a3c717e 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/project.lock.json +++ b/src/Compilers/Test/Utilities/VisualBasic/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -386,11 +386,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/VisualBasic/Portable/BoundTree/Expression.vb b/src/Compilers/VisualBasic/Portable/BoundTree/Expression.vb index 5a013531af455..293f216dfb22c 100644 --- a/src/Compilers/VisualBasic/Portable/BoundTree/Expression.vb +++ b/src/Compilers/VisualBasic/Portable/BoundTree/Expression.vb @@ -739,6 +739,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return BinaryOperationKind.OperatorMethodMultiply Case BinaryOperatorKind.Divide Return BinaryOperationKind.OperatorMethodDivide + Case BinaryOperatorKind.IntegerDivide + Return BinaryOperationKind.OperatorMethodIntegerDivide Case BinaryOperatorKind.Modulo Return BinaryOperationKind.OperatorMethodRemainder Case BinaryOperatorKind.And diff --git a/src/Compilers/VisualBasic/Portable/CommandLine/VisualBasicCommandLineParser.vb b/src/Compilers/VisualBasic/Portable/CommandLine/VisualBasicCommandLineParser.vb index 6d3b4bd6d5df8..59b417706a386 100644 --- a/src/Compilers/VisualBasic/Portable/CommandLine/VisualBasicCommandLineParser.vb +++ b/src/Compilers/VisualBasic/Portable/CommandLine/VisualBasicCommandLineParser.vb @@ -1191,6 +1191,11 @@ lVbRuntimePlus: ' Build search path Dim searchPaths As ImmutableArray(Of String) = BuildSearchPaths(baseDirectory, sdkPaths, responsePaths, libPaths) + ' Public sign doesn't use legacy search path settings + If publicSign AndAlso Not String.IsNullOrWhiteSpace(keyFileSetting) Then + keyFileSetting = ParseGenericPathToFile(keyFileSetting, diagnostics, baseDirectory) + End If + ValidateWin32Settings(noWin32Manifest, win32ResourceFile, win32IconFile, win32ManifestFile, outputKind, diagnostics) ' Validate root namespace if specified diff --git a/src/Compilers/VisualBasic/Portable/Emit/AssemblyReference.vb b/src/Compilers/VisualBasic/Portable/Emit/AssemblyReference.vb index c0107c9008af0..a44226497732e 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/AssemblyReference.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/AssemblyReference.vb @@ -23,12 +23,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit End Get End Property - Public ReadOnly Property AssemblyVersionPattern As Version Implements Cci.IAssemblyReference.AssemblyVersionPattern - Get - Return _targetAssembly.AssemblyVersionPattern - End Get - End Property - Private Sub IReferenceDispatch(visitor As Cci.MetadataVisitor) Implements Cci.IReference.Dispatch visitor.Visit(DirectCast(Me, Cci.IAssemblyReference)) End Sub diff --git a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/EmitHelpers.vb b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/EmitHelpers.vb index 19725e12a68bf..054a701d503d9 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/EmitHelpers.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/EmitHelpers.vb @@ -28,7 +28,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Try moduleVersionId = baseline.OriginalMetadata.GetModuleVersionId() Catch ex As BadImageFormatException - ' https://github.com/dotnet/roslyn/issues/8910: ' Return MakeEmitResult(success:=False, diagnostics:= ..., baseline:=Nothing) Throw End Try @@ -41,9 +40,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Dim serializationProperties = compilation.ConstructModuleSerializationProperties(emitOpts, runtimeMDVersion, moduleVersionId) Dim manifestResources = SpecializedCollections.EmptyEnumerable(Of ResourceDescription)() - Dim moduleBeingBuilt As PEDeltaAssemblyBuilder - Try - moduleBeingBuilt = New PEDeltaAssemblyBuilder( + Dim moduleBeingBuilt = New PEDeltaAssemblyBuilder( compilation.SourceAssembly, emitOptions:=emitOpts, outputKind:=compilation.Options.OutputKind, @@ -52,11 +49,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit previousGeneration:=baseline, edits:=edits, isAddedSymbol:=isAddedSymbol) - Catch e As NotSupportedException - ' TODO: better error code (https://github.com/dotnet/roslyn/issues/8910) - diagnostics.Add(ERRID.ERR_ModuleEmitFailure, NoLocation.Singleton, compilation.AssemblyName) - Return New EmitDifferenceResult(success:=False, diagnostics:=diagnostics.ToReadOnlyAndFree(), baseline:=Nothing) - End Try If testData IsNot Nothing Then moduleBeingBuilt.SetMethodTestData(testData.Methods) diff --git a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/PEDeltaAssemblyBuilder.vb b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/PEDeltaAssemblyBuilder.vb index 19ab9a046d34b..40546eb6c5db4 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/PEDeltaAssemblyBuilder.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/PEDeltaAssemblyBuilder.vb @@ -33,11 +33,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit MyBase.New(sourceAssembly, emitOptions, outputKind, serializationProperties, manifestResources, additionalTypes:=ImmutableArray(Of NamedTypeSymbol).Empty) Dim initialBaseline = previousGeneration.InitialBaseline + Dim context = New EmitContext(Me, Nothing, New DiagnosticBag()) ' Hydrate symbols from initial metadata. Once we do so it is important to reuse these symbols across all generations, ' in order for the symbol matcher to be able to use reference equality once it maps symbols to initial metadata. - Dim metadataSymbols = GetOrCreateMetadataSymbols(initialBaseline, sourceAssembly.DeclaringCompilation) + Dim metadataSymbols = GetMetadataSymbols(initialBaseline, sourceAssembly.DeclaringCompilation) Dim metadataDecoder = DirectCast(metadataSymbols.MetadataDecoder, MetadataDecoder) Dim metadataAssembly = DirectCast(metadataDecoder.ModuleSymbol.ContainingAssembly, PEAssemblySymbol) @@ -90,7 +91,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit End Get End Property - Private Function GetOrCreateMetadataSymbols(initialBaseline As EmitBaseline, compilation As VisualBasicCompilation) As EmitBaseline.MetadataSymbols + Private Function GetMetadataSymbols(initialBaseline As EmitBaseline, compilation As VisualBasicCompilation) As EmitBaseline.MetadataSymbols If initialBaseline.LazyMetadataSymbols IsNot Nothing Then Return initialBaseline.LazyMetadataSymbols End If @@ -101,11 +102,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit ' We need to transfer the references from the current source compilation but don't need its syntax trees. Dim metadataCompilation = compilation.RemoveAllSyntaxTrees() - Dim assemblyReferenceIdentityMap As ImmutableDictionary(Of AssemblyIdentity, AssemblyIdentity) = Nothing - Dim metadataAssembly = metadataCompilation.GetBoundReferenceManager().CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata.Create(originalMetadata), MetadataImportOptions.All, assemblyReferenceIdentityMap) + Dim metadataAssembly = metadataCompilation.GetBoundReferenceManager().CreatePEAssemblyForAssemblyMetadata(AssemblyMetadata.Create(originalMetadata), MetadataImportOptions.All) Dim metadataDecoder = New MetadataDecoder(metadataAssembly.PrimaryModule) Dim metadataAnonymousTypes = GetAnonymousTypeMapFromMetadata(originalMetadata.MetadataReader, metadataDecoder) - Dim metadataSymbols = New EmitBaseline.MetadataSymbols(metadataAnonymousTypes, metadataDecoder, assemblyReferenceIdentityMap) + Dim metadataSymbols = New EmitBaseline.MetadataSymbols(metadataAnonymousTypes, metadataDecoder) Return InterlockedOperations.Initialize(initialBaseline.LazyMetadataSymbols, metadataSymbols) End Function diff --git a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicDefinitionMap.vb b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicDefinitionMap.vb index 060e094e8ef49..909b8cfafe8be 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicDefinitionMap.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicDefinitionMap.vb @@ -32,6 +32,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Me._metadataDecoder = metadataDecoder End Sub + Friend Overrides ReadOnly Property MessageProvider As CommonMessageProvider + Get + Return VisualBasic.MessageProvider.Instance + End Get + End Property + Friend Function TryGetAnonymousTypeName(template As NamedTypeSymbol, ByRef name As String, ByRef index As Integer) As Boolean Return Me.mapToPrevious.TryGetAnonymousTypeName(template, name, index) End Function diff --git a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicSymbolMatcher.vb b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicSymbolMatcher.vb index 4e34a8fbd8f8f..100a4c528662e 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicSymbolMatcher.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/EditAndContinue/VisualBasicSymbolMatcher.vb @@ -330,14 +330,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Return _otherAssembly End If - ' find a referenced assembly with the exactly same source identity: + ' find a referenced assembly with the exactly same identity: For Each otherReferencedAssembly In _otherAssembly.Modules(0).ReferencedAssemblySymbols - Dim identity = symbol.Identity - Dim otherIdentity = otherReferencedAssembly.Identity - - If AssemblyIdentityComparer.SimpleNameComparer.Equals(identity.Name, otherIdentity.Name) AndAlso - If(symbol.AssemblyVersionPattern, symbol.Identity.Version).Equals(If(otherReferencedAssembly.AssemblyVersionPattern, symbol.Identity.Version)) AndAlso - AssemblyIdentity.EqualIgnoringNameAndVersion(identity, otherIdentity) Then + If symbol.Identity.Equals(otherReferencedAssembly.Identity) Then Return otherReferencedAssembly End If Next diff --git a/src/Compilers/VisualBasic/Portable/Emit/PEAssemblyBuilder.vb b/src/Compilers/VisualBasic/Portable/Emit/PEAssemblyBuilder.vb index 7dadc182d3709..c3130f48dd745 100644 --- a/src/Compilers/VisualBasic/Portable/Emit/PEAssemblyBuilder.vb +++ b/src/Compilers/VisualBasic/Portable/Emit/PEAssemblyBuilder.vb @@ -135,18 +135,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit Next End Sub - Private ReadOnly Property Identity As AssemblyIdentity Implements Cci.IAssemblyReference.Identity + Private ReadOnly Property Identity As AssemblyIdentity Implements Cci.IAssembly.Identity Get Return m_SourceAssembly.Identity End Get End Property - Private ReadOnly Property AssemblyVersionPattern As Version Implements Cci.IAssemblyReference.AssemblyVersionPattern - Get - Return m_SourceAssembly.AssemblyVersionPattern - End Get - End Property - Friend Overrides ReadOnly Property Name As String Get Return _metadataName diff --git a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb index fc0af6f3fd487..a6b69efb851cc 100644 --- a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb +++ b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb @@ -1682,6 +1682,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ERR_InvalidPathMap = 37253 ERR_PublicSignNoKey = 37254 ERR_TooManyUserStrings = 37255 + ERR_PeWritingFailure = 37256 ERR_LastPlusOne diff --git a/src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb b/src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb index b1a90827c2c42..89a95f260994c 100644 --- a/src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb +++ b/src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb @@ -236,6 +236,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End Get End Property + Public Overrides ReadOnly Property ERR_MutuallyExclusiveOptions As Integer + Get + Return ERRID.ERR_MutuallyExclusiveOptions + End Get + End Property + ' emit options: Public Overrides ReadOnly Property ERR_InvalidDebugInformationFormat As Integer @@ -480,6 +486,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return ERRID.ERR_TooManyUserStrings End Get End Property + + Public Overrides ReadOnly Property ERR_PeWritingFailure As Integer + Get + Return ERRID.ERR_PeWritingFailure + End Get + End Property + + Public Overrides ReadOnly Property ERR_ModuleEmitFailure As Integer + Get + Return ERRID.ERR_ModuleEmitFailure + End Get + End Property End Class End Namespace diff --git a/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.AsyncMethodToClassRewriter.vb b/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.AsyncMethodToClassRewriter.vb index e414d94ced74a..5f93500af77a9 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.AsyncMethodToClassRewriter.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.AsyncMethodToClassRewriter.vb @@ -95,7 +95,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' to find the previous awaiter field. If Not Me._awaiterFields.TryGetValue(awaiterType, result) Then Dim slotIndex As Integer = -1 - If Me.SlotAllocatorOpt Is Nothing OrElse Not Me.SlotAllocatorOpt.TryGetPreviousAwaiterSlotIndex(F.CompilationState.ModuleBuilderOpt.Translate(awaiterType, F.Syntax, F.Diagnostics), slotIndex) Then + If Me.SlotAllocatorOpt Is Nothing OrElse Not Me.SlotAllocatorOpt.TryGetPreviousAwaiterSlotIndex(F.CompilationState.ModuleBuilderOpt.Translate(awaiterType, F.Syntax, F.Diagnostics), F.Diagnostics, slotIndex) Then slotIndex = _nextAwaiterId _nextAwaiterId = _nextAwaiterId + 1 End If diff --git a/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.vb b/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.vb index e64c88d246bcb..76d93930c0806 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/AsyncRewriter/AsyncRewriter.vb @@ -295,11 +295,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Friend Overrides Function EnsureAllSymbolsAndSignature() As Boolean Dim hasErrors As Boolean = MyBase.EnsureAllSymbolsAndSignature - ' NOTE: in current implementation these attributes must exist - ' TODO: change to "don't use if not found" - EnsureWellKnownMember(Of MethodSymbol)(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor, hasErrors) - EnsureWellKnownMember(Of MethodSymbol)(WellKnownMember.System_Diagnostics_DebuggerHiddenAttribute__ctor, hasErrors) - EnsureSpecialType(SpecialType.System_Object, hasErrors) EnsureSpecialType(SpecialType.System_Void, hasErrors) EnsureSpecialType(SpecialType.System_ValueType, hasErrors) diff --git a/src/Compilers/VisualBasic/Portable/Lowering/IteratorRewriter/IteratorRewriter.vb b/src/Compilers/VisualBasic/Portable/Lowering/IteratorRewriter/IteratorRewriter.vb index 131fa293928b5..9441b00850508 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/IteratorRewriter/IteratorRewriter.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/IteratorRewriter/IteratorRewriter.vb @@ -86,11 +86,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic hasErrors = True End If - ' NOTE: in current implementation these attributes must exist - ' TODO: change to "don't use if not found" - EnsureWellKnownMember(Of MethodSymbol)(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor, hasErrors) - EnsureWellKnownMember(Of MethodSymbol)(WellKnownMember.System_Diagnostics_DebuggerNonUserCodeAttribute__ctor, hasErrors) - ' NOTE: We don't ensure DebuggerStepThroughAttribute, it is just not emitted if not found ' EnsureWellKnownMember(Of MethodSymbol)(WellKnownMember.System_Diagnostics_DebuggerStepThroughAttribute__ctor, hasErrors) diff --git a/src/Compilers/VisualBasic/Portable/Lowering/StateMachineRewriter/StateMachineRewriter.vb b/src/Compilers/VisualBasic/Portable/Lowering/StateMachineRewriter/StateMachineRewriter.vb index 53fcb7ff6f9f0..117dc98876423 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/StateMachineRewriter/StateMachineRewriter.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/StateMachineRewriter/StateMachineRewriter.vb @@ -295,7 +295,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic id = New LocalDebugId(syntaxOffset, ordinal) Dim previousSlotIndex = -1 - If SlotAllocatorOpt IsNot Nothing AndAlso SlotAllocatorOpt.TryGetPreviousHoistedLocalSlotIndex(declaratorSyntax, F.CompilationState.ModuleBuilderOpt.Translate(fieldType, declaratorSyntax, Diagnostics), local.SynthesizedKind, id, previousSlotIndex) Then + If SlotAllocatorOpt IsNot Nothing AndAlso SlotAllocatorOpt.TryGetPreviousHoistedLocalSlotIndex(declaratorSyntax, + F.CompilationState.ModuleBuilderOpt.Translate(fieldType, declaratorSyntax, Diagnostics), + local.SynthesizedKind, + id, + Diagnostics, + previousSlotIndex) Then slotIndex = previousSlotIndex End If End If diff --git a/src/Compilers/VisualBasic/Portable/Symbols/AssemblySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/AssemblySymbol.vb index a66ac607e0930..4ddfde15cf9bf 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/AssemblySymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/AssemblySymbol.vb @@ -16,7 +16,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ''' Friend MustInherit Class AssemblySymbol Inherits Symbol - Implements IAssemblySymbolInternal + Implements IAssemblySymbol ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ' Changes to the public interface of this class should remain synchronized with the C# version of Symbol. @@ -90,8 +90,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ''' Public MustOverride ReadOnly Property Identity As AssemblyIdentity Implements IAssemblySymbol.Identity - Public MustOverride ReadOnly Property AssemblyVersionPattern As Version Implements IAssemblySymbolInternal.AssemblyVersionPattern - ''' ''' Target architecture of the machine. ''' diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Metadata/PE/PEAssemblySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Metadata/PE/PEAssemblySymbol.vb index 5c88773cacf88..39371d1602fea 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Metadata/PE/PEAssemblySymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Metadata/PE/PEAssemblySymbol.vb @@ -91,13 +91,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols.Metadata.PE End Get End Property - Public Overrides ReadOnly Property AssemblyVersionPattern As Version - Get - ' TODO: https://github.com/dotnet/roslyn/issues/9000 - Return Nothing - End Get - End Property - Friend Overrides ReadOnly Property PublicKey As ImmutableArray(Of Byte) Get Return _assembly.Identity.PublicKey diff --git a/src/Compilers/VisualBasic/Portable/Symbols/MissingAssemblySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/MissingAssemblySymbol.vb index 50953345cef21..cd7e444dfbe61 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/MissingAssemblySymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/MissingAssemblySymbol.vb @@ -52,12 +52,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property - Public Overrides ReadOnly Property AssemblyVersionPattern As Version - Get - Return Nothing - End Get - End Property - Friend Overrides ReadOnly Property PublicKey As ImmutableArray(Of Byte) Get Return Identity.PublicKey diff --git a/src/Compilers/VisualBasic/Portable/Symbols/ReferenceManager.vb b/src/Compilers/VisualBasic/Portable/Symbols/ReferenceManager.vb index c436a32fc90ea..fbc7315e37ab9 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/ReferenceManager.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/ReferenceManager.vb @@ -1,7 +1,6 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports System.Collections.Immutable -Imports System.Runtime.InteropServices Imports Microsoft.CodeAnalysis.Collections Imports Microsoft.CodeAnalysis.VisualBasic.Emit Imports Microsoft.CodeAnalysis.VisualBasic.Symbols @@ -174,56 +173,32 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Debug.Assert(compilation._lazyAssemblySymbol IsNot Nothing) End Sub - ''' - ''' Creates a from specified metadata. - ''' - ''' - ''' Used by EnC to create symbols for emit baseline. The PE symbols are used by . - ''' - ''' The assembly references listed in the metadata AssemblyRef table are matched to the resolved references - ''' stored on this . We assume that the dependencies of the baseline metadata are - ''' the same as the dependencies of the current compilation. This is not exactly true when the dependencies use - ''' time-based versioning pattern, e.g. AssemblyVersion("1.0.*"). In that case we assume only the version - ''' changed And nothing else. - ''' - ''' Each AssemblyRef is matched against the assembly identities using an exact equality comparison modulo version. - ''' AssemblyRef with lower version in metadata is matched to a PE assembly symbol with the higher version - ''' (provided that the assembly name, culture, PKT And flags are the same) if there is no symbol with the exactly matching version. - ''' If there are multiple symbols with higher versions selects the one with the minimal version among them. - ''' - ''' Matching to a higher version is necessary to support EnC for projects whose P2P dependencies use time-based versioning pattern. - ''' The versions of the dependent projects seen from the IDE will be higher than - ''' the one written in the metadata at the time their respective baselines are built. - ''' - ''' No other unification or further resolution is performed. - ''' - ''' - ''' - ''' - ''' A map of the PE assembly symbol identities to the identities of the original metadata AssemblyRefs. - ''' This map will be used in emit when serializing AssemblyRef table of the delta. For the delta to be compatible with - ''' the original metadata we need to map the identities of the PE assembly symbols back to the original AssemblyRefs (if different). - ''' In other words, we pretend that the versions of the dependencies haven't changed. - ''' - Friend Function CreatePEAssemblyForAssemblyMetadata(metadata As AssemblyMetadata, importOptions As MetadataImportOptions, ByRef assemblyReferenceIdentityMap As ImmutableDictionary(Of AssemblyIdentity, AssemblyIdentity)) As PEAssemblySymbol + ''' + ''' Creates a from specified metadata. + ''' + ''' + ''' Used by EnC to create symbols for emit baseline. The PE symbols are used by . + ''' + ''' The assembly references listed in the metadata AssemblyRef table are matched to the resolved references + ''' stored on this . Each AssemblyRef is matched against the assembly identities + ''' using an exact equality comparison. No unification Or further resolution is performed. + ''' + Friend Function CreatePEAssemblyForAssemblyMetadata(metadata As AssemblyMetadata, importOptions As MetadataImportOptions) As PEAssemblySymbol AssertBound() ' If the compilation has a reference from metadata to source assembly we can't share the referenced PE symbols. Debug.Assert(Not HasCircularReference) - Dim referencedAssembliesByIdentity = New AssemblyIdentityMap(Of AssemblySymbol)() + Dim referencedAssembliesByIdentity = New Dictionary(Of AssemblyIdentity, AssemblySymbol)() For Each symbol In Me.ReferencedAssemblies referencedAssembliesByIdentity.Add(symbol.Identity, symbol) Next Dim assembly = metadata.GetAssembly Dim peReferences = assembly.AssemblyReferences.SelectAsArray(AddressOf MapAssemblyIdentityToResolvedSymbol, referencedAssembliesByIdentity) - - assemblyReferenceIdentityMap = GetAssemblyReferenceIdentityBaselineMap(peReferences, assembly.AssemblyReferences) - Dim assemblySymbol = New PEAssemblySymbol(assembly, DocumentationProvider.Default, isLinked:=False, importOptions:=importOptions) - Dim unifiedAssemblies = Me.UnifiedAssemblies.WhereAsArray(Function(unified) referencedAssembliesByIdentity.Contains(unified.OriginalReference, allowHigherVersion:=False)) + Dim unifiedAssemblies = Me.UnifiedAssemblies.WhereAsArray(Function(unified) referencedAssembliesByIdentity.ContainsKey(unified.OriginalReference)) InitializeAssemblyReuseData(assemblySymbol, peReferences, unifiedAssemblies) If assembly.ContainsNoPiaLocalTypes() Then @@ -233,17 +208,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return assemblySymbol End Function - Private Shared Function MapAssemblyIdentityToResolvedSymbol(identity As AssemblyIdentity, map As AssemblyIdentityMap(Of AssemblySymbol)) As AssemblySymbol + Private Shared Function MapAssemblyIdentityToResolvedSymbol(identity As AssemblyIdentity, map As Dictionary(Of AssemblyIdentity, AssemblySymbol)) As AssemblySymbol Dim symbol As AssemblySymbol = Nothing - If map.TryGetValue(identity, symbol, AddressOf CompareVersionPartsSpecifiedInSource) Then + If map.TryGetValue(identity, symbol) Then Return symbol End If - - If map.TryGetValue(identity, symbol, Function(v1, v2, s) True) Then - ' TODO: https://github.com/dotnet/roslyn/issues/9004 - Throw New NotSupportedException($"Changing the version of an assembly reference is not allowed during debugging: '{identity}' changed version to {symbol.Identity.Version}") - End If - Return New MissingAssemblySymbol(identity) End Function @@ -426,7 +395,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic referencedModulesMap, boundReferenceDirectiveMap, boundReferenceDirectives, - explicitReferences, + ExplicitReferences, implicitlyResolvedReferences, hasCircularReference, resolutionDiagnostics.ToReadOnly(), diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Retargeting/RetargetingAssemblySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Retargeting/RetargetingAssemblySymbol.vb index 1b061da069dc7..81b802e4f9a33 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Retargeting/RetargetingAssemblySymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Retargeting/RetargetingAssemblySymbol.vb @@ -125,12 +125,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols.Retargeting End Get End Property - Public Overrides ReadOnly Property AssemblyVersionPattern As Version - Get - Return _underlyingAssembly.AssemblyVersionPattern - End Get - End Property - Friend Overrides ReadOnly Property PublicKey As ImmutableArray(Of Byte) Get Return _underlyingAssembly.PublicKey diff --git a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb index 4920b45d5aa14..15880c393dd3b 100644 --- a/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb +++ b/src/Compilers/VisualBasic/Portable/Symbols/Source/SourceAssemblySymbol.vb @@ -729,10 +729,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property - ''' - ''' Raw assembly version as specified in the AssemblyVersionAttribute, or Nothing if none specified. - ''' If the string passed to AssemblyVersionAttribute contains * the version build and/or revision numbers are set to . - ''' Private ReadOnly Property AssemblyVersionAttributeSetting As Version Get Dim defaultValue As Version = Nothing @@ -754,13 +750,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property - Public Overrides ReadOnly Property AssemblyVersionPattern As Version - Get - Dim attributeValue = AssemblyVersionAttributeSetting - Return If(attributeValue Is Nothing OrElse (attributeValue.Build <> UShort.MaxValue AndAlso attributeValue.Revision <> UShort.MaxValue), Nothing, attributeValue) - End Get - End Property - Friend ReadOnly Property AssemblyHashAlgorithm As AssemblyHashAlgorithm Get Return If(AssemblyAlgorithmIdAttributeSetting, AssemblyHashAlgorithm.Sha1) @@ -1412,7 +1401,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End Get End Property - Friend Overrides Sub AddSynthesizedAttributes(compilationState As ModuleCompilationState, ByRef attributes As ArrayBuilder(Of SynthesizedAttributeData)) + Friend Overrides Sub AddSynthesizedAttributes(compilationState as ModuleCompilationState, ByRef attributes As ArrayBuilder(Of SynthesizedAttributeData)) MyBase.AddSynthesizedAttributes(compilationState, attributes) Debug.Assert(_lazyEmitExtensionAttribute <> ThreeState.Unknown) @@ -1598,10 +1587,32 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols ' make sure keycontainer and keyfile attribute contents fields will be set EnsureAttributesAreBound() - ' when both attributes and command-line options specified, cmd line wins. + ' Creating strong names is a potentially expensive operation, so we will check + ' if keys could have been created and published already. + If _lazyStrongNameKeys IsNot Nothing Then + Return + End If + Dim keys As StrongNameKeys Dim keyFile As String = _compilation.Options.CryptoKeyFile + ' Public sign requires a keyfile + If DeclaringCompilation.Options.PublicSign Then + If Not String.IsNullOrEmpty(keyFile) AndAlso Not PathUtilities.IsAbsolute(keyFile) Then + ' If keyFile has a relative path then there should be a diagnostic + ' about it + Debug.Assert(Not DeclaringCompilation.Options.Errors.IsEmpty) + keys = StrongNameKeys.None + Else + keys = StrongNameKeys.Create(keyFile, MessageProvider.Instance) + End If + + ' Public signing doesn't require a strong name provider to be used. + Interlocked.CompareExchange(_lazyStrongNameKeys, keys, Nothing) + Return + End If + + ' when both attributes and command-line options specified, cmd line wins. If String.IsNullOrEmpty(keyFile) Then keyFile = Me.AssemblyKeyFileAttributeSetting @@ -1620,19 +1631,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols End If End If - ' Creating strong names is a potentially expensive operation, so we will check again here - ' if keys could have been created and published already. - If _lazyStrongNameKeys Is Nothing Then - Dim keys As StrongNameKeys - - ' Public signing doesn't require a strong name provider to be used. - If DeclaringCompilation.Options.PublicSign AndAlso keyFile IsNot Nothing Then - keys = StrongNameKeys.Create(keyFile, MessageProvider.Instance) - Else - keys = StrongNameKeys.Create(DeclaringCompilation.Options.StrongNameProvider, keyFile, keyContainer, MessageProvider.Instance) - End If - Interlocked.CompareExchange(_lazyStrongNameKeys, keys, Nothing) - End If + keys = StrongNameKeys.Create(DeclaringCompilation.Options.StrongNameProvider, keyFile, keyContainer, MessageProvider.Instance) + Interlocked.CompareExchange(_lazyStrongNameKeys, keys, Nothing) End Sub Private Function ComputeIdentity() As AssemblyIdentity @@ -1640,7 +1640,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols EnsureAttributesAreBound() Return New AssemblyIdentity(_assemblySimpleName, - VersionHelper.GenerateVersionFromPatternAndCurrentTime(Me.AssemblyVersionAttributeSetting), + Me.AssemblyVersionAttributeSetting, Me.AssemblyCultureAttributeSetting, StrongNameKeys.PublicKey, hasPublicKey:=Not StrongNameKeys.PublicKey.IsDefault) diff --git a/src/Compilers/VisualBasic/Portable/VBResources.Designer.vb b/src/Compilers/VisualBasic/Portable/VBResources.Designer.vb index 10b0cca19ce72..1591f978b39f9 100644 --- a/src/Compilers/VisualBasic/Portable/VBResources.Designer.vb +++ b/src/Compilers/VisualBasic/Portable/VBResources.Designer.vb @@ -9009,6 +9009,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End Get End Property + ''' + ''' Looks up a localized string similar to An error occurred while writing the output file: {0}. + ''' + Friend ReadOnly Property ERR_PeWritingFailure() As String + Get + Return ResourceManager.GetString("ERR_PeWritingFailure", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Cannot embed interop types from assembly '{0}' because it is missing the '{1}' attribute.. ''' diff --git a/src/Compilers/VisualBasic/Portable/VBResources.resx b/src/Compilers/VisualBasic/Portable/VBResources.resx index 3bb50287be914..6639035a3ed32 100644 --- a/src/Compilers/VisualBasic/Portable/VBResources.resx +++ b/src/Compilers/VisualBasic/Portable/VBResources.resx @@ -5353,4 +5353,7 @@ Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string or XML literals. - \ No newline at end of file + + An error occurred while writing the output file: {0} + + diff --git a/src/Compilers/VisualBasic/Portable/VisualBasicCompilationOptions.vb b/src/Compilers/VisualBasic/Portable/VisualBasicCompilationOptions.vb index 5d1a25e04e266..6a6785bc6976f 100644 --- a/src/Compilers/VisualBasic/Portable/VisualBasicCompilationOptions.vb +++ b/src/Compilers/VisualBasic/Portable/VisualBasicCompilationOptions.vb @@ -878,6 +878,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End Function Friend Overrides Sub ValidateOptions(builder As ArrayBuilder(Of Diagnostic)) + ValidateOptions(builder, MessageProvider.Instance) + If Me.EmbedVbCoreRuntime AndAlso Me.OutputKind.IsNetModule() Then builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_VBCoreNetModuleConflict)) End If @@ -925,20 +927,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' TODO: add check for ' (kind == 'arm' || kind == 'appcontainer' || kind == 'winmdobj') && ' (version >= "6.2") - - If Not CryptoPublicKey.IsEmpty Then - If CryptoKeyFile IsNot Nothing Then - builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_MutuallyExclusiveOptions, NameOf(CryptoPublicKey), NameOf(CryptoKeyFile))) - End If - - If CryptoKeyContainer IsNot Nothing Then - builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_MutuallyExclusiveOptions, NameOf(CryptoPublicKey), NameOf(CryptoKeyContainer))) - End If - End If - - If PublicSign AndAlso DelaySign = True Then - builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_MutuallyExclusiveOptions, NameOf(PublicSign), NameOf(DelaySign))) - End If End Sub ''' diff --git a/src/Compilers/VisualBasic/Portable/project.lock.json b/src/Compilers/VisualBasic/Portable/project.lock.json index 242fa6b4ff20b..c613ea62dee4f 100644 --- a/src/Compilers/VisualBasic/Portable/project.lock.json +++ b/src/Compilers/VisualBasic/Portable/project.lock.json @@ -11,7 +11,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -37,11 +37,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb b/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb index da73a9dd11c06..d45a1750e7232 100644 --- a/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb +++ b/src/Compilers/VisualBasic/Test/CommandLine/CommandLineTests.vb @@ -7512,6 +7512,15 @@ End Class Assert.False(args.CompilationOptions.PublicSign) End Sub + + + + Public Sub PublicSign_KeyFileRelativePath() + Dim parsedArgs = FullParse("/publicsign /keyfile:test.snk a.cs", _baseDirectory) + Assert.Equal(Path.Combine(_baseDirectory, "test.snk"), parsedArgs.CompilationOptions.CryptoKeyFile) + parsedArgs.Errors.Verify() + End Sub + Public Sub CommandLineMisc() Dim args As VisualBasicCommandLineArguments diff --git a/src/Compilers/VisualBasic/Test/CommandLine/project.lock.json b/src/Compilers/VisualBasic/Test/CommandLine/project.lock.json index 9d274517c8b37..fc89de5fb5530 100644 --- a/src/Compilers/VisualBasic/Test/CommandLine/project.lock.json +++ b/src/Compilers/VisualBasic/Test/CommandLine/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_Synthesized.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_Synthesized.vb index 3dde08e23211e..3ab2983af372c 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_Synthesized.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_Synthesized.vb @@ -1673,5 +1673,79 @@ End Class Next End Sub #End Region + + + Public Sub SynthesizeAttributeWithUseSiteErrorFails() +#Region "mslib" + Dim mslibNoString = " +Namespace System + Public Class [Object] + End Class + + Public Class Int32 + End Class + + Public Class ValueType + End Class + + Public Class Attribute + End Class + + Public Class Void + End Class +End Namespace +" + Dim mslib = mslibNoString & " +Namespace System + Public Class [String] + End Class +End Namespace +" +#End Region + ' Build an mscorlib including String + Dim mslibComp = CreateCompilation({Parse(mslib)}).VerifyDiagnostics() + Dim mslibRef = mslibComp.EmitToImageReference() + + ' Build an mscorlib without String + Dim mslibNoStringComp = CreateCompilation({Parse(mslibNoString)}).VerifyDiagnostics() + Dim mslibNoStringRef = mslibNoStringComp.EmitToImageReference() + + Dim diagLibSource = " +Namespace System.Diagnostics + Public Class DebuggerDisplayAttribute + Inherits System.Attribute + + Public Sub New(s As System.String) + End Sub + + Public Property Type as System.String + End Class +End Namespace + +Namespace System.Runtime.CompilerServices + Public Class CompilerGeneratedAttribute + End Class +End Namespace +" + ' Build Diagnostics referencing mscorlib with String + Dim diagLibComp = CreateCompilation({Parse(diagLibSource)}, references:={mslibRef}).VerifyDiagnostics() + Dim diagLibRef = diagLibComp.EmitToImageReference() + + ' Create compilation using Diagnostics but referencing mscorlib without String + Dim comp = CreateCompilation({Parse("")}, references:={diagLibRef, mslibNoStringRef}) + + ' Attribute cannot be synthesized because ctor has a use-site error (String type missing) + Dim attribute = comp.TrySynthesizeAttribute(WellKnownMember.System_Diagnostics_DebuggerDisplayAttribute__ctor) + Assert.Equal(Nothing, attribute) + + ' Attribute cannot be synthesized because type in named argument has use-site error (String type missing) + Dim attribute2 = comp.TrySynthesizeAttribute( + WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor, + namedArguments:=ImmutableArray.Create(New KeyValuePair(Of WellKnownMember, TypedConstant)( + WellKnownMember.System_Diagnostics_DebuggerDisplayAttribute__Type, + New TypedConstant(comp.GetSpecialType(SpecialType.System_String), TypedConstantKind.Primitive, "unused")))) + Assert.Equal(Nothing, attribute2) + End Sub + End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/EmitTestStrongNameProvider.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/EmitTestStrongNameProvider.vb index e5b9efc6c2b81..3aa0d8c1ed086 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/EmitTestStrongNameProvider.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/EmitTestStrongNameProvider.vb @@ -11,6 +11,8 @@ Partial Public Class InternalsVisibleToAndStrongNameTests Private Class StrongNameProviderWithBadInputStream Inherits StrongNameProvider Private _underlyingProvider As StrongNameProvider + Public Property ThrownException As Exception + Public Sub New(underlyingProvider As StrongNameProvider) _underlyingProvider = underlyingProvider End Sub @@ -25,7 +27,8 @@ Partial Public Class InternalsVisibleToAndStrongNameTests End Function Friend Overrides Function CreateInputStream() As Stream - Throw New IOException("This is a test IOException") + ThrownException = New IOException("This is a test IOException") + Throw ThrownException End Function Friend Overrides Function CreateKeys(keyFilePath As String, keyContainerName As String, messageProvider As CommonMessageProvider) As StrongNameKeys @@ -53,8 +56,9 @@ End Class , options:=options) - comp.VerifyEmitDiagnostics( - Diagnostic(ERRID.ERR_PublicKeyContainerFailure).WithArguments("RoslynTestContainer", "This is a test IOException").WithLocation(1, 1)) + comp.Emit(New MemoryStream()).Diagnostics.Verify( + Diagnostic(ERRID.ERR_PeWritingFailure).WithArguments(testProvider.ThrownException.ToString()).WithLocation(1, 1)) + End Sub End Class diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb index 8ba317d4b55e6..b55d8e81a790c 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/InternalsVisibleToAndStrongNameTests.vb @@ -1673,6 +1673,45 @@ BC37254: Public sign was specified and requires a public key, but no public key Assert.True(comp.Assembly.PublicKey.IsDefaultOrEmpty) End Sub + + + Public Sub KeyFileFromAttributes_PublicSign() + Dim source = + +Public Class C +End Class +]]> + + + Dim c = CreateCompilationWithMscorlib(source, options:=TestOptions.ReleaseDll.WithPublicSign(True)) + AssertTheseDiagnostics(c, + +BC37254: Public sign was specified and requires a public key, but no public key was specified + ) + + Assert.True(c.Options.PublicSign) + End Sub + + + Public Sub KeyContainerFromAttributes_PublicSign() + Dim source = + +Public Class C +End Class +]]> + + + Dim c = CreateCompilationWithMscorlib(source, options:=TestOptions.ReleaseDll.WithPublicSign(True)) + AssertTheseDiagnostics(c, + +BC37254: Public sign was specified and requires a public key, but no public key was specified + ) + + Assert.True(c.Options.PublicSign) + End Sub + Public Sub PublicSign_FromKeyFileNoStrongNameProvider() Dim snk = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey) @@ -1701,6 +1740,24 @@ BC37254: Public sign was specified and requires a public key, but no public key PublicSignCore(options) End Sub + + Public Sub PublicSign_KeyContainerOnly() + Dim source = + + + + + Dim options = TestOptions.ReleaseDll.WithCryptoKeyContainer("testContainer").WithPublicSign(True) + Dim compilation = CreateCompilationWithMscorlib(source, options:=options) + AssertTheseDiagnostics(compilation, +BC2046: Compilation options 'PublicSign' and 'CryptoKeyContainer' can't both be specified at the same time. +BC37254: Public sign was specified and requires a public key, but no public key was specified + ) + End Sub + Public Sub PublicSign_IgnoreSourceAttributes() Dim source = diff --git a/src/Compilers/VisualBasic/Test/Emit/BasicCompilerEmitTest.vbproj b/src/Compilers/VisualBasic/Test/Emit/BasicCompilerEmitTest.vbproj index 61cf3d62187f0..aa5c8ae61b2d0 100644 --- a/src/Compilers/VisualBasic/Test/Emit/BasicCompilerEmitTest.vbproj +++ b/src/Compilers/VisualBasic/Test/Emit/BasicCompilerEmitTest.vbproj @@ -229,6 +229,7 @@ + @@ -259,4 +260,4 @@ - + \ No newline at end of file diff --git a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenIterators.vb b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenIterators.vb index 25f1dc6556842..a4c2695d27a2a 100644 --- a/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenIterators.vb +++ b/src/Compilers/VisualBasic/Test/Emit/CodeGen/CodeGenIterators.vb @@ -1618,5 +1618,75 @@ End Module CompileAndVerify(source, expectedOutput:="420420") End Sub + + Public Sub IteratorShouldCompileWithoutOptionalAttributes() + +#Region "IL For corlib without CompilerGeneratedAttribute Or DebuggerNonUserCodeAttribute" + Dim corlib = " +Namespace System + Public Class [Object] + End Class + Public Class [Int32] + End Class + Public Class [Boolean] + End Class + Public Class [String] + End Class + Public Class Exception + End Class + Public Class NotSupportedException + Inherits Exception + End Class + Public Class ValueType + End Class + Public Class [Enum] + End Class + Public Class Void + End Class + Public Interface IDisposable + Sub Dispose() + End Interface +End Namespace +Namespace System.Collections + Public Interface IEnumerable + Function GetEnumerator() As IEnumerator + End Interface + Public Interface IEnumerator + Function MoveNext() As Boolean + Property Current As Object + Sub Reset() + End Interface + Namespace Generic + Public Interface IEnumerable(Of T) + Inherits IEnumerable + Overloads Function GetEnumerator() As IEnumerator(Of T) + End Interface + Public Interface IEnumerator(Of T) + Inherits IEnumerator + Overloads Property Current As T + End Interface + End Namespace +End Namespace +Namespace System.Threading + Public Class Thread + Shared Property CurrentThread As Thread + Property ManagedThreadId As Integer + End Class +End Namespace +" +#End Region + + Dim source = " +Class C + Public Iterator Function SomeNumbers() As System.Collections.IEnumerable + Yield Nothing + End Function +End Class +" + ' The compilation succeeds even though CompilerGeneratedAttribute and DebuggerNonUserCodeAttribute are not available. + Dim compilation = CompilationUtils.CreateCompilation({Parse(source), Parse(corlib)}) + Dim verifier = CompileAndVerify(compilation, verify:=False) + verifier.VerifyDiagnostics() + End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/CompilationEmitTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/CompilationEmitTests.vb index 79f1c616cc7b9..cf68dca8fda07 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/CompilationEmitTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/CompilationEmitTests.vb @@ -2923,5 +2923,30 @@ End Class End Using End Sub + + Public Sub FailingEmitter() + ' Check that Compilation.Emit actually produces compilation errors. + Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( + + +Module M1 + Sub Main() + End Sub +End Module + + ) + + Dim emitResult As EmitResult + + Using output = New BrokenStream() + output.BreakHow = BrokenStream.BreakHowType.ThrowOnWrite + emitResult = compilation.Emit(output, Nothing, Nothing, Nothing) + + CompilationUtils.AssertTheseDiagnostics(emitResult.Diagnostics, + +BC37256: An error occurred while writing the output file: <%= output.ThrownException.ToString() %> +) + End Using + End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.vb index 2e5b524b8f7fe..3e154afe05df5 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/AssemblyReferencesTests.vb @@ -5,7 +5,6 @@ Imports System.Collections.Immutable Imports System.IO Imports System.Linq Imports System.Reflection.Metadata -Imports System.Threading Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests Imports Microsoft.CodeAnalysis.Emit @@ -18,9 +17,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests Public Class AssemblyReferencesTests Inherits EditAndContinueTestBase - Private Shared ReadOnly s_signedDll As VisualBasicCompilationOptions = - TestOptions.ReleaseDll.WithCryptoPublicKey(TestResources.TestKeys.PublicKey_ce65828c82a341f2) - ''' ''' Symbol matcher considers two source types that only differ in the declaring compilations different. ''' @@ -86,263 +82,5 @@ End Class diff2.EmitResult.Diagnostics.Verify() End Sub - - - Public Sub DependencyVersionWildcards_Compilation1() - TestDependencyVersionWildcards( - "1.0.0.*", - New Version(1, 0, 2000, 1001), - New Version(1, 0, 2000, 1001), - New Version(1, 0, 2000, 1002)) - - TestDependencyVersionWildcards( - "1.0.0.*", - New Version(1, 0, 2000, 1001), - New Version(1, 0, 2000, 1002), - New Version(1, 0, 2000, 1002)) - - TestDependencyVersionWildcards( - "1.0.0.*", - New Version(1, 0, 2000, 1003), - New Version(1, 0, 2000, 1002), - New Version(1, 0, 2000, 1001)) - - TestDependencyVersionWildcards( - "1.0.*", - New Version(1, 0, 2000, 1001), - New Version(1, 0, 2000, 1002), - New Version(1, 0, 2000, 1003)) - - TestDependencyVersionWildcards( - "1.0.*", - New Version(1, 0, 2000, 1001), - New Version(1, 0, 2000, 1005), - New Version(1, 0, 2000, 1002)) - End Sub - - Private Sub TestDependencyVersionWildcards(sourceVersion As String, version0 As Version, version1 As Version, version2 As Version) - Dim srcLib = $" - - -Public Class D -End Class -" - Dim src0 As String = " -Class C - Public Shared Function F(a As D) As Integer - Return 1 - End Function -End Class -" - Dim src1 As String = " -Class C - Public Shared Function F(a As D) As Integer - Return 2 - End Function -End Class -" - Dim src2 As String = " -Class C - Public Shared Function F(a As D) As Integer - Return 3 - End Function - - Public Shared Function G(a As D) As Integer - Return 4 - End Function -End Class -" - Dim lib0 = CreateCompilationWithMscorlib({srcLib}, assemblyName:="Lib", options:=TestOptions.DebugDll) - DirectCast(lib0.Assembly, SourceAssemblySymbol).m_lazyIdentity = New AssemblyIdentity("Lib", version0) - lib0.VerifyDiagnostics() - - Dim lib1 = CreateCompilationWithMscorlib({srcLib}, assemblyName:="Lib", options:=TestOptions.DebugDll) - DirectCast(lib1.Assembly, SourceAssemblySymbol).m_lazyIdentity = New AssemblyIdentity("Lib", version1) - lib1.VerifyDiagnostics() - - Dim lib2 = CreateCompilationWithMscorlib({srcLib}, assemblyName:="Lib", options:=TestOptions.DebugDll) - DirectCast(lib2.Assembly, SourceAssemblySymbol).m_lazyIdentity = New AssemblyIdentity("Lib", version2) - lib2.VerifyDiagnostics() - - Dim compilation0 = CreateCompilationWithMscorlib({src0}, {lib0.ToMetadataReference()}, assemblyName:="C", options:=TestOptions.DebugDll) - Dim compilation1 = compilation0.WithSource(src1).WithReferences({MscorlibRef, lib1.ToMetadataReference()}) - Dim compilation2 = compilation1.WithSource(src2).WithReferences({MscorlibRef, lib2.ToMetadataReference()}) - - Dim v0 = CompileAndVerify(compilation0) - Dim v1 = CompileAndVerify(compilation1) - Dim v2 = CompileAndVerify(compilation2) - - Dim f0 = compilation0.GetMember(Of MethodSymbol)("C.F") - Dim f1 = compilation1.GetMember(Of MethodSymbol)("C.F") - Dim f2 = compilation2.GetMember(Of MethodSymbol)("C.F") - Dim g2 = compilation2.GetMember(Of MethodSymbol)("C.G") - - Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) - Dim generation0 = EmitBaseline.CreateInitialBaseline(md0, EmptyLocalsProvider) - - Dim diff1 = compilation1.EmitDifference( - generation0, - ImmutableArray.Create(New SemanticEdit(SemanticEditKind.Update, f0, f1))) - - Dim diff2 = compilation2.EmitDifference( - diff1.NextGeneration, - ImmutableArray.Create(New SemanticEdit(SemanticEditKind.Update, f1, f2), - New SemanticEdit(SemanticEditKind.Insert, Nothing, g2))) - - Dim md1 = diff1.GetMetadata() - Dim md2 = diff2.GetMetadata() - - Dim aggReader = New AggregatedMetadataReader(md0.MetadataReader, md1.Reader, md2.Reader) - VerifyAssemblyReferences(aggReader, - { - "mscorlib, 4.0.0.0", - "Lib, " & lib0.Assembly.Identity.Version.ToString(), - "mscorlib, 4.0.0.0", - "Lib, " & lib0.Assembly.Identity.Version.ToString(), - "mscorlib, 4.0.0.0", - "Lib, " & lib0.Assembly.Identity.Version.ToString() - }) - End Sub - - - Public Sub DependencyVersionWildcards_Metadata() - Dim srcLib = $" - - -Public Class D -End Class -" - Dim src0 As String = " -Class C - Public Shared Function F(a As D) As Integer - Return 1 - End Function -End Class -" - Dim src1 As String = " -Class C - Public Shared Function F(a As D) As Integer - Return 2 - End Function -End Class -" - Dim src2 As String = " -Class C - Public Shared Function F(a As D) As Integer - Return 3 - End Function - - Public Shared Function G(a As D) As Integer - Return 4 - End Function -End Class -" - Dim lib0 = CreateCompilationWithMscorlib({srcLib}, assemblyName:="Lib", options:=TestOptions.DebugDll) - DirectCast(lib0.Assembly, SourceAssemblySymbol).m_lazyIdentity = New AssemblyIdentity("Lib", New Version(1, 0, 2000, 1001)) - lib0.VerifyDiagnostics() - - Dim lib1 = CreateCompilationWithMscorlib({srcLib}, assemblyName:="Lib", options:=TestOptions.DebugDll) - DirectCast(lib1.Assembly, SourceAssemblySymbol).m_lazyIdentity = New AssemblyIdentity("Lib", New Version(1, 0, 2000, 1002)) - lib1.VerifyDiagnostics() - - Dim lib2 = CreateCompilationWithMscorlib({srcLib}, assemblyName:="Lib", options:=TestOptions.DebugDll) - DirectCast(lib2.Assembly, SourceAssemblySymbol).m_lazyIdentity = New AssemblyIdentity("Lib", New Version(1, 0, 2000, 1003)) - lib2.VerifyDiagnostics() - - Dim compilation0 = CreateCompilationWithMscorlib({src0}, {lib0.EmitToImageReference()}, assemblyName:="C", options:=TestOptions.DebugDll) - Dim compilation1 = compilation0.WithSource(src1).WithReferences({MscorlibRef, lib1.EmitToImageReference()}) - Dim compilation2 = compilation1.WithSource(src2).WithReferences({MscorlibRef, lib2.EmitToImageReference()}) - - Dim v0 = CompileAndVerify(compilation0) - Dim v1 = CompileAndVerify(compilation1) - Dim v2 = CompileAndVerify(compilation2) - - Dim f0 = compilation0.GetMember(Of MethodSymbol)("C.F") - Dim f1 = compilation1.GetMember(Of MethodSymbol)("C.F") - Dim f2 = compilation2.GetMember(Of MethodSymbol)("C.F") - Dim g2 = compilation2.GetMember(Of MethodSymbol)("C.G") - - Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) - Dim generation0 = EmitBaseline.CreateInitialBaseline(md0, EmptyLocalsProvider) - - Dim diff1 = compilation1.EmitDifference( - generation0, - ImmutableArray.Create(New SemanticEdit(SemanticEditKind.Update, f0, f1))) - - diff1.EmitResult.Diagnostics.Verify( - Diagnostic(ERRID.ERR_ModuleEmitFailure).WithArguments("C")) - End Sub - - - Public Sub DependencyVersionWildcardsCollisions() - Dim srcLib01 = " - - -Public Class D0 -End Class -" - Dim srcLib02 = " - - -Public Class D0 -End Class -" - Dim srcLib11 = " - - -Public Class D1 -End Class -" - Dim srcLib12 = " - - -Public Class D1 -End Class -" - Dim src0 = " -Class C - Public Shared Function F(a As D0, b As D1) As Integer - Return 1 - End Function -End Class -" - Dim src1 = " -Class C - Public Shared Function F(a As D0, b As D1) As Integer - Return 2 - End Function -End Class -" - Dim lib01 = CreateCompilationWithMscorlib({srcLib01}, assemblyName:="Lib", options:=s_signedDll).VerifyDiagnostics() - Dim ref01 = lib01.ToMetadataReference() - Dim lib02 = CreateCompilationWithMscorlib({srcLib02}, assemblyName:="Lib", options:=s_signedDll).VerifyDiagnostics() - Dim ref02 = lib02.ToMetadataReference() - Dim lib11 = CreateCompilationWithMscorlib({srcLib11}, assemblyName:="Lib", options:=s_signedDll).VerifyDiagnostics() - Dim ref11 = lib11.ToMetadataReference() - Dim lib12 = CreateCompilationWithMscorlib({srcLib12}, assemblyName:="Lib", options:=s_signedDll).VerifyDiagnostics() - Dim ref12 = lib12.ToMetadataReference() - - Dim compilation0 = CreateCompilationWithMscorlib({src0}, {ref01, ref11}, assemblyName:="C", options:=TestOptions.DebugDll) - Dim compilation1 = compilation0.WithSource(src1).WithReferences({MscorlibRef, ref02, ref12}) - - Dim v0 = CompileAndVerify(compilation0) - - Dim f0 = compilation0.GetMember(Of MethodSymbol)("C.F") - Dim f1 = compilation1.GetMember(Of MethodSymbol)("C.F") - - Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) - - Dim generation0 = EmitBaseline.CreateInitialBaseline(md0, EmptyLocalsProvider) - - Dim diff1 = compilation1.EmitDifference(generation0, - ImmutableArray.Create(New SemanticEdit(SemanticEditKind.Update, f0, f1))) - - diff1.EmitResult.Diagnostics.Verify( - Diagnostic(ERRID.ERR_ModuleEmitFailure).WithArguments("C")) - End Sub - - Public Sub VerifyAssemblyReferences(reader As AggregatedMetadataReader, expected As String()) - AssertEx.Equal(expected, reader.GetAssemblyReferences().Select(Function(aref) $"{reader.GetString(aref.Name)}, {aref.Version}")) - End Sub End Class -End Namespace +End Namespace \ No newline at end of file diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb index 9499e77cbde5f..acb7dbd0d76cd 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb @@ -4402,5 +4402,107 @@ End Class "C._Closure$__: {$I1-0, _Lambda$__1-0}", "C.VB$StateMachine_1_F: {$State, $Builder, $VB$ResumableLocal_x$0, $VB$ResumableLocal_y$3, $A0, MoveNext, System.Runtime.CompilerServices.IAsyncStateMachine.SetStateMachine, $VB$ResumableLocal_y$2, $VB$ResumableLocal_y$1}") End Sub + + + Public Sub MissingIteratorStateMachineAttribute() + Dim source0 = MarkedSource(" +Imports System +Imports System.Collections.Generic + +Class C + Public Iterator Function F() As IEnumerable(Of Integer) + Dim a As Integer = 0 + Yield 0 + Console.WriteLine(a) + End Function +End Class +") + Dim source1 = MarkedSource(" +Imports System +Imports System.Collections.Generic + +Class C + Public Iterator Function F() As IEnumerable(Of Integer) + Dim a As Integer = 1 + Yield 1 + Console.WriteLine(a) + End Function +End Class +") + Dim compilation0 = CreateCompilationWithMscorlib({source0.Tree}, options:=ComSafeDebugDll) + Dim compilation1 = compilation0.WithSource(source1.Tree) + + ' older versions of mscorlib don't contain IteratorStateMachineAttribute + Assert.Null(compilation0.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_IteratorStateMachineAttribute__ctor)) + + Dim v0 = CompileAndVerify(compilation0, verify:=False) + Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) + + Dim f0 = compilation0.GetMember(Of MethodSymbol)("C.F") + Dim f1 = compilation1.GetMember(Of MethodSymbol)("C.F") + + Dim generation0 = EmitBaseline.CreateInitialBaseline(md0, AddressOf v0.CreateSymReader().GetEncMethodDebugInfo) + Dim diff1 = compilation1.EmitDifference( + generation0, + ImmutableArray.Create(New SemanticEdit(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1), preserveLocalVariables:=True))) + + diff1.EmitResult.Diagnostics.Verify( + Diagnostic(ERRID.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name)) + End Sub + + + Public Sub MissingAsyncStateMachineAttribute() + Dim common = " +Imports System +Imports System.Threading.Tasks + +Namespace Microsoft.VisualBasic.CompilerServices + Class ProjectData + Shared Sub SetProjectError(e As Exception) + End Sub + + Shared Sub ClearProjectError() + End Sub + End Class +End Namespace" + + Dim source0 = MarkedSource(common & " +Class C + Public Async Function F() As Task(Of Integer) + Dim a As Integer = 0 + Await New Task() + Return a + End Function +End Class +") + Dim source1 = MarkedSource(common & " +Class C + Public Async Function F() As Task(Of Integer) + Dim a As Integer = 1 + Await New Task() + Return a + End Function +End Class +") + Dim compilation0 = CompilationUtils.CreateCompilation({source0.Tree}, {TestReferences.NetFx.Minimal.mincorlib, TestReferences.NetFx.Minimal.minasync}, options:=ComSafeDebugDll) + Dim compilation1 = compilation0.WithSource(source1.Tree) + + Assert.Null(compilation0.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_AsyncStateMachineAttribute__ctor)) + + Dim v0 = CompileAndVerify(compilation0, verify:=False) + Dim md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData) + + Dim f0 = compilation0.GetMember(Of MethodSymbol)("C.F") + Dim f1 = compilation1.GetMember(Of MethodSymbol)("C.F") + + Dim generation0 = EmitBaseline.CreateInitialBaseline(md0, AddressOf v0.CreateSymReader().GetEncMethodDebugInfo) + Dim diff1 = compilation1.EmitDifference( + generation0, + ImmutableArray.Create(New SemanticEdit(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1), preserveLocalVariables:=True))) + + diff1.EmitResult.Diagnostics.Verify( + Diagnostic(ERRID.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name), + Diagnostic(ERRID.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name)) + End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.vb index 76a2183df343b..728a86fed7c27 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTestBase.vb @@ -8,7 +8,6 @@ Imports System.Runtime.CompilerServices Imports System.Xml.Linq Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Emit -Imports Microsoft.CodeAnalysis.VisualBasic.Emit Imports Microsoft.CodeAnalysis.VisualBasic.Symbols Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Roslyn.Test.MetadataUtilities @@ -261,16 +260,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests MetadataTokens.GetRowNumber(handle), index) End Function - - Friend Shared Function CreateMatcher(fromCompilation As VisualBasicCompilation, toCompilation As VisualBasicCompilation) As VisualBasicSymbolMatcher - Return New VisualBasicSymbolMatcher( - Nothing, - fromCompilation.SourceAssembly, - Nothing, - toCompilation.SourceAssembly, - Nothing, - Nothing) - End Function End Class Public Module EditAndContinueTestExtensions diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb index 7a83372ab3c6b..bfc60f2db7ef3 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb @@ -797,8 +797,7 @@ End Class Dim compilation0 = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll) Dim compilation1 = compilation0.Clone() - Dim matcher = CreateMatcher(compilation1, compilation0) - + Dim matcher = New VisualBasicSymbolMatcher(Nothing, compilation1.SourceAssembly, Nothing, compilation0.SourceAssembly, Nothing, Nothing) Dim members = compilation1.GetMember(Of NamedTypeSymbol)("A.B").GetMembers("M") Assert.Equal(members.Length, 2) For Each member In members @@ -824,7 +823,7 @@ End Class Dim compilation0 = CreateCompilationWithMscorlibAndVBRuntime(source, TestOptions.DebugDll) Dim compilation1 = compilation0.Clone() - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher(Nothing, compilation1.SourceAssembly, Nothing, compilation0.SourceAssembly, Nothing, Nothing) Dim member = compilation1.GetMember(Of MethodSymbol)("C.M") Dim other = DirectCast(matcher.MapDefinition(DirectCast(member, Cci.IMethodDefinition)), MethodSymbol) Assert.NotNull(other) @@ -859,7 +858,7 @@ End Class Const nModifiers As Integer = 1 Assert.Equal(nModifiers, DirectCast(member1.ReturnType, ArrayTypeSymbol).CustomModifiers.Length) - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher(Nothing, compilation1.SourceAssembly, Nothing, compilation0.SourceAssembly, Nothing, Nothing) Dim other = DirectCast(matcher.MapDefinition(DirectCast(member1, Cci.IMethodDefinition)), MethodSymbol) Assert.NotNull(other) Assert.Equal(nModifiers, DirectCast(other.ReturnType, ArrayTypeSymbol).CustomModifiers.Length) diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/SymbolMatcherTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/SymbolMatcherTests.vb index bdbaf61013e05..27369daac589e 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/SymbolMatcherTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/SymbolMatcherTests.vb @@ -57,7 +57,7 @@ End Class" Assert.True(members.Length > 10) For i = 0 To 10 - 1 - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher(Nothing, compilation1.SourceAssembly, Nothing, compilation0.SourceAssembly, Nothing, Nothing) Dim tasks(10) As Task @@ -105,7 +105,7 @@ End Class compilation0.VerifyDiagnostics() - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher(Nothing, compilation1.SourceAssembly, Nothing, compilation0.SourceAssembly, Nothing, Nothing) Dim members = compilation1.GetMember(Of NamedTypeSymbol)("A.B").GetMembers("M") Assert.Equal(members.Length, 2) @@ -128,7 +128,7 @@ End Class " Dim compilation0 = CreateCompilationWithMscorlib({source}, options:=TestOptions.DebugDll) Dim compilation1 = compilation0.WithSource(source) - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher(Nothing, compilation1.SourceAssembly, Nothing, compilation0.SourceAssembly, Nothing, Nothing) Dim member = compilation1.GetMember(Of MethodSymbol)("C.M") Dim other = matcher.MapDefinition(member) Assert.NotNull(other) @@ -161,7 +161,7 @@ End Class Dim member1 = compilation1.GetMember(Of MethodSymbol)("B.F") Assert.Equal(DirectCast(member1.ReturnType, ArrayTypeSymbol).CustomModifiers.Length, 1) - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher(Nothing, compilation1.SourceAssembly, Nothing, compilation0.SourceAssembly, Nothing, Nothing) Dim other = DirectCast(matcher.MapDefinition(member1), MethodSymbol) Assert.NotNull(other) Assert.Equal(DirectCast(other.ReturnType, ArrayTypeSymbol).CustomModifiers.Length, 1) @@ -185,7 +185,7 @@ End Class Dim compilation0 = CreateCompilationWithMscorlib({source}, {lib0.ToMetadataReference()}, options:=TestOptions.DebugDll) Dim compilation1 = compilation0.WithSource(source).WithReferences(MscorlibRef, lib1.ToMetadataReference()) - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher(Nothing, compilation1.SourceAssembly, Nothing, compilation0.SourceAssembly, Nothing, Nothing) Dim f0 = compilation0.GetMember(Of MethodSymbol)("C.F") Dim f1 = compilation1.GetMember(Of MethodSymbol)("C.F") @@ -220,7 +220,13 @@ End Class Dim compilation0 = CreateCompilationWithMscorlib(sources0, TestOptions.DebugDll) Dim compilation1 = compilation0.WithSource(sources1) - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher( + Nothing, + compilation1.SourceAssembly, + Nothing, + compilation0.SourceAssembly, + Nothing, + Nothing) Dim elementType = compilation1.GetMember(Of TypeSymbol)("C.D") Dim member = compilation1.CreateArrayTypeSymbol(elementType) Dim other = matcher.MapReference(member) @@ -252,7 +258,13 @@ End Class Dim compilation0 = CreateCompilationWithMscorlib(sources0, TestOptions.DebugDll) Dim compilation1 = compilation0.WithSource(sources1) - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher( + Nothing, + compilation1.SourceAssembly, + Nothing, + compilation0.SourceAssembly, + Nothing, + Nothing) Dim elementType = compilation1.GetMember(Of TypeSymbol)("C.D") Dim member = compilation1.CreateArrayTypeSymbol(elementType) Dim other = matcher.MapReference(member) @@ -288,7 +300,13 @@ End Class Dim compilation0 = CreateCompilationWithMscorlib(sources0, TestOptions.DebugDll) Dim compilation1 = compilation0.WithSource(sources1) - Dim matcher = CreateMatcher(compilation1, compilation0) + Dim matcher = New VisualBasicSymbolMatcher( + Nothing, + compilation1.SourceAssembly, + Nothing, + compilation0.SourceAssembly, + Nothing, + Nothing) Dim member = compilation1.GetMember(Of FieldSymbol)("C.y") Dim other = matcher.MapReference(DirectCast(member.Type, Cci.ITypeReference)) ' For a newly added type, there is no match in the previous generation. @@ -352,11 +370,7 @@ End Class Assert.Equal("$VB$Local_x1", x1.Name) Assert.Equal("$VB$Local_x2", x2.Name) - Dim matcher = New VisualBasicSymbolMatcher( - anonymousTypeMap0, - compilation1.SourceAssembly, - emitContext, - peAssemblySymbol0) + Dim matcher = New VisualBasicSymbolMatcher(anonymousTypeMap0, compilation1.SourceAssembly, emitContext, peAssemblySymbol0) Dim mappedX1 = DirectCast(matcher.MapDefinition(x1), Cci.IFieldDefinition) Dim mappedX2 = DirectCast(matcher.MapDefinition(x2), Cci.IFieldDefinition) @@ -423,11 +437,7 @@ End Class Assert.Equal("$VB$Local_x1", x1.Name) Assert.Equal("$VB$Local_x2", x2.Name) - Dim matcher = New VisualBasicSymbolMatcher( - anonymousTypeMap0, - compilation1.SourceAssembly, - emitContext, - peAssemblySymbol0) + Dim matcher = New VisualBasicSymbolMatcher(anonymousTypeMap0, compilation1.SourceAssembly, emitContext, peAssemblySymbol0) Dim mappedX1 = DirectCast(matcher.MapDefinition(x1), Cci.IFieldDefinition) Dim mappedX2 = DirectCast(matcher.MapDefinition(x2), Cci.IFieldDefinition) @@ -500,11 +510,7 @@ End Class Assert.Equal("$VB$Local_x1", x1.Name) Assert.Equal("$VB$Local_x2", x2.Name) - Dim matcher = New VisualBasicSymbolMatcher( - anonymousTypeMap0, - compilation1.SourceAssembly, - emitContext, - peAssemblySymbol0) + Dim matcher = New VisualBasicSymbolMatcher(anonymousTypeMap0, compilation1.SourceAssembly, emitContext, peAssemblySymbol0) Dim mappedX1 = DirectCast(matcher.MapDefinition(x1), Cci.IFieldDefinition) Dim mappedX2 = DirectCast(matcher.MapDefinition(x2), Cci.IFieldDefinition) diff --git a/src/Compilers/VisualBasic/Test/Emit/PDB/PortablePdbTests.vb b/src/Compilers/VisualBasic/Test/Emit/PDB/PortablePdbTests.vb new file mode 100644 index 0000000000000..3128708dc4e91 --- /dev/null +++ b/src/Compilers/VisualBasic/Test/Emit/PDB/PortablePdbTests.vb @@ -0,0 +1,60 @@ +' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +Imports Roslyn.Test.Utilities +Imports System.IO +Imports System.Reflection.Metadata +Imports Microsoft.CodeAnalysis.Emit +Imports Microsoft.CodeAnalysis.Test.Utilities + +Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.PDB + Public Class PortablePdbTests + Inherits BasicTestBase + + + Public Sub DateTimeConstant() + Dim source = + +Imports System + +Public Class C + Public Sub M() + const dt1 as datetime = #3/01/2016# + const dt2 as datetime = #10:53:37 AM# + const dt3 as datetime = #3/01/2016 10:53:37 AM# + End Sub +End Class + + + + Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime( + source, + TestOptions.DebugDll) + + Dim pdbStream = New MemoryStream() + compilation.EmitToArray(EmitOptions.Default.WithDebugInformationFormat(DebugInformationFormat.PortablePdb), pdbStream:=pdbStream) + + Using pdbMetadata As New PinnedMetadata(pdbStream.ToImmutable()) + Dim mdReader = pdbMetadata.Reader + + Assert.Equal(3, mdReader.LocalConstants.Count) + + For Each constantHandle In mdReader.LocalConstants + Dim constant = mdReader.GetLocalConstant(constantHandle) + Dim sigReader = mdReader.GetBlobReader(constant.Signature) + + ' DateTime constants are always SignatureTypeCode.ValueType {17} + Dim rawTypeCode = sigReader.ReadCompressedInteger() + Assert.Equal(17, rawTypeCode) + + ' DateTime constants are always HandleKind.TypeReference {1} + Dim typeHandle = sigReader.ReadTypeHandle() + Assert.Equal(HandleKind.TypeReference, typeHandle.Kind) + + ' DateTime constants are always stored and retrieved with no time zone specification + Dim value = sigReader.ReadDateTime() + Assert.Equal(DateTimeKind.Unspecified, value.Kind) + Next + End Using + End Sub + End Class +End Namespace diff --git a/src/Compilers/VisualBasic/Test/Emit/project.lock.json b/src/Compilers/VisualBasic/Test/Emit/project.lock.json index 8e273a551710d..0be6e5524107a 100644 --- a/src/Compilers/VisualBasic/Test/Emit/project.lock.json +++ b/src/Compilers/VisualBasic/Test/Emit/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/VisualBasic/Test/Performance/project.lock.json b/src/Compilers/VisualBasic/Test/Performance/project.lock.json index 222661284f954..24c270eaf73fb 100644 --- a/src/Compilers/VisualBasic/Test/Performance/project.lock.json +++ b/src/Compilers/VisualBasic/Test/Performance/project.lock.json @@ -156,7 +156,7 @@ "lib/net46/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -428,7 +428,7 @@ "lib/net46/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -700,7 +700,7 @@ "lib/net46/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1170,11 +1170,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb b/src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb index 2af40987e3780..759b74c97cfd1 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Compilation/CompilationAPITests.vb @@ -21,6 +21,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Public Class CompilationAPITests Inherits BasicTestBase + + + Public Sub PublicSignWithRelativeKeyPath() + Dim options = New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary). + WithPublicSign(True).WithCryptoKeyFile("test.snk") + AssertTheseDiagnostics(VisualBasicCompilation.Create("test", options:=options), + +BC2014: the value 'test.snk' is invalid for option 'CryptoKeyFile' +BC37254: Public sign was specified and requires a public key, but no public key was specified +) + End Sub + Public Sub LocalizableErrorArgumentToStringDoesntStackOverflow() ' Error ID is arbitrary diff --git a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb index 6401091cae7e5..8f1dfebac3a6d 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb @@ -1525,6 +1525,167 @@ End Class Diagnostic(UnaryAndBinaryOperationsTestAnalyzer.OperatorMinusMethodDescriptor.Id, "-a2").WithLocation(36, 14)) End Sub + + Public Sub BinaryOperatorsVisualBasic() + Dim source = + + (x As B2, y As B2) As B2 + System.Console.WriteLine("<>") + Return x + End Operator + + Public Shared Operator <(x As B2, y As B2) As B2 + System.Console.WriteLine("<") + Return x + End Operator + + Public Shared Operator >(x As B2, y As B2) As B2 + System.Console.WriteLine(">") + Return x + End Operator + + Public Shared Operator <=(x As B2, y As B2) As B2 + System.Console.WriteLine("<=") + Return x + End Operator + + Public Shared Operator >=(x As B2, y As B2) As B2 + System.Console.WriteLine(">=") + Return x + End Operator + + Public Shared Operator Like(x As B2, y As B2) As B2 + System.Console.WriteLine("Like") + Return x + End Operator + + Public Shared Operator &(x As B2, y As B2) As B2 + System.Console.WriteLine("&") + Return x + End Operator + + Public Shared Operator And(x As B2, y As B2) As B2 + System.Console.WriteLine("And") + Return x + End Operator + + Public Shared Operator Or(x As B2, y As B2) As B2 + System.Console.WriteLine("Or") + Return x + End Operator + + Public Shared Operator Xor(x As B2, y As B2) As B2 + System.Console.WriteLine("Xor") + Return x + End Operator + + Public Shared Operator <<(x As B2, y As Integer) As B2 + System.Console.WriteLine("<<") + Return x + End Operator + + Public Shared Operator >>(x As B2, y As Integer) As B2 + System.Console.WriteLine(">>") + Return x + End Operator +End Class + +Module Module1 + + Sub Main() + Dim x, y As New B2() + Dim r As B2 + r = x + y + r = x - y + r = x * y + r = x / y + r = x \ y + r = x Mod y + ' r = x ^ y TODO: Bug https://github.com/dotnet/roslyn/issues/9174 + r = x = y + r = x <> y + r = x < y + r = x > y + r = x <= y + r = x >= y + ' r = x Like y TODO: Bug https://github.com/dotnet/roslyn/issues/9174 + ' r = x & y TODO: Bug https://github.com/dotnet/roslyn/issues/9174 + r = x And y + r = x Or y + r = x Xor y + r = x << 2 + r = x >> 3 + End Sub +End Module +]]> + + + + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) + comp.VerifyDiagnostics() + comp.VerifyAnalyzerDiagnostics({New BinaryOperatorVBTestAnalyzer}, Nothing, Nothing, False, + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x + y").WithArguments("OperatorMethodAdd").WithLocation(109, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x - y").WithArguments("OperatorMethodSubtract").WithLocation(110, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x * y").WithArguments("OperatorMethodMultiply").WithLocation(111, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x / y").WithArguments("OperatorMethodDivide").WithLocation(112, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x \ y").WithArguments("OperatorMethodIntegerDivide").WithLocation(113, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x Mod y").WithArguments("OperatorMethodRemainder").WithLocation(114, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x = y").WithArguments("OperatorMethodEquals").WithLocation(116, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x <> y").WithArguments("OperatorMethodNotEquals").WithLocation(117, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x < y").WithArguments("OperatorMethodLessThan").WithLocation(118, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x > y").WithArguments("OperatorMethodGreaterThan").WithLocation(119, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x <= y").WithArguments("OperatorMethodLessThanOrEqual").WithLocation(120, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x >= y").WithArguments("OperatorMethodGreaterThanOrEqual").WithLocation(121, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x And y").WithArguments("OperatorMethodAnd").WithLocation(124, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x Or y").WithArguments("OperatorMethodOr").WithLocation(125, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x Xor y").WithArguments("OperatorMethodExclusiveOr").WithLocation(126, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x << 2").WithArguments("OperatorMethodLeftShift").WithLocation(127, 13), + Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x >> 3").WithArguments("OperatorMethodRightShift").WithLocation(128, 13)) + End Sub + Public Sub NullOperationSyntaxVisualBasic() Dim source = diff --git a/src/Compilers/VisualBasic/Test/Semantic/project.lock.json b/src/Compilers/VisualBasic/Test/Semantic/project.lock.json index 9d5fb2042916b..2c1658b8a43de 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/project.lock.json +++ b/src/Compilers/VisualBasic/Test/Semantic/project.lock.json @@ -78,7 +78,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -249,7 +249,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -580,11 +580,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/VisualBasic/Test/Symbol/project.lock.json b/src/Compilers/VisualBasic/Test/Symbol/project.lock.json index 9d274517c8b37..fc89de5fb5530 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/project.lock.json +++ b/src/Compilers/VisualBasic/Test/Symbol/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/VisualBasic/Test/Syntax/project.lock.json b/src/Compilers/VisualBasic/Test/Syntax/project.lock.json index 9d274517c8b37..fc89de5fb5530 100644 --- a/src/Compilers/VisualBasic/Test/Syntax/project.lock.json +++ b/src/Compilers/VisualBasic/Test/Syntax/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/VisualBasic/VbcCore/project.lock.json b/src/Compilers/VisualBasic/VbcCore/project.lock.json index ee58614bc3365..80184c55b42d1 100644 --- a/src/Compilers/VisualBasic/VbcCore/project.lock.json +++ b/src/Compilers/VisualBasic/VbcCore/project.lock.json @@ -511,7 +511,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1795,7 +1795,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -3149,7 +3149,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -4654,7 +4654,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -7735,11 +7735,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Compilers/VisualBasic/vbc/project.json b/src/Compilers/VisualBasic/vbc/project.json index f1d1e75a49e1e..5b76cf6eca5f7 100644 --- a/src/Compilers/VisualBasic/vbc/project.json +++ b/src/Compilers/VisualBasic/vbc/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Microsoft.DiaSymReader.Native": "1.3.3", + "Microsoft.DiaSymReader.Native": "1.3.3" }, "frameworks": { "net45": { } diff --git a/src/Compilers/VisualBasic/vbc/project.lock.json b/src/Compilers/VisualBasic/vbc/project.lock.json index 79008efc9411a..0ce428f12b00e 100644 --- a/src/Compilers/VisualBasic/vbc/project.lock.json +++ b/src/Compilers/VisualBasic/vbc/project.lock.json @@ -54,7 +54,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -150,7 +150,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -246,7 +246,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -342,7 +342,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -438,7 +438,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -534,7 +534,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -630,7 +630,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -875,11 +875,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/Microsoft.DiaSymReader.PortablePdb.UnitTests.csproj b/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/Microsoft.DiaSymReader.PortablePdb.UnitTests.csproj index a40cbc0f4b129..eda162df8d2d4 100644 --- a/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/Microsoft.DiaSymReader.PortablePdb.UnitTests.csproj +++ b/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/Microsoft.DiaSymReader.PortablePdb.UnitTests.csproj @@ -105,6 +105,9 @@ + + + diff --git a/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/project.lock.json b/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/project.lock.json index acd8f1b833bd6..3125b0e50e920 100644 --- a/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/project.lock.json +++ b/src/Debugging/Microsoft.DiaSymReader.PortablePdb.Tests/project.lock.json @@ -156,7 +156,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -903,11 +903,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec b/src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec index 2795482df85eb..282ac2d926583 100644 --- a/src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec +++ b/src/Debugging/Microsoft.DiaSymReader.PortablePdb/Microsoft.DiaSymReader.PortablePdb.nuspec @@ -10,7 +10,7 @@ Supported Platforms: - + en-US diff --git a/src/Debugging/Microsoft.DiaSymReader.PortablePdb/project.json b/src/Debugging/Microsoft.DiaSymReader.PortablePdb/project.json index 007fd8924dab6..fb185b1f7ad85 100644 --- a/src/Debugging/Microsoft.DiaSymReader.PortablePdb/project.json +++ b/src/Debugging/Microsoft.DiaSymReader.PortablePdb/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { ".NETPortable,Version=v4.5,Profile=Profile7": {} diff --git a/src/Debugging/Microsoft.DiaSymReader.PortablePdb/project.lock.json b/src/Debugging/Microsoft.DiaSymReader.PortablePdb/project.lock.json index 8f31e52b32620..193a19419995f 100644 --- a/src/Debugging/Microsoft.DiaSymReader.PortablePdb/project.lock.json +++ b/src/Debugging/Microsoft.DiaSymReader.PortablePdb/project.lock.json @@ -21,7 +21,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "type": "package", "dependencies": { "System.Collections.Immutable": "1.1.37" @@ -60,11 +60,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -79,7 +79,7 @@ "": [ "Microsoft.DiaSymReader >= 1.0.7", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETPortable,Version=v4.5,Profile=Profile7": [] } diff --git a/src/EditorFeatures/CSharp/project.lock.json b/src/EditorFeatures/CSharp/project.lock.json index 326e6345cc5dc..7e1a39c516f2a 100644 --- a/src/EditorFeatures/CSharp/project.lock.json +++ b/src/EditorFeatures/CSharp/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -318,11 +318,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs index 79ac6b31d7d50..afcadd131d280 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs @@ -2835,6 +2835,50 @@ private static OtherClass InitializeProperty() }"); } + [WorkItem(8230, "https://github.com/dotnet/roslyn/issues/8230")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)] + public async Task TestGenerateMethodForOverloadedSignatureWithDelegateType() + { + await TestAsync( +@" +using System; + +class PropertyMetadata +{ + public PropertyMetadata(object defaultValue) { } + public PropertyMetadata(EventHandler changedHandler) { } +} + +class Program +{ + static void Main() + { + new PropertyMetadata([|OnChanged|]); + } +} +", +@"using System; + +class PropertyMetadata +{ + public PropertyMetadata(object defaultValue) { } + public PropertyMetadata(EventHandler changedHandler) { } +} + +class Program +{ + static void Main() + { + new PropertyMetadata(OnChanged); + } + + private static void OnChanged(object sender, EventArgs e) + { + throw new NotImplementedException(); + } +}"); + } + public class GenerateConversionTest : AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest { internal override Tuple CreateDiagnosticProviderAndFixer(Workspace workspace) diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateVariable/GenerateVariableTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateVariable/GenerateVariableTests.cs index 5a1ce2e02e642..885b8f08a7117 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateVariable/GenerateVariableTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateVariable/GenerateVariableTests.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeFixes.GenerateVariable; @@ -37,6 +38,11 @@ internal IDictionary OptionSet(OptionKey option, object value return options; } + protected override IList MassageActions(IList actions) + { + return FlattenActions(actions); + } + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateVariable)] public async Task TestSimpleLowercaseIdentifier1() { @@ -2866,5 +2872,73 @@ await TestAsync( @"using System ; public class Test { public static int Property1 { get { int _field = 0 ; return _field ; } } } ", index: 3); } + + [WorkItem(8358, "https://github.com/dotnet/roslyn/issues/8358")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateVariable)] + public async Task TestSameNameAsInstanceVariableInContainingType() + { + await TestAsync( +@" +class Outer +{ + int _field; + + class Inner + { + public Inner(int field) + { + [|_field|] = field; + } + } +}", +@" +class Outer +{ + int _field; + + class Inner + { + private int _field; + + public Inner(int field) + { + _field = field; + } + } +} +"); + } + + [WorkItem(8358, "https://github.com/dotnet/roslyn/issues/8358")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateVariable)] + public async Task TestNotOnStaticWithExistingInstance1() + { + await TestMissingAsync( +@" +class C +{ + int _field; + void M() + { + C.[|_field|] = 42; + } +}"); + } + + [WorkItem(8358, "https://github.com/dotnet/roslyn/issues/8358")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateVariable)] + public async Task TestNotOnStaticWithExistingInstance2() + { + await TestMissingAsync( +@" +class C +{ + int _field; + static C() + { + [|_field|] = 42; + } +}"); + } } } diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/CSharpEditAndContinueTestHelpers.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/CSharpEditAndContinueTestHelpers.cs index 2c42f173c4087..9835cd44ecddb 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/CSharpEditAndContinueTestHelpers.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/CSharpEditAndContinueTestHelpers.cs @@ -17,14 +17,29 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.EditAndContinue { internal sealed class CSharpEditAndContinueTestHelpers : EditAndContinueTestHelpers { - internal static readonly CSharpEditAndContinueTestHelpers Instance = new CSharpEditAndContinueTestHelpers(); + private readonly ImmutableArray _fxReferences; + + internal static readonly CSharpEditAndContinueTestHelpers Instance = new CSharpEditAndContinueTestHelpers( + ImmutableArray.Create(TestReferences.NetFx.v4_0_30316_17626.mscorlib, TestReferences.NetFx.v4_0_30319.System_Core)); + + internal static CSharpEditAndContinueTestHelpers Instance40 => new CSharpEditAndContinueTestHelpers( + ImmutableArray.Create(TestReferences.NetFx.v4_0_30319.mscorlib, TestReferences.NetFx.v4_0_30319.System_Core)); + + internal static CSharpEditAndContinueTestHelpers InstanceMinAsync => new CSharpEditAndContinueTestHelpers( + ImmutableArray.Create(TestReferences.NetFx.Minimal.mincorlib, TestReferences.NetFx.Minimal.minasync)); + private static readonly CSharpEditAndContinueAnalyzer s_analyzer = new CSharpEditAndContinueAnalyzer(); + public CSharpEditAndContinueTestHelpers(ImmutableArray fxReferences) + { + _fxReferences = fxReferences; + } + public override AbstractEditAndContinueAnalyzer Analyzer { get { return s_analyzer; } } public override Compilation CreateLibraryCompilation(string name, IEnumerable trees) { - return CSharpCompilation.Create("New", trees, new[] { TestReferences.NetFx.v4_0_30319.mscorlib, TestReferences.NetFx.v4_0_30319.System_Core }, TestOptions.UnsafeReleaseDll); + return CSharpCompilation.Create("New", trees, _fxReferences, TestOptions.UnsafeReleaseDll); } public override SyntaxTree ParseText(string source) diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/RudeEditTestBase.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/RudeEditTestBase.cs index bdeeecc659ecc..5d79e404d8223 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/RudeEditTestBase.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/Helpers/RudeEditTestBase.cs @@ -72,8 +72,10 @@ internal static Match GetMethodMatch(string src1, string src2, Parse var m2 = MakeMethodBody(src2, options, kind); var diagnostics = new List(); - bool needsSyntaxMap; - var match = Analyzer.ComputeBodyMatch(m1, m2, Array.Empty(), diagnostics, out needsSyntaxMap); + + bool oldHasStateMachineSuspensionPoint, newHasStateMachineSuspensionPoint; + var match = Analyzer.ComputeBodyMatch(m1, m2, Array.Empty(), diagnostics, out oldHasStateMachineSuspensionPoint, out newHasStateMachineSuspensionPoint); + bool needsSyntaxMap = oldHasStateMachineSuspensionPoint && newHasStateMachineSuspensionPoint; Assert.Equal(kind != MethodKind.Regular && kind != MethodKind.ConstructorWithParameters, needsSyntaxMap); @@ -162,12 +164,14 @@ internal static void VerifyPreserveLocalVariables(EditScript edits, var body2 = ((MethodDeclarationSyntax)SyntaxFactory.SyntaxTree(decl2).GetRoot()).Body; var diagnostics = new List(); - bool isActiveMethod; - var match = Analyzer.ComputeBodyMatch(body1, body2, Array.Empty(), diagnostics, out isActiveMethod); + + bool oldHasStateMachineSuspensionPoint, newHasStateMachineSuspensionPoint; + var match = Analyzer.ComputeBodyMatch(body1, body2, Array.Empty(), diagnostics, out oldHasStateMachineSuspensionPoint, out newHasStateMachineSuspensionPoint); + bool needsSyntaxMap = oldHasStateMachineSuspensionPoint && newHasStateMachineSuspensionPoint; // Active methods are detected to preserve local variables for variable mapping and // edited async/iterator methods are considered active. - Assert.Equal(preserveLocalVariables, isActiveMethod); + Assert.Equal(preserveLocalVariables, needsSyntaxMap); } } } diff --git a/src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs b/src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs index 6daf52d4060e8..f1563564bd7e0 100644 --- a/src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs +++ b/src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs @@ -4,6 +4,7 @@ using System.IO; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.EditAndContinue.UnitTests; +using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.EditAndContinue; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; @@ -6425,6 +6426,81 @@ static IEnumerable F() Diagnostic(RudeEditKind.Insert, "yield return 2;", CSharpFeaturesResources.YieldStatement)); } + [Fact] + public void MissingIteratorStateMachineAttribute() + { + var src1 = @" +using System.Collections.Generic; + +class C +{ + static IEnumerable F() + { + yield return 1; + } +} +"; + var src2 = @" +using System.Collections.Generic; + +class C +{ + static IEnumerable F() + { + yield return 2; + } +} +"; + var edits = GetTopEdits(src1, src2); + + CSharpEditAndContinueTestHelpers.Instance40.VerifySemantics( + edits, + ActiveStatementsDescription.Empty, + null, + null, + null, + new[] + { + Diagnostic(RudeEditKind.UpdatingStateMachineMethodMissingAttribute, "static IEnumerable F()", "System.Runtime.CompilerServices.IteratorStateMachineAttribute") + }); + } + + [Fact] + public void MissingIteratorStateMachineAttribute2() + { + var src1 = @" +using System.Collections.Generic; + +class C +{ + static IEnumerable F() + { + return null; + } +} +"; + var src2 = @" +using System.Collections.Generic; + +class C +{ + static IEnumerable F() + { + yield return 2; + } +} +"; + var edits = GetTopEdits(src1, src2); + + CSharpEditAndContinueTestHelpers.Instance40.VerifySemantics( + edits, + ActiveStatementsDescription.Empty, + null, + null, + null, + null); + } + #endregion #region Await @@ -6810,6 +6886,84 @@ class C edits.VerifyRudeDiagnostics(); } + [Fact] + public void MissingAsyncStateMachineAttribute1() + { + var src1 = @" +using System.Threading.Tasks; + +class C +{ + static async Task F() + { + await new Task(); + return 1; + } +} +"; + var src2 = @" +using System.Threading.Tasks; + +class C +{ + static async Task F() + { + await new Task(); + return 2; + } +} +"; + var edits = GetTopEdits(src1, src2); + + CSharpEditAndContinueTestHelpers.InstanceMinAsync.VerifySemantics( + edits, + ActiveStatementsDescription.Empty, + null, + null, + null, + new[] + { + Diagnostic(RudeEditKind.UpdatingStateMachineMethodMissingAttribute, "static async Task F()", "System.Runtime.CompilerServices.AsyncStateMachineAttribute") + }); + } + + [Fact] + public void MissingAsyncStateMachineAttribute2() + { + var src1 = @" +using System.Threading.Tasks; + +class C +{ + static Task F() + { + return null; + } +} +"; + var src2 = @" +using System.Threading.Tasks; + +class C +{ + static async Task F() + { + await new Task(); + return 2; + } +} +"; + var edits = GetTopEdits(src1, src2); + + CSharpEditAndContinueTestHelpers.InstanceMinAsync.VerifySemantics( + edits, + ActiveStatementsDescription.Empty, + null, + null, + null, + null); + } + #endregion } } diff --git a/src/EditorFeatures/CSharpTest/project.lock.json b/src/EditorFeatures/CSharpTest/project.lock.json index 6bd596d640c86..398944b700f38 100644 --- a/src/EditorFeatures/CSharpTest/project.lock.json +++ b/src/EditorFeatures/CSharpTest/project.lock.json @@ -153,24 +153,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -283,7 +265,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -513,14 +495,6 @@ "lib/net40/Moq.dll": {} } }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "compile": { - "ref/dotnet/_._": {} - }, - "runtime": { - "runtimes/win7/lib/net/_._": {} - } - }, "System.AppContext/4.0.0": { "dependencies": { "System.Runtime": "4.0.0" @@ -569,25 +543,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0", - "runtime.win7.System.Diagnostics.Process": "4.1.0-beta-23504" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -700,7 +655,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1078,21 +1033,6 @@ "lib/sl4/Moq.Silverlight.xml" ] }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "t96Q9MyIMoFQtblYAVQshxWL8AZEKSble9wb0Wp330R02N7fsgfPlhqd3h+VvrhTKMT0WWbkHyH9vEU+SSLpTg==", - "type": "package", - "files": [ - "ref/dotnet/_._", - "runtime.win7.System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "runtime.win7.System.Diagnostics.Process.nuspec", - "runtimes/win7/lib/dotnet5.5/System.Diagnostics.Process.dll", - "runtimes/win7/lib/net/_._", - "runtimes/win7/lib/netcore50/_._", - "runtimes/win7/lib/win8/_._", - "runtimes/win7/lib/wp8/_._", - "runtimes/win7/lib/wpa81/_._" - ] - }, "System.AppContext/4.0.0": { "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", "type": "package", @@ -1200,49 +1140,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1593,11 +1490,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/EditorFeatures/CSharpTest2/project.lock.json b/src/EditorFeatures/CSharpTest2/project.lock.json index 8bddcba7263e1..233566fd6e0ab 100644 --- a/src/EditorFeatures/CSharpTest2/project.lock.json +++ b/src/EditorFeatures/CSharpTest2/project.lock.json @@ -177,24 +177,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -307,7 +289,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -621,14 +603,6 @@ "runtimes/win7/lib/net/_._": {} } }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "compile": { - "ref/dotnet/_._": {} - }, - "runtime": { - "runtimes/win7/lib/net/_._": {} - } - }, "System.AppContext/4.0.0": { "dependencies": { "System.Runtime": "4.0.0" @@ -701,25 +675,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0", - "runtime.win7.System.Diagnostics.Process": "4.1.0-beta-23504" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -856,7 +811,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1323,21 +1278,6 @@ "runtimes/win7/lib/net/_._" ] }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "t96Q9MyIMoFQtblYAVQshxWL8AZEKSble9wb0Wp330R02N7fsgfPlhqd3h+VvrhTKMT0WWbkHyH9vEU+SSLpTg==", - "type": "package", - "files": [ - "ref/dotnet/_._", - "runtime.win7.System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "runtime.win7.System.Diagnostics.Process.nuspec", - "runtimes/win7/lib/dotnet5.5/System.Diagnostics.Process.dll", - "runtimes/win7/lib/net/_._", - "runtimes/win7/lib/netcore50/_._", - "runtimes/win7/lib/win8/_._", - "runtimes/win7/lib/wp8/_._", - "runtimes/win7/lib/wpa81/_._" - ] - }, "System.AppContext/4.0.0": { "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", "type": "package", @@ -1505,49 +1445,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1948,11 +1845,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/EditorFeatures/Core/project.lock.json b/src/EditorFeatures/Core/project.lock.json index 326e6345cc5dc..7e1a39c516f2a 100644 --- a/src/EditorFeatures/Core/project.lock.json +++ b/src/EditorFeatures/Core/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -318,11 +318,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/EditorFeatures/Test/EditAndContinue/Extensions.cs b/src/EditorFeatures/Test/EditAndContinue/Extensions.cs index dc90709d0e6b5..a6651fc6b0407 100644 --- a/src/EditorFeatures/Test/EditAndContinue/Extensions.cs +++ b/src/EditorFeatures/Test/EditAndContinue/Extensions.cs @@ -12,6 +12,7 @@ internal static class Extensions { public static void Verify(this IEnumerable diagnostics, string newSource, params RudeEditDiagnosticDescription[] expectedDiagnostics) { + expectedDiagnostics = expectedDiagnostics ?? Array.Empty(); var actualDiagnostics = diagnostics.ToDescription(newSource, expectedDiagnostics.Any(d => d.FirstLine != null)).ToArray(); AssertEx.SetEqual(expectedDiagnostics, actualDiagnostics, itemSeparator: ",\r\n"); } diff --git a/src/EditorFeatures/Test/project.lock.json b/src/EditorFeatures/Test/project.lock.json index ff3f3ebff014d..218c434255b56 100644 --- a/src/EditorFeatures/Test/project.lock.json +++ b/src/EditorFeatures/Test/project.lock.json @@ -153,24 +153,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -283,7 +265,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -513,14 +495,6 @@ "lib/net40/Moq.dll": {} } }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "compile": { - "ref/dotnet/_._": {} - }, - "runtime": { - "runtimes/win7/lib/net/_._": {} - } - }, "System.AppContext/4.0.0": { "dependencies": { "System.Runtime": "4.0.0" @@ -569,25 +543,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0", - "runtime.win7.System.Diagnostics.Process": "4.1.0-beta-23504" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -700,7 +655,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -978,24 +933,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -1108,7 +1045,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1486,21 +1423,6 @@ "lib/sl4/Moq.Silverlight.xml" ] }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "t96Q9MyIMoFQtblYAVQshxWL8AZEKSble9wb0Wp330R02N7fsgfPlhqd3h+VvrhTKMT0WWbkHyH9vEU+SSLpTg==", - "type": "package", - "files": [ - "ref/dotnet/_._", - "runtime.win7.System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "runtime.win7.System.Diagnostics.Process.nuspec", - "runtimes/win7/lib/dotnet5.5/System.Diagnostics.Process.dll", - "runtimes/win7/lib/net/_._", - "runtimes/win7/lib/netcore50/_._", - "runtimes/win7/lib/win8/_._", - "runtimes/win7/lib/wp8/_._", - "runtimes/win7/lib/wpa81/_._" - ] - }, "System.AppContext/4.0.0": { "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", "type": "package", @@ -1608,49 +1530,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -2001,11 +1880,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/EditorFeatures/Test2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb b/src/EditorFeatures/Test2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb index b69335a410e02..88db6a822cefd 100644 --- a/src/EditorFeatures/Test2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb +++ b/src/EditorFeatures/Test2/Diagnostics/AbstractCrossLanguageUserDiagnosticTest.vb @@ -28,6 +28,17 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics End Using End Function + Protected Overridable Function MassageActions(actions As IList(Of CodeAction)) As IList(Of CodeAction) + Return actions + End Function + + Protected Shared Function FlattenActions(codeActions As IEnumerable(Of CodeAction)) As IList(Of CodeAction) + Return codeActions?.SelectMany( + Function(a) If(a.HasCodeActions, + a.GetCodeActions().ToArray(), + {a})).ToList() + End Function + Protected Async Function TestAsync(definition As XElement, Optional expected As String = Nothing, Optional codeActionIndex As Integer = 0, @@ -39,7 +50,9 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics onAfterWorkspaceCreated?.Invoke(workspace) Dim diagnosticAndFix = Await GetDiagnosticAndFixAsync(workspace) - Dim codeAction = diagnosticAndFix.Item2.Fixes.ElementAt(codeActionIndex).Action + Dim codeActions = diagnosticAndFix.Item2.Fixes.Select(Function(f) f.Action).ToList() + codeActions = MassageActions(codeActions) + Dim codeAction = codeActions(codeActionIndex) Dim operations = Await codeAction.GetOperationsAsync(CancellationToken.None) Dim edit = operations.OfType(Of ApplyChangesOperation)().First() diff --git a/src/EditorFeatures/Test2/Diagnostics/GenerateFromUsage/GenerateMethodCrossLanguageTests.vb b/src/EditorFeatures/Test2/Diagnostics/GenerateFromUsage/GenerateMethodCrossLanguageTests.vb index ecf48ccca527c..912254a09969d 100644 --- a/src/EditorFeatures/Test2/Diagnostics/GenerateFromUsage/GenerateMethodCrossLanguageTests.vb +++ b/src/EditorFeatures/Test2/Diagnostics/GenerateFromUsage/GenerateMethodCrossLanguageTests.vb @@ -3,11 +3,18 @@ Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis.CodeFixes Imports Microsoft.CodeAnalysis.Diagnostics +Imports Xunit.Abstractions Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics.GenerateMethod Partial Public Class GenerateMethodCrossLanguageTests Inherits AbstractCrossLanguageUserDiagnosticTest + Private ReadOnly _outputHelper As ITestOutputHelper + + Public Sub New(outputHelper As ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace, language As String) As Tuple(Of DiagnosticAnalyzer, CodeFixProvider) If language = LanguageNames.CSharp Then Return Tuple.Create(Of DiagnosticAnalyzer, CodeFixProvider)( @@ -20,7 +27,8 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics.GenerateMethod End If End Function - + + Public Async Function TestSimpleInstanceMethod_CSharpToVisualBasic() As System.Threading.Tasks.Task Dim input = @@ -55,7 +63,7 @@ public class VBClass end class .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -92,7 +100,7 @@ public class VBClass end class .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -134,7 +142,7 @@ public class VBClass end class .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -168,7 +176,7 @@ end class end interface .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -210,7 +218,7 @@ end class end class .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -285,7 +293,7 @@ end class } .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -326,7 +334,7 @@ end class end class .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -367,7 +375,7 @@ end class end class .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -412,7 +420,7 @@ end class } .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -457,7 +465,7 @@ end class }]]> .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -512,7 +520,7 @@ Module Program End Module]]> .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -582,7 +590,7 @@ Module Program End Module]]> .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -652,7 +660,7 @@ Module Program End Module]]> .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -732,7 +740,7 @@ Module Program End Module]]> .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function Public Async Function GenerateMethodUsingTypeConstraint_3BaseTypeConstraints_CommonDerived() As Task @@ -820,7 +828,7 @@ Module Program End Module]]> .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -905,7 +913,7 @@ Module Program End Module]]> .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -997,7 +1005,7 @@ Module Program End Module]]> .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function @@ -1070,7 +1078,7 @@ Module Program End Module]]> .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function #Region "Normal tests" diff --git a/src/EditorFeatures/Test2/Diagnostics/GenerateFromUsage/GenerateVariableCrossLanguageTests.vb b/src/EditorFeatures/Test2/Diagnostics/GenerateFromUsage/GenerateVariableCrossLanguageTests.vb index d28be912899ae..fcdb9bd24b917 100644 --- a/src/EditorFeatures/Test2/Diagnostics/GenerateFromUsage/GenerateVariableCrossLanguageTests.vb +++ b/src/EditorFeatures/Test2/Diagnostics/GenerateFromUsage/GenerateVariableCrossLanguageTests.vb @@ -1,13 +1,21 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports System.Threading.Tasks +Imports Microsoft.CodeAnalysis.CodeActions Imports Microsoft.CodeAnalysis.CodeFixes Imports Microsoft.CodeAnalysis.Diagnostics +Imports Xunit.Abstractions Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics.GenerateVariable Partial Public Class GenerateVariableCrossLanguageTests Inherits AbstractCrossLanguageUserDiagnosticTest + Private ReadOnly _outputHelper As ITestOutputHelper + + Public Sub New(outputHelper As ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Friend Overrides Function CreateDiagnosticProviderAndFixer(workspace As Workspace, language As String) As Tuple(Of DiagnosticAnalyzer, CodeFixProvider) If language = LanguageNames.CSharp Then Return Tuple.Create(Of DiagnosticAnalyzer, CodeFixProvider)( @@ -20,6 +28,10 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics.GenerateVariable End If End Function + Protected Overrides Function MassageActions(actions As IList(Of CodeAction)) As IList(Of CodeAction) + Return FlattenActions(actions) + End Function + Public Async Function TestSimpleInstanceProperty_VisualBasicToCSharp() As Task Dim input = @@ -52,7 +64,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics.GenerateVariable } .Value.Trim() - Await TestAsync(input, expected) + Await TestAsync(input, expected, onAfterWorkspaceCreated:=Sub(w) w.SetTestLogger(AddressOf _outputHelper.WriteLine)) End Function End Class End Namespace diff --git a/src/EditorFeatures/Test2/FindReferences/FindReferencesTests.vb b/src/EditorFeatures/Test2/FindReferences/FindReferencesTests.vb index 5036fe2200e0b..2b154f31fb9ac 100644 --- a/src/EditorFeatures/Test2/FindReferences/FindReferencesTests.vb +++ b/src/EditorFeatures/Test2/FindReferences/FindReferencesTests.vb @@ -7,12 +7,21 @@ Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.FindSymbols Imports Roslyn.Utilities +Imports Xunit.Abstractions Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences Partial Public Class FindReferencesTests + Private ReadOnly _outputHelper As ITestOutputHelper + + Public Sub New(outputHelper As ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Private Async Function TestAsync(definition As XElement, Optional searchSingleFileOnly As Boolean = False, Optional uiVisibleOnly As Boolean = False) As Task Using workspace = Await TestWorkspace.CreateAsync(definition) + workspace.SetTestLogger(AddressOf _outputHelper.WriteLine) + For Each cursorDocument In workspace.Documents.Where(Function(d) d.CursorPosition.HasValue) Dim cursorPosition = cursorDocument.CursorPosition.Value diff --git a/src/EditorFeatures/Test2/Rename/CSharp/AliasTests.vb b/src/EditorFeatures/Test2/Rename/CSharp/AliasTests.vb index 3fc036974c316..e7e96d766670d 100644 --- a/src/EditorFeatures/Test2/Rename/CSharp/AliasTests.vb +++ b/src/EditorFeatures/Test2/Rename/CSharp/AliasTests.vb @@ -1,13 +1,20 @@ ' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. Imports Microsoft.CodeAnalysis.Rename.ConflictEngine +Imports Xunit.Abstractions Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Class AliasTests + Private ReadOnly _outputHelper As ITestOutputHelper + + Sub New(outputHelper As ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub RenameNamespaceAlias() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -27,7 +34,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Sub RenameNamespaceAndAlias() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -48,7 +55,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Sub RenameNamespaceButNotDifferentlyNamedAlias() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -70,7 +77,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Sub RenameConstructedTypeAliasFromUse() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameConstructedTypeAliasFromDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameConstructedTypeAliasFromDeclaration2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameSimpleTypeAliasFromUse() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -160,7 +167,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Sub RenameSimpleTypeAliasFromDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -182,7 +189,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Sub RenameSimpleSpecialTypeAliasVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -204,7 +211,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Sub RenameSimpleSpecialTypeDoubleAliasVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -227,7 +234,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Sub RenameSimpleTypeAliasVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -249,7 +256,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Sub RenameAliasNoConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -282,7 +289,7 @@ public class C3 Public Sub RenameAliasToSameNameNoConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -310,7 +317,7 @@ public class C3 Public Sub RenameOneDuplicateAliasToNoConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -339,7 +346,7 @@ public class C3 Public Sub RenameOuterAliasWithNestedAlias() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameConflictWithAlias() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug579200_RenameNestedAliasTarget() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug579214_RenameAttributeNamedDynamic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug629695_DetectConflictWithAliasInSameBlockCompUnit() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug629695_DetectConflictWithAliasInSameBlockNSDecl() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug629695_DetectConflictWithAliasInSameBlockWithEscaping() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug603365_RenameAliasToClassNameOnlyFixesAliasUsages_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug603365_RenameAliasToClassNameOnlyFixesAliasUsages_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameAliasToAttributeAndEndingWithAttributeAttribute() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameAliasToAttributeAndEndingWithAttributeAttributeWithResolvedConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameAliasToNullableWithResolvedConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub NoConflictForDelegate() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -31,7 +37,7 @@ class C Public Sub NoConflictForIsolatedScopes() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -55,7 +61,7 @@ class C Public Sub ConflictBetweenFields() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -75,7 +81,7 @@ class Foo Public Sub ConflictBetweenFieldAndMethodDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -95,7 +101,7 @@ class Foo Public Sub ConflictBetweenPropertyAndFieldDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -115,7 +121,7 @@ class Program Public Sub ConflictBetweenMethodDeclarations() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -135,7 +141,7 @@ class Foo Public Sub ConflictBetweenParameterDeclarations() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -154,7 +160,7 @@ class Foo Public Sub NoConflictBetweenMethodsOfDifferentSignature() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -173,7 +179,7 @@ class Foo Public Sub ConflictBetweenMemberDeclarationsWithOutOrRefDifferenceOnly() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -193,7 +199,7 @@ class Foo Public Sub NoConflictBetweenMethodsDifferingByArity() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub NoConflictWithNamespaceDefinedInMetadata() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub NoConflictWithEquallyNamedNamespaces() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_ConflictInFieldInitializerOfFieldAndModuleNameResolvedThroughFullQualification() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_NoConflictBetweenLambdaParameterAndField() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_ConflictBetweenTypeParametersInTypeDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_ConflictBetweenTypeParametersInMethodDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_ConflictBetweenTypeParametersInMethodDeclaration_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_ConflictBetweenTypeParameterAndMember_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_ConflictBetweenTypeParameterAndMember_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_OverridingImplicitlyUsedMethod() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_OverridingImplicitlyUsedMethod_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_OverridingImplicitlyUsedMethod_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ConflictInsideAttributeArgument() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -550,7 +556,7 @@ class C Public Sub ResolveConflictInAnonymousTypeProperty() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ResolveConflictWhenAnonymousTypeIsUsedAsGenericArgument() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub EscapeWhenRenamingToEscapedKeyword1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -25,7 +31,7 @@ class [|$$Foo|] Public Sub EscapeWhenRenamingToEscapedKeyword2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -44,7 +50,7 @@ class {|escaped:$$Foo|} Public Sub UseFullAttributeNameWhenShortNameIsKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -70,7 +76,7 @@ class [|$$MainAttribute|] : System.Attribute Public Sub EscapeAttributeIfKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -97,7 +103,7 @@ class {|escaped:$$MainAttribute|} : System.Attribute Public Sub DoNotStickTokensTogetherForRefParameter_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -117,7 +123,7 @@ class {|escaped:$$MainAttribute|} : System.Attribute Public Sub DoNotStickTokensTogetherForRefParameter_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -136,7 +142,7 @@ class {|escaped:$$MainAttribute|} : System.Attribute Public Sub RenameEscapedIdentifierUnescapes() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -157,7 +163,7 @@ class {|escaped:$$MainAttribute|} : System.Attribute Public Sub RenameEscapedIdentifierUnescapes_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -179,7 +185,7 @@ class {|escaped:$$MainAttribute|} : System.Attribute Public Sub RenameEscapedIdentifierUnescapes_3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/CSharp/GenericTypeParameterTests.vb b/src/EditorFeatures/Test2/Rename/CSharp/GenericTypeParameterTests.vb index a65c123c7cfbc..13570cf3d79e1 100644 --- a/src/EditorFeatures/Test2/Rename/CSharp/GenericTypeParameterTests.vb +++ b/src/EditorFeatures/Test2/Rename/CSharp/GenericTypeParameterTests.vb @@ -2,10 +2,16 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Class GenericTypeParameterTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub CustomerReported_ErrorTolerance() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/CSharp/ImplicitReferenceConflictTests.vb b/src/EditorFeatures/Test2/Rename/CSharp/ImplicitReferenceConflictTests.vb index 1c0873262f705..c59868d9ba827 100644 --- a/src/EditorFeatures/Test2/Rename/CSharp/ImplicitReferenceConflictTests.vb +++ b/src/EditorFeatures/Test2/Rename/CSharp/ImplicitReferenceConflictTests.vb @@ -5,10 +5,16 @@ Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Class ImplicitReferenceConflictTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub RenameMoveNextCausesConflictInForEach() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -46,7 +52,7 @@ class C Public Sub RenameMoveNextInVBCausesConflictInForEach() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -93,7 +99,7 @@ class D Public Sub RenameMoveNextInVBToUpperCaseOnlyCausesConflictInCSForEach() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/CSharp/InteractiveTests.vb b/src/EditorFeatures/Test2/Rename/CSharp/InteractiveTests.vb index 2d56c55e80134..2ddd70fb9ab43 100644 --- a/src/EditorFeatures/Test2/Rename/CSharp/InteractiveTests.vb +++ b/src/EditorFeatures/Test2/Rename/CSharp/InteractiveTests.vb @@ -2,10 +2,16 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Class InteractiveTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub RenamingTopLevelMethodsSupported() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, void [|$$Foo|]() diff --git a/src/EditorFeatures/Test2/Rename/CSharp/InterfaceTests.vb b/src/EditorFeatures/Test2/Rename/CSharp/InterfaceTests.vb index 92fbfc00dfe04..4819f034526db 100644 --- a/src/EditorFeatures/Test2/Rename/CSharp/InterfaceTests.vb +++ b/src/EditorFeatures/Test2/Rename/CSharp/InterfaceTests.vb @@ -2,10 +2,16 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Class InterfaceTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub RenameExplicitlyImplementedInterfaceMemberFromDefinition() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -28,7 +34,7 @@ class C : I Public Sub RenameExplicitlyImplementedInterfaceMemberFromImplementation() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -51,7 +57,7 @@ class C : I Public Sub RenameExplicitlyImplementedInterfaceMemberWithInterfaceInNamespace() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -76,7 +82,7 @@ class C : N.I Public Sub RenameInterfaceForExplicitlyImplementedInterfaceMemberWithInterfaceInNamespace() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/CSharp/LocalConflictTests.vb b/src/EditorFeatures/Test2/Rename/CSharp/LocalConflictTests.vb index b5b17b85c80c3..77dd46ef5eb83 100644 --- a/src/EditorFeatures/Test2/Rename/CSharp/LocalConflictTests.vb +++ b/src/EditorFeatures/Test2/Rename/CSharp/LocalConflictTests.vb @@ -4,11 +4,17 @@ Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.CSharp Public Class LocalConflictTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub ConflictingLocalWithLocal() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -33,7 +39,7 @@ class Program Public Sub ConflictingLocalWithParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -56,7 +62,7 @@ class Program Public Sub ConflictingLocalWithForEachRangeVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -81,7 +87,7 @@ class Program Public Sub ConflictingLocalWithForLoopVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -106,7 +112,7 @@ class Program Public Sub ConflictingLocalWithUsingBlockVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -131,7 +137,7 @@ class Program : IDisposable Public Sub ConflictingLocalWithSimpleLambdaParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ConflictingLocalWithParenthesizedLambdaParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ConflictingFromClauseWithLetClause() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -215,7 +221,7 @@ class C Public Sub ConflictBetweenLabelsInSameMethod() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -243,7 +249,7 @@ public class C Public Sub ConflictBetweenLabelInMethodAndLambda() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -271,7 +277,7 @@ public class C Public Sub ConflictBetweenLabelsInLambda() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -298,7 +304,7 @@ public class C Public Sub NoConflictBetweenLabelsInTwoNonNestedLambdas() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -324,7 +330,7 @@ public class C Public Sub NoConflictsWithCatchBlockWithoutExceptionVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -353,7 +359,7 @@ class Test Public Sub NoConflictsBetweenCatchClauses() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -378,7 +384,7 @@ class Test Public Sub ConflictsWithinCatchClause() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -404,7 +410,7 @@ class Test Public Sub NoConflictsWithCatchExceptionWithoutDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -433,7 +439,7 @@ class Test Public Sub ConflictingLocalWithFieldWithExtensionMethodInvolved() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/InlineRenameTests.vb b/src/EditorFeatures/Test2/Rename/InlineRenameTests.vb index f1e65ad33f773..567b83ec6761a 100644 --- a/src/EditorFeatures/Test2/Rename/InlineRenameTests.vb +++ b/src/EditorFeatures/Test2/Rename/InlineRenameTests.vb @@ -16,6 +16,12 @@ Imports Microsoft.VisualStudio.Text Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename Public Class InlineRenameTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Async Function SimpleEditAndCommit() As Task @@ -635,7 +641,7 @@ End Class Public Sub RenameWithInheritenceCascadingWithClass() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/RenameEngineResult.vb b/src/EditorFeatures/Test2/Rename/RenameEngineResult.vb index bbea9205f2402..e9e0d8e4ff63d 100644 --- a/src/EditorFeatures/Test2/Rename/RenameEngineResult.vb +++ b/src/EditorFeatures/Test2/Rename/RenameEngineResult.vb @@ -10,6 +10,7 @@ Imports Microsoft.CodeAnalysis.Text Imports Microsoft.VisualStudio.Text Imports Xunit.Sdk Imports Microsoft.CodeAnalysis.Options +Imports Xunit.Abstractions Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename ''' @@ -54,8 +55,9 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename _renameTo = renameTo End Sub - Public Shared Function Create(workspaceXml As XElement, renameTo As String, Optional changedOptionSet As Dictionary(Of OptionKey, Object) = Nothing) As RenameEngineResult + Public Shared Function Create(helper As ITestOutputHelper, workspaceXml As XElement, renameTo As String, Optional changedOptionSet As Dictionary(Of OptionKey, Object) = Nothing) As RenameEngineResult Dim workspace = TestWorkspace.CreateWorkspace(workspaceXml) + workspace.SetTestLogger(AddressOf helper.WriteLine) Dim engineResult As RenameEngineResult = Nothing Try @@ -82,16 +84,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename Next End If - AssertIsComplete(workspace.CurrentSolution) - Dim locations = RenameLocations.FindAsync(symbol, workspace.CurrentSolution, optionSet, CancellationToken.None).Result Dim originalName = symbol.Name.Split("."c).Last() Dim result = ConflictResolver.ResolveConflictsAsync(locations, originalName, renameTo, optionSet, hasConflict:=Nothing, cancellationToken:=CancellationToken.None).Result - AssertIsComplete(result.OldSolution) - AssertIsComplete(result.NewSolution) - engineResult = New RenameEngineResult(workspace, result, renameTo) engineResult.AssertUnlabeledSpansRenamedAndHaveNoConflicts() Catch @@ -107,15 +104,6 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename Return engineResult End Function - Private Shared Sub AssertIsComplete(currentSolution As Solution) - ' Ensure we don't have a partial solution. This is to detect for possible root causes of - ' https://github.com/dotnet/roslyn/issues/9298 - - If currentSolution.Projects.Any(Function(p) Not p.HasCompleteReferencesAsync().Result) Then - AssertEx.Fail("We have an incomplete project floating around which we should not.") - End If - End Sub - Friend ReadOnly Property ConflictResolution As ConflictResolution Get Return _resolution diff --git a/src/EditorFeatures/Test2/Rename/RenameEngineTests.CSharpConflicts.vb b/src/EditorFeatures/Test2/Rename/RenameEngineTests.CSharpConflicts.vb index 6328aa90fce8b..07f99c00e9a78 100644 --- a/src/EditorFeatures/Test2/Rename/RenameEngineTests.CSharpConflicts.vb +++ b/src/EditorFeatures/Test2/Rename/RenameEngineTests.CSharpConflicts.vb @@ -3,13 +3,19 @@ Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename - Partial Public Class RenameEngineTest + Partial Public Class RenameEngineTests Public Class CSharpConflicts + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub BreakingRenameWithRollBacksInsideLambdas_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -37,7 +43,7 @@ class C Public Sub BreakingRenameWithRollBacksInsideLambdas_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -69,7 +75,7 @@ class C Public Sub BreakingRenameWithInvocationOnDelegateInstance() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -100,7 +106,7 @@ class C Public Sub BreakingRenameWithSameClassInOneNamespace() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -128,7 +134,7 @@ namespace N Public Sub BreakingRenameCrossAssembly() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, CSAssembly1 @@ -160,7 +166,7 @@ public class [|C|] Public Sub ConflictResolutionInsideLambdaBody() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -208,7 +214,7 @@ class Proaasgram Public Sub ConflictResolutionInsideExpressionBodiedLambda() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -234,7 +240,7 @@ public class B Public Sub ConflictResolutionInsideExpressionBodiedLambda2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -259,7 +265,7 @@ public class B Public Sub ConflictResolutionInsideMethodBody() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -287,7 +293,7 @@ public class B Public Sub ConflictResolutionInInvocationWithLambda_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -337,7 +343,7 @@ static class E Public Sub ConflictResolutionInInvocationWithLambda_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -387,7 +393,7 @@ static class E Public Sub ConflictResolutionInInvocationWithLambda_3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -437,7 +443,7 @@ static class E Public Sub ConflictResolutionInInvocationWithLambda_4() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -487,7 +493,7 @@ static class E Public Sub ConflictResolutionInInvocationWithLambda_5() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -537,7 +543,7 @@ static class E Public Sub ParameterConflictingWithInstanceField1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -562,7 +568,7 @@ class Foo Public Sub ParameterConflictingWithInstanceField2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -589,7 +595,7 @@ class Foo Public Sub ParameterConflictingWithInstanceFieldRenamingToKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -616,7 +622,7 @@ class Foo Public Sub ParameterConflictingWithStaticField() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -643,7 +649,7 @@ class Foo Public Sub ParameterConflictingWithFieldFromAnotherLanguage() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, VisualBasicAssembly @@ -675,7 +681,7 @@ End Class Public Sub ConflictingTypeDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenamingToInvalidIdentifier() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -742,7 +748,7 @@ class {|Invalid:$$Foo|} Public Sub RenamingToInvalidIdentifier2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -764,7 +770,7 @@ class {|Invalid:$$Foo|} Public Sub RenamingToConflictingMethodInvocation() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -794,7 +800,7 @@ class Program Public Sub RenamingToConflictingMethodInvocation2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -825,7 +831,7 @@ class Program Public Sub RenamingTypeToConflictingMemberAndParentTypeName() ' It's important that we see conflicts for both simultaneously, so I do a single ' test for both cases. - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -849,7 +855,7 @@ class {|Conflict:Foo|} Public Sub RenamingMemberToNameConflictingWithParent() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -870,7 +876,7 @@ class {|Conflict:Foo|} Public Sub RenamingMemberToInvalidIdentifierName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -889,7 +895,7 @@ class {|Invalid:$$Foo|} Public Sub MinimalQualificationOfBaseType1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -915,7 +921,7 @@ class Y : X Public Sub MinimalQualificationOfBaseType2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -942,7 +948,7 @@ class Y : X Public Sub EscapeIfKeywordWhenDoingTypeNameQualification() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -969,7 +975,7 @@ static class Foo Public Sub EscapeUnboundGenericTypesInTypeOfContext() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub EscapeUnboundGenericTypesInTypeOfContext2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub EscapeUnboundGenericTypesInTypeOfContext3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ReplaceAliasWithGenericTypeThatIncludesArrays() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ReplaceAliasWithGenericTypeThatIncludesPointers() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ReplaceAliasWithNestedGenericType() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RewriteConflictingExtensionMethodCallSite() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1201,7 +1207,7 @@ static class E Public Sub RewriteConflictingExtensionMethodCallSiteWithReturnTypeChange() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1231,7 +1237,7 @@ static class E Public Sub RewriteConflictingExtensionMethodCallSiteRequiringTypeArguments() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RewriteConflictingExtensionMethodCallSiteInferredTypeArguments() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub DoNotDetectQueryContinuationNamedTheSame() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1322,7 +1328,7 @@ class C Public Sub RenameHandlesUsingWithoutDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1351,7 +1357,7 @@ class Program Public Sub RenameHandlesForWithoutDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1378,7 +1384,7 @@ class Program Public Sub RenameAttributeSuffix() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1403,7 +1409,7 @@ public class [|$$SomethingAttribute|] : Attribute Public Sub RenameAddAttributeSuffix() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1427,7 +1433,7 @@ public class [|$$SomethingAttribute|] : Attribute Public Sub RenameKeepAttributeSuffixOnUsages() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1451,7 +1457,7 @@ public class [|$$SomethingAttribute|] : Attribute Public Sub RenameToConflictWithValue() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1480,7 +1486,7 @@ class C Public Sub RenameAttributeWithConflictingUse() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1508,7 +1514,7 @@ class [|$$Main|] : System.Attribute Public Sub QualifyTypeWithGlobalWhenConflicting() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1532,7 +1538,7 @@ class B Public Sub RenameSymbolConflictWithLocals() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1559,7 +1565,7 @@ class C Public Sub RenameAliasToCatchConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1582,7 +1588,7 @@ namespace X Public Sub RenameAttributeToCreateConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1608,7 +1614,7 @@ class [|$$Main|] : Attribute // Rename 'Main' to 'Special' Public Sub RenameUsingToKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1635,7 +1641,7 @@ class B Public Sub RenameInNestedClasses() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameAndEscapeContextualKeywordsInCSharp() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1693,7 +1699,7 @@ class [|t$$o|] // Rename 'to' to 'from' Public Sub RenameCrefWithConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameClassContainingAlias() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameFunctionWithOverloadConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1782,7 +1788,7 @@ class Bar Public Sub RenameActionWithFunctionConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameFunctionNameToDelegateTypeConflict1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1842,7 +1848,7 @@ class A Public Sub RenameFunctionNameToDelegateTypeConflict2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1871,7 +1877,7 @@ class A Public Sub RenameFunctionNameToDelegateTypeConflict3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1903,7 +1909,7 @@ class A Public Sub RenameFunctionNameToDelegateTypeConflict4() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1936,7 +1942,7 @@ class A Public Sub RenameActionTypeConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameConflictAttribute1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameConflictAttribute2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2011,7 +2017,7 @@ class AAttributeAttribute : Attribute Public Sub Bug576573_ConflictAttributeWithNamespace() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2042,7 +2048,7 @@ namespace X Public Sub Bug579602_RenameFunctionWithDynamicParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2073,7 +2079,7 @@ class A Public Sub IdentifyConflictsWithVar() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2101,7 +2107,7 @@ class [|$$vor|] Public Sub CS_DetectOverLoadResolutionChangesInEnclosingInvocations() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2140,7 +2146,7 @@ static class E Public Sub ExpandingDynamicAddsObjectCast() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2170,7 +2176,7 @@ class C Public Sub RenameNamespaceConflictsAndResolves() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2205,7 +2211,7 @@ namespace N Public Sub RenameUnnecessaryExpansion() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2237,7 +2243,7 @@ namespace N Public Sub RenameInCrefPreservesWhitespaceTrivia() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2276,7 +2282,7 @@ public class A Public Sub GenericNameTypeInferenceExpansion() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2305,7 +2311,7 @@ class C Public Sub GenericNameTypeInferenceExpansion_This() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2334,7 +2340,7 @@ class C Public Sub GenericNameTypeInferenceExpansion_Nested() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_ReferenceType() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_ConstructedTypeArgumentNonGenericContainer() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_SameTypeParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_ArrayTypeParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_MultiDArrayTypeParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_UsedAsArgument() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_UsedInConstructorInitialization() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_CalledOnObject() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_UsedInGenericDelegate() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_UsedInNonGenericDelegate() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_MultipleTypeParameters() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_ConflictInDerived() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameGenericInvocationWithDynamicArgument() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ExpandInvocationInStaticMemberAccess() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RecursiveTypeParameterExpansionFail() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCrefWithProperBracesForTypeInferenceAdditionToMethod() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_GenericBase() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub GenericNameTypeInferenceExpansion_InErrorCode() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CS_ConflictBetweenTypeNamesInTypeConstraintSyntax() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, : IReferenceFin Public Sub MemberQualificationInNameOfUsesTypeName_StaticReferencingInstance() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub MemberQualificationInNameOfUsesTypeName_InstanceReferencingStatic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub MemberQualificationInNameOfUsesTypeName_InstanceReferencingInstance() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub MemberQualificationInNameOfMethodInvocationUsesThisDot() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameComplexifiesInLambdaBodyExpression() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameComplexifiesInExpressionBodiedMembers() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestConflictBetweenClassAndInterface1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestConflictBetweenClassAndInterface2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestConflictBetweenClassAndNamespace1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestConflictBetweenClassAndNamespace2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestNoConflictBetweenTwoNamespaces() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestNoConflictWithParametersOrLocalsOfDelegateType() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestConflictWithLocalsOfDelegateTypeWhenBindingChangesToNonDelegateLocal() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub NoCrashOrConflictOnRenameWithNameOfInAttribute() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3223,7 +3229,7 @@ class C Public Sub ConflictWhenNameOfReferenceDoesNotBindToAnyOriginalSymbols() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3247,7 +3253,7 @@ class C Public Sub NoConflictWhenNameOfReferenceDoesNotBindToSomeOriginalSymbols() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3266,7 +3272,7 @@ class Program Public Sub NoConflictWhenNameOfReferenceBindsToSymbolForFirstTime() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3285,7 +3291,7 @@ class Program Public Sub ConflictWhenNameOfReferenceChangesBindingFromMetadataToSource() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3311,7 +3317,7 @@ class Program Public Sub InvalidNamesDoNotCauseCrash_IntroduceQualifiedName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3331,7 +3337,7 @@ class {|conflict:C$$|} { } Public Sub InvalidNamesDoNotCauseCrash_AccidentallyPasteLotsOfCode() Dim renameTo = "class C { public void M() { for (int i = 0; i < 10; i++) { System.Console.Writeline(""This is a test""); } } }" - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3349,7 +3355,7 @@ class {|conflict:C$$|} { } Public Sub DeclarationConflictInFileWithoutReferences_SameProject() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3381,7 +3387,7 @@ class Program2 Public Sub DeclarationConflictInFileWithoutReferences_DifferentProjects() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3417,7 +3423,7 @@ class Program2 Public Sub DeclarationConflictInFileWithoutReferences_PartialTypes() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3447,7 +3453,7 @@ partial class C Public Sub RenameInsideNameOf1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3474,7 +3480,7 @@ class Program Public Sub RenameInsideNameOf2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3501,7 +3507,7 @@ class Program Public Sub RenameInsideNameOf3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3531,7 +3537,7 @@ class Program Public Sub RenameTypeParameterInPartialClass() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3547,7 +3553,7 @@ partial class C<[|T|]> {} Public Sub RenameMethodToConflictWithTypeParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/RenameEngineTests.VisualBasicConflicts.vb b/src/EditorFeatures/Test2/Rename/RenameEngineTests.VisualBasicConflicts.vb index 752f916c5e180..27f868960851c 100644 --- a/src/EditorFeatures/Test2/Rename/RenameEngineTests.VisualBasicConflicts.vb +++ b/src/EditorFeatures/Test2/Rename/RenameEngineTests.VisualBasicConflicts.vb @@ -4,13 +4,20 @@ Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename Partial Public Class RenameEngineTests + Public Class VisualBasicConflicts + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub BreakingRenameWithRollBacksInsideLambdas_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -38,7 +45,7 @@ End Class Public Sub BreakingRenameWithRollBacksInsideLambdas() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -68,7 +75,7 @@ End Class Public Sub HandleInvocationExpressions() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -88,7 +95,7 @@ End Module Public Sub BreakingRenameWithInvocationOnDelegateInstance() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -114,7 +121,7 @@ End Class Public Sub BreakingRenameWithSameClassInOneNamespace() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -139,7 +146,7 @@ End Namespace Public Sub OverloadResolutionConflictResolve_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -195,7 +202,7 @@ End Module Public Sub OverloadResolutionConflictResolve_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -256,7 +263,7 @@ End Module Public Sub OverloadResolutionConflictResolve_3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -322,7 +329,7 @@ End Module Public Sub OverloadResolutionConflictResolve_4() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -388,7 +395,7 @@ End Module Public Sub RenameStatementWithResolvingAndUnresolvingConflictInSameStatement_VB() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -427,7 +434,7 @@ End Module Public Sub IntroduceWhitespaceTriviaToInvocationIfCallKeywordIsIntroduced() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -459,7 +466,7 @@ End Class Public Sub ExpandInvocationInStaticMemberAccess() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -497,7 +504,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_Me() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -531,7 +538,7 @@ End Class Public Sub ConflictResolutionWithTypeInference() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -564,7 +571,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_Nested() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -599,7 +606,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_ReferenceType() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -627,7 +634,7 @@ End Module Public Sub ConflictResolutionWithTypeInference_Cref() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ConflictResolutionWithTypeInference_DifferentScope1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -690,7 +697,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_ConstructedTypeArgumentGenericContainer() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -718,7 +725,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_ConstructedTypeArgumentNonGenericContainer() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -748,7 +755,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_ObjectType() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -776,7 +783,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_SameTypeParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -805,7 +812,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_MultiDArrayTypeParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -834,7 +841,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_UsedAsArgument() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -864,7 +871,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_UsedInConstructorInitialization() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -894,7 +901,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_CalledOnObject() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -922,7 +929,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_UsedInGenericDelegate() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -950,7 +957,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_UsedInNonGenericDelegate() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -978,7 +985,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_MultipleTypeParameters() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1007,7 +1014,7 @@ End Class Public Sub ConflictResolutionWithTypeInference_ConflictInDerived() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1044,7 +1051,7 @@ End Class Public Sub ParameterConflictingWithInstanceField() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1068,7 +1075,7 @@ End Class Public Sub ParameterConflictingWithInstanceFieldRenamingToKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1094,7 +1101,7 @@ End Class Public Sub ParameterConflictingWithInstanceFieldRenamingToKeyword2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1117,7 +1124,7 @@ End Class Public Sub ParameterConflictingWithSharedField() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1141,7 +1148,7 @@ End Class Public Sub ParameterConflictingWithFieldInModule() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1165,7 +1172,7 @@ End Module Public Sub MinimalQualificationOfBaseType1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1196,7 +1203,7 @@ End Module Public Sub MinimalQualificationOfBaseType2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1227,7 +1234,7 @@ End Module Public Sub PreserveTypeCharactersForKeywordsAsIdentifiers() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1256,7 +1263,7 @@ End Class Public Sub RenameDoesNotBreakQuery() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1289,7 +1296,7 @@ End Class Public Sub ProperlyEscapeNewKeywordWithTypeCharacters() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1316,7 +1323,7 @@ End Class Public Sub AvoidDoubleEscapeAttempt() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1336,7 +1343,7 @@ End Class Public Sub ReplaceAliasWithNestedGenericType() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1370,7 +1377,7 @@ End Class Public Sub RenamingFunctionWithFunctionVariableFromFunction() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1392,7 +1399,7 @@ End Module Public Sub RenamingFunctionWithFunctionVariableFromFunctionVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1415,7 +1422,7 @@ End Module Public Sub ResolveConflictingTypeIncludedThroughModule1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ResolveConflictingTypeIncludedThroughModule2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ResolveConflictingTypeImportedFromMultipleTypes() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ConflictWithImplicitlyDeclaredLocal() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameForRangeVariableUsedInLambda() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ShouldNotCascadeToExplicitlyImplementedInterfaceMethodOfDifferentName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1584,7 +1591,7 @@ End Structure Public Sub ShouldNotCascadeToImplementingMethodOfDifferentName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1609,7 +1616,7 @@ End Structure Public Sub RenameAttributeSuffix() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameAttributeFromUsage() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, ' This is a simple scenario but it has a somewhat strange tree in VB. The ' BeginTerminator of the ElseBlockSyntax is missing, and just so happens to land at ' the same location as the NewMethod invocation that follows the Else. - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1684,7 +1691,7 @@ End Module Public Sub RenameImplicitlyDeclaredLocal() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1709,7 +1716,7 @@ End Module Public Sub RenameFieldToConflictWithImplicitlyDeclaredLocal() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1738,7 +1745,7 @@ End Module Public Sub RenameParameterOfEvent() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1758,7 +1765,7 @@ End Class Public Sub RenameLocalInMethodMissingParameterList() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1780,7 +1787,7 @@ End Module Public Sub QualifyTypeWithGlobalWhenConflicting() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1805,7 +1812,7 @@ End Class Public Sub QualifyFieldInReDimStatement() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1830,7 +1837,7 @@ End Module Public Sub QualifyTypeNameInImports() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1856,7 +1863,7 @@ End Module Public Sub RenameNewOverload() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1891,7 +1898,7 @@ End Class Public Sub RenameAttributeRequiringReducedNameToResolveConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameEvent() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1955,7 +1962,7 @@ class C : I Public Sub RenameInterfaceImplementation() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1982,7 +1989,7 @@ End Class Public Sub RenameAttributeConflictWithNamespace() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2027,7 +2034,7 @@ End Module Public Sub RenameImports() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug578105_VBRenamingPartialMethodDifferentCasing() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug588142_SimplifyAttributeUsageCanAlwaysEscapeInVB() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug588142_RenameAttributeToAttribute() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug576573_ConflictAttributeWithNamespace() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug603368_ConflictAttributeWithNamespaceCaseInsensitive() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug603367_ConflictAttributeWithNamespaceCaseInsensitive2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug603276_ConflictAttributeWithNamespaceCaseInsensitive3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug529712_ConflictNamespaceWithModuleName_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug529837_ResolveConflictByOmittingModuleName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2301,7 +2308,7 @@ End Namespace Public Sub Bug529989_RenameCSharpIdentifierToInvalidVBIdentifier() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2329,7 +2336,7 @@ End Namespace Public Sub RenameModuleBetweenAssembly() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Project2 @@ -2362,7 +2369,7 @@ End Module Public Sub RenameModuleClassConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2401,7 +2408,7 @@ End Namespace Public Sub RenameModuleNamespaceNested() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2438,7 +2445,7 @@ End Module Public Sub RenameModuleConflictWithInterface() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2470,7 +2477,7 @@ End Namespace Public Sub RenameModuleConflictWithLocal() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2501,7 +2508,7 @@ End Namespace Public Sub VB_DetectOverLoadResolutionChangesInEnclosingInvocations() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2552,7 +2559,7 @@ End Module Public Sub RenameNamespaceConflictsAndResolves() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2581,7 +2588,7 @@ End Namespace Public Sub RenameUnnecessaryExpansion() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2608,7 +2615,7 @@ End Namespace Public Sub AdjustTriviaForExtensionMethodRewrite() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2638,7 +2645,7 @@ End Module Public Sub RenameCrefWithConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2673,7 +2680,7 @@ End Class Public Sub RenameInCrefPreservesWhitespaceTrivia() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2706,7 +2713,7 @@ End Class Public Sub VB_ConflictBetweenTypeNamesInTypeConstraintSyntax() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenamingCompilerGeneratedPropertyBackingField_InvokeFromProperty() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2762,7 +2769,7 @@ End Class Public Sub RenamingCompilerGeneratedPropertyBackingField_IntroduceConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2809,7 +2816,7 @@ End Class Public Sub MemberQualificationInNameOfUsesTypeName_StaticReferencingInstance() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2831,7 +2838,7 @@ End Class Public Sub MemberQualificationInNameOfUsesTypeName_InstanceReferencingStatic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2853,7 +2860,7 @@ End Class Public Sub MemberQualificationInNameOfUsesTypeName_InstanceReferencingInstance() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2875,7 +2882,7 @@ End Class Public Sub TestConflictBetweenClassAndInterface1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestConflictBetweenClassAndInterface2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestConflictBetweenClassAndNamespace1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestConflictBetweenClassAndNamespace2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub TestNoConflictBetweenTwoNamespaces() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub NameOfReferenceNoConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub NameOfReferenceWithConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub InvalidNamesDoNotCauseCrash_IntroduceQualifiedName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameTypeParameterInPartialClass() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameMethodToConflictWithTypeParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Partial Public Class RenameEngineTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub Public Sub CannotRenameNamespaceAlias() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -39,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename Public Sub RenameTypeDoesNotRenameGeneratedConstructorCalls() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -58,7 +63,7 @@ struct [|$$Type|] Public Sub UnmodifiedDocumentsAreNotCheckedOutBySourceControl() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -86,7 +91,7 @@ class C2 Public Sub ReferenceConflictInsideDelegateLocalNotRenamed() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -116,7 +121,7 @@ class C Public Sub RenameMoreThanOneTokenInUnResolvedStatement() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -144,7 +149,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameInvocationExpressionAcrossProjects() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -176,7 +181,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameInvocationExpressionAcrossProjectsWithPartialClass() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -212,7 +217,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameInvocationExpressionAcrossProjectsWithConflictResolve() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -256,7 +261,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RollBackExpandedConflicts_WithinInvocationExpression() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -285,7 +290,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RollBackExpandedConflicts_WithinQuery() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -307,7 +312,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameOverloadCSharp() Dim changingOptions = New Dictionary(Of OptionKey, Object)() changingOptions.Add(RenameOptions.RenameOverloads, True) - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -345,7 +350,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameOverloadVisualBasic() Dim changingOptions = New Dictionary(Of OptionKey, Object)() changingOptions.Add(RenameOptions.RenameOverloads, True) - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -384,7 +389,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub ConflictCheckInInvocationCSharp() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -417,7 +422,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub ConflictCheckInInvocationVisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -443,7 +448,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameType() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -468,7 +473,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameTypeAcrossFiles() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -501,7 +506,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameTypeAcrossProjectsAndLanguages() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -539,7 +544,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameCSharpTypeFromConstructorDefinition() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -565,7 +570,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameCSharpTypeFromConstructorUse() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -591,7 +596,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameCSharpTypeFromDestructor() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -611,7 +616,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameCSharpTypeFromSynthesizedConstructorUse() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -633,7 +638,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameCSharpPredefinedTypeVariables1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -657,7 +662,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameCSharpPredefinedTypeVariables2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -681,7 +686,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameCSharpPredefinedTypeVariables3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -705,7 +710,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameVisualBasicPredefinedTypeVariables1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -725,7 +730,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameVisualBasicPredefinedTypeVariables2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -745,7 +750,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameVisualBasicPredefinedTypeVariables3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -765,7 +770,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameCSharpEnumMemberToContainingEnumName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -785,7 +790,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameCSharpEnumToEnumMemberName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -804,7 +809,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameVisualBasicTypeFromConstructorUse() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -828,7 +833,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameVisualBasicTypeFromSynthesizedConstructorUse() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -848,7 +853,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameNamespace() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -869,7 +874,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameVisualBasicEnum() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -889,7 +894,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub RenameVisualBasicEnumMember() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -909,7 +914,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub DoNothingRename() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -931,7 +936,7 @@ class {|unresolve3:$$D|} // Rename to C Public Sub CSharpBugfix553631() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -959,7 +964,7 @@ class Program Public Sub VisualBasicBugfix553631() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -991,7 +996,7 @@ End Class Public Sub RenameExtensionMethod() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1020,7 +1025,7 @@ End Class Public Sub RenameCSharpIndexerNamedArgument1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1046,7 +1051,7 @@ End Class Public Sub RenameCSharpIndexerNamedArgument2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1071,7 +1076,7 @@ End Class Public Sub RenameRangeVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1098,7 +1103,7 @@ End Class Public Sub RenameVisualBasicParameterizedPropertyNamedArgument() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1128,7 +1133,7 @@ End Class Public Sub RenameIndexerParameterFromDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1153,7 +1158,7 @@ class Program Public Sub RenameIndexerParameterFromUseInsideGetAccessor() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1178,7 +1183,7 @@ class Program Public Sub RenameIndexerParameterFromUseInsideSetAccessor() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1203,7 +1208,7 @@ class Program Public Sub RenamePartialMethodParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1233,7 +1238,7 @@ partial class Test Public Sub RenameVisualBasicAnonymousKey() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1258,7 +1263,7 @@ partial class Test Public Sub RenameIncludesPreviouslyInvalidReference() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1285,7 +1290,7 @@ partial class Test Public Sub RenameVariableInQueryAsUsingStatement() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1322,7 +1327,7 @@ class MyManagedType : System.IDisposable Public Sub LambdaWithOutParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1352,7 +1357,7 @@ class D Public Sub CascadeBetweenOverridingProperties() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1390,7 +1395,7 @@ End Class Public Sub CascadeBetweenImplementedInterfaceEvent() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1415,7 +1420,7 @@ End Class Public Sub CascadeBetweenEventParameters() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1442,7 +1447,7 @@ class Bar : IFoo Public Sub DoNotCascadeToMetadataSymbols() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1463,7 +1468,7 @@ class Bar : IFoo Public Sub RenamePartialTypeParameter_CSharp1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenamePartialTypeParameter_CSharp2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenamePartialTypeParameter_VB1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenamePartialTypeParameter_VB2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub AmbiguousBeforeRenameHandledCorrectly_Bug11516() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1571,7 +1576,7 @@ End Module Public Sub AmbiguousBeforeRenameHandledCorrectly_Bug11516_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1595,7 +1600,7 @@ End Module Public Sub RenamePartialMethods_1_CS() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1622,7 +1627,7 @@ End Module Public Sub RenamePartialMethods_2_CS() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1649,7 +1654,7 @@ End Module Public Sub RenamePartialMethods_1_VB() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1673,7 +1678,7 @@ End Module Public Sub RenamePartialMethods_2_VB() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1697,7 +1702,7 @@ End Module Public Sub Bug530740() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1736,7 +1741,7 @@ End Module Public Sub RenameMethodThatImplementsInterfaceMethod() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1769,7 +1774,7 @@ End Module Public Sub DoNotRemoveAttributeSuffixOn__Attribute() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1792,7 +1797,7 @@ End Module Public Sub RenameEventParameterOnUsage() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1816,7 +1821,7 @@ End Module Public Sub RenameCompilerGeneratedBackingFieldForNonCustomEvent() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1840,7 +1845,7 @@ End Module Public Sub RenameCompilerGeneratedEventHandlerForNonCustomEvent() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1866,7 +1871,7 @@ End Module Public Sub CSharpRenameParenthesizedFunctionName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1890,7 +1895,7 @@ End Module Public Sub VisualBasicAwaitAsIdentifierInAsyncShouldBeEscaped() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1915,7 +1920,7 @@ End Module Public Sub CSharpAwaitAsIdentifierInAsyncMethodShouldBeEscaped0() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1950,7 +1955,7 @@ class M Public Sub CSharpAwaitAsIdentifierInAsyncLambdaShouldBeEscaped() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1984,7 +1989,7 @@ class s Public Sub CSharpAwaitAsIdentifierInAsyncLambdaShouldBeEscaped1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2019,7 +2024,7 @@ class s Public Sub CSharpAwaitAsIdentifierInAsyncLambdaShouldNotBeEscaped() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2053,7 +2058,7 @@ class s Public Sub VBRoundTripMissingModuleName_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2084,7 +2089,7 @@ class s Public Sub VBRoundTripMissingModuleName_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2115,7 +2120,7 @@ class s Public Sub Bug603767_RenamePartialAttributeDeclarationWithDifferentCasingAndCSharpUsage() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2147,7 +2152,7 @@ class s Public Sub Bug603371_VisualBasicRenameAttributeToGlobal() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2168,7 +2173,7 @@ class s Public Sub Bug603371_VisualBasicRenameAttributeToGlobal_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2189,7 +2194,7 @@ class s Public Sub Bug602494_RenameOverrideWithNoOverriddenMember() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2208,7 +2213,7 @@ class s Public Sub Bug576607() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2233,7 +2238,7 @@ End Class Public Sub Bug529765_VisualBasicOverrideImplicitPropertyAccessor() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2264,7 +2269,7 @@ End Class Public Sub Bug529765_VisualBasicOverrideImplicitPropertyAccessor_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2295,7 +2300,7 @@ End Class Public Sub Bug529765_VisualBasicOverrideImplicitPropertyAccessor_3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2335,7 +2340,7 @@ End Class Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2380,7 +2385,7 @@ End Class Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2429,7 +2434,7 @@ End Class Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2478,7 +2483,7 @@ End Class Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_4() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2544,7 +2549,7 @@ End Class Public Sub Bug529765_CrossLanguageOverrideImplicitPropertyAccessor_5() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2603,7 +2608,7 @@ End Class Public Sub Bug610120_CrossLanguageOverrideImplicitPropertyAccessorConflictWithVBProperty() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2666,7 +2671,7 @@ End Class Public Sub Bug612380_CrossLanguageOverrideImplicitPropertyAccessorCascadesToInterface() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2723,7 +2728,7 @@ End Class Public Sub Bug866094() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2751,7 +2756,7 @@ End Class Public Sub RenameDynamicallyBoundFunction() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2781,7 +2786,7 @@ class A Public Sub CSharp_RenameToIdentifierWithUnicodeEscaping() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2804,7 +2809,7 @@ public class A Public Sub CSharp_RenameParenthesizedMethodNames() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2827,7 +2832,7 @@ class C Public Sub CSharp_RenameParameterUsedInObjectInitializer() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2857,7 +2862,7 @@ class C Public Sub LocationsIssue() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -2896,7 +2901,7 @@ End Module Public Sub RenameParam1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameParam1_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameParam2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameParam2_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameTypeParam1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameTypeParam1_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug624310_VBCascadeLambdaParameterInFieldInitializer() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3080,7 +3085,7 @@ End Class]]> Public Sub Bug624310_CSNoCascadeLambdaParameterInFieldInitializer() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug633582_CSDoNotAddParenthesesInExpansionForParenthesizedBinaryExpression() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, - + + Public Sub Bug622086_CSRenameExplicitInterfaceImplementation() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenamingEventCascadesToCSUsingEventHandlerDelegate() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3211,7 +3217,7 @@ class Program : IA Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3261,7 +3267,7 @@ class Program : IA Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3311,7 +3317,7 @@ class Program : IA Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3343,7 +3349,7 @@ class C Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_4() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3375,7 +3381,7 @@ class C Public Sub RenamingCompilerGeneratedDelegateTypeForEventCascadesBackToEvent_5() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3407,7 +3413,7 @@ Class C Public Sub Bug622086_CSRenameVarNotSupported() Assert.ThrowsAny(Of ArgumentException)(Sub() - Dim result = RenameEngineResult.Create( + Dim result = RenameEngineResult.Create(_outputHelper, Public Sub Bug622086_CSRenameCustomTypeNamedVarSupported() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug622086_CSRenameDynamicNotSupported() Assert.ThrowsAny(Of ArgumentException)(Sub() - Dim result = RenameEngineResult.Create( + Dim result = RenameEngineResult.Create(_outputHelper, Public Sub Bug622086_CSRenameToVarSupported() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug622086_CSRenameToVarSupportedButConflictsWithOtherVar() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug622086_CSRenameToVarSupportedButDoesntConflictsWithOtherVarOfSameType() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug622086_CSRenameToDynamicSupported() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug622086_CSRenameToDynamicSupportedButConflictsWithOtherDynamic_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub Bug622086_CSRenameToDynamicSupportedButConflictsWithOtherDynamic_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameNamespaceInVbFromCSharReference() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3675,7 +3681,7 @@ class Y : [|$$N|].X { } Public Sub RenameTypeFromCref() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3699,7 +3705,7 @@ class [|Program|] Public Sub RenameTypeFromCref_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3720,7 +3726,7 @@ End Class Public Sub RenameMemberFromCref() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3744,7 +3750,7 @@ class Program Public Sub RenameMemberFromCref_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3765,7 +3771,7 @@ End Class Public Sub RenameCrefFromMember() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3789,7 +3795,7 @@ class Program Public Sub RenameCrefFromMember_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3811,7 +3817,7 @@ End Class Public Sub RenameIncludingCrefContainingAttribute() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3839,7 +3845,7 @@ class {|yAttribute:F$$ooAttribute|} : Attribute Public Sub RenameIncludingCrefContainingAttribute_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3864,7 +3870,7 @@ End Class Public Sub RenameFromCrefContainingAttribute() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3891,7 +3897,7 @@ class {|yAttribute:FooAttribute|} : Attribute Public Sub RenameFromCrefContainingAttribute_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3916,7 +3922,7 @@ End Class Public Sub RenameCrefTypeParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -3934,7 +3940,7 @@ class C { } Public Sub RenameCref1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref1_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref2_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref3_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref4() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref4_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref5() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref5_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref6() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref6_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref7() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref7_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref8() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref8_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref9() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref9_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref10() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref10_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref11() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref11_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref12() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref12_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref13() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref13_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref14() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref14_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref15() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref15_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref17() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref17_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCref18() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCrefWithUsing1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCrefWithUsing1_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCrefWithUsing2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCrefWithUsing2_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCrefWithInterface() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCrefWithInterface_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameCrefCrossAssembly() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, VBAssembly @@ -5196,7 +5202,7 @@ End Namespace Public Sub RenameCrefCrossAssembly_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, CSAssembly @@ -5239,7 +5245,7 @@ namespace [|$$N|] Public Sub RenameStaticConstructorInsideCref1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameStaticConstructorInsideCref1_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameStaticConstructorInsideCref2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameStaticConstructorInsideCref2_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameInheritanceCref1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameInheritanceCref1_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameGenericTypeCrefWithConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameGenericTypeCrefWithConflict_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameNestedNamespaceToParent1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameNestedNamespaceToParent2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameStaticConstructor() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub SingleOnlyLocalDeclarationInsideLambdaRecurseInfinitely() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameDontReplaceBaseConstructorToken_CSharp() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameDontReplaceBaseConstructorToken_VisualBasic() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameMergedNamespaceAcrossProjects() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameMergedNamespaceAcrossProjects_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameMainWithoutAssertFailureVB() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameMainWithoutAssertFailureCSharp() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -5747,7 +5753,7 @@ class Program Public Sub RenameEscapedIdentifierToUnescapedIdentifier() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameEscapedIdentifierToUnescapedIdentifierKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameEscapedTypeNew() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameConstructorInCref() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameWithTryCatchBlock1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameWithTryCatchBlock2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameMethodWithNameof_NoOverloads_CSharp() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameMethodWithNameof_WithOverloads_CSharp() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub CannotRenameInheritedMetadataButRenameCascade() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -48,7 +53,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename Public Sub RenameEventWithInvalidNames() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/VisualBasic/AliasTests.vb b/src/EditorFeatures/Test2/Rename/VisualBasic/AliasTests.vb index 7e64eb6b631d3..d1a68cf202eea 100644 --- a/src/EditorFeatures/Test2/Rename/VisualBasic/AliasTests.vb +++ b/src/EditorFeatures/Test2/Rename/VisualBasic/AliasTests.vb @@ -4,11 +4,16 @@ Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Class AliasTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub Public Sub RenameSimpleSpecialTypeAliasVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -28,7 +33,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Sub RenameSimpleSpecialTypeDoubleAliasVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -49,7 +54,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Sub RenameSimpleTypeAliasVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -69,7 +74,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Sub RenameAliasNoConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -98,7 +103,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Sub RenameAliasToSameNameNoConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -123,7 +128,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Sub RenameOneDuplicateAliasToNoConflict() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -146,7 +151,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Sub RenameNamespaceAlias() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -169,7 +174,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Sub RenameConstructedTypeAliasFromUse() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -192,7 +197,7 @@ End Module Public Sub RenameConstructedTypeAliasFromDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -216,7 +221,7 @@ End Module Public Sub RenameSimpleTypeAliasFromUse() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -239,7 +244,7 @@ End Module Public Sub RenameSimpleTypeAliasFromDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -261,7 +266,7 @@ End Module Public Sub ConflictWhenRenamingAliasToSameAsGlobalTypeName() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -289,7 +294,7 @@ End Class Public Sub RenameAliasToAttributeAndEndingWithAttributeAttribute() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameAliasToAttributeAndEndingWithAttributeAttributeNoConflict1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameAliasToAttributeAndEndingWithAttributeAttributeWithConflict1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + + Public Sub RewriteConflictingExtensionMethodCallSite() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RewriteConflictingExtensionMethodCallSiteRequiringTypeArguments() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RewriteConflictingExtensionMethodCallSiteInferredTypeArguments() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub QualifyConflictingMethodInvocation() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/VisualBasic/DeclarationConflictTests.vb b/src/EditorFeatures/Test2/Rename/VisualBasic/DeclarationConflictTests.vb index eba952c71d320..091512392c916 100644 --- a/src/EditorFeatures/Test2/Rename/VisualBasic/DeclarationConflictTests.vb +++ b/src/EditorFeatures/Test2/Rename/VisualBasic/DeclarationConflictTests.vb @@ -4,10 +4,16 @@ Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Class DeclarationConflictTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub ConflictBetweenFields() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -27,7 +33,7 @@ End Module Public Sub ConflictBetweenFieldAndMethod() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -48,7 +54,7 @@ End Module Public Sub ConflictBetweenTwoMethodsWithSameSignature() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -71,7 +77,7 @@ End Module Public Sub ConflictBetweenTwoParameters() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -91,7 +97,7 @@ End Module Public Sub NoConflictBetweenMethodsWithDifferentSignatures() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -114,7 +120,7 @@ End Module Public Sub ConflictBetweenTwoLocals() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -137,7 +143,7 @@ End Module Public Sub ConflictBetweenLocalAndParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -159,7 +165,7 @@ End Module Public Sub ConflictBetweenQueryVariableAndParameter() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -181,7 +187,7 @@ End Module Public Sub ConflictBetweenTwoQueryVariables() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -204,7 +210,7 @@ End Module Public Sub ConflictBetweenLambdaParametersInsideMethod() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -228,7 +234,7 @@ End Module Public Sub ConflictBetweenLambdaParametersInFieldInitializer() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -250,7 +256,7 @@ End Module Public Sub NoConflictBetweenLambdaParameterAndField() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -271,7 +277,7 @@ End Module Public Sub ConflictBetweenLabels() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -298,7 +304,7 @@ End Class Public Sub ConflictBetweenMethodsDifferingByByRef() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -323,7 +329,7 @@ End Module Public Sub ConflictBetweenMethodsDifferingByOptional() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -348,7 +354,7 @@ End Module Public Sub NoConflictBetweenMethodsDifferingByArity() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -372,7 +378,7 @@ End Module Public Sub ConflictBetweenImplicitlyDeclaredLocalAndNamespace() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -396,7 +402,7 @@ End Module Public Sub ConflictBetweenImplicitlyDeclaredLocalAndAndGlobalFunction() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -425,7 +431,7 @@ End Module Public Sub ConflictBetweenAliases() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -452,7 +458,7 @@ End Namespace Public Sub ConflictBetweenImplicitVariableAndClass() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -480,7 +486,7 @@ End Module Public Sub ConflictBetweenEquallyNamedAlias() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -512,7 +518,7 @@ End Class Public Sub ConflictBetweenEquallyNamedPropertyAndItsParameter_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -539,7 +545,7 @@ End Class Public Sub ConflictBetweenEquallyNamedPropertyAndItsParameter_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -592,7 +598,7 @@ End Class Public Sub ConflictBetweenEquallyNamedPropertyAndItsParameter_3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -619,7 +625,7 @@ End Class Public Sub VB_ConflictInFieldInitializerOfFieldAndModuleNameResolvedThroughFullQualification() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -640,7 +646,7 @@ End Module Public Sub VB_ConflictForForEachLoopVariableNotBindingToTypeAnyMore() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -672,7 +678,7 @@ End Namespace Public Sub VB_ConflictForForEachLoopVariableAndRangeVariable_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -705,7 +711,7 @@ End Namespace Public Sub VB_ConflictForForEachLoopVariableAndRangeVariable_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -738,7 +744,7 @@ End Namespace Public Sub VB_ConflictForForEachLoopVariableAndRangeVariable_3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -773,7 +779,7 @@ End Namespace Public Sub VB_ConflictForForEachLoopVariableAndRangeVariable_4() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -807,7 +813,7 @@ End Namespace Public Sub VB_ConflictForUsingVariableAndRangeVariable_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -840,7 +846,7 @@ End Namespace Public Sub VB_ConflictForUsingVariableAndRangeVariable_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -871,7 +877,7 @@ End Namespace Public Sub VB_ConflictForUsingVariableAndRangeVariable_3() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -900,7 +906,7 @@ End Namespace Public Sub VB_ConflictForCatchVariable_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -929,7 +935,7 @@ End Namespace Public Sub VB_ConflictBetweenTypeParametersInTypeDeclaration() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -948,7 +954,7 @@ End Class Public Sub VB_ConflictBetweenTypeParametersInMethodDeclaration_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -969,7 +975,7 @@ End Class Public Sub VB_ConflictBetweenTypeParametersInMethodDeclaration_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -990,7 +996,7 @@ End Class Public Sub VB_ConflictBetweenTypeParameterAndMember_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1011,7 +1017,7 @@ End Class Public Sub VB_ConflictBetweenTypeParameterAndMember_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1031,7 +1037,7 @@ End Class Public Sub VB_ConflictBetweenEscapedForEachControlVariableAndQueryRangeVariable() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -1062,7 +1068,7 @@ End Module Public Sub VB_OverridingImplicitlyUsedMethod() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub VB_OverridingImplicitlyUsedMethod_1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub VB_OverridingImplicitlyUsedMethod_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub ConflictInsideSimpleArgument() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/VisualBasic/EscapingTests.vb b/src/EditorFeatures/Test2/Rename/VisualBasic/EscapingTests.vb index 83c03187db648..61345b679dcd3 100644 --- a/src/EditorFeatures/Test2/Rename/VisualBasic/EscapingTests.vb +++ b/src/EditorFeatures/Test2/Rename/VisualBasic/EscapingTests.vb @@ -4,10 +4,16 @@ Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Class EscapingTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub EscapeTypeWhenRenamingToKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -28,7 +34,7 @@ End Module Public Sub DoNotEscapeMethodAfterDotWhenRenamingToKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -50,7 +56,7 @@ End Module Public Sub EscapeAttributeWhenRenamingToRegularKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub EscapeAttributeUsageWhenRenamingToAssembly() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub EscapeAttributeUsageWhenRenamingToModule() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub EscapeWhenRenamingMethodToNew() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -159,7 +165,7 @@ End Class Public Sub EscapeWhenRenamingMethodToRem() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -182,7 +188,7 @@ End Module Public Sub EscapeWhenRenamingPropertyToMid() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -209,7 +215,7 @@ End Module Public Sub EscapeWhenRenamingPropertyToStrangelyCasedMid() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -236,7 +242,7 @@ End Module Public Sub EscapeWhenRenamingToMidWithTypeCharacters1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -263,7 +269,7 @@ End Module Public Sub EscapeWhenRenamingToMidWithTypeCharacters2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -289,7 +295,7 @@ End Module Public Sub EscapePreserveKeywordWhenRenamingWithRedim() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -312,7 +318,7 @@ End Module Public Sub EscapeRemKeywordWhenDoingTypeNameQualification() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -338,7 +344,7 @@ End Module Public Sub EscapeNewKeywordWhenDoingTypeNameQualification() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -364,7 +370,7 @@ End Module Public Sub EscapeRemKeywordWhenDoingMeQualification() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -390,7 +396,7 @@ End Class Public Sub DoNotEscapeIfKeywordWhenDoingMeQualification() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -416,7 +422,7 @@ End Class Public Sub EscapeIdentifierWhenRenamingToRemKeyword() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -438,7 +444,7 @@ End Module Public Sub EscapeIdentifierWhenRenamingToRemKeyword2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -461,7 +467,7 @@ End Module Public Sub RenamingToEscapedIdentifierWithFullwidthSquareBracket() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -482,7 +488,7 @@ End Module Public Sub EscapeContextualKeywordsInQuery1() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub EscapeMidIfNeeded() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenamingToRemAndUsingTypeCharactersIsNotAllowed() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub RenameIdentifierBracketed() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -588,7 +594,7 @@ End Module Public Sub RenameToIdentifierBracketed() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -609,7 +615,7 @@ End Module Public Sub RenameToIdentifierBracketed_2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/VisualBasic/ImplicitReferenceConflictTests.vb b/src/EditorFeatures/Test2/Rename/VisualBasic/ImplicitReferenceConflictTests.vb index cdd9dbc0afb39..90feaaafb112d 100644 --- a/src/EditorFeatures/Test2/Rename/VisualBasic/ImplicitReferenceConflictTests.vb +++ b/src/EditorFeatures/Test2/Rename/VisualBasic/ImplicitReferenceConflictTests.vb @@ -4,12 +4,17 @@ Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Class ImplicitReferenceConflictTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub Public Sub RenameMoveNextCausesConflictInForEach() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -47,7 +52,7 @@ End Class Public Sub RenameMoveNextToChangeCasingDoesntCauseConflictInForEach() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -84,7 +89,7 @@ End Class Public Sub RenameMoveNextToChangeCasingInCSDoesntCauseConflictInForEach() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -135,7 +140,7 @@ End Class Public Sub RenameMoveNextInCSCauseConflictInForEach() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Rename/VisualBasic/InvalidIdentifierTests.vb b/src/EditorFeatures/Test2/Rename/VisualBasic/InvalidIdentifierTests.vb index 8157856567159..d391f1de48a91 100644 --- a/src/EditorFeatures/Test2/Rename/VisualBasic/InvalidIdentifierTests.vb +++ b/src/EditorFeatures/Test2/Rename/VisualBasic/InvalidIdentifierTests.vb @@ -4,10 +4,16 @@ Imports Microsoft.CodeAnalysis.Rename.ConflictEngine Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename.VisualBasic Public Class InvalidIdentifierTests + Private ReadOnly _outputHelper As Abstractions.ITestOutputHelper + + Sub New(outputHelper As Abstractions.ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Sub RenamingToInvalidIdentifier() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -26,7 +32,7 @@ End Class Public Sub RenamingToInvalidIdentifier2() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -45,7 +51,7 @@ End Class Public Sub RenamingToUnderscoreAttribute() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, Public Sub QualifyBackingField() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, @@ -34,7 +40,7 @@ End Class Public Sub ConflictingLocalWithFieldWithExtensionMethodInvolved() - Using result = RenameEngineResult.Create( + Using result = RenameEngineResult.Create(_outputHelper, diff --git a/src/EditorFeatures/Test2/Workspaces/TryFindSourceDefinitionTests.vb b/src/EditorFeatures/Test2/Workspaces/TryFindSourceDefinitionTests.vb index 32113d7a9dab6..07f962e01d801 100644 --- a/src/EditorFeatures/Test2/Workspaces/TryFindSourceDefinitionTests.vb +++ b/src/EditorFeatures/Test2/Workspaces/TryFindSourceDefinitionTests.vb @@ -7,13 +7,20 @@ Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.FindSymbols Imports Microsoft.CodeAnalysis.Text Imports Xunit +Imports Xunit.Abstractions Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Public Class TryFindSourceDefinitionTests + Private ReadOnly _outputHelper As ITestOutputHelper + Private Function GetProject(snapshot As Solution, assemblyName As String) As Project Return snapshot.Projects.Single(Function(p) p.AssemblyName = assemblyName) End Function + Public Sub New(outputHelper As ITestOutputHelper) + _outputHelper = outputHelper + End Sub + Public Async Function TestFindTypeInCSharpToVisualBasicProject() As Task Dim workspaceDefinition = @@ -40,6 +47,8 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Using workspace = Await TestWorkspace.CreateAsync(workspaceDefinition) + workspace.SetTestLogger(AddressOf _outputHelper.WriteLine) + Dim snapshot = workspace.CurrentSolution Dim Type = (Await GetProject(snapshot, "CSharpAssembly").GetCompilationAsync()).GlobalNamespace.GetTypeMembers("CSClass").Single() @@ -84,6 +93,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Using workspace = Await TestWorkspace.CreateAsync(workspaceDefinition) + workspace.SetTestLogger(AddressOf _outputHelper.WriteLine) Dim snapshot = workspace.CurrentSolution Dim Type = (Await GetProject(snapshot, "VBAssembly").GetCompilationAsync()).GlobalNamespace.GetTypeMembers("VBClass").Single() @@ -125,6 +135,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Using workspace = Await TestWorkspace.CreateAsync(workspaceDefinition) + workspace.SetTestLogger(AddressOf _outputHelper.WriteLine) Dim compilation = Await GetProject(workspace.CurrentSolution, "VBAssembly").GetCompilationAsync() Dim member = compilation.GlobalNamespace.GetMembers("N").Single().GetTypeMembers("CSClass").Single().GetMembers("M").Single() @@ -163,6 +174,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Using workspace = Await TestWorkspace.CreateAsync(workspaceDefinition) + workspace.SetTestLogger(AddressOf _outputHelper.WriteLine) Dim compilation = Await GetProject(workspace.CurrentSolution, "VBAssembly").GetCompilationAsync() Dim member = compilation.GlobalNamespace.GetMembers("N").Single().GetTypeMembers("CSClass").Single().GetMembers("M").Single() @@ -201,6 +213,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Using workspace = Await TestWorkspace.CreateAsync(workspaceDefinition) + workspace.SetTestLogger(AddressOf _outputHelper.WriteLine) Dim compilation = Await GetProject(workspace.CurrentSolution, "VBAssembly").GetCompilationAsync() Dim member = compilation.GlobalNamespace.GetMembers("N").Single().GetTypeMembers("CSClass").Single().GetMembers("M").Single() @@ -236,6 +249,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Using workspace = Await TestWorkspace.CreateAsync(workspaceDefinition) + workspace.SetTestLogger(AddressOf _outputHelper.WriteLine) Dim retargetedCompilation = Await GetProject(workspace.CurrentSolution, "CSharpAssembly").GetCompilationAsync() Dim originalClass = retargetedCompilation.GlobalNamespace.GetMembers("N").Single().GetTypeMembers("CSClass").Single() Dim retargetingCompilation = Await GetProject(workspace.CurrentSolution, "CSharpAssembly2").GetCompilationAsync() diff --git a/src/EditorFeatures/Test2/project.lock.json b/src/EditorFeatures/Test2/project.lock.json index 6bd596d640c86..398944b700f38 100644 --- a/src/EditorFeatures/Test2/project.lock.json +++ b/src/EditorFeatures/Test2/project.lock.json @@ -153,24 +153,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -283,7 +265,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -513,14 +495,6 @@ "lib/net40/Moq.dll": {} } }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "compile": { - "ref/dotnet/_._": {} - }, - "runtime": { - "runtimes/win7/lib/net/_._": {} - } - }, "System.AppContext/4.0.0": { "dependencies": { "System.Runtime": "4.0.0" @@ -569,25 +543,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0", - "runtime.win7.System.Diagnostics.Process": "4.1.0-beta-23504" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -700,7 +655,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1078,21 +1033,6 @@ "lib/sl4/Moq.Silverlight.xml" ] }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "t96Q9MyIMoFQtblYAVQshxWL8AZEKSble9wb0Wp330R02N7fsgfPlhqd3h+VvrhTKMT0WWbkHyH9vEU+SSLpTg==", - "type": "package", - "files": [ - "ref/dotnet/_._", - "runtime.win7.System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "runtime.win7.System.Diagnostics.Process.nuspec", - "runtimes/win7/lib/dotnet5.5/System.Diagnostics.Process.dll", - "runtimes/win7/lib/net/_._", - "runtimes/win7/lib/netcore50/_._", - "runtimes/win7/lib/win8/_._", - "runtimes/win7/lib/wp8/_._", - "runtimes/win7/lib/wpa81/_._" - ] - }, "System.AppContext/4.0.0": { "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", "type": "package", @@ -1200,49 +1140,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1593,11 +1490,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/EditorFeatures/TestUtilities/project.lock.json b/src/EditorFeatures/TestUtilities/project.lock.json index 2ed7a86b1f8c6..7e130f819e372 100644 --- a/src/EditorFeatures/TestUtilities/project.lock.json +++ b/src/EditorFeatures/TestUtilities/project.lock.json @@ -86,7 +86,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -421,11 +421,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/EditorFeatures/Text/project.lock.json b/src/EditorFeatures/Text/project.lock.json index 326e6345cc5dc..7e1a39c516f2a 100644 --- a/src/EditorFeatures/Text/project.lock.json +++ b/src/EditorFeatures/Text/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -318,11 +318,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/EditorFeatures/VisualBasic/project.lock.json b/src/EditorFeatures/VisualBasic/project.lock.json index 326e6345cc5dc..7e1a39c516f2a 100644 --- a/src/EditorFeatures/VisualBasic/project.lock.json +++ b/src/EditorFeatures/VisualBasic/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -318,11 +318,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateVariable/GenerateVariableTests.vb b/src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateVariable/GenerateVariableTests.vb index b379e4935773f..32fae58cea135 100644 --- a/src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateVariable/GenerateVariableTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateVariable/GenerateVariableTests.vb @@ -3,6 +3,7 @@ Option Strict Off Imports System.Threading.Tasks +Imports Microsoft.CodeAnalysis.CodeActions Imports Microsoft.CodeAnalysis.CodeFixes Imports Microsoft.CodeAnalysis.Diagnostics Imports Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateVariable @@ -15,6 +16,10 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics.Genera Return New Tuple(Of DiagnosticAnalyzer, CodeFixProvider)(Nothing, New GenerateVariableCodeFixProvider()) End Function + Protected Overrides Function MassageActions(actions As IList(Of CodeAction)) As IList(Of CodeAction) + Return FlattenActions(actions) + End Function + Public Async Function TestGenerateSimpleProperty() As Threading.Tasks.Task Await TestAsync( diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/RudeEditTestBase.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/RudeEditTestBase.vb index 3f19cb65871b1..faf97570d3f48 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/RudeEditTestBase.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/RudeEditTestBase.vb @@ -59,8 +59,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests Dim m2 = MakeMethodBody(src2, options, stateMachine) Dim diagnostics = New List(Of RudeEditDiagnostic)() - Dim needsSyntaxMap As Boolean - Dim match = Analyzer.ComputeBodyMatch(m1, m2, Array.Empty(Of AbstractEditAndContinueAnalyzer.ActiveNode)(), diagnostics, needsSyntaxMap) + + Dim oldHasStateMachineSuspensionPoint = False, newHasStateMachineSuspensionPoint = False + Dim match = Analyzer.ComputeBodyMatch(m1, m2, Array.Empty(Of AbstractEditAndContinueAnalyzer.ActiveNode)(), diagnostics, oldHasStateMachineSuspensionPoint, newHasStateMachineSuspensionPoint) + Dim needsSyntaxMap = oldHasStateMachineSuspensionPoint AndAlso newHasStateMachineSuspensionPoint Assert.Equal(stateMachine <> StateMachineKind.None, needsSyntaxMap) diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/VisualBasicEditAndContinueTestHelpers.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/VisualBasicEditAndContinueTestHelpers.vb index 62812340c75d5..ff45614391808 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/VisualBasicEditAndContinueTestHelpers.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/Helpers/VisualBasicEditAndContinueTestHelpers.vb @@ -13,10 +13,23 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EditAndContinue Friend NotInheritable Class VisualBasicEditAndContinueTestHelpers Inherits EditAndContinueTestHelpers - Friend Shared ReadOnly Instance As VisualBasicEditAndContinueTestHelpers = New VisualBasicEditAndContinueTestHelpers() + Private ReadOnly _fxReferences As ImmutableArray(Of PortableExecutableReference) + + Friend Shared ReadOnly Instance As VisualBasicEditAndContinueTestHelpers = New VisualBasicEditAndContinueTestHelpers( + ImmutableArray.Create(TestReferences.NetFx.v4_0_30316_17626.mscorlib, TestReferences.NetFx.v4_0_30319.System, TestReferences.NetFx.v4_0_30319.System_Core)) + + Friend Shared ReadOnly Instance40 As VisualBasicEditAndContinueTestHelpers = New VisualBasicEditAndContinueTestHelpers( + ImmutableArray.Create(TestReferences.NetFx.v4_0_30319.mscorlib, TestReferences.NetFx.v4_0_30319.System_Core)) + + Friend Shared ReadOnly InstanceMinAsync As VisualBasicEditAndContinueTestHelpers = New VisualBasicEditAndContinueTestHelpers( + ImmutableArray.Create(TestReferences.NetFx.Minimal.mincorlib, TestReferences.NetFx.Minimal.minasync)) Private Shared ReadOnly s_analyzer As VisualBasicEditAndContinueAnalyzer = New VisualBasicEditAndContinueAnalyzer() + Sub New(fxReferences As ImmutableArray(Of PortableExecutableReference)) + _fxReferences = fxReferences + End Sub + Public Overrides ReadOnly Property Analyzer As AbstractEditAndContinueAnalyzer Get Return s_analyzer @@ -26,7 +39,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EditAndContinue Public Overrides Function CreateLibraryCompilation(name As String, trees As IEnumerable(Of SyntaxTree)) As Compilation Return VisualBasicCompilation.Create("New", trees, - {TestReferences.NetFx.v4_0_30319.mscorlib, TestReferences.NetFx.v4_0_30319.System, TestReferences.NetFx.v4_0_30319.System_Core}, + _fxReferences, TestOptions.ReleaseDll.WithEmbedVbCoreRuntime(True)) End Function diff --git a/src/EditorFeatures/VisualBasicTest/EditAndContinue/RudeEditStatementTests.vb b/src/EditorFeatures/VisualBasicTest/EditAndContinue/RudeEditStatementTests.vb index 0628f0442ae4e..e2a1cbc1f5e42 100644 --- a/src/EditorFeatures/VisualBasicTest/EditAndContinue/RudeEditStatementTests.vb +++ b/src/EditorFeatures/VisualBasicTest/EditAndContinue/RudeEditStatementTests.vb @@ -2,6 +2,7 @@ Imports Microsoft.CodeAnalysis.EditAndContinue Imports Microsoft.CodeAnalysis.EditAndContinue.UnitTests +Imports Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.EditAndContinue Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue.UnitTests @@ -5586,6 +5587,67 @@ Yield 2 edits.VerifyEdits( "Delete [Yield 3]@66") End Sub + + + Public Sub MissingIteratorStateMachineAttribute() + Dim src1 = " +Imports System.Collections.Generic + +Class C + Shared Iterator Function F() As IEnumerable(Of Integer) + Yield 1 + End Function +End Class +" + Dim src2 = " +Imports System.Collections.Generic + +Class C + Shared Iterator Function F() As IEnumerable(Of Integer) + Yield 2 + End Function +End Class +" + Dim edits = GetTopEdits(src1, src2) + VisualBasicEditAndContinueTestHelpers.Instance40.VerifySemantics( + edits, + ActiveStatementsDescription.Empty, + Nothing, + Nothing, + Nothing, + {Diagnostic(RudeEditKind.UpdatingStateMachineMethodMissingAttribute, "Shared Iterator Function F()", "System.Runtime.CompilerServices.IteratorStateMachineAttribute")}) + End Sub + + + Public Sub MissingIteratorStateMachineAttribute2() + Dim src1 = " +Imports System.Collections.Generic + +Class C + Shared Function F() As IEnumerable(Of Integer) + Return Nothing + End Function +End Class +" + Dim src2 = " +Imports System.Collections.Generic + +Class C + Shared Iterator Function F() As IEnumerable(Of Integer) + Yield 2 + End Function +End Class +" + Dim edits = GetTopEdits(src1, src2) + VisualBasicEditAndContinueTestHelpers.Instance40.VerifySemantics( + edits, + ActiveStatementsDescription.Empty, + Nothing, + Nothing, + Nothing, + Nothing) + End Sub + #End Region #Region "Await" @@ -5639,6 +5701,69 @@ Await F(3) edits.VerifyEdits( "Delete [Await F(2)]@51") End Sub + + + Public Sub MissingAsyncStateMachineAttribute1() + Dim src1 = " +Imports System.Threading.Tasks + +Class C + Shared Async Function F() As Task(Of Integer) + Await New Task() + Return 1 + End Function +End Class +" + Dim src2 = " +Imports System.Threading.Tasks + +Class C + Shared Async Function F() As Task(Of Integer) + Await New Task() + Return 2 + End Function +End Class +" + Dim edits = GetTopEdits(src1, src2) + VisualBasicEditAndContinueTestHelpers.InstanceMinAsync.VerifySemantics( + edits, + ActiveStatementsDescription.Empty, + Nothing, + Nothing, + Nothing, + {Diagnostic(RudeEditKind.UpdatingStateMachineMethodMissingAttribute, "Shared Async Function F()", "System.Runtime.CompilerServices.AsyncStateMachineAttribute")}) + End Sub + + + Public Sub MissingAsyncStateMachineAttribute2() + Dim src1 = " +Imports System.Threading.Tasks + +Class C + Shared Function F() As Task(Of Integer) + Return Nothing + End Function +End Class +" + Dim src2 = " +Imports System.Threading.Tasks + +Class C + Shared Async Function F() As Task(Of Integer) + Await New Task() + Return 2 + End Function +End Class +" + Dim edits = GetTopEdits(src1, src2) + VisualBasicEditAndContinueTestHelpers.InstanceMinAsync.VerifySemantics( + edits, + ActiveStatementsDescription.Empty, + Nothing, + Nothing, + Nothing, + Nothing) + End Sub #End Region End Class End Namespace diff --git a/src/EditorFeatures/VisualBasicTest/project.lock.json b/src/EditorFeatures/VisualBasicTest/project.lock.json index e45755eb8692a..34b2c3ef0bc9e 100644 --- a/src/EditorFeatures/VisualBasicTest/project.lock.json +++ b/src/EditorFeatures/VisualBasicTest/project.lock.json @@ -153,24 +153,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -283,7 +265,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -513,14 +495,6 @@ "lib/net40/Moq.dll": {} } }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "compile": { - "ref/dotnet/_._": {} - }, - "runtime": { - "runtimes/win7/lib/net/_._": {} - } - }, "System.AppContext/4.0.0": { "dependencies": { "System.Runtime": "4.0.0" @@ -569,25 +543,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0", - "runtime.win7.System.Diagnostics.Process": "4.1.0-beta-23504" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -700,7 +655,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1078,21 +1033,6 @@ "lib/sl4/Moq.Silverlight.xml" ] }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "t96Q9MyIMoFQtblYAVQshxWL8AZEKSble9wb0Wp330R02N7fsgfPlhqd3h+VvrhTKMT0WWbkHyH9vEU+SSLpTg==", - "type": "package", - "files": [ - "ref/dotnet/_._", - "runtime.win7.System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "runtime.win7.System.Diagnostics.Process.nuspec", - "runtimes/win7/lib/dotnet5.5/System.Diagnostics.Process.dll", - "runtimes/win7/lib/net/_._", - "runtimes/win7/lib/netcore50/_._", - "runtimes/win7/lib/win8/_._", - "runtimes/win7/lib/wp8/_._", - "runtimes/win7/lib/wpa81/_._" - ] - }, "System.AppContext/4.0.0": { "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", "type": "package", @@ -1200,49 +1140,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1593,11 +1490,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EEAssemblyBuilder.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EEAssemblyBuilder.cs index 3998d243eeb47..1d9aa671973c8 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EEAssemblyBuilder.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EEAssemblyBuilder.cs @@ -167,7 +167,7 @@ public override string PreviousStateMachineTypeName get { return null; } } - public override bool TryGetPreviousHoistedLocalSlotIndex(SyntaxNode currentDeclarator, Cci.ITypeReference currentType, SynthesizedLocalKind synthesizedKind, LocalDebugId currentId, out int slotIndex) + public override bool TryGetPreviousHoistedLocalSlotIndex(SyntaxNode currentDeclarator, Cci.ITypeReference currentType, SynthesizedLocalKind synthesizedKind, LocalDebugId currentId, DiagnosticBag diagnostics, out int slotIndex) { slotIndex = -1; return false; @@ -178,7 +178,7 @@ public override int PreviousHoistedLocalSlotCount get { return 0; } } - public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentType, out int slotIndex) + public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentType, DiagnosticBag diagnostics, out int slotIndex) { slotIndex = -1; return false; diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/project.lock.json b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/project.lock.json index a94e9053263f0..1e01a1486d52a 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/project.lock.json +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/project.lock.json @@ -19,7 +19,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -57,11 +57,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/project.lock.json b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/project.lock.json index 8e273a551710d..0be6e5524107a 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/project.lock.json +++ b/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/ExpressionEvaluator/CSharp/Test/ResultProvider/CSharpResultProviderTest.csproj b/src/ExpressionEvaluator/CSharp/Test/ResultProvider/CSharpResultProviderTest.csproj index 631a8c1047b1f..68c444a3b8557 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ResultProvider/CSharpResultProviderTest.csproj +++ b/src/ExpressionEvaluator/CSharp/Test/ResultProvider/CSharpResultProviderTest.csproj @@ -101,6 +101,9 @@ + + + diff --git a/src/ExpressionEvaluator/CSharp/Test/ResultProvider/project.lock.json b/src/ExpressionEvaluator/CSharp/Test/ResultProvider/project.lock.json index 8e2abdd9c089a..3533193d8f9c0 100644 --- a/src/ExpressionEvaluator/CSharp/Test/ResultProvider/project.lock.json +++ b/src/ExpressionEvaluator/CSharp/Test/ResultProvider/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/AssemblyReference.cs b/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/AssemblyReference.cs index 9b59f2a97eb61..7650332e77c04 100644 --- a/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/AssemblyReference.cs +++ b/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/AssemblyReference.cs @@ -20,7 +20,6 @@ internal AssemblyReference(AssemblyIdentity identity) } AssemblyIdentity IAssemblyReference.Identity => _identity; - Version IAssemblyReference.AssemblyVersionPattern => null; string INamedEntity.Name => _identity.Name; IAssemblyReference IModuleReference.GetContainingAssembly(EmitContext context) diff --git a/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/project.lock.json b/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/project.lock.json index 9b8fa1a3d7df0..72f35d69b253e 100644 --- a/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/project.lock.json +++ b/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/project.lock.json @@ -19,7 +19,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -57,11 +57,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/project.lock.json b/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/project.lock.json index 6ce0bbdcc3f22..756d8e5fc5926 100644 --- a/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/project.lock.json +++ b/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -386,11 +386,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/ExpressionEvaluator/Core/Test/ResultProvider/project.lock.json b/src/ExpressionEvaluator/Core/Test/ResultProvider/project.lock.json index 9e8086b0db2ea..b95eb7af25ee8 100644 --- a/src/ExpressionEvaluator/Core/Test/ResultProvider/project.lock.json +++ b/src/ExpressionEvaluator/Core/Test/ResultProvider/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -386,11 +386,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/EEAssemblyBuilder.vb b/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/EEAssemblyBuilder.vb index ac183246fda44..9b0cd04e07aa5 100644 --- a/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/EEAssemblyBuilder.vb +++ b/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/EEAssemblyBuilder.vb @@ -162,12 +162,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator End Get End Property - Public Overrides Function TryGetPreviousHoistedLocalSlotIndex(currentDeclarator As SyntaxNode, currentType As ITypeReference, synthesizedKind As SynthesizedLocalKind, currentId As LocalDebugId, ByRef slotIndex As Integer) As Boolean + Public Overrides Function TryGetPreviousHoistedLocalSlotIndex(currentDeclarator As SyntaxNode, currentType As ITypeReference, synthesizedKind As SynthesizedLocalKind, currentId As LocalDebugId, diagnostics As DiagnosticBag, ByRef slotIndex As Integer) As Boolean slotIndex = -1 Return False End Function - Public Overrides Function TryGetPreviousAwaiterSlotIndex(currentType As ITypeReference, ByRef slotIndex As Integer) As Boolean + Public Overrides Function TryGetPreviousAwaiterSlotIndex(currentType As ITypeReference, diagnostics As DiagnosticBag, ByRef slotIndex As Integer) As Boolean slotIndex = -1 Return False End Function diff --git a/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/project.lock.json b/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/project.lock.json index a94e9053263f0..1e01a1486d52a 100644 --- a/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/project.lock.json +++ b/src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/project.lock.json @@ -19,7 +19,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -57,11 +57,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/project.lock.json b/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/project.lock.json index 8e273a551710d..0be6e5524107a 100644 --- a/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/project.lock.json +++ b/src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/BasicResultProviderTest.vbproj b/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/BasicResultProviderTest.vbproj index b5a9342695fc2..c3a0db1752bc2 100644 --- a/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/BasicResultProviderTest.vbproj +++ b/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/BasicResultProviderTest.vbproj @@ -87,6 +87,9 @@ + + + diff --git a/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/project.lock.json b/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/project.lock.json index 9d274517c8b37..fc89de5fb5530 100644 --- a/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/project.lock.json +++ b/src/ExpressionEvaluator/VisualBasic/Test/ResultProvider/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -233,7 +233,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -550,11 +550,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Features/CSharp/Portable/CodeFixes/GenerateVariable/GenerateVariableCodeFixProvider.cs b/src/Features/CSharp/Portable/CodeFixes/GenerateVariable/GenerateVariableCodeFixProvider.cs index 82b7506b503fe..5b22eedc4531e 100644 --- a/src/Features/CSharp/Portable/CodeFixes/GenerateVariable/GenerateVariableCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/CodeFixes/GenerateVariable/GenerateVariableCodeFixProvider.cs @@ -24,11 +24,10 @@ internal class GenerateVariableCodeFixProvider : AbstractGenerateMemberCodeFixPr private const string CS0117 = nameof(CS0117); // error CS0117: 'TestNs.Program' does not contain a definition for 'blah' private const string CS0539 = nameof(CS0539); // error CS0539: 'Class.SomeProp' in explicit interface declaration is not a member of interface private const string CS0246 = nameof(CS0246); // error CS0246: The type or namespace name 'Version' could not be found + private const string CS0120 = nameof(CS0120); // error CS0120: An object reference is required for the non-static field, method, or property 'A' - public override ImmutableArray FixableDiagnosticIds - { - get { return ImmutableArray.Create(CS1061, CS0103, CS0117, CS0539, CS0246); } - } + public override ImmutableArray FixableDiagnosticIds => + ImmutableArray.Create(CS1061, CS0103, CS0117, CS0539, CS0246, CS0120); protected override bool IsCandidate(SyntaxNode node, Diagnostic diagnostic) { diff --git a/src/Features/CSharp/Portable/project.lock.json b/src/Features/CSharp/Portable/project.lock.json index 39ee2994a4f41..7fd5fb06c1f04 100644 --- a/src/Features/CSharp/Portable/project.lock.json +++ b/src/Features/CSharp/Portable/project.lock.json @@ -27,7 +27,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -72,11 +72,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Features/Core/Portable/CodeStyle/SimpleCodeStyleOption.cs b/src/Features/Core/Portable/CodeStyle/SimpleCodeStyleOption.cs index fd3e24389b640..809d350003000 100644 --- a/src/Features/Core/Portable/CodeStyle/SimpleCodeStyleOption.cs +++ b/src/Features/Core/Portable/CodeStyle/SimpleCodeStyleOption.cs @@ -34,10 +34,19 @@ public XElement ToXElement() => public static SimpleCodeStyleOption FromXElement(XElement element) { - var isChecked = bool.Parse(element.Attribute(nameof(IsChecked)).Value); - var severity = (DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), element.Attribute(nameof(DiagnosticSeverity)).Value); - NotificationOption notificationOption; + var isCheckedAttribute = element.Attribute(nameof(IsChecked)); + var severityAttribute = element.Attribute(nameof(DiagnosticSeverity)); + + if (isCheckedAttribute == null || severityAttribute == null) + { + // data from storage is corrupt, or nothing has been stored yet. + return Default; + } + + var isChecked = bool.Parse(isCheckedAttribute.Value); + var severity = (DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), severityAttribute.Value); + NotificationOption notificationOption; switch (severity) { case DiagnosticSeverity.Hidden: diff --git a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs index bcdf951cd30f4..9d4657dd8155b 100644 --- a/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs +++ b/src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs @@ -222,8 +222,11 @@ protected abstract bool TryMatchActiveStatement( /// protected abstract IEnumerable GetVariableUseSites(IEnumerable roots, ISymbol localOrParameter, SemanticModel model, CancellationToken cancellationToken); + // diagnostic spans: protected abstract TextSpan GetDiagnosticSpan(SyntaxNode node, EditKind editKind); internal abstract TextSpan GetLambdaParameterDiagnosticSpan(SyntaxNode lambda, int ordinal); + private TextSpan GetBodyDiagnosticSpan(SyntaxNode body, EditKind editKind) => GetDiagnosticSpan(IsMethod(body) ? body : body.Parent, EditKind.Update); + protected abstract string GetTopLevelDisplayName(SyntaxNode node, EditKind editKind); protected abstract string GetStatementDisplayName(SyntaxNode node, EditKind editKind); protected abstract string GetLambdaDisplayName(SyntaxNode lambda); @@ -805,9 +808,13 @@ internal struct UpdatedMemberInfo // the method has an active statement (the statement might be in the body itself or in a lambda) public readonly bool HasActiveStatement; - // The method body has a suspension point (await/yield); + // The old method body has a suspension point (await/yield); + // only true if the body itself has the suspension point, not if it contains async/iterator lambda + public readonly bool OldHasStateMachineSuspensionPoint; + + // The new method body has a suspension point (await/yield); // only true if the body itself has the suspension point, not if it contains async/iterator lambda - public readonly bool HasStateMachineSuspensionPoint; + public readonly bool NewHasStateMachineSuspensionPoint; public UpdatedMemberInfo( int editOrdinal, @@ -816,7 +823,8 @@ public UpdatedMemberInfo( BidirectionalMap map, IReadOnlyDictionary activeOrMatchedLambdasOpt, bool hasActiveStatement, - bool hasStateMachineSuspensionPoint) + bool oldHasStateMachineSuspensionPoint, + bool newHasStateMachineSuspensionPoint) { Debug.Assert(editOrdinal >= 0); Debug.Assert(!map.IsDefaultOrEmpty); @@ -829,7 +837,8 @@ public UpdatedMemberInfo( Map = map; ActiveOrMatchedLambdasOpt = activeOrMatchedLambdasOpt; HasActiveStatement = hasActiveStatement; - HasStateMachineSuspensionPoint = hasStateMachineSuspensionPoint; + OldHasStateMachineSuspensionPoint = oldHasStateMachineSuspensionPoint; + NewHasStateMachineSuspensionPoint = newHasStateMachineSuspensionPoint; } } @@ -981,14 +990,14 @@ private void AnalyzeUpdatedActiveMethodBodies( activeNodes[i] = new ActiveNode(oldStatementSyntax, oldEnclosingLambdaBody, statementPart, isTracked ? trackedSpan : (TextSpan?)null, trackedNode); } - bool hasStateMachineSuspensionPoint; - var bodyMatch = ComputeBodyMatch(oldBody, newBody, activeNodes.Where(n => n.EnclosingLambdaBodyOpt == null).ToArray(), diagnostics, out hasStateMachineSuspensionPoint); + bool oldHasStateMachineSuspensionPoint, newHasStateMachineSuspensionPoint; + var bodyMatch = ComputeBodyMatch(oldBody, newBody, activeNodes.Where(n => n.EnclosingLambdaBodyOpt == null).ToArray(), diagnostics, out oldHasStateMachineSuspensionPoint, out newHasStateMachineSuspensionPoint); var map = ComputeMap(bodyMatch, activeNodes, ref lazyActiveOrMatchedLambdas, diagnostics); // Save the body match for local variable mapping. // We'll use it to tell the compiler what local variables to preserve in an active method. // An edited async/iterator method is considered active. - updatedMembers.Add(new UpdatedMemberInfo(editOrdinal, oldBody, newBody, map, lazyActiveOrMatchedLambdas, hasActiveStatement, hasStateMachineSuspensionPoint)); + updatedMembers.Add(new UpdatedMemberInfo(editOrdinal, oldBody, newBody, map, lazyActiveOrMatchedLambdas, hasActiveStatement, oldHasStateMachineSuspensionPoint, newHasStateMachineSuspensionPoint)); for (int i = 0; i < activeNodes.Length; i++) { @@ -1257,8 +1266,8 @@ private Match ComputeLambdaBodyMatch( info = new LambdaInfo(); } - bool needsSyntaxMap; - var lambdaBodyMatch = ComputeBodyMatch(oldLambdaBody, newLambdaBody, activeNodesInLambda ?? SpecializedCollections.EmptyArray(), diagnostics, out needsSyntaxMap); + bool _; + var lambdaBodyMatch = ComputeBodyMatch(oldLambdaBody, newLambdaBody, activeNodesInLambda ?? SpecializedCollections.EmptyArray(), diagnostics, out _, out _); activeOrMatchedLambdas[oldLambdaBody] = info.WithMatch(lambdaBodyMatch, newLambdaBody); @@ -1271,7 +1280,8 @@ internal Match ComputeBodyMatch( SyntaxNode newBody, ActiveNode[] activeNodes, List diagnostics, - out bool hasStateMachineSuspensionPoint) + out bool oldHasStateMachineSuspensionPoint, + out bool newHasStateMachineSuspensionPoint) { Debug.Assert(oldBody != null); Debug.Assert(newBody != null); @@ -1302,7 +1312,8 @@ internal Match ComputeBodyMatch( // Note that iterators in VB don't need to contain yield, so this case is not covered by change in number of yields. bool creatingStateMachineAroundActiveStatement = oldStateMachineSuspensionPoints.Length == 0 && newStateMachineSuspensionPoints.Length > 0 && activeNodes.Length > 0; - hasStateMachineSuspensionPoint = oldStateMachineSuspensionPoints.Length > 0 && newStateMachineSuspensionPoints.Length > 0; + oldHasStateMachineSuspensionPoint = oldStateMachineSuspensionPoints.Length > 0; + newHasStateMachineSuspensionPoint = newStateMachineSuspensionPoints.Length > 0; if (oldStateMachineSuspensionPoints.Length > 0 || creatingStateMachineAroundActiveStatement) { @@ -1357,7 +1368,7 @@ internal Match ComputeBodyMatch( { diagnostics.Add(new RudeEditDiagnostic( RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, - GetDiagnosticSpan(IsMethod(newBody) ? newBody : newBody.Parent, EditKind.Update))); + GetBodyDiagnosticSpan(newBody, EditKind.Update))); } } @@ -2301,6 +2312,8 @@ internal void AnalyzeSemantics( { var updatedMember = updatedMembers[updatedMemberIndex]; + ReportStateMachineRudeEdits(updatedMember, oldSymbol, diagnostics); + bool newBodyHasLambdas; ReportLambdaAndClosureRudeEdits( oldModel, @@ -2323,7 +2336,7 @@ internal void AnalyzeSemantics( // 3) The new member contains lambdas // We need to map new lambdas in the method to the matching old ones. // If the old method has lambdas but the new one doesn't there is nothing to preserve. - if (updatedMember.HasActiveStatement || updatedMember.HasStateMachineSuspensionPoint || newBodyHasLambdas) + if (updatedMember.HasActiveStatement || updatedMember.NewHasStateMachineSuspensionPoint || newBodyHasLambdas) { syntaxMapOpt = CreateSyntaxMap(updatedMember.Map.Reverse); } @@ -3687,6 +3700,37 @@ private bool AreEquivalentClosureScopes(SyntaxNode oldScopeOpt, SyntaxNode newSc #endregion + #region State Machines + + private void ReportStateMachineRudeEdits( + UpdatedMemberInfo updatedInfo, + ISymbol oldMember, + List diagnostics) + { + if (!updatedInfo.OldHasStateMachineSuspensionPoint) + { + return; + } + + // only methods and anonymous functions may be async/iterators machines: + var stateMachineAttributeQualifiedName = ((IMethodSymbol)oldMember).IsAsync ? + "System.Runtime.CompilerServices.AsyncStateMachineAttribute" : + "System.Runtime.CompilerServices.IteratorStateMachineAttribute"; + + // We assume that the attributes, if exist, are well formed. + // If not an error will be reported during EnC delta emit. + if (oldMember.ContainingAssembly.GetTypeByMetadataName(stateMachineAttributeQualifiedName) == null) + { + diagnostics.Add(new RudeEditDiagnostic( + RudeEditKind.UpdatingStateMachineMethodMissingAttribute, + GetBodyDiagnosticSpan(updatedInfo.NewBody, EditKind.Update), + updatedInfo.NewBody, + new[] { stateMachineAttributeQualifiedName })); + } + } + + #endregion + #endregion #region Helpers diff --git a/src/Features/Core/Portable/EditAndContinue/RudeEditDiagnosticDescriptors.cs b/src/Features/Core/Portable/EditAndContinue/RudeEditDiagnosticDescriptors.cs index eac126fcb3beb..636a5d8d44e7e 100644 --- a/src/Features/Core/Portable/EditAndContinue/RudeEditDiagnosticDescriptors.cs +++ b/src/Features/Core/Portable/EditAndContinue/RudeEditDiagnosticDescriptors.cs @@ -80,6 +80,8 @@ internal static class RudeEditDiagnosticDescriptors { GetDescriptorPair(RudeEditKind.PartiallyExecutedActiveStatementDelete, FeaturesResources.AnActiveStatementHasBeenRemoved) }, { GetDescriptorPair(RudeEditKind.InsertFile, FeaturesResources.AddingANewFile) }, { GetDescriptorPair(RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, FeaturesResources.UpdatingStateMachineMethodAroundActive) }, + // TODO: move message to resources https://github.com/dotnet/roslyn/issues/9196 + { GetDescriptorPair(RudeEditKind.UpdatingStateMachineMethodMissingAttribute, "Attribute '{0}' is missing. Updating an async method or an iterator will prevent the debug session from continuing.") }, { GetDescriptorPair(RudeEditKind.RUDE_EDIT_COMPLEX_QUERY_EXPRESSION, FeaturesResources.ModifyingAWhichContainsComplexQuery) }, diff --git a/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs b/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs index 706dd7e3577d2..ec7f6c5ac408d 100644 --- a/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs +++ b/src/Features/Core/Portable/EditAndContinue/RudeEditKind.cs @@ -90,6 +90,7 @@ internal enum RudeEditKind : ushort PartiallyExecutedActiveStatementUpdate = 72, PartiallyExecutedActiveStatementDelete = 73, UpdatingStateMachineMethodAroundActiveStatement = 74, + UpdatingStateMachineMethodMissingAttribute = 75, // TODO: remove values below RUDE_EDIT_COMPLEX_QUERY_EXPRESSION = 0x103, diff --git a/src/Features/Core/Portable/FeaturesResources.Designer.cs b/src/Features/Core/Portable/FeaturesResources.Designer.cs index 74ffd8c7cac01..c9e414a696c5f 100644 --- a/src/Features/Core/Portable/FeaturesResources.Designer.cs +++ b/src/Features/Core/Portable/FeaturesResources.Designer.cs @@ -907,6 +907,15 @@ internal static string Generate_type { } } + /// + /// Looks up a localized string similar to Generate variable. + /// + internal static string Generate_variable { + get { + return ResourceManager.GetString("Generate_variable", resourceCulture); + } + } + /// /// Looks up a localized string similar to Generate abstract method '{0}' in '{1}'. /// diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index c8c1aea0e3b6c..8a855c18a1616 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -928,4 +928,7 @@ Do you want to continue? Naming Styles + + Generate variable + \ No newline at end of file diff --git a/src/Features/Core/Portable/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs b/src/Features/Core/Portable/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs index dcf7bd7c33427..8935e9254e4be 100644 --- a/src/Features/Core/Portable/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs +++ b/src/Features/Core/Portable/GenerateMember/GenerateVariable/AbstractGenerateVariableService.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -45,7 +46,7 @@ public async Task> GenerateVariableAsync( return SpecializedCollections.EmptyEnumerable(); } - var result = new List(); + var actions = new List(); var canGenerateMember = CodeGenerator.CanAdd(document.Project.Solution, state.TypeToGenerateIn, cancellationToken); @@ -56,24 +57,32 @@ public async Task> GenerateVariableAsync( { if (canGenerateMember) { - AddPropertyCodeActions(result, document, state); - AddFieldCodeActions(result, document, state); + AddPropertyCodeActions(actions, document, state); + AddFieldCodeActions(actions, document, state); } - AddLocalCodeActions(result, document, state); + AddLocalCodeActions(actions, document, state); } else { if (canGenerateMember) { - AddFieldCodeActions(result, document, state); - AddPropertyCodeActions(result, document, state); + AddFieldCodeActions(actions, document, state); + AddPropertyCodeActions(actions, document, state); } - AddLocalCodeActions(result, document, state); + AddLocalCodeActions(actions, document, state); } - return result; + if (actions.Count > 1) + { + // Wrap the generate variable actions into a single top level suggestion + // so as to not clutter the list. + return SpecializedCollections.SingletonEnumerable( + new MyCodeAction(FeaturesResources.Generate_variable, actions.AsImmutable())); + } + + return actions; } } @@ -136,5 +145,13 @@ private void AddLocalCodeActions(List result, Document document, Sta result.Add(new GenerateLocalCodeAction((TService)this, document, state)); } } + + private class MyCodeAction : CodeAction.SimpleCodeAction + { + public MyCodeAction(string title, ImmutableArray nestedActions) + : base(title, nestedActions) + { + } + } } } diff --git a/src/Features/Core/Portable/project.lock.json b/src/Features/Core/Portable/project.lock.json index 39ee2994a4f41..7fd5fb06c1f04 100644 --- a/src/Features/Core/Portable/project.lock.json +++ b/src/Features/Core/Portable/project.lock.json @@ -27,7 +27,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -72,11 +72,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Features/VisualBasic/Portable/project.lock.json b/src/Features/VisualBasic/Portable/project.lock.json index 39ee2994a4f41..7fd5fb06c1f04 100644 --- a/src/Features/VisualBasic/Portable/project.lock.json +++ b/src/Features/VisualBasic/Portable/project.lock.json @@ -27,7 +27,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -72,11 +72,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Interactive/CsiCore/project.lock.json b/src/Interactive/CsiCore/project.lock.json index a3d4cee19f4b6..01c99cf2acfd8 100644 --- a/src/Interactive/CsiCore/project.lock.json +++ b/src/Interactive/CsiCore/project.lock.json @@ -605,7 +605,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1983,7 +1983,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -3431,7 +3431,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -5030,7 +5030,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -8295,11 +8295,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Interactive/EditorFeatures/CSharp/project.lock.json b/src/Interactive/EditorFeatures/CSharp/project.lock.json index 42c6f82d89c45..4e2b9693850cc 100644 --- a/src/Interactive/EditorFeatures/CSharp/project.lock.json +++ b/src/Interactive/EditorFeatures/CSharp/project.lock.json @@ -86,24 +86,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -216,7 +198,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -538,49 +520,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -931,11 +870,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Interactive/EditorFeatures/Core/Extensibility/Interactive/ResetInteractive.cs b/src/Interactive/EditorFeatures/Core/Extensibility/Interactive/ResetInteractive.cs index 430e84de6ac13..9c8eb4620673a 100644 --- a/src/Interactive/EditorFeatures/Core/Extensibility/Interactive/ResetInteractive.cs +++ b/src/Interactive/EditorFeatures/Core/Extensibility/Interactive/ResetInteractive.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.Editor; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Editor.OptionsExtensionMethods; +using System.Collections.Generic; namespace Microsoft.VisualStudio.LanguageServices.Interactive { @@ -37,10 +38,10 @@ internal ResetInteractive(IEditorOptionsFactoryService editorOptionsFactoryServi internal Task Execute(IInteractiveWindow interactiveWindow, string title) { - ImmutableArray references, referenceSearchPaths, sourceSearchPaths, namespacesToImport; + ImmutableArray references, referenceSearchPaths, sourceSearchPaths, projectNamespaces; string projectDirectory; - if (GetProjectProperties(out references, out referenceSearchPaths, out sourceSearchPaths, out namespacesToImport, out projectDirectory)) + if (GetProjectProperties(out references, out referenceSearchPaths, out sourceSearchPaths, out projectNamespaces, out projectDirectory)) { // Now, we're going to do a bunch of async operations. So create a wait // indicator so the user knows something is happening, and also so they cancel. @@ -52,7 +53,7 @@ internal Task Execute(IInteractiveWindow interactiveWindow, string title) references, referenceSearchPaths, sourceSearchPaths, - namespacesToImport, + projectNamespaces, projectDirectory, waitContext); @@ -74,7 +75,7 @@ private async Task ResetInteractiveAsync( ImmutableArray referencePaths, ImmutableArray referenceSearchPaths, ImmutableArray sourceSearchPaths, - ImmutableArray namespacesToImport, + ImmutableArray projectNamespaces, string projectDirectory, IWaitContext waitContext) { @@ -112,13 +113,21 @@ private async Task ResetInteractiveAsync( var editorOptions = _editorOptionsFactoryService.GetOptions(interactiveWindow.CurrentLanguageBuffer); var importReferencesCommand = referencePaths.Select(_createReference); + await interactiveWindow.SubmitAsync(importReferencesCommand).ConfigureAwait(true); + + // Project's default namespace might be different from namespace used within project. + // Filter out namespace imports that do not exist in interactive compilation. + IEnumerable namespacesToImport = await GetNamespacesToImportAsync(projectNamespaces, interactiveWindow).ConfigureAwait(true); var importNamespacesCommand = namespacesToImport.Select(_createImport).Join(editorOptions.GetNewLineCharacter()); - await interactiveWindow.SubmitAsync(importReferencesCommand.Concat(new[] + + if (!string.IsNullOrWhiteSpace(importNamespacesCommand)) { - importNamespacesCommand - })).ConfigureAwait(true); + await interactiveWindow.SubmitAsync(new[] { importNamespacesCommand }).ConfigureAwait(true); + } } + protected abstract Task> GetNamespacesToImportAsync(IEnumerable namespacesToImport, IInteractiveWindow interactiveWindow); + /// /// Gets the properties of the currently selected projects necessary for reset. /// @@ -126,7 +135,7 @@ protected abstract bool GetProjectProperties( out ImmutableArray references, out ImmutableArray referenceSearchPaths, out ImmutableArray sourceSearchPaths, - out ImmutableArray namespacesToImport, + out ImmutableArray projectNamespaces, out string projectDirectory); /// diff --git a/src/Interactive/EditorFeatures/Core/project.lock.json b/src/Interactive/EditorFeatures/Core/project.lock.json index 6adde8e3b30ba..95b8a88c552bf 100644 --- a/src/Interactive/EditorFeatures/Core/project.lock.json +++ b/src/Interactive/EditorFeatures/Core/project.lock.json @@ -75,24 +75,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -197,7 +179,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -480,49 +462,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -840,11 +779,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Interactive/EditorFeatures/VisualBasic/project.lock.json b/src/Interactive/EditorFeatures/VisualBasic/project.lock.json index cc77b59d3b33b..164b8beac7d5d 100644 --- a/src/Interactive/EditorFeatures/VisualBasic/project.lock.json +++ b/src/Interactive/EditorFeatures/VisualBasic/project.lock.json @@ -86,24 +86,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -208,7 +190,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -520,49 +502,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -880,11 +819,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Interactive/Features/InteractiveFeatures.csproj b/src/Interactive/Features/InteractiveFeatures.csproj index f7f3aebe0ca56..2d1d9d0cc0fe5 100644 --- a/src/Interactive/Features/InteractiveFeatures.csproj +++ b/src/Interactive/Features/InteractiveFeatures.csproj @@ -88,6 +88,7 @@ + diff --git a/src/Interactive/Features/project.json b/src/Interactive/Features/project.json index 8940ca6437214..645f90a7fa263 100644 --- a/src/Interactive/Features/project.json +++ b/src/Interactive/Features/project.json @@ -1,6 +1,5 @@ { "dependencies": { - "System.Diagnostics.Process": "4.1.0-beta-23504" }, "frameworks": { "net46": {} diff --git a/src/Interactive/Features/project.lock.json b/src/Interactive/Features/project.lock.json index 55bb0535082ad..95b8a88c552bf 100644 --- a/src/Interactive/Features/project.lock.json +++ b/src/Interactive/Features/project.lock.json @@ -75,24 +75,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -197,7 +179,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -480,49 +462,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -840,11 +779,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -1127,9 +1066,7 @@ } }, "projectFileDependencyGroups": { - "": [ - "System.Diagnostics.Process >= 4.1.0-beta-23504" - ], + "": [], ".NETFramework,Version=v4.6": [] } } \ No newline at end of file diff --git a/src/Interactive/Host/project.lock.json b/src/Interactive/Host/project.lock.json index b6a0ac5178c07..8d7bdad51b572 100644 --- a/src/Interactive/Host/project.lock.json +++ b/src/Interactive/Host/project.lock.json @@ -75,24 +75,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -197,7 +179,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -298,14 +280,6 @@ "lib/net45/_._": {} } }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "compile": { - "ref/dotnet/_._": {} - }, - "runtime": { - "runtimes/win7/lib/net/_._": {} - } - }, "System.AppContext/4.0.0": { "dependencies": { "System.Runtime": "4.0.0" @@ -354,25 +328,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0", - "runtime.win7.System.Diagnostics.Process": "4.1.0-beta-23504" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -477,7 +432,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -626,24 +581,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -748,7 +685,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -924,21 +861,6 @@ "runtimes/aot/lib/netcore50/mscorlib.dll" ] }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "t96Q9MyIMoFQtblYAVQshxWL8AZEKSble9wb0Wp330R02N7fsgfPlhqd3h+VvrhTKMT0WWbkHyH9vEU+SSLpTg==", - "type": "package", - "files": [ - "ref/dotnet/_._", - "runtime.win7.System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "runtime.win7.System.Diagnostics.Process.nuspec", - "runtimes/win7/lib/dotnet5.5/System.Diagnostics.Process.dll", - "runtimes/win7/lib/net/_._", - "runtimes/win7/lib/netcore50/_._", - "runtimes/win7/lib/win8/_._", - "runtimes/win7/lib/wp8/_._", - "runtimes/win7/lib/wpa81/_._" - ] - }, "System.AppContext/4.0.0": { "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", "type": "package", @@ -1046,49 +968,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1406,11 +1285,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Interactive/HostTest/project.lock.json b/src/Interactive/HostTest/project.lock.json index 41a8f210b4084..8abd206e0e53a 100644 --- a/src/Interactive/HostTest/project.lock.json +++ b/src/Interactive/HostTest/project.lock.json @@ -103,24 +103,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -233,7 +215,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -460,24 +442,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -590,7 +554,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -817,24 +781,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -947,7 +893,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1355,49 +1301,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1748,11 +1651,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Interactive/VbiCore/project.lock.json b/src/Interactive/VbiCore/project.lock.json index 5379fd348367a..4d776c03aaa77 100644 --- a/src/Interactive/VbiCore/project.lock.json +++ b/src/Interactive/VbiCore/project.lock.json @@ -605,7 +605,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1983,7 +1983,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -3431,7 +3431,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -5030,7 +5030,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -8275,11 +8275,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Interactive/csi/project.lock.json b/src/Interactive/csi/project.lock.json index e7294f70a33c3..6e6be388a526c 100644 --- a/src/Interactive/csi/project.lock.json +++ b/src/Interactive/csi/project.lock.json @@ -182,7 +182,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -438,7 +438,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -694,7 +694,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1347,11 +1347,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Interactive/vbi/project.lock.json b/src/Interactive/vbi/project.lock.json index 5cd446182cacd..d2b85e0481cd3 100644 --- a/src/Interactive/vbi/project.lock.json +++ b/src/Interactive/vbi/project.lock.json @@ -174,7 +174,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -422,7 +422,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -670,7 +670,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1280,11 +1280,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/InteractiveWindow/EditorTest/project.lock.json b/src/InteractiveWindow/EditorTest/project.lock.json index 687ec8c67a4e0..10ee569aee681 100644 --- a/src/InteractiveWindow/EditorTest/project.lock.json +++ b/src/InteractiveWindow/EditorTest/project.lock.json @@ -102,7 +102,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -297,7 +297,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -656,11 +656,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/InteractiveWindow/VisualStudio/IVsInteractiveWindow2.cs b/src/InteractiveWindow/VisualStudio/IVsInteractiveWindow2.cs deleted file mode 100644 index 2a2c8470db5ac..0000000000000 --- a/src/InteractiveWindow/VisualStudio/IVsInteractiveWindow2.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.VisualStudio.Imaging.Interop; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.VisualStudio.InteractiveWindow.Shell -{ - /// - /// Extends with additional functionality. - /// - public interface IVsInteractiveWindow2 : IVsInteractiveWindow - { - /// - /// Gets the associated with the . - /// - object WindowFrame { get; } - - /// - /// Gets or sets the ImageMoniker for the icon for this tool window. This property - /// should be used instead of BitmapResource and BitmapIndex to allow for DPI-aware - /// icons. - /// - ImageMoniker BitmapImageMoniker { get; set; } - } -} diff --git a/src/InteractiveWindow/VisualStudio/PublicAPI.Unshipped.txt b/src/InteractiveWindow/VisualStudio/PublicAPI.Unshipped.txt index f1abeb90badee..e69de29bb2d1d 100644 --- a/src/InteractiveWindow/VisualStudio/PublicAPI.Unshipped.txt +++ b/src/InteractiveWindow/VisualStudio/PublicAPI.Unshipped.txt @@ -1,4 +0,0 @@ -Microsoft.VisualStudio.InteractiveWindow.Shell.IVsInteractiveWindow2 -Microsoft.VisualStudio.InteractiveWindow.Shell.IVsInteractiveWindow2.WindowFrame.get -> object -Microsoft.VisualStudio.InteractiveWindow.Shell.IVsInteractiveWindow2.BitmapImageMoniker.get -> Microsoft.VisualStudio.Imaging.Interop.ImageMoniker -Microsoft.VisualStudio.InteractiveWindow.Shell.IVsInteractiveWindow2.BitmapImageMoniker.set -> void \ No newline at end of file diff --git a/src/InteractiveWindow/VisualStudio/VisualStudioInteractiveWindow.csproj b/src/InteractiveWindow/VisualStudio/VisualStudioInteractiveWindow.csproj index 48f8fee803851..60f82887b6b78 100644 --- a/src/InteractiveWindow/VisualStudio/VisualStudioInteractiveWindow.csproj +++ b/src/InteractiveWindow/VisualStudio/VisualStudioInteractiveWindow.csproj @@ -52,9 +52,6 @@ false - - True - false @@ -127,8 +124,6 @@ - - diff --git a/src/InteractiveWindow/VisualStudio/VsInteractiveWindow.cs b/src/InteractiveWindow/VisualStudio/VsInteractiveWindow.cs index 95aaa667aa1ab..38ceac62f5df6 100644 --- a/src/InteractiveWindow/VisualStudio/VsInteractiveWindow.cs +++ b/src/InteractiveWindow/VisualStudio/VsInteractiveWindow.cs @@ -8,9 +8,12 @@ using System.Windows; using System.Windows.Input; using Microsoft.VisualStudio.ComponentModelHost; -using Microsoft.VisualStudio.Imaging.Interop; +using Microsoft.VisualStudio.Editor; using Microsoft.VisualStudio.OLE.Interop; +using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.VisualStudio.TextManager.Interop; using Microsoft.VisualStudio.Utilities; namespace Microsoft.VisualStudio.InteractiveWindow.Shell @@ -27,56 +30,165 @@ namespace Microsoft.VisualStudio.InteractiveWindow.Shell /// on the interactive window. /// [Guid(Guids.InteractiveToolWindowIdString)] - internal sealed class VsInteractiveWindow : IOleCommandTarget, IVsInteractiveWindow2, IDisposable + internal sealed class VsInteractiveWindow : ToolWindowPane, IOleCommandTarget, IVsInteractiveWindow { - private readonly VsInteractiveWindowPane _windowPane; + // Keep in sync with Microsoft.VisualStudio.Editor.Implementation.EnableFindOptionDefinition.OptionName. + private const string EnableFindOptionName = "Enable Autonomous Find"; + + private readonly IComponentModel _componentModel; + private readonly IVsEditorAdaptersFactoryService _editorAdapters; + + private IInteractiveWindow _window; + private IVsFindTarget _findTarget; + private IOleCommandTarget _commandTarget; + private IInteractiveEvaluator _evaluator; + private IWpfTextViewHost _textViewHost; internal VsInteractiveWindow(IComponentModel model, Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags) { - _windowPane = new VsInteractiveWindowPane(model, providerId, instanceId, title, evaluator, creationFlags); + _componentModel = model; + this.Caption = title; + _editorAdapters = _componentModel.GetService(); + _evaluator = evaluator; + + // The following calls this.OnCreate: + Guid clsId = this.ToolClsid; + Guid empty = Guid.Empty; + Guid typeId = providerId; + IVsWindowFrame frame; + var vsShell = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell)); + + // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are + // destroyed when closed. We are really multi instance but we don't want to be closed. + + ErrorHandler.ThrowOnFailure( + vsShell.CreateToolWindow( + (uint)(__VSCREATETOOLWIN.CTW_fInitNew | __VSCREATETOOLWIN.CTW_fToolbarHost | creationFlags), + (uint)instanceId, + this.GetIVsWindowPane(), + ref clsId, + ref typeId, + ref empty, + null, + title, + null, + out frame + ) + ); + var guid = GetType().GUID; + ErrorHandler.ThrowOnFailure(frame.SetGuidProperty((int)__VSFPROPID.VSFPROPID_CmdUIGuid, ref guid)); + this.Frame = frame; } - void IDisposable.Dispose() => _windowPane.Dispose(); + public void SetLanguage(Guid languageServiceGuid, IContentType contentType) + { + _window.SetLanguage(languageServiceGuid, contentType); + } - int IOleCommandTarget.Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) => - _windowPane.CommandTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); + public IInteractiveWindow InteractiveWindow { get { return _window; } } - int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) => - _windowPane.CommandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText); + #region ToolWindowPane overrides - void IVsInteractiveWindow.SetLanguage(Guid languageServiceGuid, IContentType contentType) => - InteractiveWindow.SetLanguage(languageServiceGuid, contentType); + protected override void OnCreate() + { + _window = _componentModel.GetService().CreateWindow(_evaluator); + _window.SubmissionBufferAdded += SubmissionBufferAdded; + _textViewHost = _window.GetTextViewHost(); + var textView = _textViewHost.TextView; + textView.Options.SetOptionValue(EnableFindOptionName, true); + var viewAdapter = _editorAdapters.GetViewAdapter(textView); + _findTarget = viewAdapter as IVsFindTarget; + _commandTarget = viewAdapter as IOleCommandTarget; + } - void IVsInteractiveWindow.Show(bool focus) + private void SubmissionBufferAdded(object sender, SubmissionBufferAddedEventArgs e) { - var windowFrame = (IVsWindowFrame)WindowFrame; - ErrorHandler.ThrowOnFailure(focus ? windowFrame.Show() : windowFrame.ShowNoActivate()); + GetToolbarHost().ForceUpdateUI(); + } - if (focus) + protected override void OnClose() + { + _window.Close(); + base.OnClose(); + } + + protected override void Dispose(bool disposing) + { + if (disposing) { - IInputElement input = InteractiveWindow.TextView as IInputElement; - if (input != null) + if (_window != null) { - Keyboard.Focus(input); + _window.Dispose(); } } } - public IInteractiveWindow InteractiveWindow => _windowPane.InteractiveWindow; + /// + /// This property returns the control that should be hosted in the Tool Window. It can be + /// either a FrameworkElement (for easy creation of tool windows hosting WPF content), or it + /// can be an object implementing one of the IVsUIWPFElement or IVsUIWin32Element + /// interfaces. + /// + public override object Content + { + get { return _textViewHost; } + set { } + } + + public override void OnToolWindowCreated() + { + Guid commandUiGuid = VSConstants.GUID_TextEditorFactory; + ((IVsWindowFrame)Frame).SetGuidProperty((int)__VSFPROPID.VSFPROPID_InheritKeyBindings, ref commandUiGuid); + + base.OnToolWindowCreated(); + + // add our toolbar which is defined in our VSCT file + var toolbarHost = GetToolbarHost(); + Guid guidInteractiveCmdSet = Guids.InteractiveCommandSetId; + ErrorHandler.ThrowOnFailure(toolbarHost.AddToolbar(VSTWT_LOCATION.VSTWT_TOP, ref guidInteractiveCmdSet, (uint)MenuIds.InteractiveWindowToolbar)); + } + + #endregion - public object WindowFrame => _windowPane.Frame; + #region Window IOleCommandTarget - ImageMoniker IVsInteractiveWindow2.BitmapImageMoniker + public int QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { - get - { - return _windowPane.BitmapImageMoniker; - } + return _commandTarget.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText); + } - set + public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) + { + return _commandTarget.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); + } + + #endregion + + #region IVsInteractiveWindow + + public void Show(bool focus) + { + var windowFrame = (IVsWindowFrame)Frame; + ErrorHandler.ThrowOnFailure(focus ? windowFrame.Show() : windowFrame.ShowNoActivate()); + + if (focus) { - _windowPane.BitmapImageMoniker = value; + IInputElement input = _window.TextView as IInputElement; + if (input != null) + { + Keyboard.Focus(input); + } } } + + private IVsToolWindowToolbarHost GetToolbarHost() + { + var frame = (IVsWindowFrame)Frame; + object result; + ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_ToolbarHost, out result)); + return (IVsToolWindowToolbarHost)result; + } + + #endregion } } diff --git a/src/InteractiveWindow/VisualStudio/VsInteractiveWindowPane.cs b/src/InteractiveWindow/VisualStudio/VsInteractiveWindowPane.cs deleted file mode 100644 index 985bbbde265f5..0000000000000 --- a/src/InteractiveWindow/VisualStudio/VsInteractiveWindowPane.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.VisualStudio.ComponentModelHost; -using Microsoft.VisualStudio.Editor; -using Microsoft.VisualStudio.OLE.Interop; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.Text.Editor; -using Microsoft.VisualStudio.TextManager.Interop; - -namespace Microsoft.VisualStudio.InteractiveWindow.Shell -{ - /// - /// The backing type for . It subclasses so - /// that the instance handed out through the public API does not. - /// - internal sealed class VsInteractiveWindowPane : ToolWindowPane - { - // Keep in sync with Microsoft.VisualStudio.Editor.Implementation.EnableFindOptionDefinition.OptionName. - private const string EnableFindOptionName = "Enable Autonomous Find"; - - private readonly IComponentModel _componentModel; - private readonly IVsEditorAdaptersFactoryService _editorAdapters; - private readonly IInteractiveEvaluator _evaluator; - - private IInteractiveWindow _window; - private IVsFindTarget _findTarget; - private IOleCommandTarget _commandTarget; - private IWpfTextViewHost _textViewHost; - - internal VsInteractiveWindowPane(IComponentModel model, Guid providerId, int instanceId, string title, IInteractiveEvaluator evaluator, __VSCREATETOOLWIN creationFlags) - { - _componentModel = model; - this.Caption = title; - _editorAdapters = _componentModel.GetService(); - _evaluator = evaluator; - - // The following calls this.OnCreate: - Guid clsId = this.ToolClsid; - Guid empty = Guid.Empty; - Guid typeId = providerId; - IVsWindowFrame frame; - var vsShell = (IVsUIShell)ServiceProvider.GlobalProvider.GetService(typeof(SVsUIShell)); - - // we don't pass __VSCREATETOOLWIN.CTW_fMultiInstance because multi instance panes are - // destroyed when closed. We are really multi instance but we don't want to be closed. - - ErrorHandler.ThrowOnFailure( - vsShell.CreateToolWindow( - (uint)(__VSCREATETOOLWIN.CTW_fInitNew | __VSCREATETOOLWIN.CTW_fToolbarHost | creationFlags), - (uint)instanceId, - this.GetIVsWindowPane(), - ref clsId, - ref typeId, - ref empty, - null, - title, - null, - out frame)); - - var guid = GetType().GUID; - ErrorHandler.ThrowOnFailure(frame.SetGuidProperty((int)__VSFPROPID.VSFPROPID_CmdUIGuid, ref guid)); - this.Frame = frame; - } - - internal IInteractiveWindow InteractiveWindow => _window; - - internal IOleCommandTarget CommandTarget => _commandTarget; - - #region ToolWindowPane overrides - - protected override void OnCreate() - { - _window = _componentModel.GetService().CreateWindow(_evaluator); - _window.SubmissionBufferAdded += SubmissionBufferAdded; - _textViewHost = _window.GetTextViewHost(); - var textView = _textViewHost.TextView; - textView.Options.SetOptionValue(EnableFindOptionName, true); - var viewAdapter = _editorAdapters.GetViewAdapter(textView); - _findTarget = viewAdapter as IVsFindTarget; - _commandTarget = viewAdapter as IOleCommandTarget; - } - - private void SubmissionBufferAdded(object sender, SubmissionBufferAddedEventArgs e) - { - GetToolbarHost().ForceUpdateUI(); - } - - protected override void OnClose() - { - _window.Close(); - base.OnClose(); - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (_window != null) - { - _window.Dispose(); - } - } - } - - /// - /// This property returns the control that should be hosted in the Tool Window. It can be - /// either a FrameworkElement (for easy creation of tool windows hosting WPF content), or it - /// can be an object implementing one of the IVsUIWPFElement or IVsUIWin32Element - /// interfaces. - /// - public override object Content - { - get { return _textViewHost; } - set { } - } - - public override void OnToolWindowCreated() - { - Guid commandUiGuid = VSConstants.GUID_TextEditorFactory; - ((IVsWindowFrame)Frame).SetGuidProperty((int)__VSFPROPID.VSFPROPID_InheritKeyBindings, ref commandUiGuid); - - base.OnToolWindowCreated(); - - // add our toolbar which is defined in our VSCT file - var toolbarHost = GetToolbarHost(); - Guid guidInteractiveCmdSet = Guids.InteractiveCommandSetId; - ErrorHandler.ThrowOnFailure(toolbarHost.AddToolbar(VSTWT_LOCATION.VSTWT_TOP, ref guidInteractiveCmdSet, (uint)MenuIds.InteractiveWindowToolbar)); - } - - #endregion - - private IVsToolWindowToolbarHost GetToolbarHost() - { - var frame = (IVsWindowFrame)Frame; - object result; - ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_ToolbarHost, out result)); - return (IVsToolWindowToolbarHost)result; - } - } -} diff --git a/src/Samples/CSharp/APISampleUnitTests/project.json b/src/Samples/CSharp/APISampleUnitTests/project.json index 4b652498cb156..1f9e1604f0b26 100644 --- a/src/Samples/CSharp/APISampleUnitTests/project.json +++ b/src/Samples/CSharp/APISampleUnitTests/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "xunit": "2.1.0" }, "frameworks": { diff --git a/src/Samples/CSharp/APISampleUnitTests/project.lock.json b/src/Samples/CSharp/APISampleUnitTests/project.lock.json index f0fa6c63a25ce..4ee725ea7675e 100644 --- a/src/Samples/CSharp/APISampleUnitTests/project.lock.json +++ b/src/Samples/CSharp/APISampleUnitTests/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -230,7 +230,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -391,7 +391,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -690,11 +690,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -992,7 +992,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811", + "System.Reflection.Metadata >= 1.2.0-rc2-23826", "xunit >= 2.1.0" ], ".NETFramework,Version=v4.5.2": [] diff --git a/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers.Test/project.json b/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers.Test/project.json index 530becbedd289..bb2e111c4c93a 100644 --- a/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers.Test/project.json +++ b/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers.Test/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net452": {} diff --git a/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers.Test/project.lock.json b/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers.Test/project.lock.json index 88dce544d19a1..05e1472003e77 100644 --- a/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers.Test/project.lock.json +++ b/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers.Test/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -429,11 +429,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -621,7 +621,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers/project.json b/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers/project.json index d7eb3bc6b373f..d0f82f28760c2 100644 --- a/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers/project.json +++ b/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { ".NETPortable,Version=v4.5,Profile=Profile7": {} diff --git a/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers/project.lock.json b/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers/project.lock.json index bd1a7be49fd8b..eca36eb86aaf4 100644 --- a/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers/project.lock.json +++ b/src/Samples/CSharp/Analyzers/CSharpAnalyzers/CSharpAnalyzers/project.lock.json @@ -27,7 +27,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -72,11 +72,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -91,7 +91,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETPortable,Version=v4.5,Profile=Profile7": [] } diff --git a/src/Samples/CSharp/ConsoleClassifier/project.json b/src/Samples/CSharp/ConsoleClassifier/project.json index 39b88ca958fe2..0819d60b4614e 100644 --- a/src/Samples/CSharp/ConsoleClassifier/project.json +++ b/src/Samples/CSharp/ConsoleClassifier/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "Microsoft.Composition": "1.0.27" }, "frameworks": { diff --git a/src/Samples/CSharp/ConsoleClassifier/project.lock.json b/src/Samples/CSharp/ConsoleClassifier/project.lock.json index 452563f819b95..4e51e9b58e50c 100644 --- a/src/Samples/CSharp/ConsoleClassifier/project.lock.json +++ b/src/Samples/CSharp/ConsoleClassifier/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/CSharp/ConvertToAutoProperty/project.json b/src/Samples/CSharp/ConvertToAutoProperty/project.json index 41a35d6ecdf9c..d062bee4d9939 100644 --- a/src/Samples/CSharp/ConvertToAutoProperty/project.json +++ b/src/Samples/CSharp/ConvertToAutoProperty/project.json @@ -1,7 +1,7 @@ { "dependencies": { "Microsoft.Composition": "1.0.27", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "System.Collections.Immutable": "1.1.37" }, "frameworks": { diff --git a/src/Samples/CSharp/ConvertToAutoProperty/project.lock.json b/src/Samples/CSharp/ConvertToAutoProperty/project.lock.json index 452563f819b95..4e51e9b58e50c 100644 --- a/src/Samples/CSharp/ConvertToAutoProperty/project.lock.json +++ b/src/Samples/CSharp/ConvertToAutoProperty/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/CSharp/ConvertToConditional/Impl/project.json b/src/Samples/CSharp/ConvertToConditional/Impl/project.json index 647839844d687..23273d174d0db 100644 --- a/src/Samples/CSharp/ConvertToConditional/Impl/project.json +++ b/src/Samples/CSharp/ConvertToConditional/Impl/project.json @@ -1,7 +1,7 @@ { "dependencies": { "Microsoft.Composition": "1.0.27", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "System.Collections.Immutable": "1.1.37" }, "frameworks": { diff --git a/src/Samples/CSharp/ConvertToConditional/Impl/project.lock.json b/src/Samples/CSharp/ConvertToConditional/Impl/project.lock.json index 6b3ba4cdf2326..d88e989f1617c 100644 --- a/src/Samples/CSharp/ConvertToConditional/Impl/project.lock.json +++ b/src/Samples/CSharp/ConvertToConditional/Impl/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.6": [] } diff --git a/src/Samples/CSharp/ConvertToConditional/Test/project.json b/src/Samples/CSharp/ConvertToConditional/Test/project.json index 07f7db4c04a20..e6ba97b9c8ff8 100644 --- a/src/Samples/CSharp/ConvertToConditional/Test/project.json +++ b/src/Samples/CSharp/ConvertToConditional/Test/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "xunit": "2.1.0", "xunit.runner.console": "2.1.0" }, diff --git a/src/Samples/CSharp/ConvertToConditional/Test/project.lock.json b/src/Samples/CSharp/ConvertToConditional/Test/project.lock.json index 8e97fdb366d5c..cf3fa4af16c7b 100644 --- a/src/Samples/CSharp/ConvertToConditional/Test/project.lock.json +++ b/src/Samples/CSharp/ConvertToConditional/Test/project.lock.json @@ -77,7 +77,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -247,7 +247,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -417,7 +417,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -731,11 +731,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -1052,7 +1052,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811", + "System.Reflection.Metadata >= 1.2.0-rc2-23826", "xunit >= 2.1.0", "xunit.runner.console >= 2.1.0" ], diff --git a/src/Samples/CSharp/CopyPasteWithUsing/project.json b/src/Samples/CSharp/CopyPasteWithUsing/project.json index 647839844d687..23273d174d0db 100644 --- a/src/Samples/CSharp/CopyPasteWithUsing/project.json +++ b/src/Samples/CSharp/CopyPasteWithUsing/project.json @@ -1,7 +1,7 @@ { "dependencies": { "Microsoft.Composition": "1.0.27", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "System.Collections.Immutable": "1.1.37" }, "frameworks": { diff --git a/src/Samples/CSharp/CopyPasteWithUsing/project.lock.json b/src/Samples/CSharp/CopyPasteWithUsing/project.lock.json index 6b3ba4cdf2326..d88e989f1617c 100644 --- a/src/Samples/CSharp/CopyPasteWithUsing/project.lock.json +++ b/src/Samples/CSharp/CopyPasteWithUsing/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.6": [] } diff --git a/src/Samples/CSharp/FormatSolution/project.json b/src/Samples/CSharp/FormatSolution/project.json index 41a35d6ecdf9c..d062bee4d9939 100644 --- a/src/Samples/CSharp/FormatSolution/project.json +++ b/src/Samples/CSharp/FormatSolution/project.json @@ -1,7 +1,7 @@ { "dependencies": { "Microsoft.Composition": "1.0.27", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "System.Collections.Immutable": "1.1.37" }, "frameworks": { diff --git a/src/Samples/CSharp/FormatSolution/project.lock.json b/src/Samples/CSharp/FormatSolution/project.lock.json index 452563f819b95..4e51e9b58e50c 100644 --- a/src/Samples/CSharp/FormatSolution/project.lock.json +++ b/src/Samples/CSharp/FormatSolution/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Impl/project.json b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Impl/project.json index 41a35d6ecdf9c..d062bee4d9939 100644 --- a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Impl/project.json +++ b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Impl/project.json @@ -1,7 +1,7 @@ { "dependencies": { "Microsoft.Composition": "1.0.27", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "System.Collections.Immutable": "1.1.37" }, "frameworks": { diff --git a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Impl/project.lock.json b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Impl/project.lock.json index 452563f819b95..4e51e9b58e50c 100644 --- a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Impl/project.lock.json +++ b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Impl/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/project.json b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/project.json index 90cc827fff340..4e14381644843 100644 --- a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/project.json +++ b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "xunit": "2.1.0", "xunit.runner.console": "2.1.0" }, diff --git a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/project.lock.json b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/project.lock.json index 1f4eb926cf7f3..a21e27bc0e790 100644 --- a/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/project.lock.json +++ b/src/Samples/CSharp/ImplementNotifyPropertyChanged/Test/project.lock.json @@ -77,7 +77,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -247,7 +247,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -417,7 +417,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -731,11 +731,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -1051,7 +1051,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811", + "System.Reflection.Metadata >= 1.2.0-rc2-23826", "xunit >= 2.1.0", "xunit.runner.console >= 2.1.0" ], diff --git a/src/Samples/CSharp/MakeConst/Impl/project.json b/src/Samples/CSharp/MakeConst/Impl/project.json index 41a35d6ecdf9c..d062bee4d9939 100644 --- a/src/Samples/CSharp/MakeConst/Impl/project.json +++ b/src/Samples/CSharp/MakeConst/Impl/project.json @@ -1,7 +1,7 @@ { "dependencies": { "Microsoft.Composition": "1.0.27", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "System.Collections.Immutable": "1.1.37" }, "frameworks": { diff --git a/src/Samples/CSharp/MakeConst/Impl/project.lock.json b/src/Samples/CSharp/MakeConst/Impl/project.lock.json index 452563f819b95..4e51e9b58e50c 100644 --- a/src/Samples/CSharp/MakeConst/Impl/project.lock.json +++ b/src/Samples/CSharp/MakeConst/Impl/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/CSharp/RefOutModifier/project.json b/src/Samples/CSharp/RefOutModifier/project.json index 048f72f8dc3b1..d7882901917e1 100644 --- a/src/Samples/CSharp/RefOutModifier/project.json +++ b/src/Samples/CSharp/RefOutModifier/project.json @@ -1,7 +1,7 @@ { "dependencies": { "Microsoft.Composition": "1.0.27", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "System.Collections.Immutable": "1.1.37" }, "frameworks": { diff --git a/src/Samples/CSharp/RefOutModifier/project.lock.json b/src/Samples/CSharp/RefOutModifier/project.lock.json index 6b3ba4cdf2326..d88e989f1617c 100644 --- a/src/Samples/CSharp/RefOutModifier/project.lock.json +++ b/src/Samples/CSharp/RefOutModifier/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.6": [] } diff --git a/src/Samples/CSharp/TreeTransforms/project.json b/src/Samples/CSharp/TreeTransforms/project.json index 7502de442dc31..7dc97954163b9 100644 --- a/src/Samples/CSharp/TreeTransforms/project.json +++ b/src/Samples/CSharp/TreeTransforms/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net452": {} diff --git a/src/Samples/CSharp/TreeTransforms/project.lock.json b/src/Samples/CSharp/TreeTransforms/project.lock.json index 08f6bb33f9845..30323adce8fd1 100644 --- a/src/Samples/CSharp/TreeTransforms/project.lock.json +++ b/src/Samples/CSharp/TreeTransforms/project.lock.json @@ -53,7 +53,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -148,7 +148,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -243,7 +243,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -338,7 +338,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -568,11 +568,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -759,7 +759,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/Shared/UnitTestFramework/project.lock.json b/src/Samples/Shared/UnitTestFramework/project.lock.json index 96da30b016a44..f79acc798cdb5 100644 --- a/src/Samples/Shared/UnitTestFramework/project.lock.json +++ b/src/Samples/Shared/UnitTestFramework/project.lock.json @@ -77,7 +77,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -246,7 +246,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -415,7 +415,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -728,11 +728,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Samples/VisualBasic/APISampleUnitTests/project.json b/src/Samples/VisualBasic/APISampleUnitTests/project.json index 90cc827fff340..4e14381644843 100644 --- a/src/Samples/VisualBasic/APISampleUnitTests/project.json +++ b/src/Samples/VisualBasic/APISampleUnitTests/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "xunit": "2.1.0", "xunit.runner.console": "2.1.0" }, diff --git a/src/Samples/VisualBasic/APISampleUnitTests/project.lock.json b/src/Samples/VisualBasic/APISampleUnitTests/project.lock.json index 2558cad48ae0c..f0dcea6764367 100644 --- a/src/Samples/VisualBasic/APISampleUnitTests/project.lock.json +++ b/src/Samples/VisualBasic/APISampleUnitTests/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -231,7 +231,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -393,7 +393,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -693,11 +693,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -1013,7 +1013,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811", + "System.Reflection.Metadata >= 1.2.0-rc2-23826", "xunit >= 2.1.0", "xunit.runner.console >= 2.1.0" ], diff --git a/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers.Test/project.json b/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers.Test/project.json index b7547cf2f8bcf..eba416355bf27 100644 --- a/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers.Test/project.json +++ b/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers.Test/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net452": {} diff --git a/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers.Test/project.lock.json b/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers.Test/project.lock.json index 88dce544d19a1..05e1472003e77 100644 --- a/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers.Test/project.lock.json +++ b/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers.Test/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -429,11 +429,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -621,7 +621,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers/project.json b/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers/project.json index 87e3f8b8af613..6ce6689e2370d 100644 --- a/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers/project.json +++ b/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { diff --git a/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers/project.lock.json b/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers/project.lock.json index bd1a7be49fd8b..eca36eb86aaf4 100644 --- a/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers/project.lock.json +++ b/src/Samples/VisualBasic/Analyzers/BasicAnalyzers/BasicAnalyzers/project.lock.json @@ -27,7 +27,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -72,11 +72,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -91,7 +91,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETPortable,Version=v4.5,Profile=Profile7": [] } diff --git a/src/Samples/VisualBasic/ConsoleClassifier/project.json b/src/Samples/VisualBasic/ConsoleClassifier/project.json index 32cd06ffcf559..36236316e5890 100644 --- a/src/Samples/VisualBasic/ConsoleClassifier/project.json +++ b/src/Samples/VisualBasic/ConsoleClassifier/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net452": {} diff --git a/src/Samples/VisualBasic/ConsoleClassifier/project.lock.json b/src/Samples/VisualBasic/ConsoleClassifier/project.lock.json index edcc3240d7dbb..289a57a5c9cd4 100644 --- a/src/Samples/VisualBasic/ConsoleClassifier/project.lock.json +++ b/src/Samples/VisualBasic/ConsoleClassifier/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -731,7 +731,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/VisualBasic/ConvertToAutoProperty/Impl/project.json b/src/Samples/VisualBasic/ConvertToAutoProperty/Impl/project.json index 4549f394cd387..4f455ad0b21af 100644 --- a/src/Samples/VisualBasic/ConvertToAutoProperty/Impl/project.json +++ b/src/Samples/VisualBasic/ConvertToAutoProperty/Impl/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net452": {} diff --git a/src/Samples/VisualBasic/ConvertToAutoProperty/Impl/project.lock.json b/src/Samples/VisualBasic/ConvertToAutoProperty/Impl/project.lock.json index 452563f819b95..4e51e9b58e50c 100644 --- a/src/Samples/VisualBasic/ConvertToAutoProperty/Impl/project.lock.json +++ b/src/Samples/VisualBasic/ConvertToAutoProperty/Impl/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/VisualBasic/ConvertToAutoProperty/Test/project.lock.json b/src/Samples/VisualBasic/ConvertToAutoProperty/Test/project.lock.json index 242fc2617bdce..3ed181a83233a 100644 --- a/src/Samples/VisualBasic/ConvertToAutoProperty/Test/project.lock.json +++ b/src/Samples/VisualBasic/ConvertToAutoProperty/Test/project.lock.json @@ -77,7 +77,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -247,7 +247,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -417,7 +417,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -731,11 +731,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Samples/VisualBasic/FormatSolution/project.json b/src/Samples/VisualBasic/FormatSolution/project.json index 32cd06ffcf559..36236316e5890 100644 --- a/src/Samples/VisualBasic/FormatSolution/project.json +++ b/src/Samples/VisualBasic/FormatSolution/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net452": {} diff --git a/src/Samples/VisualBasic/FormatSolution/project.lock.json b/src/Samples/VisualBasic/FormatSolution/project.lock.json index edcc3240d7dbb..289a57a5c9cd4 100644 --- a/src/Samples/VisualBasic/FormatSolution/project.lock.json +++ b/src/Samples/VisualBasic/FormatSolution/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -731,7 +731,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Impl/project.json b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Impl/project.json index 4549f394cd387..4f455ad0b21af 100644 --- a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Impl/project.json +++ b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Impl/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net452": {} diff --git a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Impl/project.lock.json b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Impl/project.lock.json index 452563f819b95..4e51e9b58e50c 100644 --- a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Impl/project.lock.json +++ b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Impl/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/project.json b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/project.json index 90cc827fff340..4e14381644843 100644 --- a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/project.json +++ b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "xunit": "2.1.0", "xunit.runner.console": "2.1.0" }, diff --git a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/project.lock.json b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/project.lock.json index 1f4eb926cf7f3..a21e27bc0e790 100644 --- a/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/project.lock.json +++ b/src/Samples/VisualBasic/ImplementNotifyPropertyChanged/Test/project.lock.json @@ -77,7 +77,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -247,7 +247,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -417,7 +417,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -731,11 +731,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -1051,7 +1051,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811", + "System.Reflection.Metadata >= 1.2.0-rc2-23826", "xunit >= 2.1.0", "xunit.runner.console >= 2.1.0" ], diff --git a/src/Samples/VisualBasic/MakeConst/Impl/project.json b/src/Samples/VisualBasic/MakeConst/Impl/project.json index 4549f394cd387..4f455ad0b21af 100644 --- a/src/Samples/VisualBasic/MakeConst/Impl/project.json +++ b/src/Samples/VisualBasic/MakeConst/Impl/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net452": {} diff --git a/src/Samples/VisualBasic/MakeConst/Impl/project.lock.json b/src/Samples/VisualBasic/MakeConst/Impl/project.lock.json index 452563f819b95..4e51e9b58e50c 100644 --- a/src/Samples/VisualBasic/MakeConst/Impl/project.lock.json +++ b/src/Samples/VisualBasic/MakeConst/Impl/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Samples/VisualBasic/RemoveByVal/Impl/project.json b/src/Samples/VisualBasic/RemoveByVal/Impl/project.json index 2b20eae4e0d8e..28f9c69b3c92b 100644 --- a/src/Samples/VisualBasic/RemoveByVal/Impl/project.json +++ b/src/Samples/VisualBasic/RemoveByVal/Impl/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net46": {} diff --git a/src/Samples/VisualBasic/RemoveByVal/Impl/project.lock.json b/src/Samples/VisualBasic/RemoveByVal/Impl/project.lock.json index 6b3ba4cdf2326..d88e989f1617c 100644 --- a/src/Samples/VisualBasic/RemoveByVal/Impl/project.lock.json +++ b/src/Samples/VisualBasic/RemoveByVal/Impl/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -540,11 +540,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -732,7 +732,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.6": [] } diff --git a/src/Samples/VisualBasic/RemoveByVal/Test/project.json b/src/Samples/VisualBasic/RemoveByVal/Test/project.json index cc07d8d5e11c2..d4235f81e1c74 100644 --- a/src/Samples/VisualBasic/RemoveByVal/Test/project.json +++ b/src/Samples/VisualBasic/RemoveByVal/Test/project.json @@ -1,7 +1,7 @@ { "dependencies": { "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "xunit": "2.1.0", "xunit.runner.console": "2.1.0" }, diff --git a/src/Samples/VisualBasic/RemoveByVal/Test/project.lock.json b/src/Samples/VisualBasic/RemoveByVal/Test/project.lock.json index fb1a632a38a77..eb641d7af8b9f 100644 --- a/src/Samples/VisualBasic/RemoveByVal/Test/project.lock.json +++ b/src/Samples/VisualBasic/RemoveByVal/Test/project.lock.json @@ -77,7 +77,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -247,7 +247,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -417,7 +417,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -731,11 +731,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -1051,7 +1051,7 @@ "projectFileDependencyGroups": { "": [ "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811", + "System.Reflection.Metadata >= 1.2.0-rc2-23826", "xunit >= 2.1.0", "xunit.runner.console >= 2.1.0" ], diff --git a/src/Samples/VisualBasic/TreeTransforms/project.json b/src/Samples/VisualBasic/TreeTransforms/project.json index 7f2a40542ef8f..5be415c7c1620 100644 --- a/src/Samples/VisualBasic/TreeTransforms/project.json +++ b/src/Samples/VisualBasic/TreeTransforms/project.json @@ -2,7 +2,7 @@ "dependencies": { "Microsoft.Composition": "1.0.27", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { "net452": {} diff --git a/src/Samples/VisualBasic/TreeTransforms/project.lock.json b/src/Samples/VisualBasic/TreeTransforms/project.lock.json index a8f5e6f85c9f2..ef05f587a97a1 100644 --- a/src/Samples/VisualBasic/TreeTransforms/project.lock.json +++ b/src/Samples/VisualBasic/TreeTransforms/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -180,7 +180,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -291,7 +291,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -402,7 +402,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -651,11 +651,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -843,7 +843,7 @@ "": [ "Microsoft.Composition >= 1.0.27", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETFramework,Version=v4.5.2": [] } diff --git a/src/Scripting/CSharp/project.lock.json b/src/Scripting/CSharp/project.lock.json index d2151a7e66525..9781dc3e4ffcd 100644 --- a/src/Scripting/CSharp/project.lock.json +++ b/src/Scripting/CSharp/project.lock.json @@ -216,7 +216,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -942,11 +942,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Scripting/CSharpTest.Desktop/CSharpScriptingTest.Desktop.csproj b/src/Scripting/CSharpTest.Desktop/CSharpScriptingTest.Desktop.csproj index 2bbea98113766..98c14431cf87e 100644 --- a/src/Scripting/CSharpTest.Desktop/CSharpScriptingTest.Desktop.csproj +++ b/src/Scripting/CSharpTest.Desktop/CSharpScriptingTest.Desktop.csproj @@ -78,6 +78,9 @@ + + + diff --git a/src/Scripting/CSharpTest.Desktop/project.lock.json b/src/Scripting/CSharpTest.Desktop/project.lock.json index b96bf72dd8ffd..57e4ff2a9ff5f 100644 --- a/src/Scripting/CSharpTest.Desktop/project.lock.json +++ b/src/Scripting/CSharpTest.Desktop/project.lock.json @@ -252,7 +252,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -745,7 +745,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1770,11 +1770,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Scripting/CSharpTest/CSharpScriptingTest.csproj b/src/Scripting/CSharpTest/CSharpScriptingTest.csproj index 0bb9f295294f3..82cf7530b797d 100644 --- a/src/Scripting/CSharpTest/CSharpScriptingTest.csproj +++ b/src/Scripting/CSharpTest/CSharpScriptingTest.csproj @@ -74,8 +74,11 @@ + + + - + \ No newline at end of file diff --git a/src/Scripting/CSharpTest/project.lock.json b/src/Scripting/CSharpTest/project.lock.json index bf4867eb4ce4c..cb202ef24a7ed 100644 --- a/src/Scripting/CSharpTest/project.lock.json +++ b/src/Scripting/CSharpTest/project.lock.json @@ -288,7 +288,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1347,11 +1347,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Scripting/Core/project.lock.json b/src/Scripting/Core/project.lock.json index 27c859d2839ed..36c4e6c3ddac2 100644 --- a/src/Scripting/Core/project.lock.json +++ b/src/Scripting/Core/project.lock.json @@ -164,7 +164,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -779,11 +779,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Scripting/CoreTest.Desktop/ScriptingTest.Desktop.csproj b/src/Scripting/CoreTest.Desktop/ScriptingTest.Desktop.csproj index 197577e0e9ca2..cd9553312f136 100644 --- a/src/Scripting/CoreTest.Desktop/ScriptingTest.Desktop.csproj +++ b/src/Scripting/CoreTest.Desktop/ScriptingTest.Desktop.csproj @@ -64,6 +64,9 @@ + + + diff --git a/src/Scripting/CoreTest.Desktop/project.lock.json b/src/Scripting/CoreTest.Desktop/project.lock.json index 55cc3329df5d0..37814f4b71b0a 100644 --- a/src/Scripting/CoreTest.Desktop/project.lock.json +++ b/src/Scripting/CoreTest.Desktop/project.lock.json @@ -226,7 +226,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -685,7 +685,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1644,11 +1644,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Scripting/CoreTest/ScriptingTest.csproj b/src/Scripting/CoreTest/ScriptingTest.csproj index 59d82ccef05d0..2a621be334455 100644 --- a/src/Scripting/CoreTest/ScriptingTest.csproj +++ b/src/Scripting/CoreTest/ScriptingTest.csproj @@ -84,6 +84,9 @@ + + + diff --git a/src/Scripting/CoreTest/project.lock.json b/src/Scripting/CoreTest/project.lock.json index bf4867eb4ce4c..cb202ef24a7ed 100644 --- a/src/Scripting/CoreTest/project.lock.json +++ b/src/Scripting/CoreTest/project.lock.json @@ -288,7 +288,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1347,11 +1347,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Scripting/VisualBasic/project.lock.json b/src/Scripting/VisualBasic/project.lock.json index 36fcd4416c0d0..4c328d3b00c33 100644 --- a/src/Scripting/VisualBasic/project.lock.json +++ b/src/Scripting/VisualBasic/project.lock.json @@ -216,7 +216,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -932,11 +932,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Scripting/VisualBasicTest.Desktop/BasicScriptingTest.Desktop.vbproj b/src/Scripting/VisualBasicTest.Desktop/BasicScriptingTest.Desktop.vbproj index 0a2a4ccf9b0fa..12ee855a3f397 100644 --- a/src/Scripting/VisualBasicTest.Desktop/BasicScriptingTest.Desktop.vbproj +++ b/src/Scripting/VisualBasicTest.Desktop/BasicScriptingTest.Desktop.vbproj @@ -71,8 +71,11 @@ + + + - + \ No newline at end of file diff --git a/src/Scripting/VisualBasicTest.Desktop/project.lock.json b/src/Scripting/VisualBasicTest.Desktop/project.lock.json index 55cc3329df5d0..37814f4b71b0a 100644 --- a/src/Scripting/VisualBasicTest.Desktop/project.lock.json +++ b/src/Scripting/VisualBasicTest.Desktop/project.lock.json @@ -226,7 +226,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -685,7 +685,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1644,11 +1644,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj b/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj index 61288c8c1ff49..2972fabd5fcb1 100644 --- a/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj +++ b/src/Scripting/VisualBasicTest/BasicScriptingTest.vbproj @@ -67,6 +67,9 @@ + + + diff --git a/src/Scripting/VisualBasicTest/project.lock.json b/src/Scripting/VisualBasicTest/project.lock.json index bf4867eb4ce4c..cb202ef24a7ed 100644 --- a/src/Scripting/VisualBasicTest/project.lock.json +++ b/src/Scripting/VisualBasicTest/project.lock.json @@ -288,7 +288,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1347,11 +1347,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Test/DeployCoreClrTestRuntime/project.lock.json b/src/Test/DeployCoreClrTestRuntime/project.lock.json index d0ac19446ee5f..6260b19acf6b2 100644 --- a/src/Test/DeployCoreClrTestRuntime/project.lock.json +++ b/src/Test/DeployCoreClrTestRuntime/project.lock.json @@ -640,7 +640,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -2189,7 +2189,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -3811,7 +3811,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -5588,7 +5588,7 @@ "lib/DNXCore50/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -9086,11 +9086,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Test/DeployDesktopTestRuntime/project.lock.json b/src/Test/DeployDesktopTestRuntime/project.lock.json index 8abc9bb13a561..197da62ca3301 100644 --- a/src/Test/DeployDesktopTestRuntime/project.lock.json +++ b/src/Test/DeployDesktopTestRuntime/project.lock.json @@ -226,7 +226,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -684,7 +684,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1103,7 +1103,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -2061,11 +2061,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Test/Diagnostics/project.lock.json b/src/Test/Diagnostics/project.lock.json index 90cdd300de5b9..090afece6d3a7 100644 --- a/src/Test/Diagnostics/project.lock.json +++ b/src/Test/Diagnostics/project.lock.json @@ -86,7 +86,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -421,11 +421,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Test/PdbUtilities/Metadata/AggregatedMetadataReader.cs b/src/Test/PdbUtilities/Metadata/AggregatedMetadataReader.cs deleted file mode 100644 index d0823ce24221f..0000000000000 --- a/src/Test/PdbUtilities/Metadata/AggregatedMetadataReader.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; -using System.Reflection.Metadata; -using System.Reflection.Metadata.Ecma335; - -namespace Roslyn.Test.MetadataUtilities -{ - public sealed class AggregatedMetadataReader - { - private readonly MetadataAggregator _aggregator; - public readonly MetadataReader Last; - public ImmutableArray Readers { get; } - - public AggregatedMetadataReader(params MetadataReader[] readers) - : this((IEnumerable)readers) - { - } - - public AggregatedMetadataReader(IEnumerable readers) - { - Readers = ImmutableArray.CreateRange(readers); - Last = Readers.Last(); - _aggregator = new MetadataAggregator(readers.First(), readers.Skip(1).ToArray()); - } - - private TEntity GetValue(Handle handle, Func getter) - { - int generation; - var genHandle = _aggregator.GetGenerationHandle(handle, out generation); - return getter(Readers[generation], genHandle); - } - - public IEnumerable GetAssemblyReferences() => - Readers.SelectMany(r => r.AssemblyReferences.Select(h => r.GetAssemblyReference(h))); - - public string GetString(StringHandle handle) => GetValue(handle, (r, h) => r.GetString((StringHandle)h)); - } -} diff --git a/src/Test/PdbUtilities/Metadata/MetadataVisualizer.cs b/src/Test/PdbUtilities/Metadata/MetadataVisualizer.cs index f371aa8ae8f6d..f363ad51ed46e 100644 --- a/src/Test/PdbUtilities/Metadata/MetadataVisualizer.cs +++ b/src/Test/PdbUtilities/Metadata/MetadataVisualizer.cs @@ -626,11 +626,6 @@ private string FormatImports(ImportScope scope) return sb.ToString(); } - private string Version(Version version) - { - return version.Major + "." + version.Minor + "." + version.Build + "." + version.Revision; - } - private string SequencePoint(SequencePoint sequencePoint) { string range = sequencePoint.IsHidden ? @@ -1115,7 +1110,7 @@ private void WriteAssembly() AddRow( Literal(entry.Name), - Version(entry.Version), + entry.Version.Major + "." + entry.Version.Minor + "." + entry.Version.Revision + "." + entry.Version.Build, Literal(entry.Culture), Literal(entry.PublicKey, BlobKind.Key), EnumValue(entry.Flags), @@ -1141,7 +1136,7 @@ private void WriteAssemblyRef() AddRow( Literal(entry.Name), - Version(entry.Version), + entry.Version.Major + "." + entry.Version.Minor + "." + entry.Version.Revision + "." + entry.Version.Build, Literal(entry.Culture), Literal(entry.PublicKeyOrToken, BlobKind.Key), EnumValue(entry.Flags) diff --git a/src/Test/PdbUtilities/PdbUtilities.csproj b/src/Test/PdbUtilities/PdbUtilities.csproj index 95efc59822a30..5b862b417635e 100644 --- a/src/Test/PdbUtilities/PdbUtilities.csproj +++ b/src/Test/PdbUtilities/PdbUtilities.csproj @@ -110,7 +110,6 @@ Roslyn.Reflection.Metadata.Decoding\SignatureTypeHandleCode.cs - diff --git a/src/Test/PdbUtilities/project.json b/src/Test/PdbUtilities/project.json index c13c7f653c13e..88d4181149ddb 100644 --- a/src/Test/PdbUtilities/project.json +++ b/src/Test/PdbUtilities/project.json @@ -4,7 +4,7 @@ "Microsoft.DiaSymReader": "1.0.7", "Microsoft.DiaSymReader.Native": "1.3.3", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "frameworks": { ".NETPortable,Version=v4.5,Profile=Profile7": {} diff --git a/src/Test/PdbUtilities/project.lock.json b/src/Test/PdbUtilities/project.lock.json index b7abf6d4bfc8e..a17a033234b89 100644 --- a/src/Test/PdbUtilities/project.lock.json +++ b/src/Test/PdbUtilities/project.lock.json @@ -20,7 +20,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -73,11 +73,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -93,7 +93,7 @@ "Microsoft.DiaSymReader >= 1.0.7", "Microsoft.DiaSymReader.Native >= 1.3.3", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811" + "System.Reflection.Metadata >= 1.2.0-rc2-23826" ], ".NETPortable,Version=v4.5,Profile=Profile7": [] } diff --git a/src/Test/Utilities/Desktop/project.json b/src/Test/Utilities/Desktop/project.json index 40a381b3f0308..8c9534529faf6 100644 --- a/src/Test/Utilities/Desktop/project.json +++ b/src/Test/Utilities/Desktop/project.json @@ -4,7 +4,7 @@ "Microsoft.DiaSymReader": "1.0.7", "Microsoft.DiaSymReader.Native": "1.3.3", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "xunit": "2.1.0" }, "frameworks": { diff --git a/src/Test/Utilities/Desktop/project.lock.json b/src/Test/Utilities/Desktop/project.lock.json index 95d1f185fd63f..12d75d246d77b 100644 --- a/src/Test/Utilities/Desktop/project.lock.json +++ b/src/Test/Utilities/Desktop/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -232,7 +232,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -394,7 +394,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -556,7 +556,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -718,7 +718,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -880,7 +880,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1042,7 +1042,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1358,11 +1358,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -1663,7 +1663,7 @@ "Microsoft.DiaSymReader >= 1.0.7", "Microsoft.DiaSymReader.Native >= 1.3.3", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811", + "System.Reflection.Metadata >= 1.2.0-rc2-23826", "xunit >= 2.1.0" ], ".NETFramework,Version=v4.5": [] diff --git a/src/Test/Utilities/Portable.FX45/project.json b/src/Test/Utilities/Portable.FX45/project.json index 1d138be6d1227..094396bca5ea6 100644 --- a/src/Test/Utilities/Portable.FX45/project.json +++ b/src/Test/Utilities/Portable.FX45/project.json @@ -3,7 +3,7 @@ "Microsoft.CodeAnalysis.Test.Resources.Proprietary": "1.2.0-beta1-20160105-04", "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811", + "System.Reflection.Metadata": "1.2.0-rc2-23826", "xunit": "2.1.0" }, "frameworks": { diff --git a/src/Test/Utilities/Portable.FX45/project.lock.json b/src/Test/Utilities/Portable.FX45/project.lock.json index d3bb651ecea0f..028cb7e700d0a 100644 --- a/src/Test/Utilities/Portable.FX45/project.lock.json +++ b/src/Test/Utilities/Portable.FX45/project.lock.json @@ -70,7 +70,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -232,7 +232,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -394,7 +394,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -556,7 +556,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -718,7 +718,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -880,7 +880,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1042,7 +1042,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1358,11 +1358,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -1662,7 +1662,7 @@ "Microsoft.CodeAnalysis.Test.Resources.Proprietary >= 1.2.0-beta1-20160105-04", "Microsoft.DiaSymReader >= 1.0.7", "System.Collections.Immutable >= 1.1.37", - "System.Reflection.Metadata >= 1.2.0-rc3-23811", + "System.Reflection.Metadata >= 1.2.0-rc2-23826", "xunit >= 2.1.0" ], ".NETFramework,Version=v4.5": [] diff --git a/src/Test/Utilities/Portable/project.lock.json b/src/Test/Utilities/Portable/project.lock.json index 783f5e819ccde..cc082d3b4958e 100644 --- a/src/Test/Utilities/Portable/project.lock.json +++ b/src/Test/Utilities/Portable/project.lock.json @@ -245,7 +245,7 @@ "ref/dotnet/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections": "4.0.0", "System.Collections.Immutable": "1.1.37", @@ -1240,11 +1240,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Test/Utilities/Shared/Compilation/TestOperationWalker.cs b/src/Test/Utilities/Shared/Compilation/TestOperationWalker.cs new file mode 100644 index 0000000000000..8506775231dfc --- /dev/null +++ b/src/Test/Utilities/Shared/Compilation/TestOperationWalker.cs @@ -0,0 +1,541 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Semantics; +using Xunit; + +namespace Microsoft.CodeAnalysis.Test.Utilities +{ + public sealed class TestOperationWalker : OperationWalker + { + private static TestOperationWalker s_instance; + + private TestOperationWalker() + : base() + { } + + public static TestOperationWalker GetInstance() + { + if (s_instance == null) + { + s_instance = new TestOperationWalker(); + } + return s_instance; + } + +#if Test_IOperation_None_Kind + internal override void VisitNoneOperation(IOperation operation) + { + Assert.True(false, "Encountered an IOperation with `Kind == OperationKind.None` while walking the operation tree."); + } +#endif + + public override void Visit(IOperation operation) + { + if (operation != null) + { + var syntax = operation.Syntax; + var type = operation.Type; + var constantValue = operation.ConstantValue; + var isInvlid = operation.IsInvalid; + } + base.Visit(operation); + } + + public override void VisitBlockStatement(IBlockStatement operation) + { + foreach (var local in operation.Locals) + { + // empty loop body, just want to make sure it won't crash. + } + + base.VisitBlockStatement(operation); + } + + public override void VisitVariableDeclarationStatement(IVariableDeclarationStatement operation) + { + base.VisitVariableDeclarationStatement(operation); + } + + public override void VisitVariableDeclaration(IVariableDeclaration operation) + { + var variable = operation.Variable; + + base.VisitVariableDeclaration(operation); + } + + public override void VisitSwitchStatement(ISwitchStatement operation) + { + base.VisitSwitchStatement(operation); + } + + public override void VisitSwitchCase(ISwitchCase operation) + { + base.VisitSwitchCase(operation); + } + + public override void VisitSingleValueCaseClause(ISingleValueCaseClause operation) + { + var caseKind = operation.CaseKind; + var equality = operation.Equality; + + base.VisitSingleValueCaseClause(operation); + } + + public override void VisitRelationalCaseClause(IRelationalCaseClause operation) + { + var caseKind = operation.CaseKind; + var relation = operation.Relation; + + base.VisitRelationalCaseClause(operation); + } + + public override void VisitWhileUntilLoopStatement(IWhileUntilLoopStatement operation) + { + var loopKind = operation.LoopKind; + var isTopTest = operation.IsTopTest; + var isWhile = operation.IsWhile; + + base.VisitWhileUntilLoopStatement(operation); + } + + public override void VisitForLoopStatement(IForLoopStatement operation) + { + var loopKind = operation.LoopKind; + foreach (var local in operation.Locals) + { + // empty loop body, just want to make sure it won't crash. + } + + base.VisitForLoopStatement(operation); + } + + public override void VisitForEachLoopStatement(IForEachLoopStatement operation) + { + var loopKind = operation.LoopKind; + var iteraionVariable = operation.IterationVariable; + + base.VisitForEachLoopStatement(operation); + } + + public override void VisitLabelStatement(ILabelStatement operation) + { + var label = operation.Label; + + base.VisitLabelStatement(operation); + } + + public override void VisitBranchStatement(IBranchStatement operation) + { + var target = operation.Target; + var branchKind = operation.BranchKind; + + base. VisitBranchStatement(operation); + } + + public override void VisitYieldBreakStatement(IReturnStatement operation) + { + base.VisitYieldBreakStatement(operation); + } + + public override void VisitEmptyStatement(IEmptyStatement operation) + { + base.VisitEmptyStatement(operation); + } + + public override void VisitThrowStatement(IThrowStatement operation) + { + base.VisitThrowStatement(operation); + } + + public override void VisitReturnStatement(IReturnStatement operation) + { + base.VisitReturnStatement(operation); + } + + public override void VisitLockStatement(ILockStatement operation) + { + base.VisitLockStatement(operation); + } + + public override void VisitTryStatement(ITryStatement operation) + { + base.VisitTryStatement(operation); + } + + public override void VisitCatch(ICatchClause operation) + { + var caughtType = operation.CaughtType; + var exceptionLocal = operation.ExceptionLocal; + + base.VisitCatch(operation); + } + + public override void VisitUsingStatement(IUsingStatement operation) + { + base.VisitUsingStatement(operation); + } + + public override void VisitFixedStatement(IFixedStatement operation) + { + base.VisitFixedStatement(operation); + } + + public override void VisitExpressionStatement(IExpressionStatement operation) + { + base.VisitExpressionStatement(operation); + } + + public override void VisitWithStatement(IWithStatement operation) + { + base.VisitWithStatement(operation); + } + + public override void VisitStopStatement(IStopStatement operation) + { + base.VisitStopStatement(operation); + } + + public override void VisitEndStatement(IEndStatement operation) + { + base.VisitEndStatement(operation); + } + + public override void VisitInvocationExpression(IInvocationExpression operation) + { + var targetMethod = operation.TargetMethod; + var isVirtual = operation.IsVirtual; + // base.VisitInvocationExpression only visit operations in ArgumentsInSourceOrder + foreach (var argument in operation.ArgumentsInParameterOrder) + { + Visit(argument); + } + if (targetMethod != null) + { + foreach (var parameter in targetMethod.Parameters) + { + var matchingArgument = operation.GetArgumentMatchingParameter(parameter); + Visit(matchingArgument); + } + } + + base.VisitInvocationExpression(operation); + } + + public override void VisitArgument(IArgument operation) + { + var argumentKind = operation.ArgumentKind; + var parameter = operation.Parameter; + + base.VisitArgument(operation); + } + + public override void VisitOmittedArgumentExpression(IOmittedArgumentExpression operation) + { + base.VisitOmittedArgumentExpression(operation); + } + + public override void VisitArrayElementReferenceExpression(IArrayElementReferenceExpression operation) + { + base.VisitArrayElementReferenceExpression(operation); + } + + public override void VisitPointerIndirectionReferenceExpression(IPointerIndirectionReferenceExpression operation) + { + base.VisitPointerIndirectionReferenceExpression(operation); + } + + public override void VisitLocalReferenceExpression(ILocalReferenceExpression operation) + { + var local = operation.Local; + + base.VisitLocalReferenceExpression(operation); + } + + public override void VisitParameterReferenceExpression(IParameterReferenceExpression operation) + { + var parameter = operation.Parameter; + + base.VisitParameterReferenceExpression(operation); + } + + public override void VisitSyntheticLocalReferenceExpression(ISyntheticLocalReferenceExpression operation) + { + var syntheticLocalKind = operation.SyntheticLocalKind; + var containingStatement = operation.ContainingStatement; + + base.VisitSyntheticLocalReferenceExpression(operation); + } + + public override void VisitInstanceReferenceExpression(IInstanceReferenceExpression operation) + { + var instanceReferenceKind = operation.InstanceReferenceKind; + + base.VisitInstanceReferenceExpression(operation); + } + + public override void VisitFieldReferenceExpression(IFieldReferenceExpression operation) + { + var member = operation.Member; + var field = operation.Field; + + base.VisitFieldReferenceExpression(operation); + } + + public override void VisitMethodBindingExpression(IMethodBindingExpression operation) + { + var member = operation.Member; + var method = operation.Method; + + base.VisitMethodBindingExpression(operation); + } + + public override void VisitPropertyReferenceExpression(IPropertyReferenceExpression operation) + { + var member = operation.Member; + var property = operation.Property; + + base.VisitPropertyReferenceExpression(operation); + } + + public override void VisitEventReferenceExpression(IEventReferenceExpression operation) + { + var member = operation.Member; + var eventSymbol = operation.Event; + + base.VisitEventReferenceExpression(operation); + } + + public override void VisitEventAssignmentExpression(IEventAssignmentExpression operation) + { + var eventSymbol = operation.Event; + var adds = operation.Adds; + + base.VisitEventAssignmentExpression(operation); + } + + public override void VisitConditionalAccessExpression(IConditionalAccessExpression operation) + { + base.VisitConditionalAccessExpression(operation); + } + + public override void VisitConditionalAccessInstanceExpression(IConditionalAccessInstanceExpression operation) + { + base.VisitConditionalAccessInstanceExpression(operation); + } + + public override void VisitPlaceholderExpression(IPlaceholderExpression operation) + { + base.VisitPlaceholderExpression(operation); + } + + public override void VisitIndexedPropertyReferenceExpression(IIndexedPropertyReferenceExpression operation) + { + var member = operation.Member; + var property = operation.Property; + if (property != null) + { + foreach (var parameter in property.Parameters) + { + var matchingArgument = operation.GetArgumentMatchingParameter(parameter); + Visit(matchingArgument); + } + } + + base.VisitIndexedPropertyReferenceExpression(operation); + } + + public override void VisitUnaryOperatorExpression(IUnaryOperatorExpression operation) + { + var usesOperatorMethod = operation.UsesOperatorMethod; + var operatorMethod = operation.OperatorMethod; + var unaryOperationKind = operation.UnaryOperationKind; + + base.VisitUnaryOperatorExpression(operation); + } + + public override void VisitBinaryOperatorExpression(IBinaryOperatorExpression operation) + { + var usesOperatorMethod = operation.UsesOperatorMethod; + var operatorMethod = operation.OperatorMethod; + var binaryOperationKind = operation.BinaryOperationKind; + + base.VisitBinaryOperatorExpression(operation); + } + + public override void VisitConversionExpression(IConversionExpression operation) + { + var usesOperatorMethod = operation.UsesOperatorMethod; + var operatorMethod = operation.OperatorMethod; + var converisionKind = operation.ConversionKind; + var isExplicit = operation.IsExplicit; + + base.VisitConversionExpression(operation); + } + + public override void VisitConditionalChoiceExpression(IConditionalChoiceExpression operation) + { + base.VisitConditionalChoiceExpression(operation); + } + + public override void VisitNullCoalescingExpression(INullCoalescingExpression operation) + { + base.VisitNullCoalescingExpression(operation); + } + + public override void VisitIsTypeExpression(IIsTypeExpression operation) + { + var isType = operation.IsType; + + base.VisitIsTypeExpression(operation); + } + + public override void VisitSizeOfExpression(ISizeOfExpression operation) + { + var typeOperand = operation.TypeOperand; + + base.VisitSizeOfExpression(operation); + } + + public override void VisitTypeOfExpression(ITypeOfExpression operation) + { + var typeOperand = operation.TypeOperand; + + base.VisitTypeOfExpression(operation); + } + + public override void VisitLambdaExpression(ILambdaExpression operation) + { + var signature = operation.Signature; + + base.VisitLambdaExpression(operation); + } + + public override void VisitLiteralExpression(ILiteralExpression operation) + { + var text = operation.Text; + + base.VisitLiteralExpression(operation); + } + + public override void VisitAwaitExpression(IAwaitExpression operation) + { + base.VisitAwaitExpression(operation); + } + + public override void VisitAddressOfExpression(IAddressOfExpression operation) + { + base.VisitAddressOfExpression(operation); + } + + public override void VisitObjectCreationExpression(IObjectCreationExpression operation) + { + var ctor = operation.Constructor; + if (ctor != null) + { + foreach (var parameter in ctor.Parameters) + { + var matchingArgument = operation.GetArgumentMatchingParameter(parameter); + Visit(matchingArgument); + } + } + + base.VisitObjectCreationExpression(operation); + } + + public override void VisitFieldInitializer(IFieldInitializer operation) + { + foreach (var field in operation.InitializedFields) + { + // empty loop body, just want to make sure it won't crash. + } + base.VisitFieldInitializer(operation); + } + + public override void VisitPropertyInitializer(IPropertyInitializer operation) + { + var initializedProperty = operation.InitializedProperty; + + base.VisitPropertyInitializer(operation); + } + + public override void VisitParameterInitializer(IParameterInitializer operation) + { + var parameter = operation.Parameter; + + base.VisitParameterInitializer(operation); + } + + public override void VisitArrayCreationExpression(IArrayCreationExpression operation) + { + var elementType = operation.ElementType; + + base.VisitArrayCreationExpression(operation); + } + + public override void VisitArrayInitializer(IArrayInitializer operation) + { + base.VisitArrayInitializer(operation); + } + + public override void VisitAssignmentExpression(IAssignmentExpression operation) + { + base.VisitAssignmentExpression(operation); + } + + public override void VisitCompoundAssignmentExpression(ICompoundAssignmentExpression operation) + { + var usesOperatorMethod = operation.UsesOperatorMethod; + var operatorMethod = operation.OperatorMethod; + var binaryOperationKind = operation.BinaryOperationKind; + + base.VisitCompoundAssignmentExpression(operation); + } + + public override void VisitIncrementExpression(IIncrementExpression operation) + { + var usesOperatorMethod = operation.UsesOperatorMethod; + var operatorMethod = operation.OperatorMethod; + var binaryOperationKind = operation.BinaryOperationKind; + var incrementOperationKind = operation.IncrementOperationKind; + + base.VisitIncrementExpression(operation); + } + + public override void VisitParenthesizedExpression(IParenthesizedExpression operation) + { + base.VisitParenthesizedExpression(operation); + } + + public override void VisitLateBoundMemberReferenceExpression(ILateBoundMemberReferenceExpression operation) + { + var memberName = operation.MemberName; + + base.VisitLateBoundMemberReferenceExpression(operation); + } + + public override void VisitUnboundLambdaExpression(IUnboundLambdaExpression operation) + { + base.VisitUnboundLambdaExpression(operation); + } + + public override void VisitDefaultValueExpression(IDefaultValueExpression operation) + { + base.VisitDefaultValueExpression(operation); + } + + public override void VisitTypeParameterObjectCreationExpression(ITypeParameterObjectCreationExpression operation) + { + base.VisitTypeParameterObjectCreationExpression(operation); + } + + public override void VisitInvalidStatement(IInvalidStatement operation) + { + base.VisitInvalidStatement(operation); + } + + public override void VisitInvalidExpression(IInvalidExpression operation) + { + base.VisitInvalidExpression(operation); + } + } +} \ No newline at end of file diff --git a/src/Test/Utilities/Shared/Mocks/TestMessageProvider.cs b/src/Test/Utilities/Shared/Mocks/TestMessageProvider.cs index 4e459dcebf6e1..3c7c9da423470 100644 --- a/src/Test/Utilities/Shared/Mocks/TestMessageProvider.cs +++ b/src/Test/Utilities/Shared/Mocks/TestMessageProvider.cs @@ -355,6 +355,14 @@ public override int ERR_BadCompilationOptionValue } } + public override int ERR_MutuallyExclusiveOptions + { + get + { + throw new NotImplementedException(); + } + } + public override int ERR_TooManyUserStrings { get @@ -362,5 +370,21 @@ public override int ERR_TooManyUserStrings throw new NotImplementedException(); } } + + public override int ERR_PeWritingFailure + { + get + { + throw new NotImplementedException(); + } + } + + public override int ERR_ModuleEmitFailure + { + get + { + throw new NotImplementedException(); + } + } } } diff --git a/src/Test/Utilities/Shared/Mocks/TestReferences.cs b/src/Test/Utilities/Shared/Mocks/TestReferences.cs index 99a30eccdab2a..57a27be0e1ac7 100644 --- a/src/Test/Utilities/Shared/Mocks/TestReferences.cs +++ b/src/Test/Utilities/Shared/Mocks/TestReferences.cs @@ -141,6 +141,37 @@ public static PortableExecutableReference VBInterfaces01 public static class NetFx { + public static class Minimal + { + private static PortableExecutableReference s_mincorlib; + public static PortableExecutableReference mincorlib + { + get + { + if (s_mincorlib == null) + { + s_mincorlib = AssemblyMetadata.CreateFromImage(TestResources.NetFX.Minimal.mincorlib).GetReference(display: "mincorlib.dll"); + } + + return s_mincorlib; + } + } + + private static PortableExecutableReference s_minasync; + public static PortableExecutableReference minasync + { + get + { + if (s_minasync == null) + { + s_minasync = AssemblyMetadata.CreateFromImage(TestResources.NetFX.Minimal.minasync).GetReference(display: "minasync.dll"); + } + + return s_minasync; + } + } + } + public static class silverlight_v5_0_5_0 { private static PortableExecutableReference s_system; @@ -453,6 +484,23 @@ public static PortableExecutableReference System_Runtime_Serialization } } } + + public static class v4_0_30316_17626 + { + private static PortableExecutableReference s_mscorlib; + public static PortableExecutableReference mscorlib + { + get + { + if (s_mscorlib == null) + { + s_mscorlib = AssemblyMetadata.CreateFromImage(TestResources.NetFX.v4_0_30316_17626.mscorlib).GetReference(display: @"mscorlib.v4_0_30319_17626.dll", filePath: @"Z:\FxReferenceAssembliesUri"); + } + + return s_mscorlib; + } + } + } } public static class DiagnosticTests diff --git a/src/Test/Utilities/Shared/Pe/BrokenStream.cs b/src/Test/Utilities/Shared/Pe/BrokenStream.cs new file mode 100644 index 0000000000000..7eb5c77c12097 --- /dev/null +++ b/src/Test/Utilities/Shared/Pe/BrokenStream.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.IO; + +namespace Roslyn.Test.Utilities +{ + internal class BrokenStream : Stream + { + public enum BreakHowType + { + ThrowOnSetPosition, + ThrowOnWrite, + ThrowOnSetLength + } + + public BreakHowType BreakHow; + public Exception ThrownException { get; private set; } + + public override bool CanRead + { + get { return true; } + } + + public override bool CanSeek + { + get { return true; } + } + + public override bool CanWrite + { + get { return true; } + } + + public override void Flush() + { + } + + public override long Length + { + get + { + return 0; + } + } + + public override long Position + { + get + { + return 0; + } + set + { + if (BreakHow == BreakHowType.ThrowOnSetPosition) + { + ThrownException = new NotSupportedException(); + throw ThrownException; + } + } + } + + public override int Read(byte[] buffer, int offset, int count) + { + return 0; + } + + public override long Seek(long offset, SeekOrigin origin) + { + return 0; + } + + public override void SetLength(long value) + { + if (BreakHow == BreakHowType.ThrowOnSetLength) + { + ThrownException = new IOException(); + throw ThrownException; + } + } + + public override void Write(byte[] buffer, int offset, int count) + { + if (BreakHow == BreakHowType.ThrowOnWrite) + { + ThrownException = new IOException(); + throw ThrownException; + } + } + } +} diff --git a/src/Test/Utilities/Shared/TestBase.cs b/src/Test/Utilities/Shared/TestBase.cs index b26296c6e2b92..42325e91c99fc 100644 --- a/src/Test/Utilities/Shared/TestBase.cs +++ b/src/Test/Utilities/Shared/TestBase.cs @@ -290,19 +290,7 @@ public static MetadataReference MscorlibRef_v20 } } - private static MetadataReference s_mscorlibRef_v4_0_30316_17626; - public static MetadataReference MscorlibRef_v4_0_30316_17626 - { - get - { - if (s_mscorlibRef_v4_0_30316_17626 == null) - { - s_mscorlibRef_v4_0_30316_17626 = AssemblyMetadata.CreateFromImage(TestResources.NetFX.v4_0_30316_17626.mscorlib).GetReference(display: "mscorlib.v4_0_30319_17626.dll", filePath: @"Z:\FxReferenceAssembliesUri"); - } - - return s_mscorlibRef_v4_0_30316_17626; - } - } + public static MetadataReference MscorlibRef_v4_0_30316_17626 => TestReferences.NetFx.v4_0_30316_17626.mscorlib; private static MetadataReference s_mscorlibRef_v46; public static MetadataReference MscorlibRef_v46 @@ -335,19 +323,7 @@ public static MetadataReference MscorlibRefSilverlight } } - private static MetadataReference s_minCorlibRef; - public static MetadataReference MinCorlibRef - { - get - { - if (s_minCorlibRef == null) - { - s_minCorlibRef = AssemblyMetadata.CreateFromImage(TestResources.NetFX.Minimal.mincorlib).GetReference(display: "minCorLib.dll"); - } - - return s_minCorlibRef; - } - } + public static MetadataReference MinCorlibRef => TestReferences.NetFx.Minimal.mincorlib; private static MetadataReference s_msvbRef; public static MetadataReference MsvbRef diff --git a/src/Test/Utilities/Shared/TestUtilities.projitems b/src/Test/Utilities/Shared/TestUtilities.projitems index 7110202222fc1..aa5da9c699d6d 100644 --- a/src/Test/Utilities/Shared/TestUtilities.projitems +++ b/src/Test/Utilities/Shared/TestUtilities.projitems @@ -26,6 +26,7 @@ + @@ -61,6 +62,7 @@ + diff --git a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/Program.cs b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/Program.cs index de9fec807dc9b..dd6f1edd734e4 100644 --- a/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/Program.cs +++ b/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/Program.cs @@ -66,7 +66,9 @@ public static void Main(string[] args) if (writeSignatures) { - SignatureWriter.Write(Console.Out, tree); + var tw = new StreamWriter(@"D:\api.txt"); + SignatureWriter.Write(tw, tree); + tw.Close(); } else { diff --git a/src/Tools/Source/MetadataVisualizer/project.lock.json b/src/Tools/Source/MetadataVisualizer/project.lock.json index 76bd80b81dd59..9e74e25405c66 100644 --- a/src/Tools/Source/MetadataVisualizer/project.lock.json +++ b/src/Tools/Source/MetadataVisualizer/project.lock.json @@ -62,7 +62,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -166,7 +166,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -270,7 +270,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -527,11 +527,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Tools/Source/Pdb2Xml/project.lock.json b/src/Tools/Source/Pdb2Xml/project.lock.json index bc8ed01e3a19a..e3e79dd440d96 100644 --- a/src/Tools/Source/Pdb2Xml/project.lock.json +++ b/src/Tools/Source/Pdb2Xml/project.lock.json @@ -62,7 +62,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -166,7 +166,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -270,7 +270,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -527,11 +527,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Tools/Source/RunTests/Cache/CachingTestExecutor.cs b/src/Tools/Source/RunTests/Cache/CachingTestExecutor.cs index 59d69e4ef3bf4..bf56c54097edb 100644 --- a/src/Tools/Source/RunTests/Cache/CachingTestExecutor.cs +++ b/src/Tools/Source/RunTests/Cache/CachingTestExecutor.cs @@ -14,6 +14,8 @@ internal sealed class CachingTestExecutor : ITestExecutor private readonly ContentUtil _contentUtil; private readonly IDataStorage _dataStorage; + public IDataStorage DataStorage => _dataStorage; + internal CachingTestExecutor(Options options, ITestExecutor testExecutor, IDataStorage dataStorage) { _testExecutor = testExecutor; @@ -76,7 +78,8 @@ private TestResult Migrate(string assemblyPath, CachedTestResult cachedTestResul commandLine: commandLine, elapsed: TimeSpan.FromMilliseconds(0), standardOutput: cachedTestResult.StandardOutput, - errorOutput: cachedTestResult.ErrorOutput); + errorOutput: cachedTestResult.ErrorOutput, + isResultFromCache: true); } private async Task CacheTestResult(ContentFile contentFile, TestResult testResult) @@ -91,7 +94,7 @@ private async Task CacheTestResult(ContentFile contentFile, TestResult testResul resultsFileName: Path.GetFileName(testResult.ResultsFilePath), resultsFileContent: resultFileContent, ellapsed: testResult.Elapsed); - await _dataStorage.AddCachedTestResult(contentFile, cachedTestResult).ConfigureAwait(true); + await _dataStorage.AddCachedTestResult(testResult.AssemblyName, contentFile, cachedTestResult).ConfigureAwait(true); } catch (Exception ex) { diff --git a/src/Tools/Source/RunTests/Cache/EmptyDataStorage.cs b/src/Tools/Source/RunTests/Cache/EmptyDataStorage.cs new file mode 100644 index 0000000000000..dbef51f06082d --- /dev/null +++ b/src/Tools/Source/RunTests/Cache/EmptyDataStorage.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RunTests.Cache +{ + internal sealed class EmptyDataStorage : IDataStorage + { + internal static readonly EmptyDataStorage Instance = new EmptyDataStorage(); + + public string Name => "none"; + + public Task AddCachedTestResult(string assemblyName, ContentFile conentFile, CachedTestResult testResult) + { + var source = new TaskCompletionSource(); + source.SetResult(true); + return source.Task; + } + + public Task TryGetCachedTestResult(string checksum) + { + return Task.FromResult(null); + } + } +} diff --git a/src/Tools/Source/RunTests/Cache/IDataStorage.cs b/src/Tools/Source/RunTests/Cache/IDataStorage.cs index 20855e23d3784..60cbabc185dc7 100644 --- a/src/Tools/Source/RunTests/Cache/IDataStorage.cs +++ b/src/Tools/Source/RunTests/Cache/IDataStorage.cs @@ -10,9 +10,11 @@ namespace RunTests.Cache { internal interface IDataStorage { + string Name { get; } + Task TryGetCachedTestResult(string checksum); - Task AddCachedTestResult(ContentFile conentFile, CachedTestResult testResult); + Task AddCachedTestResult(string assemblyName, ContentFile conentFile, CachedTestResult testResult); } internal struct CachedTestResult diff --git a/src/Tools/Source/RunTests/Cache/LocalDataStorage.cs b/src/Tools/Source/RunTests/Cache/LocalDataStorage.cs index 7c96fc06659b9..0a902209719be 100644 --- a/src/Tools/Source/RunTests/Cache/LocalDataStorage.cs +++ b/src/Tools/Source/RunTests/Cache/LocalDataStorage.cs @@ -31,6 +31,8 @@ private enum StorageKind private readonly string _storagePath; + public string Name => "local"; + internal LocalDataStorage(string storagePath = null) { _storagePath = storagePath ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), DirectoryName); @@ -85,7 +87,7 @@ public bool TryGetCachedTestResult(string checksum, out CachedTestResult testRes return false; } - public Task AddCachedTestResult(ContentFile contentFile, CachedTestResult testResult) + public Task AddCachedTestResult(string assemblyName, ContentFile contentFile, CachedTestResult testResult) { var checksum = contentFile.Checksum; var storagePath = Path.Combine(_storagePath, checksum); diff --git a/src/Tools/Source/RunTests/Cache/WebDataStorage.cs b/src/Tools/Source/RunTests/Cache/WebDataStorage.cs index e121de3488457..e0704bcdd87d3 100644 --- a/src/Tools/Source/RunTests/Cache/WebDataStorage.cs +++ b/src/Tools/Source/RunTests/Cache/WebDataStorage.cs @@ -20,15 +20,16 @@ internal sealed class WebDataStorage : IDataStorage private const string NameResultsFileName = "ResultsFileName"; private const string NameResultsFileContent = "ResultsFileContent"; private const string NameEllapsedSeconds = "EllapsedSeconds"; - private const string DashboardUriString = "http://jdash.azurewebsites.net"; - private readonly RestClient _restClient = new RestClient(DashboardUriString); + private readonly RestClient _restClient = new RestClient(Constants.DashboardUriString); - public async Task AddCachedTestResult(ContentFile contentFile, CachedTestResult testResult) + public string Name => "web"; + + public async Task AddCachedTestResult(string assemblyName, ContentFile contentFile, CachedTestResult testResult) { var obj = new JObject(); obj["TestResultData"] = CreateTestResultData(testResult); - obj["TestSourceData"] = CreateTestSourceData(); + obj["TestSourceData"] = CreateTestSourceData(assemblyName); var request = new RestRequest($"api/testcache/{contentFile.Checksum}"); request.Method = Method.PUT; @@ -72,15 +73,17 @@ private static JObject CreateTestResultData(CachedTestResult testResult) obj[NameOutputStandard] = testResult.ErrorOutput; obj[NameResultsFileName] = testResult.ResultsFileName; obj[NameResultsFileContent] = testResult.ResultsFileContent; - obj[NameEllapsedSeconds] = testResult.Ellapsed.TotalSeconds; + obj[NameEllapsedSeconds] = (int)testResult.Ellapsed.TotalSeconds; return obj; } - private static JObject CreateTestSourceData() + private JObject CreateTestSourceData(string assemblyName) { var obj = new JObject(); obj["MachineName"] = Environment.MachineName; obj["TestRoot"] = ""; + obj["AssemblyName"] = assemblyName; + obj["IsJenkins"] = Constants.IsJenkinsRun; return obj; } } diff --git a/src/Tools/Source/RunTests/Constants.cs b/src/Tools/Source/RunTests/Constants.cs index f18e3a82be6dc..7fe04a38fdda7 100644 --- a/src/Tools/Source/RunTests/Constants.cs +++ b/src/Tools/Source/RunTests/Constants.cs @@ -10,6 +10,10 @@ namespace RunTests { internal static class Constants { - internal const string ResultsDirectoryName = "xUnitResults"; + internal static string ResultsDirectoryName => "xUnitResults"; + + internal static bool IsJenkinsRun => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("JENKINS_URL")); + + internal static string DashboardUriString => "http://jdash.azurewebsites.net"; } } diff --git a/src/Tools/Source/RunTests/CrashDumps.cs b/src/Tools/Source/RunTests/CrashDumps.cs new file mode 100644 index 0000000000000..77516cce1046e --- /dev/null +++ b/src/Tools/Source/RunTests/CrashDumps.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RunTests +{ + public static class CrashDumps + { + public static bool TryMonitorProcess(Process processToMonitor, string outputPath) + { + var procDumpPath = TryGetProcDumpPath(); + + // Make sure everything is fully qualified as we are passing this to other processes + outputPath = Path.GetFullPath(outputPath); + + if (procDumpPath == null) + { + return false; + } + + var processStart = new ProcessStartInfo(); + + processStart.Arguments = GetProcDumpArgumentsForMonitoring(processToMonitor.Id, outputPath); + processStart.CreateNoWindow = true; + processStart.FileName = procDumpPath; + processStart.UseShellExecute = false; + + var process = Process.Start(processStart); + + return true; + } + + private static string GetProcDumpArgumentsForMonitoring(int pid, string outputPath) + { + // Here's what these arguments mean: + // + // -g: run as a native debugger in a managed process (no interop). + // -e: dump when an unhandled exception happens + // -b: dump when a breakpoint (__int 3 / Debugger.Break()) is encountered + // -ma: create a full memory dump + // + // without -g, procdump will not catch unhandled managed exception since CLR will always + // handle unhandled exception. for procdump point of view, there is no such thing as unhandled + // exception for managed app. + + return $"-accepteula -g -e -b -ma {pid} {outputPath}"; + } + + private const string DotNetContinuousIntegrationProcDumpLocation = @"C:\Sysinternals\Procdump.exe"; + + private static string TryGetProcDumpPath() + { + if (File.Exists(DotNetContinuousIntegrationProcDumpLocation)) + { + return DotNetContinuousIntegrationProcDumpLocation; + } + + return null; + } + } +} diff --git a/src/Tools/Source/RunTests/ITestExecutor.cs b/src/Tools/Source/RunTests/ITestExecutor.cs index 28713ab395dce..4eba2a8424806 100644 --- a/src/Tools/Source/RunTests/ITestExecutor.cs +++ b/src/Tools/Source/RunTests/ITestExecutor.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using RunTests.Cache; using System; using System.IO; using System.Threading; @@ -16,6 +17,7 @@ internal struct TestResult internal TimeSpan Elapsed { get; } internal string StandardOutput { get; } internal string ErrorOutput { get; } + internal bool IsResultFromCache { get; } /// /// Path to the results file. Can be null in the case xunit error'd and did not create one. @@ -25,7 +27,7 @@ internal struct TestResult internal string ResultDir { get; } internal bool Succeeded => ExitCode == 0; - internal TestResult(int exitCode, string assemblyPath, string resultDir, string resultsFilePath, string commandLine, TimeSpan elapsed, string standardOutput, string errorOutput) + internal TestResult(int exitCode, string assemblyPath, string resultDir, string resultsFilePath, string commandLine, TimeSpan elapsed, string standardOutput, string errorOutput, bool isResultFromCache) { ExitCode = exitCode; AssemblyName = Path.GetFileName(assemblyPath); @@ -36,11 +38,14 @@ internal TestResult(int exitCode, string assemblyPath, string resultDir, string Elapsed = elapsed; StandardOutput = standardOutput; ErrorOutput = errorOutput; + IsResultFromCache = isResultFromCache; } } internal interface ITestExecutor { + IDataStorage DataStorage { get; } + string GetCommandLine(string assemblyPath); Task RunTestAsync(string assemblyPath, CancellationToken cancellationToken); diff --git a/src/Tools/Source/RunTests/ProcessRunner.cs b/src/Tools/Source/RunTests/ProcessRunner.cs index 64f1578d90591..cb3597dd10d65 100644 --- a/src/Tools/Source/RunTests/ProcessRunner.cs +++ b/src/Tools/Source/RunTests/ProcessRunner.cs @@ -56,7 +56,8 @@ public static Task RunProcessAsync( string workingDirectory = null, bool captureOutput = false, bool displayWindow = true, - Dictionary environmentVariables = null) + Dictionary environmentVariables = null, + Action processMonitor = null) { cancellationToken.ThrowIfCancellationRequested(); @@ -70,6 +71,8 @@ public static Task RunProcessAsync( process.Start(); + processMonitor?.Invoke(process); + if (lowPriority) { process.PriorityClass = ProcessPriorityClass.BelowNormal; diff --git a/src/Tools/Source/RunTests/ProcessTestExecutor.cs b/src/Tools/Source/RunTests/ProcessTestExecutor.cs index d8a76c1699a7f..d3ffdb6aeb847 100644 --- a/src/Tools/Source/RunTests/ProcessTestExecutor.cs +++ b/src/Tools/Source/RunTests/ProcessTestExecutor.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using RunTests.Cache; using System; using System.Collections.Generic; using System.Diagnostics; @@ -15,6 +16,8 @@ internal sealed class ProcessTestExecutor : ITestExecutor { private readonly Options _options; + public IDataStorage DataStorage => EmptyDataStorage.Instance; + internal ProcessTestExecutor(Options options) { _options = options; @@ -78,6 +81,8 @@ public async Task RunTestAsync(string assemblyPath, CancellationToke // an empty log just in case, so our runner will still fail. File.Create(resultsFilePath).Close(); + var dumpOutputFilePath = Path.Combine(resultsDir, Path.GetFileNameWithoutExtension(assemblyPath) + ".dmp"); + var start = DateTime.UtcNow; var xunitPath = _options.XunitPath; var processOutput = await ProcessRunner.RunProcessAsync( @@ -86,7 +91,8 @@ public async Task RunTestAsync(string assemblyPath, CancellationToke lowPriority: false, displayWindow: false, captureOutput: true, - cancellationToken: cancellationToken).ConfigureAwait(false); + cancellationToken: cancellationToken, + processMonitor: p => CrashDumps.TryMonitorProcess(p, dumpOutputFilePath)).ConfigureAwait(false); var span = DateTime.UtcNow - start; if (processOutput.ExitCode != 0) @@ -125,7 +131,8 @@ public async Task RunTestAsync(string assemblyPath, CancellationToke commandLine: commandLine, elapsed: span, standardOutput: standardOutput, - errorOutput: errorOutput); + errorOutput: errorOutput, + isResultFromCache: false); } catch (Exception ex) { diff --git a/src/Tools/Source/RunTests/Program.cs b/src/Tools/Source/RunTests/Program.cs index e133a54cf9c7a..c0c342971c907 100644 --- a/src/Tools/Source/RunTests/Program.cs +++ b/src/Tools/Source/RunTests/Program.cs @@ -9,6 +9,8 @@ using System.Threading; using System.Threading.Tasks; using RunTests.Cache; +using Newtonsoft.Json.Linq; +using RestSharp; namespace RunTests { @@ -30,31 +32,21 @@ internal static int Main(string[] args) cts.Cancel(); }; - ITestExecutor testExecutor = new ProcessTestExecutor(options); - if (options.UseCachedResults) - { - // The web caching layer is still being worked on. For now want to limit it to Roslyn developers - // and Jenkins runs by default until we work on this a bit more. Anyone reading this who wants - // to try it out should feel free to opt into this. - IDataStorage dataStorage = new LocalDataStorage(); - if (StringComparer.OrdinalIgnoreCase.Equals("REDMOND", Environment.UserDomainName) || - !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("JENKINS_URL"))) - { - Console.WriteLine("Using web cache"); - dataStorage = new WebDataStorage(); - } - - testExecutor = new CachingTestExecutor(options, testExecutor, dataStorage); - } + return RunCore(options, cts.Token).GetAwaiter().GetResult(); + } + private static async Task RunCore(Options options, CancellationToken cancellationToken) + { + var testExecutor = CreateTestExecutor(options); var testRunner = new TestRunner(options, testExecutor); var start = DateTime.Now; - Console.WriteLine("Running {0} test assemblies", options.Assemblies.Count()); + Console.WriteLine($"Data Storage: {testExecutor.DataStorage.Name}"); + Console.WriteLine($"Running {options.Assemblies.Count()} test assemblies"); var orderedList = OrderAssemblyList(options.Assemblies); - var result = testRunner.RunAllAsync(orderedList, cts.Token).Result; - var span = DateTime.Now - start; + var result = await testRunner.RunAllAsync(orderedList, cancellationToken).ConfigureAwait(true); + var ellapsed = DateTime.Now - start; foreach (var assemblyPath in options.MissingAssemblies) { @@ -63,22 +55,89 @@ internal static int Main(string[] args) Logger.Finish(); - if (!result) + if (CanUseWebStorage()) + { + await SendRunStats(options, testExecutor.DataStorage, ellapsed, result, cancellationToken).ConfigureAwait(true); + } + + if (!result.Succeeded) { - ConsoleUtil.WriteLine(ConsoleColor.Red, "Test failures encountered: {0}", span); + ConsoleUtil.WriteLine(ConsoleColor.Red, $"Test failures encountered: {ellapsed}"); return 1; } - Console.WriteLine("All tests passed: {0}", span); + Console.WriteLine($"All tests passed: {ellapsed}"); return options.MissingAssemblies.Any() ? 1 : 0; } + private static bool CanUseWebStorage() + { + // The web caching layer is still being worked on. For now want to limit it to Roslyn developers + // and Jenkins runs by default until we work on this a bit more. Anyone reading this who wants + // to try it out should feel free to opt into this. + return + StringComparer.OrdinalIgnoreCase.Equals("REDMOND", Environment.UserDomainName) || + Constants.IsJenkinsRun; + } + + private static ITestExecutor CreateTestExecutor(Options options) + { + var processTestExecutor = new ProcessTestExecutor(options); + if (!options.UseCachedResults) + { + return processTestExecutor; + } + + // The web caching layer is still being worked on. For now want to limit it to Roslyn developers + // and Jenkins runs by default until we work on this a bit more. Anyone reading this who wants + // to try it out should feel free to opt into this. + IDataStorage dataStorage = new LocalDataStorage(); + if (CanUseWebStorage()) + { + dataStorage = new WebDataStorage(); + } + + return new CachingTestExecutor(options, processTestExecutor, dataStorage); + } + /// /// Order the assembly list so that the largest assemblies come first. This /// is not ideal as the largest assembly does not necessarily take the most time. /// /// - private static IOrderedEnumerable OrderAssemblyList(IEnumerable list) => - list.OrderByDescending((assemblyName) => new FileInfo(assemblyName).Length); + private static IOrderedEnumerable OrderAssemblyList(IEnumerable list) + { + return list.OrderByDescending((assemblyName) => new FileInfo(assemblyName).Length); + } + + private static async Task SendRunStats(Options options, IDataStorage dataStorage, TimeSpan ellapsed, RunAllResult result, CancellationToken cancellationToken) + { + var obj = new JObject(); + obj["Cache"] = dataStorage.Name; + obj["EllapsedSeconds"] = (int)ellapsed.TotalSeconds; + obj["IsJenkins"] = Constants.IsJenkinsRun; + obj["Is32Bit"] = !options.Test64; + obj["AssemblyCount"] = options.Assemblies.Count; + obj["CacheCount"] = result.CacheCount; + obj["Succeeded"] = result.Succeeded; + + var request = new RestRequest("api/testrun", Method.POST); + request.RequestFormat = DataFormat.Json; + request.AddParameter("text/json", obj.ToString(), ParameterType.RequestBody); + + try + { + var client = new RestClient(Constants.DashboardUriString); + var response = await client.ExecuteTaskAsync(request); + if (response.StatusCode != System.Net.HttpStatusCode.NoContent) + { + Logger.Log($"Unable to send results: {response.ErrorMessage}"); + } + } + catch + { + Logger.Log("Unable to send results"); + } + } } } \ No newline at end of file diff --git a/src/Tools/Source/RunTests/RunTests.csproj b/src/Tools/Source/RunTests/RunTests.csproj index 08044d3cacafa..96e1b542a95b5 100644 --- a/src/Tools/Source/RunTests/RunTests.csproj +++ b/src/Tools/Source/RunTests/RunTests.csproj @@ -30,8 +30,10 @@ + + @@ -50,4 +52,4 @@ - + \ No newline at end of file diff --git a/src/Tools/Source/RunTests/TestRunner.cs b/src/Tools/Source/RunTests/TestRunner.cs index 3c5a56e51fb2e..ea02688dce75d 100644 --- a/src/Tools/Source/RunTests/TestRunner.cs +++ b/src/Tools/Source/RunTests/TestRunner.cs @@ -12,6 +12,18 @@ namespace RunTests { + internal struct RunAllResult + { + internal readonly bool Succeeded; + internal readonly int CacheCount; + + internal RunAllResult(bool succeeded, int cacheCount) + { + Succeeded = succeeded; + CacheCount = cacheCount; + } + } + internal sealed class TestRunner { private readonly ITestExecutor _testExecutor; @@ -23,10 +35,11 @@ internal TestRunner(Options options, ITestExecutor testExecutor) _options = options; } - internal async Task RunAllAsync(IEnumerable assemblyList, CancellationToken cancellationToken) + internal async Task RunAllAsync(IEnumerable assemblyList, CancellationToken cancellationToken) { var max = (int)Environment.ProcessorCount * 1.5; var allPassed = true; + var cacheCount = 0; var waiting = new Stack(assemblyList); var running = new List>(); var completed = new List(); @@ -49,6 +62,11 @@ internal async Task RunAllAsync(IEnumerable assemblyList, Cancella allPassed = false; } + if (testResult.IsResultFromCache) + { + cacheCount++; + } + completed.Add(testResult); } catch (Exception ex) @@ -77,7 +95,7 @@ internal async Task RunAllAsync(IEnumerable assemblyList, Cancella Print(completed); - return allPassed; + return new RunAllResult(allPassed, cacheCount); } private void Print(List testResults) diff --git a/src/Tools/Source/RunTests/project.lock.json b/src/Tools/Source/RunTests/project.lock.json index 0bb3cd11c1f82..50061afd070e1 100644 --- a/src/Tools/Source/RunTests/project.lock.json +++ b/src/Tools/Source/RunTests/project.lock.json @@ -66,11 +66,10 @@ "libraries": { "Newtonsoft.Json/8.0.2": { "sha512": "e5yWmEfu68rmtG431zl9N/7PlNKQDIuiDW5MHlEFAZcecakcxrIGnKqrPAtWNILzK2oNanRB5cD150MYhECK3g==", - "type": "Package", + "type": "package", "files": [ + "Newtonsoft.Json.8.0.2.nupkg.sha512", "Newtonsoft.Json.nuspec", - "[Content_Types].xml", - "_rels/.rels", "lib/net20/Newtonsoft.Json.dll", "lib/net20/Newtonsoft.Json.xml", "lib/net35/Newtonsoft.Json.dll", @@ -83,17 +82,15 @@ "lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.xml", "lib/portable-net45+wp80+win8+wpa81+dnxcore50/Newtonsoft.Json.dll", "lib/portable-net45+wp80+win8+wpa81+dnxcore50/Newtonsoft.Json.xml", - "package/services/metadata/core-properties/cc8c591d554640789c6a6ef6456f7772.psmdcp", "tools/install.ps1" ] }, "RestSharp/105.2.3": { "sha512": "50LkciOclb7Lza9QXqR9reKeUoPlDQiFD4iBdOmd6twOBmTtqEFIOXQgdDdsTHQg4HcGh6EvrM6gN1X72vkJLA==", - "type": "Package", + "type": "package", "files": [ + "RestSharp.105.2.3.nupkg.sha512", "RestSharp.nuspec", - "[Content_Types].xml", - "_rels/.rels", "lib/MonoAndroid10/RestSharp.dll", "lib/MonoAndroid10/RestSharp.xml", "lib/MonoTouch10/RestSharp.dll", @@ -120,7 +117,6 @@ "lib/windowsphone8/RestSharp.xml", "lib/windowsphone81/RestSharp.dll", "lib/windowsphone81/RestSharp.xml", - "package/services/metadata/core-properties/fe62c7f38ace4dbeaf729ff7b329d22a.psmdcp", "readme.txt" ] } diff --git a/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerControl/packages.config b/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerControl/packages.config index bd5711d3f6a90..b955ba1d0f275 100644 --- a/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerControl/packages.config +++ b/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerControl/packages.config @@ -2,7 +2,7 @@ - + diff --git a/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerDgmlHelper/packages.config b/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerDgmlHelper/packages.config index 6d9c6d12888cc..cce1baf6ace3b 100644 --- a/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerDgmlHelper/packages.config +++ b/src/Tools/Source/SyntaxVisualizer/SyntaxVisualizerDgmlHelper/packages.config @@ -2,7 +2,7 @@ - + diff --git a/src/VisualStudio/CSharp/Impl/project.lock.json b/src/VisualStudio/CSharp/Impl/project.lock.json index f23e574cfbf66..ee0c30f8fbe89 100644 --- a/src/VisualStudio/CSharp/Impl/project.lock.json +++ b/src/VisualStudio/CSharp/Impl/project.lock.json @@ -85,7 +85,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -359,11 +359,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/CSharp/Repl/project.lock.json b/src/VisualStudio/CSharp/Repl/project.lock.json index d08142f3da2bc..61081d257421a 100644 --- a/src/VisualStudio/CSharp/Repl/project.lock.json +++ b/src/VisualStudio/CSharp/Repl/project.lock.json @@ -102,24 +102,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -232,7 +214,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -579,49 +561,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -972,11 +911,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/CSharp/Test/Interactive/Commands/ResetInteractiveTests.cs b/src/VisualStudio/CSharp/Test/Interactive/Commands/ResetInteractiveTests.cs index e3b0cfaaea1d2..eec7aa228f3c7 100644 --- a/src/VisualStudio/CSharp/Test/Interactive/Commands/ResetInteractiveTests.cs +++ b/src/VisualStudio/CSharp/Test/Interactive/Commands/ResetInteractiveTests.cs @@ -22,7 +22,13 @@ public class ResetInteractiveTests ResetInteractiveVisualBasicSubproject - + +namespace ResetInteractiveTestsDocument +{ + class TestClass + { + } +} "; @@ -40,7 +46,7 @@ public async void TestResetREPLWithProjectContext() Assert.True(replReferenceCommands.Any(rc => rc.EndsWith(@"ResetInteractiveVisualBasicSubproject.dll"""))); var expectedReferences = replReferenceCommands.ToList(); - var expectedUsings = new List { @"using ""ns1"";", @"using ""ns2"";" }; + var expectedUsings = new List { @"using ""System"";", @"using ""ResetInteractiveTestsDocument"";" }; AssertResetInteractive(workspace, project, buildSucceeds: true, expectedReferences: expectedReferences, expectedUsings: expectedUsings); // Test that no submissions are executed if the build fails. @@ -79,7 +85,8 @@ private async void AssertResetInteractive( References = ImmutableArray.CreateRange(GetProjectReferences(workspace, project)), ReferenceSearchPaths = ImmutableArray.Create("rsp1", "rsp2"), SourceSearchPaths = ImmutableArray.Create("ssp1", "ssp2"), - NamespacesToImport = ImmutableArray.Create("ns1", "ns2"), + ProjectNamespaces = ImmutableArray.Create("System", "ResetInteractiveTestsDocument", "VisualBasicResetInteractiveTestsDocument"), + NamespacesToImport = ImmutableArray.Create("System", "ResetInteractiveTestsDocument"), ProjectDirectory = "pj", }; diff --git a/src/VisualStudio/CSharp/Test/Interactive/Commands/TestResetInteractive.cs b/src/VisualStudio/CSharp/Test/Interactive/Commands/TestResetInteractive.cs index 26bfa24af81fe..88e16cf040f37 100644 --- a/src/VisualStudio/CSharp/Test/Interactive/Commands/TestResetInteractive.cs +++ b/src/VisualStudio/CSharp/Test/Interactive/Commands/TestResetInteractive.cs @@ -6,6 +6,8 @@ using System; using System.Collections.Immutable; using System.Threading.Tasks; +using Microsoft.VisualStudio.InteractiveWindow; +using System.Collections.Generic; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Interactive.Commands { @@ -25,6 +27,8 @@ internal class TestResetInteractive : ResetInteractive internal ImmutableArray SourceSearchPaths { get; set; } + internal ImmutableArray ProjectNamespaces { get; set; } + internal ImmutableArray NamespacesToImport { get; set; } internal string ProjectDirectory { get; set; } @@ -56,13 +60,13 @@ protected override bool GetProjectProperties( out ImmutableArray references, out ImmutableArray referenceSearchPaths, out ImmutableArray sourceSearchPaths, - out ImmutableArray namespacesToImport, + out ImmutableArray projectNamespaces, out string projectDirectory) { references = References; referenceSearchPaths = ReferenceSearchPaths; sourceSearchPaths = SourceSearchPaths; - namespacesToImport = NamespacesToImport; + projectNamespaces = ProjectNamespaces; projectDirectory = ProjectDirectory; return true; } @@ -71,5 +75,10 @@ protected override IWaitIndicator GetWaitIndicator() { return _waitIndicator; } + + protected override Task> GetNamespacesToImportAsync(IEnumerable namespacesToImport, IInteractiveWindow interactiveWindow) + { + return Task.FromResult((IEnumerable)NamespacesToImport); + } } } diff --git a/src/VisualStudio/CSharp/Test/project.lock.json b/src/VisualStudio/CSharp/Test/project.lock.json index c2ba9eeed7036..cba8181871a55 100644 --- a/src/VisualStudio/CSharp/Test/project.lock.json +++ b/src/VisualStudio/CSharp/Test/project.lock.json @@ -161,24 +161,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -291,7 +273,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -529,14 +511,6 @@ "lib/net40/Moq.dll": {} } }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "compile": { - "ref/dotnet/_._": {} - }, - "runtime": { - "runtimes/win7/lib/net/_._": {} - } - }, "System.AppContext/4.0.0": { "dependencies": { "System.Runtime": "4.0.0" @@ -585,25 +559,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0", - "runtime.win7.System.Diagnostics.Process": "4.1.0-beta-23504" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -716,7 +671,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1107,21 +1062,6 @@ "lib/sl4/Moq.Silverlight.xml" ] }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "t96Q9MyIMoFQtblYAVQshxWL8AZEKSble9wb0Wp330R02N7fsgfPlhqd3h+VvrhTKMT0WWbkHyH9vEU+SSLpTg==", - "type": "package", - "files": [ - "ref/dotnet/_._", - "runtime.win7.System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "runtime.win7.System.Diagnostics.Process.nuspec", - "runtimes/win7/lib/dotnet5.5/System.Diagnostics.Process.dll", - "runtimes/win7/lib/net/_._", - "runtimes/win7/lib/netcore50/_._", - "runtimes/win7/lib/win8/_._", - "runtimes/win7/lib/wp8/_._", - "runtimes/win7/lib/wpa81/_._" - ] - }, "System.AppContext/4.0.0": { "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", "type": "package", @@ -1229,49 +1169,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1622,11 +1519,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/Core/Def/project.lock.json b/src/VisualStudio/Core/Def/project.lock.json index 7792dc527d285..3235beaed5a2d 100644 --- a/src/VisualStudio/Core/Def/project.lock.json +++ b/src/VisualStudio/Core/Def/project.lock.json @@ -85,7 +85,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -359,11 +359,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/Core/Impl/project.lock.json b/src/VisualStudio/Core/Impl/project.lock.json index f23e574cfbf66..ee0c30f8fbe89 100644 --- a/src/VisualStudio/Core/Impl/project.lock.json +++ b/src/VisualStudio/Core/Impl/project.lock.json @@ -85,7 +85,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -359,11 +359,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/Core/SolutionExplorerShim/project.lock.json b/src/VisualStudio/Core/SolutionExplorerShim/project.lock.json index f23e574cfbf66..ee0c30f8fbe89 100644 --- a/src/VisualStudio/Core/SolutionExplorerShim/project.lock.json +++ b/src/VisualStudio/Core/SolutionExplorerShim/project.lock.json @@ -85,7 +85,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -359,11 +359,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/Core/Test/project.lock.json b/src/VisualStudio/Core/Test/project.lock.json index c2ba9eeed7036..cba8181871a55 100644 --- a/src/VisualStudio/Core/Test/project.lock.json +++ b/src/VisualStudio/Core/Test/project.lock.json @@ -161,24 +161,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -291,7 +273,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -529,14 +511,6 @@ "lib/net40/Moq.dll": {} } }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "compile": { - "ref/dotnet/_._": {} - }, - "runtime": { - "runtimes/win7/lib/net/_._": {} - } - }, "System.AppContext/4.0.0": { "dependencies": { "System.Runtime": "4.0.0" @@ -585,25 +559,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0", - "runtime.win7.System.Diagnostics.Process": "4.1.0-beta-23504" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -716,7 +671,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1107,21 +1062,6 @@ "lib/sl4/Moq.Silverlight.xml" ] }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "t96Q9MyIMoFQtblYAVQshxWL8AZEKSble9wb0Wp330R02N7fsgfPlhqd3h+VvrhTKMT0WWbkHyH9vEU+SSLpTg==", - "type": "package", - "files": [ - "ref/dotnet/_._", - "runtime.win7.System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "runtime.win7.System.Diagnostics.Process.nuspec", - "runtimes/win7/lib/dotnet5.5/System.Diagnostics.Process.dll", - "runtimes/win7/lib/net/_._", - "runtimes/win7/lib/netcore50/_._", - "runtimes/win7/lib/win8/_._", - "runtimes/win7/lib/wp8/_._", - "runtimes/win7/lib/wpa81/_._" - ] - }, "System.AppContext/4.0.0": { "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", "type": "package", @@ -1229,49 +1169,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1622,11 +1519,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/InteractiveServices/Interactive/VsResetInteractive.cs b/src/VisualStudio/InteractiveServices/Interactive/VsResetInteractive.cs index 8717787cb483e..06f6b82ea4129 100644 --- a/src/VisualStudio/InteractiveServices/Interactive/VsResetInteractive.cs +++ b/src/VisualStudio/InteractiveServices/Interactive/VsResetInteractive.cs @@ -17,6 +17,10 @@ using Project = EnvDTE.Project; using System.Collections.Immutable; using Microsoft.VisualStudio.Text.Editor; +using Microsoft.VisualStudio.InteractiveWindow; +using Microsoft.CodeAnalysis.Text; +using System.Linq; +using core::Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.VisualStudio.LanguageServices.Interactive { @@ -49,7 +53,7 @@ protected override bool GetProjectProperties( out ImmutableArray references, out ImmutableArray referenceSearchPaths, out ImmutableArray sourceSearchPaths, - out ImmutableArray namespacesToImport, + out ImmutableArray projectNamespaces, out string projectDirectory) { var hierarchyPointer = default(IntPtr); @@ -57,7 +61,7 @@ protected override bool GetProjectProperties( references = ImmutableArray.Empty; referenceSearchPaths = ImmutableArray.Empty; sourceSearchPaths = ImmutableArray.Empty; - namespacesToImport = ImmutableArray.Empty; + projectNamespaces = ImmutableArray.Empty; projectDirectory = null; try @@ -69,7 +73,7 @@ protected override bool GetProjectProperties( if (hierarchyPointer != IntPtr.Zero) { - GetProjectProperties(hierarchyPointer, out references, out referenceSearchPaths, out sourceSearchPaths, out namespacesToImport, out projectDirectory); + GetProjectProperties(hierarchyPointer, out references, out referenceSearchPaths, out sourceSearchPaths, out projectNamespaces, out projectDirectory); return true; } } @@ -87,7 +91,7 @@ private static void GetProjectProperties( out ImmutableArray references, out ImmutableArray referenceSearchPaths, out ImmutableArray sourceSearchPaths, - out ImmutableArray namespacesToImport, + out ImmutableArray projectNamespaces, out string projectDirectory) { var hierarchy = (IVsHierarchy)Marshal.GetObjectForIUnknown(hierarchyPointer); @@ -143,7 +147,7 @@ private static void GetProjectProperties( references = referencesBuilder.ToImmutableArray(); referenceSearchPaths = referenceSearchPathsBuilder.ToImmutableArray(); sourceSearchPaths = sourceSearchPathsBuilder.ToImmutableArray(); - namespacesToImport = namespacesToImportBuilder.ToImmutableArray(); + projectNamespaces = namespacesToImportBuilder.ToImmutableArray(); } private static string GetReferenceString(Reference reference) @@ -259,5 +263,15 @@ protected override IWaitIndicator GetWaitIndicator() { return _componentModel.GetService(); } + + /// + /// Return namespaces that can be resolved in the latest interactive compilation. + /// + protected override async Task> GetNamespacesToImportAsync(IEnumerable namespacesToImport, IInteractiveWindow interactiveWindow) + { + var document = interactiveWindow.CurrentLanguageBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var compilation = await document.Project.GetCompilationAsync().ConfigureAwait(true); + return namespacesToImport.Where(ns => compilation.GlobalNamespace.GetQualifiedNamespace(ns) != null); + } } } diff --git a/src/VisualStudio/InteractiveServices/project.lock.json b/src/VisualStudio/InteractiveServices/project.lock.json index e66c5aceda71d..e8c0059306366 100644 --- a/src/VisualStudio/InteractiveServices/project.lock.json +++ b/src/VisualStudio/InteractiveServices/project.lock.json @@ -91,24 +91,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -213,7 +195,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -521,49 +503,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -881,11 +820,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/Setup/project.lock.json b/src/VisualStudio/Setup/project.lock.json index 9f6b9f09ad3fa..6172b0edf62e7 100644 --- a/src/VisualStudio/Setup/project.lock.json +++ b/src/VisualStudio/Setup/project.lock.json @@ -85,7 +85,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -212,7 +212,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -339,7 +339,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -613,11 +613,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/SetupInteractive/project.lock.json b/src/VisualStudio/SetupInteractive/project.lock.json index f3183e296a383..d28a77061cb51 100644 --- a/src/VisualStudio/SetupInteractive/project.lock.json +++ b/src/VisualStudio/SetupInteractive/project.lock.json @@ -113,24 +113,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -243,7 +225,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -430,24 +412,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -560,7 +524,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -936,49 +900,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1329,11 +1250,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/VisualBasic/Impl/project.lock.json b/src/VisualStudio/VisualBasic/Impl/project.lock.json index f23e574cfbf66..ee0c30f8fbe89 100644 --- a/src/VisualStudio/VisualBasic/Impl/project.lock.json +++ b/src/VisualStudio/VisualBasic/Impl/project.lock.json @@ -85,7 +85,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -359,11 +359,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/VisualBasic/Repl/project.lock.json b/src/VisualStudio/VisualBasic/Repl/project.lock.json index dd922b9481f48..7cdc422ee6de4 100644 --- a/src/VisualStudio/VisualBasic/Repl/project.lock.json +++ b/src/VisualStudio/VisualBasic/Repl/project.lock.json @@ -102,24 +102,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -224,7 +206,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -561,49 +543,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -921,11 +860,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/project.lock.json b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/project.lock.json index 63e0ff5c8ec19..f3b71819aa0a9 100644 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/project.lock.json +++ b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/project.lock.json @@ -94,7 +94,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -280,7 +280,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -628,11 +628,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/VisualStudio/VisualStudioInteractiveComponents/project.lock.json b/src/VisualStudio/VisualStudioInteractiveComponents/project.lock.json index 6991efd48d641..64e853ca39c5a 100644 --- a/src/VisualStudio/VisualStudioInteractiveComponents/project.lock.json +++ b/src/VisualStudio/VisualStudioInteractiveComponents/project.lock.json @@ -113,24 +113,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -243,7 +225,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -382,14 +364,6 @@ "lib/net45/_._": {} } }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "compile": { - "ref/dotnet/_._": {} - }, - "runtime": { - "runtimes/win7/lib/net/_._": {} - } - }, "System.AppContext/4.0.0": { "dependencies": { "System.Runtime": "4.0.0" @@ -438,25 +412,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0", - "runtime.win7.System.Diagnostics.Process": "4.1.0-beta-23504" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -569,7 +524,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -756,24 +711,6 @@ "lib/net46/_._": {} } }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "dependencies": { - "System.IO": "4.0.0", - "System.Runtime": "4.0.0", - "System.Runtime.Handles": "4.0.0", - "System.Text.Encoding": "4.0.0" - }, - "frameworkAssemblies": [ - "System", - "mscorlib" - ], - "compile": { - "ref/net46/System.Diagnostics.Process.dll": {} - }, - "runtime": { - "lib/net46/System.Diagnostics.Process.dll": {} - } - }, "System.Diagnostics.StackTrace/4.0.0": { "dependencies": { "System.Reflection": "4.0.0", @@ -886,7 +823,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -1155,21 +1092,6 @@ "ref/wpa81/_._" ] }, - "runtime.win7.System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "t96Q9MyIMoFQtblYAVQshxWL8AZEKSble9wb0Wp330R02N7fsgfPlhqd3h+VvrhTKMT0WWbkHyH9vEU+SSLpTg==", - "type": "package", - "files": [ - "ref/dotnet/_._", - "runtime.win7.System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "runtime.win7.System.Diagnostics.Process.nuspec", - "runtimes/win7/lib/dotnet5.5/System.Diagnostics.Process.dll", - "runtimes/win7/lib/net/_._", - "runtimes/win7/lib/netcore50/_._", - "runtimes/win7/lib/win8/_._", - "runtimes/win7/lib/wp8/_._", - "runtimes/win7/lib/wpa81/_._" - ] - }, "System.AppContext/4.0.0": { "sha512": "gUoYgAWDC3+xhKeU5KSLbYDhTdBYk9GssrMSCcWUADzOglW+s0AmwVhOUGt2tL5xUl7ZXoYTPdA88zCgKrlG0A==", "type": "package", @@ -1277,49 +1199,6 @@ "runtimes/win8-aot/lib/netcore50/System.Diagnostics.Debug.dll" ] }, - "System.Diagnostics.Process/4.1.0-beta-23504": { - "sha512": "x2J3Sww13e9um3rXRf+iBh06z3elsh2ihbKaJyn3rT97PMY/AJUpySARe9eqvs5SnzuI9FT+4++iSdWV5Ftmgg==", - "type": "package", - "files": [ - "System.Diagnostics.Process.4.1.0-beta-23504.nupkg.sha512", - "System.Diagnostics.Process.nuspec", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Diagnostics.Process.dll", - "lib/net461/System.Diagnostics.Process.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/dotnet5.4/System.Diagnostics.Process.dll", - "ref/dotnet5.4/System.Diagnostics.Process.xml", - "ref/dotnet5.4/de/System.Diagnostics.Process.xml", - "ref/dotnet5.4/es/System.Diagnostics.Process.xml", - "ref/dotnet5.4/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.4/it/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.4/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.4/zh-hant/System.Diagnostics.Process.xml", - "ref/dotnet5.5/System.Diagnostics.Process.dll", - "ref/dotnet5.5/System.Diagnostics.Process.xml", - "ref/dotnet5.5/de/System.Diagnostics.Process.xml", - "ref/dotnet5.5/es/System.Diagnostics.Process.xml", - "ref/dotnet5.5/fr/System.Diagnostics.Process.xml", - "ref/dotnet5.5/it/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ja/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ko/System.Diagnostics.Process.xml", - "ref/dotnet5.5/ru/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hans/System.Diagnostics.Process.xml", - "ref/dotnet5.5/zh-hant/System.Diagnostics.Process.xml", - "ref/net46/System.Diagnostics.Process.dll", - "ref/net461/System.Diagnostics.Process.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "runtime.json" - ] - }, "System.Diagnostics.StackTrace/4.0.0": { "sha512": "PItgenqpRiMqErvQONBlfDwctKpWVrcDSW5pppNZPJ6Bpiyz+KjsWoSiaqs5dt03HEbBTMNCrZb8KCkh7YfXmw==", "type": "package", @@ -1670,11 +1549,11 @@ "runtimes/win8-aot/lib/netcore50/System.Reflection.Extensions.dll" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Workspaces/CSharp/Portable/project.lock.json b/src/Workspaces/CSharp/Portable/project.lock.json index f448c4cec3116..7d26150ab2de5 100644 --- a/src/Workspaces/CSharp/Portable/project.lock.json +++ b/src/Workspaces/CSharp/Portable/project.lock.json @@ -27,7 +27,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -72,11 +72,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Workspaces/CSharpTest/project.lock.json b/src/Workspaces/CSharpTest/project.lock.json index 8bcaa819546e6..dbefdcbef17ff 100644 --- a/src/Workspaces/CSharpTest/project.lock.json +++ b/src/Workspaces/CSharpTest/project.lock.json @@ -86,7 +86,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -265,7 +265,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -601,11 +601,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Workspaces/Core/Desktop/project.lock.json b/src/Workspaces/Core/Desktop/project.lock.json index 75f71f909ea6d..62eccbb663558 100644 --- a/src/Workspaces/Core/Desktop/project.lock.json +++ b/src/Workspaces/Core/Desktop/project.lock.json @@ -69,7 +69,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -318,11 +318,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/INamespaceSymbolExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/INamespaceSymbolExtensions.cs index f8013284c6d0a..ee2199f42c66c 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/INamespaceSymbolExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/INamespaceSymbolExtensions.cs @@ -150,6 +150,26 @@ public static bool ContainsAccessibleTypesOrNamespaces( } } + public static INamespaceSymbol GetQualifiedNamespace( + this INamespaceSymbol globalNamespace, + string namespaceName) + { + var namespaceSymbol = globalNamespace; + foreach (var name in namespaceName.Split('.')) + { + var members = namespaceSymbol.GetMembers(name); + namespaceSymbol = members.Count() == 1 + ? members.First() as INamespaceSymbol + : null; + + if ((object)namespaceSymbol == null) + { + break; + } + } + return namespaceSymbol; + } + private static bool ContainsAccessibleTypesOrNamespacesWorker( this INamespaceSymbol namespaceSymbol, IAssemblySymbol assembly, diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ITypeInferenceServiceExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ITypeInferenceServiceExtensions.cs index 2296181f0b519..ac32e015e6eff 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/ITypeInferenceServiceExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/ITypeInferenceServiceExtensions.cs @@ -16,8 +16,9 @@ public static INamedTypeSymbol InferDelegateType( SyntaxNode expression, CancellationToken cancellationToken) { - var type = typeInferenceService.InferType(semanticModel, expression, objectAsDefault: false, cancellationToken: cancellationToken); - return type.GetDelegateType(semanticModel.Compilation); + var types = typeInferenceService.InferTypes(semanticModel, expression, cancellationToken); + var delegateTypes = types.Select(t => t.GetDelegateType(semanticModel.Compilation)); + return delegateTypes.WhereNotNull().FirstOrDefault(); } public static ITypeSymbol InferType(this ITypeInferenceService typeInferenceService, diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/MetadataOnlyImage.cs b/src/Workspaces/Core/Portable/Workspace/Solution/MetadataOnlyImage.cs index 2aabac3bb6ef8..db8660274beb6 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/MetadataOnlyImage.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/MetadataOnlyImage.cs @@ -30,31 +30,50 @@ public bool IsEmpty get { return _storage == null; } } - public static MetadataOnlyImage Create(ITemporaryStorageService service, Compilation compilation, CancellationToken cancellationToken) + public static MetadataOnlyImage Create(Workspace workspace, ITemporaryStorageService service, Compilation compilation, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); - using (Logger.LogBlock(FunctionId.Workspace_SkeletonAssembly_EmitMetadataOnlyImage, cancellationToken)) + try { - // TODO: make it to use SerializableBytes.WritableStream rather than MemoryStream so that - // we don't allocate anything for skeleton assembly. - using (var stream = SerializableBytes.CreateWritableStream()) - { - // note: cloning compilation so we don't retain all the generated symbols after its emitted. - // * REVIEW * is cloning clone p2p reference compilation as well? - var emitResult = compilation.Clone().Emit(stream, options: s_emitOptions, cancellationToken: cancellationToken); + workspace.LogTestMessage($"Beginning to create a skeleton assembly for {compilation.AssemblyName}..."); - if (emitResult.Success) + using (Logger.LogBlock(FunctionId.Workspace_SkeletonAssembly_EmitMetadataOnlyImage, cancellationToken)) + { + // TODO: make it to use SerializableBytes.WritableStream rather than MemoryStream so that + // we don't allocate anything for skeleton assembly. + using (var stream = SerializableBytes.CreateWritableStream()) { - var storage = service.CreateTemporaryStreamStorage(cancellationToken); - - stream.Position = 0; - storage.WriteStream(stream, cancellationToken); - - return new MetadataOnlyImage(storage, compilation.AssemblyName); + // note: cloning compilation so we don't retain all the generated symbols after its emitted. + // * REVIEW * is cloning clone p2p reference compilation as well? + var emitResult = compilation.Clone().Emit(stream, options: s_emitOptions, cancellationToken: cancellationToken); + + if (emitResult.Success) + { + workspace.LogTestMessage($"Successfully emitted a skeleton assembly for {compilation.AssemblyName}"); + var storage = service.CreateTemporaryStreamStorage(cancellationToken); + + stream.Position = 0; + storage.WriteStream(stream, cancellationToken); + + return new MetadataOnlyImage(storage, compilation.AssemblyName); + } + else + { + workspace.LogTestMessage($"Failed to create a skeleton assembly for {compilation.AssemblyName}:"); + + foreach (var diagnostic in emitResult.Diagnostics) + { + workspace.LogTestMessage(" " + diagnostic.GetMessage()); + } + } } } } + finally + { + workspace.LogTestMessage($"Done trying to create a skeleton assembly for {compilation.AssemblyName}"); + } return Empty; } diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/MetadataOnlyReference.cs b/src/Workspaces/Core/Portable/Workspace/Solution/MetadataOnlyReference.cs index 11289b5ae86fb..76b525aa1f0f5 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/MetadataOnlyReference.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/MetadataOnlyReference.cs @@ -30,9 +30,11 @@ internal static MetadataReference GetOrBuildReference( VersionStamp version, CancellationToken cancellationToken) { + solution.Workspace.LogTestMessage($"Looking to see if we already have a skeleton assembly for {projectReference.ProjectId} before we build one..."); MetadataReference reference; if (TryGetReference(solution, projectReference, finalCompilation, version, out reference)) { + solution.Workspace.LogTestMessage($"A reference was found {projectReference.ProjectId} so we're skipping the build."); return reference; } @@ -41,12 +43,15 @@ internal static MetadataReference GetOrBuildReference( // first, prepare image // * NOTE * image is cancellable, do not create it inside of conditional weak table. var service = solution.Workspace.Services.GetService(); - var image = MetadataOnlyImage.Create(service, finalCompilation, cancellationToken); + var image = MetadataOnlyImage.Create(solution.Workspace, service, finalCompilation, cancellationToken); + if (image.IsEmpty) { // unfortunately, we couldn't create one. do best effort if (TryGetReference(solution, projectReference, finalCompilation, VersionStamp.Default, out reference)) { + solution.Workspace.LogTestMessage($"We failed to create metadata so we're using the one we just found from an earlier version."); + // we have one from previous compilation!!, it might be out-of-date big time, but better than nothing. // re-use it return reference; @@ -71,6 +76,10 @@ internal static MetadataReference GetOrBuildReference( // return new reference return referenceSet.GetMetadataReference(finalCompilation, projectReference.Aliases, projectReference.EmbedInteropTypes); } + else + { + solution.Workspace.LogTestMessage($"Successfully stored the metadata generated for {projectReference.ProjectId}"); + } // record it to version based cache as well. snapshot cache always has a higher priority. we don't need to check returned set here // since snapshot based cache will take care of same compilation for us. @@ -87,6 +96,7 @@ internal static bool TryGetReference( MetadataOnlyReferenceSet referenceSet; if (s_snapshotCache.TryGetValue(finalOrDeclarationCompilation, out referenceSet)) { + solution.Workspace.LogTestMessage($"Found already cached metadata in {nameof(s_snapshotCache)} for the exact compilation"); reference = referenceSet.GetMetadataReference(finalOrDeclarationCompilation, projectReference.Aliases, projectReference.EmbedInteropTypes); return true; } @@ -96,6 +106,7 @@ internal static bool TryGetReference( // get one for the branch if (TryGetReferenceFromBranch(solution.BranchId, projectReference, finalOrDeclarationCompilation, version, out reference)) { + solution.Workspace.LogTestMessage($"Found already cached metadata for the branch and version {version}"); return true; } @@ -104,6 +115,7 @@ internal static bool TryGetReference( if (solution.BranchId != primaryBranchId && TryGetReferenceFromBranch(primaryBranchId, projectReference, finalOrDeclarationCompilation, version, out reference)) { + solution.Workspace.LogTestMessage($"Found already cached metadata for the primary branch and version {version}"); return true; } diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/Solution.CompilationTracker.cs b/src/Workspaces/Core/Portable/Workspace/Solution/Solution.CompilationTracker.cs index 21b8b2c95b2da..6938a9f26c828 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/Solution.CompilationTracker.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/Solution.CompilationTracker.cs @@ -741,16 +741,25 @@ private async Task GetMetadataOnlyImageReferenceAsync( var declarationCompilation = await this.GetOrBuildDeclarationCompilationAsync(solution, cancellationToken: cancellationToken).ConfigureAwait(false); MetadataReference reference; + + solution.Workspace.LogTestMessage($"Looking for a cached skeleton assembly for {projectReference.ProjectId} before taking the lock..."); + if (!MetadataOnlyReference.TryGetReference(solution, projectReference, declarationCompilation, version, out reference)) { // using async build lock so we don't get multiple consumers attempting to build metadata-only images for the same compilation. using (await _buildLock.DisposableWaitAsync(cancellationToken).ConfigureAwait(false)) { + solution.Workspace.LogTestMessage($"Build lock taken for {ProjectState.Id}..."); + // okay, we still don't have one. bring the compilation to final state since we are going to use it to create skeleton assembly var compilationInfo = await this.GetOrBuildCompilationInfoAsync(solution, lockGate: false, cancellationToken: cancellationToken).ConfigureAwait(false); reference = MetadataOnlyReference.GetOrBuildReference(solution, projectReference, compilationInfo.Compilation, version, cancellationToken); } } + else + { + solution.Workspace.LogTestMessage($"Reusing the already cached skeleton assembly for {projectReference.ProjectId}"); + } return reference; } diff --git a/src/Workspaces/Core/Portable/Workspace/Workspace.cs b/src/Workspaces/Core/Portable/Workspace/Workspace.cs index 1e16e31ecf396..549896c6732ae 100644 --- a/src/Workspaces/Core/Portable/Workspace/Workspace.cs +++ b/src/Workspaces/Core/Portable/Workspace/Workspace.cs @@ -46,6 +46,8 @@ public abstract partial class Workspace : IDisposable internal bool TestHookPartialSolutionsDisabled { get; set; } + private Action _testMessageLogger; + /// /// Constructs a new workspace instance. /// @@ -66,6 +68,20 @@ protected Workspace(HostServices host, string workspaceKind) _latestSolution = CreateSolution(SolutionId.CreateNewId()); } + internal void LogTestMessage(string message) + { + _testMessageLogger?.Invoke(message); + } + + /// + /// Sets an internal logger that will receive some messages. + /// + /// An action called to write a single line to the log. + internal void SetTestLogger(Action writeLineMessageLogger) + { + _testMessageLogger = writeLineMessageLogger; + } + /// /// Services provider by the host for implementing workspace features. /// diff --git a/src/Workspaces/Core/Portable/project.lock.json b/src/Workspaces/Core/Portable/project.lock.json index 39ee2994a4f41..7fd5fb06c1f04 100644 --- a/src/Workspaces/Core/Portable/project.lock.json +++ b/src/Workspaces/Core/Portable/project.lock.json @@ -27,7 +27,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -72,11 +72,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Workspaces/CoreTest/AssemblyAttributes.cs b/src/Workspaces/CoreTest/AssemblyAttributes.cs deleted file mode 100644 index e8f2354bfbf34..0000000000000 --- a/src/Workspaces/CoreTest/AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Xunit; - diff --git a/src/Workspaces/CoreTest/project.lock.json b/src/Workspaces/CoreTest/project.lock.json index 8bcaa819546e6..dbefdcbef17ff 100644 --- a/src/Workspaces/CoreTest/project.lock.json +++ b/src/Workspaces/CoreTest/project.lock.json @@ -86,7 +86,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -265,7 +265,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -601,11 +601,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Workspaces/VisualBasic/Portable/project.lock.json b/src/Workspaces/VisualBasic/Portable/project.lock.json index f448c4cec3116..7d26150ab2de5 100644 --- a/src/Workspaces/VisualBasic/Portable/project.lock.json +++ b/src/Workspaces/VisualBasic/Portable/project.lock.json @@ -27,7 +27,7 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -72,11 +72,11 @@ "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", diff --git a/src/Workspaces/VisualBasicTest/project.lock.json b/src/Workspaces/VisualBasicTest/project.lock.json index 8bcaa819546e6..dbefdcbef17ff 100644 --- a/src/Workspaces/VisualBasicTest/project.lock.json +++ b/src/Workspaces/VisualBasicTest/project.lock.json @@ -86,7 +86,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -265,7 +265,7 @@ "lib/net45/_._": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { + "System.Reflection.Metadata/1.2.0-rc2-23826": { "dependencies": { "System.Collections.Immutable": "1.1.37" }, @@ -601,11 +601,11 @@ "ref/wpa81/_._" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23811": { - "sha512": "gAOQV1dsGyQfQUuzsCYFLMlI6BhfK1/2aA7JGf6gJphaLgjU4dV4hzjbE0iZXgo61VUuda2LtCBrWWZBw5897Q==", + "System.Reflection.Metadata/1.2.0-rc2-23826": { + "sha512": "iaq5zpluF7mUMd5hFyhmZGyCSzF6glZjvNI2VAhLFQEp8sGA/tROj6NoZL42q6HhoHxi1XyGeoIXPi5hyw0+5w==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23811.nupkg.sha512", + "System.Reflection.Metadata.1.2.0-rc2-23826.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt",