Skip to content

Commit

Permalink
Merge pull request #3 from rimrul/fody2
Browse files Browse the repository at this point in the history
Fody 2 compatibility
  • Loading branch information
duaneedwards committed May 12, 2018
2 parents 7c1d173 + 2fb4ee7 commit 472b39b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion NuGet/SwallowExceptions.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<language>en-AU</language>
<tags>ILWeaving, Fody, Cecil</tags>
<dependencies>
<dependency id="Fody"/>
<dependency id="Fody" version="[2.0.0,3.0.0)"/>
</dependencies>
</metadata>
</package>
4 changes: 2 additions & 2 deletions SwallowExceptions/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions SwallowExceptions/CecilExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public static Instruction FindStringInstruction(this Instruction call)

return null;
}

/*
public static SequencePoint GetPreviousSequencePoint(this Instruction instruction)
{
while (true)
Expand All @@ -183,7 +183,7 @@ public static SequencePoint GetPreviousSequencePoint(this Instruction instructio
return null;
}
}
}
}*/

public static bool ContainsAttribute(this Collection<CustomAttribute> attributes, string attributeName)
{
Expand Down
5 changes: 5 additions & 0 deletions SwallowExceptions/MockAssemblyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,10 @@ public AssemblyDefinition Resolve(string fullName, ReaderParameters parameters)
throw new NotImplementedException();
}

public void Dispose()
{
throw new NotImplementedException();
}

public string Directory;
}
4 changes: 2 additions & 2 deletions SwallowExceptions/ModuleWeaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
20 changes: 12 additions & 8 deletions SwallowExceptions/SwallowExceptions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,21 @@
<AssemblyOriginatorKeyFile>..\key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Cecil">
<HintPath>..\packages\FodyCecil.1.24.0-beta2\lib\net40\Mono.Cecil.dll</HintPath>
<Reference Include="Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\FodyCecil.2.0.0\lib\net40\Mono.Cecil.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Mdb">
<HintPath>..\packages\FodyCecil.1.24.0-beta2\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
<Reference Include="Mono.Cecil.Mdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\FodyCecil.2.0.0\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Pdb">
<HintPath>..\packages\FodyCecil.1.24.0-beta2\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
<Reference Include="Mono.Cecil.Pdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\FodyCecil.2.0.0\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Rocks">
<HintPath>..\packages\FodyCecil.1.24.0-beta2\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
<Reference Include="Mono.Cecil.Rocks, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\FodyCecil.2.0.0\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion SwallowExceptions/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FodyCecil" version="1.24.0-beta2" targetFramework="net40" developmentDependency="true" />
<package id="FodyCecil" version="2.0.0" targetFramework="net40" developmentDependency="true" />
</packages>

0 comments on commit 472b39b

Please sign in to comment.