Skip to content

Commit

Permalink
Merge pull request dotnet#20234 from dotnet/merges/master-to-dev15.6-…
Browse files Browse the repository at this point in the history
…20170615-070013

Merge master to dev15.6
  • Loading branch information
En-Shuo Hsu authored Jun 15, 2017
2 parents ac26c81 + 671e0c1 commit 0c6e237
Show file tree
Hide file tree
Showing 22 changed files with 257 additions and 176 deletions.
4 changes: 4 additions & 0 deletions build/Targets/Imports.targets
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@
</When>
</Choose>

<ItemGroup Condition="'$(ProjectLanguage)' == 'CSharp' AND '$(TargetNetFX20)' == 'true'">
<_ExplicitReference Include="$(FrameworkPathOverride)\mscorlib.dll" />
</ItemGroup>

<ItemDefinitionGroup Condition="'$(_CopyReferences)' == 'false'">
<Reference>
<Private>False</Private>
Expand Down
83 changes: 38 additions & 45 deletions build/Targets/Settings.props
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@
{RawFileName};
</AssemblySearchPaths>

<NoWarn>$(NoWarn);1701</NoWarn>
<RoslynNetSdkRootPath>$(MSBuildSDKsPath)\Microsoft.NET.Sdk\Sdk\</RoslynNetSdkRootPath>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>

<!-- Windows specific settings -->
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
<BaseNuGetRuntimeIdentifier>win7</BaseNuGetRuntimeIdentifier>
<DebugType>pdbonly</DebugType>
<RoslynDebugType>full</RoslynDebugType>
<UseSharedCompilation>true</UseSharedCompilation>

<!-- Presently our code can build on machines with Dev14 or Dev15 but only successfully deploy
Expand All @@ -93,7 +92,7 @@

<!-- Unix specific settings -->
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<DebugType>portable</DebugType>
<RoslynDebugType>portable</RoslynDebugType>
</PropertyGroup>

<!--
Expand Down Expand Up @@ -121,7 +120,39 @@
<VisualBasicCoreTargetsPath>$(BootstrapBuildPath)\Microsoft.VisualBasic.Core.targets</VisualBasicCoreTargetsPath>
</PropertyGroup>

<!-- Language specifc settings -->
<!-- During bootstrap builds it's important to load our bootstrap tasks before doing any
other imports (which could load a same named DLL) -->
<UsingTask TaskName="Microsoft.CodeAnalysis.BuildTasks.Csc"
AssemblyFile="$(BootstrapBuildPath)\Microsoft.Build.Tasks.CodeAnalysis.dll"
Condition="'$(BootstrapBuildPath)' != ''" />
<UsingTask TaskName="Microsoft.CodeAnalysis.BuildTasks.Vbc"
AssemblyFile="$(BootstrapBuildPath)\Microsoft.Build.Tasks.CodeAnalysis.dll"
Condition="'$(BootstrapBuildPath)' != ''" />
<UsingTask TaskName="Microsoft.CodeAnalysis.BuildTasks.ValidateBootstrap"
AssemblyFile="$(BootstrapBuildPath)\Microsoft.Build.Tasks.CodeAnalysis.dll"
Condition="'$(BootstrapBuildPath)' != ''" />

<!-- This file is imported by all projects at the beginning of the project files -->
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props') AND '$(RoslynSdkProject)' != 'true'" />

<Import Project="$(RoslynNetSdkRootPath)Sdk.props" Condition="'$(RoslynSdkProject)' == 'true'" />

<Import Project="$(RoslynDiagnosticsPropsFilePath)" Condition="'$(UseRoslynAnalyzers)' == 'true' AND Exists('$(RoslynDiagnosticsPropsFilePath)')" />

<ImportGroup Label="WindowsImports" Condition="'$(OS)' == 'Windows_NT'">
<Import Project="$(NuGetPackageRoot)\Microsoft.VSSDK.BuildTools\$(VisualStudioBuildToolsVersion)\build\Microsoft.VsSDK.BuildTools.props" />
</ImportGroup>

<Import Project="$(ToolsetCompilerPropsFilePath)" Condition="Exists('$(ToolsetCompilerPropsFilePath)') AND '$(BootstrapBuildPath)' == ''" />

<!--
Language specifc settings
These deliberately come after importing the core targets. That way we can assure these are
the final settings, and not over written by core targets. Certain versions of the SDK for
example do exactly that.
-->
<Choose>
<!-- VB specific settings -->
<When Condition="'$(MSBuildProjectExtension)' == '.vbproj' OR '$(Language)' == 'VB' OR '$(ProjectLanguage)' == 'VB'">
Expand Down Expand Up @@ -175,7 +206,7 @@
and hence suppress this warning until we get closer to release and a more
thorough documentation story
-->
<NoWarn>$(NoWarn);1591</NoWarn>
<NoWarn>$(NoWarn);1591;1701</NoWarn>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<MSBuildTargetsLanguageName>CSharp</MSBuildTargetsLanguageName>
</PropertyGroup>
Expand Down Expand Up @@ -205,45 +236,7 @@
</When>
</Choose>

<ItemGroup Condition="'$(ProjectLanguage)' == 'CSharp' AND '$(TargetNetFX20)' == 'true'">
<_ExplicitReference Include="$(FrameworkPathOverride)\mscorlib.dll" />
</ItemGroup>

<!-- During bootstrap builds it's important to load our bootstrap tasks before doing any
other imports (which could load a same named DLL) -->
<UsingTask TaskName="Microsoft.CodeAnalysis.BuildTasks.Csc"
AssemblyFile="$(BootstrapBuildPath)\Microsoft.Build.Tasks.CodeAnalysis.dll"
Condition="'$(BootstrapBuildPath)' != ''" />
<UsingTask TaskName="Microsoft.CodeAnalysis.BuildTasks.Vbc"
AssemblyFile="$(BootstrapBuildPath)\Microsoft.Build.Tasks.CodeAnalysis.dll"
Condition="'$(BootstrapBuildPath)' != ''" />
<UsingTask TaskName="Microsoft.CodeAnalysis.BuildTasks.ValidateBootstrap"
AssemblyFile="$(BootstrapBuildPath)\Microsoft.Build.Tasks.CodeAnalysis.dll"
Condition="'$(BootstrapBuildPath)' != ''" />

<!-- This file is imported by all projects at the beginning of the project files -->
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props') AND '$(RoslynSdkProject)' != 'true'" />

<Import Project="$(RoslynNetSdkRootPath)Sdk.props" Condition="'$(RoslynSdkProject)' == 'true'" />

<Import Project="$(RoslynDiagnosticsPropsFilePath)" Condition="'$(UseRoslynAnalyzers)' == 'true' AND Exists('$(RoslynDiagnosticsPropsFilePath)')" />

<ImportGroup Label="WindowsImports" Condition="'$(OS)' == 'Windows_NT'">
<Import Project="$(NuGetPackageRoot)\Microsoft.VSSDK.BuildTools\$(VisualStudioBuildToolsVersion)\build\Microsoft.VsSDK.BuildTools.props" />
</ImportGroup>

<Import Project="$(ToolsetCompilerPropsFilePath)" Condition="Exists('$(ToolsetCompilerPropsFilePath)') AND '$(BootstrapBuildPath)' == ''" />

<!-- The Sdk props will set the rootnamespace to the assembly name when the property
is empty. Need to override this after -->
<PropertyGroup Condition="'$(RoslynSdkProject)' == 'true'" >
<DebugType>full</DebugType>
<RootNamespace Condition="'$(MSBuildTargetsLanguageName)' == 'VisualBasic'"></RootNamespace>
<DefineConstants Condition="'$(InitialDefineConstants)' != ''">$(InitialDefineConstants)</DefineConstants>

<!-- The NoWarn property is still being unconditionally set. https://github.com/dotnet/sdk/issues/752 -->
<OptionStrict>On</OptionStrict>
<NoWarn>$(NoWarn);1591</NoWarn>
<PropertyGroup>
<DebugType>$(RoslynDebugType)</DebugType>
</PropertyGroup>
</Project>
8 changes: 4 additions & 4 deletions netci.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ commitPullList.each { isPr ->

def triggerPhraseOnly = false
def triggerPhraseExtra = "perf-correctness"
Utilities.setMachineAffinity(myJob, 'Windows_NT', 'latest-dev15-3-preview1')
Utilities.setMachineAffinity(myJob, 'Windows_NT', 'latest-dev15-3-preview2')
addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
}

Expand Down Expand Up @@ -221,9 +221,9 @@ commitPullList.each { isPr ->
}
}

def triggerPhraseOnly = false
def triggerPhraseExtra = ""
Utilities.setMachineAffinity(myJob, 'Windows_NT', 'latest-dev15-3-preview1')
def triggerPhraseOnly = true
def triggerPhraseExtra = "vsintegration"
Utilities.setMachineAffinity(myJob, 'Windows_NT', 'latest-dev15-3-preview2')
Utilities.addXUnitDotNETResults(myJob, '**/xUnitResults/*.xml')
addRoslynJob(myJob, jobName, branchName, isPr, triggerPhraseExtra, triggerPhraseOnly)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1226,5 +1226,49 @@ public override bool Equals(object obj)
optionsCallback: options => Assert.Null(options.FirstOrDefault(i => i.Id == ImplementIEquatableId)),
ignoreTrivia: false);
}

[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateEqualsAndGetHashCode)]
public async Task TestMissingReferences()
{
await TestWithPickMembersDialogAsync(
@"
<Workspace>
<Project Language='C#' AssemblyName='CSharpAssembly1' CommonReferences='false'>
<Document FilePath='Test1.cs'>
public class Class1
{
int i;
[||]
public void Foo()
{
}
}
</Document>
</Project>
</Workspace>",
@"
public class Class1
{
int i;
public override global::System.Boolean Equals(global::System.Object obj)
{
var @class = obj as Class1;
return @class != null;
}
public void Foo()
{
}
public override global::System.Int32 GetHashCode()
{
return 0;
}
}",
chosenSymbols: new string[] { },
index: 1);
}
}
}
1 change: 1 addition & 0 deletions src/EditorFeatures/Core/EditorFeatures.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
<Compile Include="ReferenceHighlighting\Tags\WrittenReferenceHighlightTag.cs" />
<Compile Include="ReferenceHighlighting\Tags\WrittenReferenceHighlightTagDefinition.cs" />
<Compile Include="Implementation\InfoBar\EditorInfoBarService.cs" />
<Compile Include="Shared\Extensions\ITextBufferEditExtensions.cs" />
<Compile Include="SymbolSearch\IAddReferenceDatabaseWrapper.cs" />
<Compile Include="SymbolSearch\IDatabaseFactoryService.cs" />
<Compile Include="SymbolSearch\IDelayService.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System.Diagnostics;
using System.Threading;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.BraceCompletion;
Expand Down Expand Up @@ -116,7 +117,7 @@ private void Start(CancellationToken cancellationToken)
}
else
{
snapshot = edit.Apply();
snapshot = edit.ApplyAndLogExceptions();
}
}

Expand Down Expand Up @@ -166,7 +167,7 @@ public void PreBackspace(out bool handledCommand)
// handle the command so the backspace does
// not go through since we've already cleared the braces
handledCommand = true;
edit.Apply();
edit.ApplyAndLogExceptions();
undo.Complete();
EndSession();
}
Expand Down Expand Up @@ -222,7 +223,7 @@ public void PreOverType(out bool handledCommand)
{
handledCommand = true;

edit.Apply();
edit.ApplyAndLogExceptions();

MoveCaretToClosingPoint();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected void ApplyReplacementText(ITextBuffer subjectBuffer, ITextUndoHistory
}
}

edit.Apply();
edit.ApplyAndLogExceptions();
if (!edit.HasEffectiveChanges && !this.UndoStack.Any())
{
transaction.Cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ internal void ApplyConflictResolutionEdits(IInlineRenameReplacementInfo conflict
edit.Replace(change.Span.Start, change.Span.Length, change.NewText);
}

edit.Apply();
edit.ApplyAndLogExceptions();
}
});

Expand Down Expand Up @@ -528,7 +528,7 @@ private IEnumerable<InlineRenameReplacement> GetMergedReplacementInfos(
buffer.Replace(change.Span.ToSpan(), change.NewText);
}

edit.Apply();
edit.ApplyAndLogExceptions();
}

yield return new InlineRenameReplacement(replacement.Kind, replacement.OriginalSpan, trackingSpan.GetSpan(buffer.CurrentSnapshot).Span.ToTextSpan());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void Commit(
using (var textEdit = this.SubjectBuffer.CreateEdit(editOptions, reiteratedVersionNumber: null, editTag: null))
{
textEdit.Replace(mappedSpan.Span, adjustedNewText);
textEdit.Apply();
textEdit.ApplyAndLogExceptions();
}

// If the completion change requested a new position for the caret to go,
Expand Down Expand Up @@ -204,7 +204,7 @@ private void RollbackToBeforeTypeChar(ITextSnapshot initialTextSnapshot)
textEdit.Replace(change.NewSpan, change.OldText);
}

textEdit.Apply();
textEdit.ApplyAndLogExceptions();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Text;

namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions
{
internal static class ITextBufferEditExtensions
{
private static Exception s_lastException = null;

/// <summary>
/// Logs exceptions thrown during <see cref="ITextBufferEdit.Apply"/> as we look for issues.
/// </summary>
/// <param name="edit"></param>
/// <returns></returns>
public static ITextSnapshot ApplyAndLogExceptions(this ITextBufferEdit edit)
{
try
{
return edit.Apply();
}
catch (Exception e) when (ErrorReporting.FatalError.ReportWithoutCrash(e))
{
s_lastException = e;

// Since we don't know what is causing this yet, I don't feel safe that catching
// will not cause some further downstream failure. So we'll continue to propagate.
throw;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.VisualStudio.Text;
using Roslyn.Utilities;

Expand Down Expand Up @@ -113,7 +114,7 @@ public void ApplyReplacementText(string replacementText)
}
}

edit.Apply();
edit.ApplyAndLogExceptions();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.EndConstructGeneration
Using edit = subjectBuffer.CreateEdit()
Dim aligningWhitespace = subjectBuffer.CurrentSnapshot.GetAligningWhitespace(state.TokenToLeft.Parent.Span.Start)
edit.Insert(state.CaretPosition, state.NewLineCharacter + aligningWhitespace)
edit.Apply()
edit.ApplyAndLogExceptions()
End Using

' And now just send down a normal enter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,24 @@ private async Task HandleNonSelectionAsync(CodeRefactoringContext context)

var pickMembersOptions = ArrayBuilder<PickMembersOption>.GetInstance();

var equatableType = semanticModel.Compilation.GetTypeByMetadataName(typeof(IEquatable<>).FullName);
var constructedType = equatableType.Construct(containingType);
if (!containingType.AllInterfaces.Contains(constructedType))
var equatableTypeOpt = semanticModel.Compilation.GetTypeByMetadataName(typeof(IEquatable<>).FullName);
if (equatableTypeOpt != null)
{
var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false);
var value = options.GetOption(GenerateEqualsAndGetHashCodeFromMembersOptions.ImplementIEquatable);
var constructedType = equatableTypeOpt.Construct(containingType);
if (!containingType.AllInterfaces.Contains(constructedType))
{
var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false);
var value = options.GetOption(GenerateEqualsAndGetHashCodeFromMembersOptions.ImplementIEquatable);

var displayName = constructedType.ToDisplayString(new SymbolDisplayFormat(
typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameOnly,
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters));
var displayName = constructedType.ToDisplayString(new SymbolDisplayFormat(
typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameOnly,
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters));

pickMembersOptions.Add(new PickMembersOption(
ImplementIEquatableId,
string.Format(FeaturesResources.Implement_0, displayName),
value));
pickMembersOptions.Add(new PickMembersOption(
ImplementIEquatableId,
string.Format(FeaturesResources.Implement_0, displayName),
value));
}
}

if (!HasOperators(containingType))
Expand Down
Loading

0 comments on commit 0c6e237

Please sign in to comment.