diff --git a/ICSharpCode.Decompiler/Ast/AstBuilder.cs b/ICSharpCode.Decompiler/Ast/AstBuilder.cs index 428e99a29..54ffa78e1 100644 --- a/ICSharpCode.Decompiler/Ast/AstBuilder.cs +++ b/ICSharpCode.Decompiler/Ast/AstBuilder.cs @@ -125,7 +125,7 @@ namespace Decompiler { // create IL code mappings - used for debugger if (!CSharpCodeMapping.SourceCodeMappings.ContainsKey(typeDef.FullName)) { - CSharpCodeMapping.SourceCodeMappings.Add(typeDef.FullName, new List()); + CSharpCodeMapping.SourceCodeMappings.TryAdd(typeDef.FullName, new List()); } else { CSharpCodeMapping.SourceCodeMappings[typeDef.FullName].Clear(); } diff --git a/ICSharpCode.Decompiler/Ast/CSharpCodeMapping.cs b/ICSharpCode.Decompiler/Ast/CSharpCodeMapping.cs index 22e4cdadc..91d530b8a 100644 --- a/ICSharpCode.Decompiler/Ast/CSharpCodeMapping.cs +++ b/ICSharpCode.Decompiler/Ast/CSharpCodeMapping.cs @@ -2,7 +2,9 @@ // This code is distributed under MIT X11 license (for details please see \doc\license.txt) using System; +using System.Collections.Concurrent; using System.Collections.Generic; + using ICSharpCode.Decompiler; namespace Decompiler @@ -12,12 +14,12 @@ namespace Decompiler /// public static class CSharpCodeMapping { - static Dictionary> codeMappings = new Dictionary>(); + static ConcurrentDictionary> codeMappings = new ConcurrentDictionary>(); /// /// Stores the source codes mappings: CSharp <-> editor lines /// - public static Dictionary> SourceCodeMappings { + public static ConcurrentDictionary> SourceCodeMappings { get { return codeMappings; } set { codeMappings = value; } } diff --git a/ICSharpCode.Decompiler/CodeMappings.cs b/ICSharpCode.Decompiler/CodeMappings.cs index 3a5475f30..f4ac2ffc2 100644 --- a/ICSharpCode.Decompiler/CodeMappings.cs +++ b/ICSharpCode.Decompiler/CodeMappings.cs @@ -2,7 +2,9 @@ // This code is distributed under MIT X11 license (for details please see \doc\license.txt) using System; +using System.Collections.Concurrent; using System.Collections.Generic; + using Decompiler; using ICSharpCode.Decompiler.Disassembler; using Mono.Cecil; @@ -39,9 +41,9 @@ namespace ICSharpCode.Decompiler public static class CodeMappings { - public static Dictionary> GetStorage(DecompiledLanguages language) + public static ConcurrentDictionary> GetStorage(DecompiledLanguages language) { - Dictionary> storage = null; + ConcurrentDictionary> storage = null; switch (language) { case DecompiledLanguages.IL: @@ -64,7 +66,7 @@ namespace ICSharpCode.Decompiler /// Source code mapping storage. public static MethodMapping CreateCodeMapping( this MethodDefinition method, - Dictionary> sourceCodeMappings) + ConcurrentDictionary> sourceCodeMappings) { // create IL code mappings - used in debugger MethodMapping currentMethodMapping = null; @@ -92,7 +94,7 @@ namespace ICSharpCode.Decompiler /// Metadata token. /// public static SourceCodeMapping GetInstructionByTypeAndLine( - this Dictionary> codeMappings, + this ConcurrentDictionary> codeMappings, string typeName, int lineNumber, out uint metadataToken) @@ -129,7 +131,7 @@ namespace ICSharpCode.Decompiler /// Type name. /// Line number. public static void GetSourceCodeFromMetadataTokenAndOffset( - this Dictionary> codeMappings, + this ConcurrentDictionary> codeMappings, uint token, int ilOffset, out string typeName, diff --git a/ICSharpCode.Decompiler/Disassembler/ILCodeMapping.cs b/ICSharpCode.Decompiler/Disassembler/ILCodeMapping.cs index 3425b2dfc..f08d6bb92 100644 --- a/ICSharpCode.Decompiler/Disassembler/ILCodeMapping.cs +++ b/ICSharpCode.Decompiler/Disassembler/ILCodeMapping.cs @@ -2,6 +2,7 @@ // This code is distributed under MIT X11 license (for details please see \doc\license.txt) using System; +using System.Collections.Concurrent; using System.Collections.Generic; namespace ICSharpCode.Decompiler.Disassembler @@ -11,12 +12,12 @@ namespace ICSharpCode.Decompiler.Disassembler /// public static class ILCodeMapping { - static Dictionary> codeMappings = new Dictionary>(); + static ConcurrentDictionary> codeMappings = new ConcurrentDictionary>(); /// /// Stores the source codes mappings: IL <-> editor lines /// - public static Dictionary> SourceCodeMappings { + public static ConcurrentDictionary> SourceCodeMappings { get { return codeMappings; } set { codeMappings = value; } } diff --git a/ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs b/ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs index 2804b0104..6e20cdfa0 100644 --- a/ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs +++ b/ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs @@ -314,7 +314,9 @@ namespace ICSharpCode.Decompiler.Disassembler { // create IL code mappings - used for debugger if (!ILCodeMapping.SourceCodeMappings.ContainsKey(type.FullName)) { - ILCodeMapping.SourceCodeMappings.Add(type.FullName, new List()); + ILCodeMapping.SourceCodeMappings.TryAdd(type.FullName, new List()); + } else { + ILCodeMapping.SourceCodeMappings.Clear(); } // start writing IL diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj index 217934a97..f080ce46a 100644 --- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj +++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj @@ -1,4 +1,3 @@ -<<<<<<< HEAD  @@ -52,8 +51,8 @@ - + @@ -72,132 +71,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {D68133BD-1E63-496E-9EDE-4FBDBF77B486} - Mono.Cecil - - - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} - ICSharpCode.NRefactory - - - - - - - - - - - - - - -======= - - - - {984CC812-9470-4A13-AFF9-CC44068D666C} - Debug - AnyCPU - Library - ICSharpCode.Decompiler - ICSharpCode.Decompiler - v4.0 - Client - Properties - False - False - 4 - false - - - AnyCPU - False - Auto - 4194304 - 4096 - - - bin\Debug\ - true - Full - False - True - DEBUG;TRACE - - - bin\Release\ - False - None - True - False - TRACE - - - - - 3.5 - - - - 3.5 - - - - - - - - - - - - - - - - - - - - - - - + @@ -250,5 +125,4 @@ ->>>>>>> 758f18c73f2667591014666e73ee139fe449c022 \ No newline at end of file diff --git a/ILSpy.sln b/ILSpy.sln index 3bb9f43f4..3310fac98 100644 --- a/ILSpy.sln +++ b/ILSpy.sln @@ -1,15 +1,15 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -# SharpDevelop 4.1.0.7302-alpha +# SharpDevelop 4.1.0.7279-alpha Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{1DEB3B4E-03AC-437C-821D-B09FBFCC3E5B}" ProjectSection(SolutionItems) = postProject EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "Debugger\Debugger.Core\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.Debugger", "Debugger\ILSpy.Debugger\ILSpy.Debugger.csproj", "{6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "Debugger\Debugger.Core\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy", "ILSpy\ILSpy.csproj", "{1E85EFF9-E370-4683-83E4-8A3D063FF791}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TreeView", "SharpTreeView\ICSharpCode.TreeView.csproj", "{DDE2A481-8271-4EAC-A330-8FA6A38D13D1}" @@ -106,7 +106,7 @@ Global {6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A}.Release|Any CPU.ActiveCfg = Release|x86 EndGlobalSection GlobalSection(NestedProjects) = preSolution - {6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A} = {1DEB3B4E-03AC-437C-821D-B09FBFCC3E5B} {1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {1DEB3B4E-03AC-437C-821D-B09FBFCC3E5B} + {6D3D0F0D-348D-456A-A6ED-E9BD5EFABB6A} = {1DEB3B4E-03AC-437C-821D-B09FBFCC3E5B} EndGlobalSection EndGlobal