From db7c3c78c2f291b3571ed88d58aa2736c5eafc28 Mon Sep 17 00:00:00 2001 From: TomasMatousek Date: Mon, 9 Jun 2014 18:11:43 -0700 Subject: [PATCH] Removes calls to NotifyOfCrossThreadDependency. The underlying debugger issue has been fixed, so the calls are not needed anymore. (changeset 1274269) --- .../Syntax/InternalSyntax/SyntaxNode.cs | 2 -- Src/Compilers/Core/Source/CodeAnalysis.csproj | 1 - .../CodeGen/PrivateImplementationDetails.cs | 2 -- .../InternalUtilities/DebuggerUtilities.cs | 29 ------------------- .../Core/Source/NonPortable/MetadataCache.cs | 7 ----- 5 files changed, 41 deletions(-) delete mode 100644 Src/Compilers/Core/Source/InternalUtilities/DebuggerUtilities.cs diff --git a/Src/Compilers/CSharp/Source/Syntax/InternalSyntax/SyntaxNode.cs b/Src/Compilers/CSharp/Source/Syntax/InternalSyntax/SyntaxNode.cs index fff164620387e..f8073efac3413 100644 --- a/Src/Compilers/CSharp/Source/Syntax/InternalSyntax/SyntaxNode.cs +++ b/Src/Compilers/CSharp/Source/Syntax/InternalSyntax/SyntaxNode.cs @@ -377,8 +377,6 @@ public override SyntaxNode GetStructure(Microsoft.CodeAnalysis.SyntaxTrivia triv var parent = trivia.Token.Parent; if (parent != null) { - DebuggerUtilities.CallBeforeAcquiringLock(); //see method comment - SyntaxNode structure; var structsInParent = structuresTable.GetOrCreateValue(parent); lock (structsInParent) diff --git a/Src/Compilers/Core/Source/CodeAnalysis.csproj b/Src/Compilers/Core/Source/CodeAnalysis.csproj index d7e6da31b31d5..3508b0c261932 100644 --- a/Src/Compilers/Core/Source/CodeAnalysis.csproj +++ b/Src/Compilers/Core/Source/CodeAnalysis.csproj @@ -225,7 +225,6 @@ - diff --git a/Src/Compilers/Core/Source/CodeGen/PrivateImplementationDetails.cs b/Src/Compilers/Core/Source/CodeGen/PrivateImplementationDetails.cs index 4ac359385c93a..ab23583d733b9 100644 --- a/Src/Compilers/Core/Source/CodeGen/PrivateImplementationDetails.cs +++ b/Src/Compilers/Core/Source/CodeGen/PrivateImplementationDetails.cs @@ -104,8 +104,6 @@ internal Cci.IFieldReference CreateDataField(byte[] data) Cci.ITypeReference type = this.proxyTypes.GetOrAdd((uint)data.Length, size => GetStorageStruct(size)); - DebuggerUtilities.CallBeforeAcquiringLock(); //see method comment - var block = new MetadataBlock(data); //This object may be accessed concurrently diff --git a/Src/Compilers/Core/Source/InternalUtilities/DebuggerUtilities.cs b/Src/Compilers/Core/Source/InternalUtilities/DebuggerUtilities.cs deleted file mode 100644 index f2d4616755b9f..0000000000000 --- a/Src/Compilers/Core/Source/InternalUtilities/DebuggerUtilities.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Diagnostics; - -namespace Roslyn.Utilities -{ - internal static class DebuggerUtilities - { - /// - /// The issue here is acquiring a lock in the course of evaluating a property - /// value in the debugger (e.g. in the Locals window). If anything causes that - /// evaluation to bail, it will do so without releasing the lock, making future - /// evaluations impossible (leads to a timeout, among other things). One thing - /// that might cause the evaluation to bail is a call to - /// Debugger.NotifyOfCrossThreadDependency, which causes the debugger to prompt - /// the user for confirmation (little swirling red and blue icon) before evaluating - /// an expression that will involve multiple threads. To prevent this from happening - /// we make the call ourselved *before* acquiring the lock. Then, when the user - /// opts to proceed, the evaluation runs without interruption and succeeds. - /// - /// - /// TODO: This probably isn't necessary in Dev11 (see Dev11 548767 and/or Dev11 84313). - /// - internal static void CallBeforeAcquiringLock() - { - Debugger.NotifyOfCrossThreadDependency(); - } - } -} \ No newline at end of file diff --git a/Src/Compilers/Core/Source/NonPortable/MetadataCache.cs b/Src/Compilers/Core/Source/NonPortable/MetadataCache.cs index e7c6abe38f91e..c01ac4d5a03e0 100644 --- a/Src/Compilers/Core/Source/NonPortable/MetadataCache.cs +++ b/Src/Compilers/Core/Source/NonPortable/MetadataCache.cs @@ -186,7 +186,6 @@ private static void CompactCache(Object state) compactCollectionCount = currentCollectionCount; - DebuggerUtilities.CallBeforeAcquiringLock(); //see method comment lock (Guard) { if (!(AnyAssembliesCached() || AnyModulesCached() || AnyAnalyzerAssembliesCached())) @@ -268,8 +267,6 @@ internal static void TriggerCacheCompact() /// private static void CompactCacheOfAssemblies() { - DebuggerUtilities.CallBeforeAcquiringLock(); //see method comment - // Do one pass through the assemblyKeys list int originalCount = -1; @@ -335,8 +332,6 @@ private static bool AnyAssembliesCached() /// private static void CompactCacheOfModules() { - DebuggerUtilities.CallBeforeAcquiringLock(); //see method comment - // Do one pass through the moduleKeys list int originalCount = -1; @@ -402,8 +397,6 @@ private static bool AnyModulesCached() /// private static void CompactCacheOfAnalyzers() { - DebuggerUtilities.CallBeforeAcquiringLock(); //see method comment - // Do one pass through the analyzerAssemblyKeys list int originalCount = -1;