Imported Upstream version 5.20.0.180

Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-02-04 20:11:37 +00:00
parent 0e2d47d1c8
commit 0510252385
3360 changed files with 83827 additions and 39243 deletions

View File

@@ -13,3 +13,4 @@ Mono.Cecil.sln.ide*
TestResults
project.lock.json
.vs/
.idea/

View File

@@ -1,8 +0,0 @@
language: csharp
solution: Mono.Cecil.sln
install:
- nuget restore Mono.Cecil.sln
- nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory testrunner
script:
- xbuild /p:Configuration=net_4_0_Debug Mono.Cecil.sln
- mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe Mono.Cecil.nunit

View File

@@ -158,7 +158,6 @@ namespace Mono.Cecil.Cil {
public ISymbolReader GetSymbolReader (ModuleDefinition module, string fileName)
{
Mixin.CheckModule (module);
Mixin.CheckFileName (fileName);
var header = module.GetDebugHeader ();
var entry = header.GetEmbeddedPortablePdbEntry ();
@@ -451,6 +450,8 @@ namespace Mono.Cecil.Cil {
var directory = new ImageDebugDirectory {
Type = ImageDebugType.EmbeddedPortablePdb,
MajorVersion = 0x0100,
MinorVersion = 0x0100,
};
var data = new MemoryStream ();

View File

@@ -16,6 +16,7 @@ using SR = System.Reflection;
using Mono.Collections.Generic;
using Mono.Cecil.Cil;
using Mono.Cecil.PE;
namespace Mono.Cecil.Cil {
@@ -855,7 +856,69 @@ namespace Mono.Cecil.Cil {
public ISymbolReader GetSymbolReader (ModuleDefinition module, Stream symbolStream)
{
throw new NotSupportedException ();
if (module.Image.HasDebugTables ())
return null;
if (module.HasDebugHeader) {
var header = module.GetDebugHeader ();
var entry = header.GetEmbeddedPortablePdbEntry ();
if (entry != null)
return new EmbeddedPortablePdbReaderProvider ().GetSymbolReader (module, "");
}
Mixin.CheckStream (symbolStream);
Mixin.CheckReadSeek (symbolStream);
var position = symbolStream.Position;
const int portablePdbHeader = 0x424a5342;
var reader = new BinaryStreamReader (symbolStream);
var intHeader = reader.ReadInt32 ();
symbolStream.Position = position;
if (intHeader == portablePdbHeader) {
return new PortablePdbReaderProvider ().GetSymbolReader (module, symbolStream);
}
const string nativePdbHeader = "Microsoft C/C++ MSF 7.00";
var bytesHeader = reader.ReadBytes (nativePdbHeader.Length);
symbolStream.Position = position;
var isNativePdb = true;
for (var i = 0; i < bytesHeader.Length; i++) {
if (bytesHeader [i] != (byte) nativePdbHeader [i]) {
isNativePdb = false;
break;
}
}
if (isNativePdb) {
try {
return SymbolProvider.GetReaderProvider (SymbolKind.NativePdb).GetSymbolReader (module, symbolStream);
} catch (Exception) {
// We might not include support for native pdbs.
}
}
const long mdbHeader = 0x45e82623fd7fa614;
var longHeader = reader.ReadInt64 ();
symbolStream.Position = position;
if (longHeader == mdbHeader) {
try {
return SymbolProvider.GetReaderProvider (SymbolKind.Mdb).GetSymbolReader (module, symbolStream);
} catch (Exception) {
// We might not include support for mdbs.
}
}
if (throw_if_no_symbol)
throw new SymbolsNotFoundException (string.Format ("No symbols found in stream"));
return null;
}
}

View File

@@ -13,13 +13,13 @@
</PropertyGroup>
<ItemGroup Condition="$(NetStandard)">
<PackageReference Include="NUnit">
<Version>3.7.1</Version>
<Version>3.10.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.3.0</Version>
<Version>15.8.0</Version>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter">
<Version>3.8.0</Version>
<Version>3.10.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="!$(NetStandard)">

View File

@@ -2,7 +2,7 @@
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Mono.Cecil</id>
<version>0.10.0.0</version>
<version>0.10.1.0</version>
<title>Mono.Cecil</title>
<authors>Jb Evain</authors>
<owners>Jb Evain</owners>

View File

@@ -43,6 +43,10 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<DefineConstants>$(DefineConstants);NET_4_0;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" $(Configuration.StartsWith('net_462_')) ">
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<DefineConstants>$(DefineConstants);NET_4_0;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(NetStandard)">
<TargetFramework Condition="$(IsTestProject)">netcoreapp2.0</TargetFramework>
<TargetFramework Condition="!$(IsTestProject)">netstandard1.3</TargetFramework>
@@ -62,6 +66,10 @@
<PropertyGroup Condition=" '$(Configuration)' == 'net_4_0_Debug_ReadOnly' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_4_0_Release' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_4_0_Release_ReadOnly' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_462_Debug' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_462_Debug_ReadOnly' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_462_Release' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_462_Release_ReadOnly' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'netstandard_Debug' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'netstandard_Debug_ReadOnly' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'netstandard_Release' "/>

View File

@@ -37,6 +37,10 @@ Global
net_4_0_Debug|Any CPU = net_4_0_Debug|Any CPU
net_4_0_Release_ReadOnly|Any CPU = net_4_0_Release_ReadOnly|Any CPU
net_4_0_Release|Any CPU = net_4_0_Release|Any CPU
net_462_Debug_ReadOnly|Any CPU = net_462_Debug_ReadOnly|Any CPU
net_462_Debug|Any CPU = net_462_Debug|Any CPU
net_462_Release_ReadOnly|Any CPU = net_462_Release_ReadOnly|Any CPU
net_462_Release|Any CPU = net_462_Release|Any CPU
netstandard_Debug_ReadOnly|Any CPU = netstandard_Debug_ReadOnly|Any CPU
netstandard_Debug|Any CPU = netstandard_Debug|Any CPU
netstandard_Release_ReadOnly|Any CPU = netstandard_Release_ReadOnly|Any CPU
@@ -59,6 +63,14 @@ Global
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_0_Release_ReadOnly|Any CPU.Build.0 = net_4_0_Release_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_0_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_0_Release|Any CPU.Build.0 = net_4_0_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_462_Debug_ReadOnly|Any CPU.ActiveCfg = net_462_Debug_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_462_Debug_ReadOnly|Any CPU.Build.0 = net_462_Debug_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_462_Debug|Any CPU.ActiveCfg = net_462_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_462_Debug|Any CPU.Build.0 = net_462_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_462_Release_ReadOnly|Any CPU.ActiveCfg = net_462_Release_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_462_Release_ReadOnly|Any CPU.Build.0 = net_462_Release_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_462_Release|Any CPU.ActiveCfg = net_462_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_462_Release|Any CPU.Build.0 = net_462_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.netstandard_Debug_ReadOnly|Any CPU.Build.0 = netstandard_Debug_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.netstandard_Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
@@ -83,6 +95,14 @@ Global
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_4_0_Release_ReadOnly|Any CPU.Build.0 = net_4_0_Release_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_4_0_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_4_0_Release|Any CPU.Build.0 = net_4_0_Release|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_462_Debug_ReadOnly|Any CPU.ActiveCfg = net_462_Debug_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_462_Debug_ReadOnly|Any CPU.Build.0 = net_462_Debug_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_462_Debug|Any CPU.ActiveCfg = net_462_Debug|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_462_Debug|Any CPU.Build.0 = net_462_Debug|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_462_Release_ReadOnly|Any CPU.ActiveCfg = net_462_Release_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_462_Release_ReadOnly|Any CPU.Build.0 = net_462_Release_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_462_Release|Any CPU.ActiveCfg = net_462_Release|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_462_Release|Any CPU.Build.0 = net_462_Release|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.netstandard_Debug_ReadOnly|Any CPU.Build.0 = netstandard_Debug_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.netstandard_Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
@@ -107,6 +127,14 @@ Global
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Release_ReadOnly|Any CPU.Build.0 = net_4_0_Release_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Release|Any CPU.Build.0 = net_4_0_Release|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_462_Debug_ReadOnly|Any CPU.ActiveCfg = net_462_Debug_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_462_Debug_ReadOnly|Any CPU.Build.0 = net_462_Debug_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_462_Debug|Any CPU.ActiveCfg = net_462_Debug|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_462_Debug|Any CPU.Build.0 = net_462_Debug|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_462_Release_ReadOnly|Any CPU.ActiveCfg = net_462_Release_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_462_Release_ReadOnly|Any CPU.Build.0 = net_462_Release_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_462_Release|Any CPU.ActiveCfg = net_462_Release|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_462_Release|Any CPU.Build.0 = net_462_Release|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Debug_ReadOnly|Any CPU.Build.0 = netstandard_Debug_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
@@ -131,6 +159,14 @@ Global
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_4_0_Release_ReadOnly|Any CPU.Build.0 = net_4_0_Release_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_4_0_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_4_0_Release|Any CPU.Build.0 = net_4_0_Release|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_462_Debug_ReadOnly|Any CPU.ActiveCfg = net_462_Debug_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_462_Debug_ReadOnly|Any CPU.Build.0 = net_462_Debug_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_462_Debug|Any CPU.ActiveCfg = net_462_Debug|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_462_Debug|Any CPU.Build.0 = net_462_Debug|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_462_Release_ReadOnly|Any CPU.ActiveCfg = net_462_Release_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_462_Release_ReadOnly|Any CPU.Build.0 = net_462_Release_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_462_Release|Any CPU.ActiveCfg = net_462_Release|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_462_Release|Any CPU.Build.0 = net_462_Release|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.netstandard_Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.netstandard_Release_ReadOnly|Any CPU.ActiveCfg = netstandard_Release_ReadOnly|Any CPU
@@ -151,6 +187,14 @@ Global
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_4_0_Release_ReadOnly|Any CPU.Build.0 = net_4_0_Release_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_4_0_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_4_0_Release|Any CPU.Build.0 = net_4_0_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_462_Debug_ReadOnly|Any CPU.ActiveCfg = net_462_Debug_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_462_Debug_ReadOnly|Any CPU.Build.0 = net_462_Debug_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_462_Debug|Any CPU.ActiveCfg = net_462_Debug|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_462_Debug|Any CPU.Build.0 = net_462_Debug|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_462_Release_ReadOnly|Any CPU.ActiveCfg = net_462_Release_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_462_Release_ReadOnly|Any CPU.Build.0 = net_462_Release_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_462_Release|Any CPU.ActiveCfg = net_462_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_462_Release|Any CPU.Build.0 = net_462_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.netstandard_Debug_ReadOnly|Any CPU.Build.0 = netstandard_Debug_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.netstandard_Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
@@ -175,6 +219,14 @@ Global
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_4_0_Release_ReadOnly|Any CPU.Build.0 = net_4_0_Release_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_4_0_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_4_0_Release|Any CPU.Build.0 = net_4_0_Release|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_462_Debug_ReadOnly|Any CPU.ActiveCfg = net_462_Debug_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_462_Debug_ReadOnly|Any CPU.Build.0 = net_462_Debug_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_462_Debug|Any CPU.ActiveCfg = net_462_Debug|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_462_Debug|Any CPU.Build.0 = net_462_Debug|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_462_Release_ReadOnly|Any CPU.ActiveCfg = net_462_Release_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_462_Release_ReadOnly|Any CPU.Build.0 = net_462_Release_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_462_Release|Any CPU.ActiveCfg = net_462_Release|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_462_Release|Any CPU.Build.0 = net_462_Release|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.netstandard_Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.netstandard_Release_ReadOnly|Any CPU.ActiveCfg = netstandard_Release_ReadOnly|Any CPU
@@ -195,6 +247,14 @@ Global
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_4_0_Release_ReadOnly|Any CPU.Build.0 = net_4_0_Release_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_4_0_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_4_0_Release|Any CPU.Build.0 = net_4_0_Release|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_462_Debug_ReadOnly|Any CPU.ActiveCfg = net_462_Debug_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_462_Debug_ReadOnly|Any CPU.Build.0 = net_462_Debug_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_462_Debug|Any CPU.ActiveCfg = net_462_Debug|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_462_Debug|Any CPU.Build.0 = net_462_Debug|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_462_Release_ReadOnly|Any CPU.ActiveCfg = net_462_Release_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_462_Release_ReadOnly|Any CPU.Build.0 = net_462_Release_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_462_Release|Any CPU.ActiveCfg = net_462_Release|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_462_Release|Any CPU.Build.0 = net_462_Release|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.netstandard_Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.netstandard_Release_ReadOnly|Any CPU.ActiveCfg = netstandard_Release_ReadOnly|Any CPU
@@ -215,6 +275,14 @@ Global
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_4_0_Release_ReadOnly|Any CPU.Build.0 = net_4_0_Release_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_4_0_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_4_0_Release|Any CPU.Build.0 = net_4_0_Release|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_462_Debug_ReadOnly|Any CPU.ActiveCfg = net_462_Debug_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_462_Debug_ReadOnly|Any CPU.Build.0 = net_462_Debug_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_462_Debug|Any CPU.ActiveCfg = net_462_Debug|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_462_Debug|Any CPU.Build.0 = net_462_Debug|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_462_Release_ReadOnly|Any CPU.ActiveCfg = net_462_Release_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_462_Release_ReadOnly|Any CPU.Build.0 = net_462_Release_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_462_Release|Any CPU.ActiveCfg = net_462_Release|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_462_Release|Any CPU.Build.0 = net_462_Release|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.netstandard_Debug_ReadOnly|Any CPU.Build.0 = netstandard_Debug_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.netstandard_Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU

View File

@@ -2406,6 +2406,9 @@ namespace Mono.Cecil {
if (token.TokenType != TokenType.Signature)
throw new NotSupportedException ();
if (token.RID == 0)
return null;
if (!MoveTo (Table.StandAloneSig, token.RID))
return null;
@@ -3763,8 +3766,10 @@ namespace Mono.Cecil {
if (length == 0)
return string.Empty;
var @string = Encoding.UTF8.GetString (buffer, position,
buffer [position + length - 1] == 0 ? length - 1 : length);
if (position + length >= buffer.Length)
return string.Empty;
var @string = Encoding.UTF8.GetString (buffer, position, length);
position += length;
return @string;

View File

@@ -1445,8 +1445,7 @@ namespace Mono.Cecil {
if (type.HasInterfaces)
AddInterfaces (type);
if (type.HasLayoutInfo)
AddLayoutInfo (type);
AddLayoutInfo (type);
if (type.HasFields)
AddFields (type);
@@ -1557,12 +1556,36 @@ namespace Mono.Cecil {
void AddLayoutInfo (TypeDefinition type)
{
var table = GetTable<ClassLayoutTable> (Table.ClassLayout);
if (type.HasLayoutInfo) {
var table = GetTable<ClassLayoutTable> (Table.ClassLayout);
table.AddRow (new ClassLayoutRow (
(ushort) type.PackingSize,
(uint) type.ClassSize,
type.token.RID));
table.AddRow (new ClassLayoutRow (
(ushort) type.PackingSize,
(uint) type.ClassSize,
type.token.RID));
return;
}
if (type.IsValueType && HasNoInstanceField (type)) {
var table = GetTable<ClassLayoutTable> (Table.ClassLayout);
table.AddRow (new ClassLayoutRow (0, 1, type.token.RID));
}
}
static bool HasNoInstanceField (TypeDefinition type)
{
if (!type.HasFields)
return true;
var fields = type.Fields;
for (int i = 0; i < fields.Count; i++)
if (!fields [i].IsStatic)
return false;
return true;
}
void AddNestedTypes (TypeDefinition type)
@@ -3162,7 +3185,7 @@ namespace Mono.Cecil {
void WriteTypeReference (TypeReference type)
{
WriteUTF8String (TypeParser.ToParseable (type));
WriteUTF8String (TypeParser.ToParseable (type, top_level: false));
}
public void WriteMarshalInfo (MarshalInfo marshal_info)

View File

@@ -59,6 +59,15 @@ namespace Mono.Cecil {
this.member = member;
}
public ResolutionException (MemberReference member, Exception innerException)
: base ("Failed to resolve " + member.FullName, innerException)
{
if (member == null)
throw new ArgumentNullException ("member");
this.member = member;
}
#if !NET_CORE
ResolutionException (
System.Runtime.Serialization.SerializationInfo info,

View File

@@ -402,13 +402,13 @@ namespace Mono.Cecil {
return false;
}
public static string ToParseable (TypeReference type)
public static string ToParseable (TypeReference type, bool top_level = true)
{
if (type == null)
return null;
var name = new StringBuilder ();
AppendType (type, name, true, true);
AppendType (type, name, true, top_level);
return name.ToString ();
}

View File

@@ -15,6 +15,6 @@ using System.Runtime.InteropServices;
[assembly: ComVisible (false)]
[assembly: AssemblyVersion ("0.10.0.0")]
[assembly: AssemblyFileVersion ("0.10.0.0")]
[assembly: AssemblyInformationalVersion ("0.10.0.0")]
[assembly: AssemblyVersion ("0.10.1.0")]
[assembly: AssemblyFileVersion ("0.10.1.0")]
[assembly: AssemblyInformationalVersion ("0.10.1.0")]

View File

@@ -51,6 +51,11 @@ namespace Mono.Cecil.Tests {
return ModuleDefinition.ReadModule (GetAssemblyResourcePath (name, GetType ().Assembly), new ReaderParameters (mode));
}
public Stream GetResourceStream (string name)
{
return new FileStream (GetAssemblyResourcePath (name, GetType ().Assembly), FileMode.Open, FileAccess.Read);
}
internal Image GetResourceImage (string name)
{
var file = new FileStream (GetAssemblyResourcePath (name, GetType ().Assembly), FileMode.Open, FileAccess.Read);

View File

@@ -449,6 +449,21 @@ namespace Mono.Cecil.Tests {
});
}
[Test]
public void NullCharInString ()
{
TestCSharp ("CustomAttributes.cs", module => {
var type = module.GetType ("NullCharInString");
var attributes = type.CustomAttributes;
Assert.AreEqual (1, attributes.Count);
var attribute = attributes [0];
Assert.AreEqual (1, attribute.ConstructorArguments.Count);
var value = (string) attribute.ConstructorArguments [0].Value;
Assert.AreEqual (8, value.Length);
Assert.AreEqual ('\0', value [7]);
});
}
#if !READ_ONLY
[Test]
public void DefineCustomAttributeFromBlob ()

View File

@@ -364,6 +364,8 @@ namespace Mono.Cecil.Tests {
var eppdb = header.Entries [1];
Assert.AreEqual (ImageDebugType.EmbeddedPortablePdb, eppdb.Directory.Type);
Assert.AreEqual (0x0100, eppdb.Directory.MajorVersion);
Assert.AreEqual (0x0100, eppdb.Directory.MinorVersion);
}, symbolReaderProvider: typeof (EmbeddedPortablePdbReaderProvider), symbolWriterProvider: typeof (EmbeddedPortablePdbWriterProvider));
}

View File

@@ -80,6 +80,58 @@ namespace Mono.Cecil.Tests {
Assert.IsFalse (module.HasSymbols);
}
}
[Test]
public void DefaultPortablePdbStream ()
{
using (var symbolStream = GetResourceStream ("PdbTarget.pdb")) {
var parameters = new ReaderParameters {
SymbolReaderProvider = new PortablePdbReaderProvider (),
SymbolStream = symbolStream,
};
using (var module = GetResourceModule ("PdbTarget.exe", parameters)) {
Assert.IsNotNull (module.SymbolReader);
Assert.IsTrue (module.HasSymbols);
Assert.AreEqual (typeof (PortablePdbReader), module.SymbolReader.GetType ());
}
}
}
[Test]
public void DefaultPdbStream ()
{
using (var symbolStream = GetResourceStream ("libpdb.pdb")) {
var parameters = new ReaderParameters {
SymbolReaderProvider = new NativePdbReaderProvider (),
SymbolStream = symbolStream,
};
using (var module = GetResourceModule ("libpdb.dll", parameters)) {
Assert.IsNotNull (module.SymbolReader);
Assert.IsTrue (module.HasSymbols);
Assert.AreEqual (typeof (NativePdbReader), module.SymbolReader.GetType ());
}
}
}
[Test]
public void DefaultMdbStream ()
{
using (var symbolStream = GetResourceStream ("libmdb.dll.mdb")) {
var parameters = new ReaderParameters {
SymbolReaderProvider = new MdbReaderProvider (),
SymbolStream = symbolStream,
};
using (var module = GetResourceModule ("libmdb.dll", parameters)) {
Assert.IsNotNull (module.SymbolReader);
Assert.IsTrue (module.HasSymbols);
Assert.AreEqual (typeof (MdbReader), module.SymbolReader.GetType ());
}
}
}
}
}
#endif
#endif

View File

@@ -30,6 +30,19 @@ namespace Mono.Cecil.Tests {
});
}
[Test]
public void EmptyStructLayout ()
{
TestModule ("hello.exe", module =>
{
var foo = new TypeDefinition ("", "Foo",
TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit | TypeAttributes.SequentialLayout,
module.ImportReference (typeof (ValueType))) ;
module.Types.Add (foo) ;
}) ;
}
[Test]
public void SimpleInterfaces ()
{

View File

@@ -156,3 +156,7 @@ class Parent {
public class Child {
}
}
[Foo ("Foo\0Bar\0")]
class NullCharInString {
}

View File

@@ -222,7 +222,7 @@ namespace Mono.Cecil.Rocks {
void WriteItemName (string name)
{
id.Append (name.Replace ('.', '#'));
id.Append (name.Replace ('.', '#').Replace('<', '{').Replace('>', '}'));
}
public override string ToString ()

Some files were not shown because too many files have changed in this diff Show More