From 4613d537097d1d9d5ce24d661613214b160c139f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= Date: Thu, 26 Apr 2018 19:45:32 +0200 Subject: [PATCH 1/2] Update for Fody 2 compatibility updated FodyCecil version to 2.0.0 and implemented required changes --- SwallowExceptions/CecilExtensions.cs | 4 ++-- SwallowExceptions/MockAssemblyResolver.cs | 5 +++++ SwallowExceptions/ModuleWeaver.cs | 4 ++-- SwallowExceptions/SwallowExceptions.csproj | 20 ++++++++++++-------- SwallowExceptions/packages.config | 2 +- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/SwallowExceptions/CecilExtensions.cs b/SwallowExceptions/CecilExtensions.cs index cfc5f02..a88fc93 100644 --- a/SwallowExceptions/CecilExtensions.cs +++ b/SwallowExceptions/CecilExtensions.cs @@ -167,7 +167,7 @@ public static Instruction FindStringInstruction(this Instruction call) return null; } - + /* public static SequencePoint GetPreviousSequencePoint(this Instruction instruction) { while (true) @@ -183,7 +183,7 @@ public static SequencePoint GetPreviousSequencePoint(this Instruction instructio return null; } } - } + }*/ public static bool ContainsAttribute(this Collection attributes, string attributeName) { diff --git a/SwallowExceptions/MockAssemblyResolver.cs b/SwallowExceptions/MockAssemblyResolver.cs index 8445107..ab2faa8 100644 --- a/SwallowExceptions/MockAssemblyResolver.cs +++ b/SwallowExceptions/MockAssemblyResolver.cs @@ -48,5 +48,10 @@ public AssemblyDefinition Resolve(string fullName, ReaderParameters parameters) throw new NotImplementedException(); } + public void Dispose() + { + throw new NotImplementedException(); + } + public string Directory; } \ No newline at end of file diff --git a/SwallowExceptions/ModuleWeaver.cs b/SwallowExceptions/ModuleWeaver.cs index 9e793b9..d6d29c1 100644 --- a/SwallowExceptions/ModuleWeaver.cs +++ b/SwallowExceptions/ModuleWeaver.cs @@ -35,8 +35,8 @@ public void Execute() // } ObjectArray = new ArrayType(ModuleDefinition.TypeSystem.Object); - var msCoreLibDefinition = AssemblyResolver.Resolve("mscorlib"); - ExceptionType = ModuleDefinition.Import(msCoreLibDefinition.MainModule.Types.First(x => x.Name == "Exception")); + var msCoreLibDefinition = AssemblyResolver.Resolve(ModuleDefinition.AssemblyReferences.First(a => a.Name == "mscorlib")); + ExceptionType = ModuleDefinition.ImportReference(msCoreLibDefinition.MainModule.Types.First(x => x.Name == "Exception")); foreach (var type in ModuleDefinition .GetTypes() .Where(x => (x.BaseType != null) && !x.IsEnum && !x.IsInterface)) diff --git a/SwallowExceptions/SwallowExceptions.csproj b/SwallowExceptions/SwallowExceptions.csproj index 9851649..f6be5bd 100644 --- a/SwallowExceptions/SwallowExceptions.csproj +++ b/SwallowExceptions/SwallowExceptions.csproj @@ -39,17 +39,21 @@ ..\key.snk - - ..\packages\FodyCecil.1.24.0-beta2\lib\net40\Mono.Cecil.dll + + ..\packages\FodyCecil.2.0.0\lib\net40\Mono.Cecil.dll + True - - ..\packages\FodyCecil.1.24.0-beta2\lib\net40\Mono.Cecil.Mdb.dll + + ..\packages\FodyCecil.2.0.0\lib\net40\Mono.Cecil.Mdb.dll + True - - ..\packages\FodyCecil.1.24.0-beta2\lib\net40\Mono.Cecil.Pdb.dll + + ..\packages\FodyCecil.2.0.0\lib\net40\Mono.Cecil.Pdb.dll + True - - ..\packages\FodyCecil.1.24.0-beta2\lib\net40\Mono.Cecil.Rocks.dll + + ..\packages\FodyCecil.2.0.0\lib\net40\Mono.Cecil.Rocks.dll + True diff --git a/SwallowExceptions/packages.config b/SwallowExceptions/packages.config index 23c33a6..6ca9959 100644 --- a/SwallowExceptions/packages.config +++ b/SwallowExceptions/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file From 2fb4ee7fd5244cca1f542c814a179a4ee0659692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20A=C3=9Fhauer?= Date: Thu, 26 Apr 2018 19:48:05 +0200 Subject: [PATCH 2/2] update version info --- NuGet/SwallowExceptions.nuspec | 2 +- SwallowExceptions/AssemblyInfo.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NuGet/SwallowExceptions.nuspec b/NuGet/SwallowExceptions.nuspec index 0cdd7ca..131ec9b 100644 --- a/NuGet/SwallowExceptions.nuspec +++ b/NuGet/SwallowExceptions.nuspec @@ -16,7 +16,7 @@ en-AU ILWeaving, Fody, Cecil - + \ No newline at end of file diff --git a/SwallowExceptions/AssemblyInfo.cs b/SwallowExceptions/AssemblyInfo.cs index 4a53d7c..2f49ab9 100644 --- a/SwallowExceptions/AssemblyInfo.cs +++ b/SwallowExceptions/AssemblyInfo.cs @@ -2,5 +2,5 @@ [assembly: AssemblyTitle("SwallowExceptions")] [assembly: AssemblyProduct("SwallowExceptions")] -[assembly: AssemblyVersion("0.0.3")] -[assembly: AssemblyFileVersion("0.0.3")] +[assembly: AssemblyVersion("0.0.4")] +[assembly: AssemblyFileVersion("0.0.4")]