Imported Upstream version 5.4.0.199

Former-commit-id: f4d318e4b2f128fa9f4d31b37bb3839a3fc0dfb2
This commit is contained in:
Xamarin Public Jenkins (auto-signing) 2017-09-25 16:57:44 +00:00
parent 536cd135cc
commit 5924117973
223 changed files with 3826 additions and 487 deletions

View File

@ -1 +1 @@
4983f549ffc7653871992231faccc651ea216755
dda12b89b57ec43ec7425bee91b759452f9ece18

View File

@ -1 +1 @@
db56ea81331da24e34c3ea02e0cc19e0c3330fb4
62872d5f3cb314c4c4b962ce6f487b4e2941c0de

View File

@ -221,7 +221,7 @@
<div class="mapi-declaration mapi-section">Syntax</div>
<div class="mapi-prototype">void
mono_raise_exception (MonoException *ex)
mono_reraise_exception (MonoException *ex)
</div>
<p />

View File

@ -160,7 +160,8 @@ namespace Mono.Cecil.Cil {
void ReadScope (ScopeDebugInformation scope)
{
var start_instruction = GetInstruction (scope.Start.Offset);
scope.Start = new InstructionOffset (start_instruction);
if (start_instruction != null)
scope.Start = new InstructionOffset (start_instruction);
var end_instruction = GetInstruction (scope.End.Offset);
scope.End = end_instruction != null

View File

@ -2954,14 +2954,20 @@ namespace Mono.Cecil {
if (record.Col2.Length > 0) {
scope.variables = new Collection<VariableDebugInformation> ((int) record.Col2.Length);
for (uint i = 0; i < record.Col2.Length; i++)
scope.variables.Add (ReadLocalVariable (record.Col2.Start + i));
for (uint i = 0; i < record.Col2.Length; i++) {
var variable = ReadLocalVariable (record.Col2.Start + i);
if (variable != null)
scope.variables.Add (variable);
}
}
if (record.Col3.Length > 0) {
scope.constants = new Collection<ConstantDebugInformation> ((int) record.Col3.Length);
for (uint i = 0; i < record.Col3.Length; i++)
scope.constants.Add (ReadLocalConstant (record.Col3.Start + i));
for (uint i = 0; i < record.Col3.Length; i++) {
var constant = ReadLocalConstant (record.Col3.Start + i);
if (constant != null)
scope.constants.Add (constant);
}
}
return scope;

View File

@ -23,4 +23,6 @@ bin/
*.force
*.FileListAbsolute.txt
*.FileListAbsolute.txt
**/Dependencies/*.dll

View File

@ -3,3 +3,9 @@ root = true
[*.cs]
indent_style = tab
csharp_space_between_method_declaration_name_and_open_parenthesis = true
csharp_space_between_method_call_name_and_opening_parenthesis = true
csharp_space_before_open_square_brackets = true
csharp_new_line_before_open_brace = methods
csharp_new_line_before_else = false
csharp_indent_switch_labels = false

View File

@ -161,11 +161,12 @@ namespace Mono.Cecil.Cil {
{
var start_instruction = GetInstruction (scope.Start.Offset);
if (start_instruction != null)
scope.Start = new InstructionOffset (start_instruction);
scope.Start = new InstructionOffset (start_instruction);
var end_instruction = GetInstruction (scope.End.Offset);
if (end_instruction != null)
scope.End = new InstructionOffset (end_instruction);
scope.End = end_instruction != null
? new InstructionOffset (end_instruction)
: new InstructionOffset ();
if (!scope.variables.IsNullOrEmpty ()) {
for (int i = 0; i < scope.variables.Count; i++) {

View File

@ -60,10 +60,12 @@ namespace Mono.Cecil.Cil {
this.debug_reader = new MetadataReader (image, module, this.reader);
}
#if !READ_ONLY
public ISymbolWriterProvider GetWriterProvider ()
{
return new PortablePdbWriterProvider ();
}
#endif
public bool ProcessDebugHeader (ImageDebugHeader header)
{
@ -92,7 +94,11 @@ namespace Mono.Cecil.Cil {
var pdb_guid = new Guid (buffer);
return module_guid == pdb_guid;
if (module_guid != pdb_guid)
return false;
ReadModule ();
return true;
}
static int ReadInt32 (byte [] bytes, int start)
@ -103,6 +109,11 @@ namespace Mono.Cecil.Cil {
| (bytes [start + 3] << 24));
}
void ReadModule ()
{
module.custom_infos = debug_reader.GetCustomDebugInformation (module);
}
public MethodDebugInformation Read (MethodDefinition method)
{
var info = new MethodDebugInformation (method);
@ -190,11 +201,12 @@ namespace Mono.Cecil.Cil {
this.reader = reader;
}
#if !READ_ONLY
public ISymbolWriterProvider GetWriterProvider ()
{
return new EmbeddedPortablePdbWriterProvider ();
}
#endif
public bool ProcessDebugHeader (ImageDebugHeader header)
{
return reader.ProcessDebugHeader (header);
@ -244,6 +256,7 @@ namespace Mono.Cecil.Cil {
interface IMetadataSymbolWriter : ISymbolWriter {
void SetMetadata (MetadataBuilder metadata);
void WriteModule ();
}
public sealed class PortablePdbWriter : ISymbolWriter, IMetadataSymbolWriter {
@ -276,6 +289,11 @@ namespace Mono.Cecil.Cil {
this.pdb_metadata.metadata_builder = metadata;
}
void IMetadataSymbolWriter.WriteModule ()
{
pdb_metadata.AddCustomDebugInformations (module);
}
public ISymbolReaderProvider GetReaderProvider ()
{
return new PortablePdbReaderProvider ();
@ -471,6 +489,11 @@ namespace Mono.Cecil.Cil {
{
((IMetadataSymbolWriter) writer).SetMetadata (metadata);
}
void IMetadataSymbolWriter.WriteModule ()
{
((IMetadataSymbolWriter) writer).WriteModule ();
}
}
#endif

View File

@ -433,6 +433,8 @@ namespace Mono.Cecil.Cil {
DynamicVariable,
DefaultNamespace,
AsyncMethodBody,
EmbeddedSource,
SourceLink,
}
public abstract class CustomDebugInformation : DebugInformation {
@ -558,6 +560,57 @@ namespace Mono.Cecil.Cil {
}
}
public sealed class EmbeddedSourceDebugInformation : CustomDebugInformation {
internal byte [] content;
internal bool compress;
public byte [] Content {
get { return content; }
set { content = value; }
}
public bool Compress {
get { return compress; }
set { compress = value; }
}
public override CustomDebugInformationKind Kind {
get { return CustomDebugInformationKind.EmbeddedSource; }
}
public static Guid KindIdentifier = new Guid ("{0E8A571B-6926-466E-B4AD-8AB04611F5FE}");
public EmbeddedSourceDebugInformation (byte [] content, bool compress)
: base (KindIdentifier)
{
this.content = content;
this.compress = compress;
}
}
public sealed class SourceLinkDebugInformation : CustomDebugInformation {
internal string content;
public string Content {
get { return content; }
set { content = value; }
}
public override CustomDebugInformationKind Kind {
get { return CustomDebugInformationKind.SourceLink; }
}
public static Guid KindIdentifier = new Guid ("{CC110556-A091-4D38-9FEC-25AB9A351A6A}");
public SourceLinkDebugInformation (string content)
: base (KindIdentifier)
{
this.content = content;
}
}
public sealed class MethodDebugInformation : DebugInformation {
internal MethodDefinition method;
@ -683,8 +736,9 @@ namespace Mono.Cecil.Cil {
}
public interface ISymbolReader : IDisposable {
#if !READ_ONLY
ISymbolWriterProvider GetWriterProvider ();
#endif
bool ProcessDebugHeader (ImageDebugHeader header);
MethodDebugInformation Read (MethodDefinition method);
}
@ -722,14 +776,25 @@ namespace Mono.Cecil.Cil {
var pdb_file_name = Mixin.GetPdbFileName (fileName);
if (File.Exists (pdb_file_name))
return Mixin.IsPortablePdb (Mixin.GetPdbFileName (fileName))
? new PortablePdbReaderProvider ().GetSymbolReader (module, fileName)
: SymbolProvider.GetReaderProvider (SymbolKind.NativePdb).GetSymbolReader (module, fileName);
if (File.Exists (pdb_file_name)) {
if (Mixin.IsPortablePdb (Mixin.GetPdbFileName (fileName)))
return new PortablePdbReaderProvider ().GetSymbolReader (module, fileName);
try {
return SymbolProvider.GetReaderProvider (SymbolKind.NativePdb).GetSymbolReader (module, fileName);
} catch (TypeLoadException) {
// We might not include support for native pdbs.
}
}
var mdb_file_name = Mixin.GetMdbFileName (fileName);
if (File.Exists (mdb_file_name))
return SymbolProvider.GetReaderProvider (SymbolKind.Mdb).GetSymbolReader (module, fileName);
if (File.Exists (mdb_file_name)) {
try {
return SymbolProvider.GetReaderProvider (SymbolKind.Mdb).GetSymbolReader (module, fileName);
} catch (TypeLoadException) {
// We might not include support for mdbs.
}
}
if (throw_if_no_symbol)
throw new FileNotFoundException (string.Format ("No symbol found for file: {0}", fileName));
@ -930,6 +995,7 @@ namespace Mono.Cecil {
{
const uint ppdb_signature = 0x424a5342;
if (stream.Length < 4) return false;
var position = stream.Position;
try {
var reader = new BinaryReader (stream);

View File

@ -197,7 +197,7 @@ namespace Mono.Cecil.PE {
void WritePEFileHeader ()
{
WriteUInt32 (0x00004550); // Magic
WriteUInt16 (GetMachine ()); // Machine
WriteUInt16 ((ushort) module.Architecture); // Machine
WriteUInt16 (sections); // NumberOfSections
WriteUInt32 (metadata.timestamp);
WriteUInt32 (0); // PointerToSymbolTable
@ -211,22 +211,6 @@ namespace Mono.Cecil.PE {
WriteUInt16 (characteristics); // Characteristics
}
ushort GetMachine ()
{
switch (module.Architecture) {
case TargetArchitecture.I386:
return 0x014c;
case TargetArchitecture.AMD64:
return 0x8664;
case TargetArchitecture.IA64:
return 0x0200;
case TargetArchitecture.ARMv7:
return 0x01c4;
}
throw new NotSupportedException ();
}
Section LastSection ()
{
if (reloc != null)

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-beta5</version>
<version>0.10.0.0-beta6</version>
<title>Mono.Cecil</title>
<authors>Jb Evain</authors>
<owners>Jb Evain</owners>

View File

@ -15,7 +15,7 @@
<NetStandard Condition=" $(Configuration.StartsWith('netstandard')) Or '$(NuGetRestoreTargets)' != '' ">true</NetStandard>
<NetStandard Condition=" '$(NetStandard)' == '' ">false</NetStandard>
</PropertyGroup>
<PropertyGroup Condition=" $(Configuration.EndsWith('Debug')) ">
<PropertyGroup Condition=" $(Configuration.Contains('Debug')) ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@ -23,7 +23,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" $(Configuration.EndsWith('Release')) ">
<PropertyGroup Condition=" $(Configuration.Contains('Release')) ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>$(DefineConstants);TRACE;</DefineConstants>
@ -31,6 +31,9 @@
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" $(Configuration.Contains('ReadOnly')) ">
<DefineConstants>$(DefineConstants);READ_ONLY;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" $(Configuration.StartsWith('net_3_5')) ">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<DefineConstants>$(DefineConstants);</DefineConstants>
@ -49,18 +52,18 @@
<Reference Include="System" />
</ItemGroup>
<!-- The following keeps Visual Studio happy; let's keep Visual Studio happy -->
<PropertyGroup Condition=" '$(Configuration)' == 'net_3_5_Debug' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'net_3_5_Release' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'net_4_0_Debug' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'net_4_0_Release' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'netstandard_Debug' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'netstandard_Release' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'net_3_5_Debug' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_3_5_Debug_ReadOnly' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_3_5_Release' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_3_5_Release_ReadOnly' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'net_4_0_Debug' "/>
<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)' == 'netstandard_Debug' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'netstandard_Debug_ReadOnly' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'netstandard_Release' "/>
<PropertyGroup Condition=" '$(Configuration)' == 'netstandard_Release_ReadOnly' "/>
<!-- This optional import allows products that distribute Cecil to tweak settings that will affect its
build, without having to fork the project unnecessarily. The Mono.Cecil.overrides file is a plain
MSBuild file with additional properties, and can exist anywhere upwards from the current Cecil repo

View File

@ -24,100 +24,202 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil.Rocks", "rocks\M
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
net_3_5_Debug_ReadOnly|Any CPU = net_3_5_Debug_ReadOnly|Any CPU
net_3_5_Debug|Any CPU = net_3_5_Debug|Any CPU
net_3_5_Release_ReadOnly|Any CPU = net_3_5_Release_ReadOnly|Any CPU
net_3_5_Release|Any CPU = net_3_5_Release|Any CPU
net_4_0_Debug_ReadOnly|Any CPU = net_4_0_Debug_ReadOnly|Any CPU
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
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
netstandard_Release|Any CPU = netstandard_Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_3_5_Debug_ReadOnly|Any CPU.ActiveCfg = net_3_5_Debug_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_3_5_Debug_ReadOnly|Any CPU.Build.0 = net_3_5_Debug_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_3_5_Debug|Any CPU.ActiveCfg = net_3_5_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_3_5_Debug|Any CPU.Build.0 = net_3_5_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_3_5_Release_ReadOnly|Any CPU.ActiveCfg = net_3_5_Release_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_3_5_Release_ReadOnly|Any CPU.Build.0 = net_3_5_Release_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_3_5_Release|Any CPU.ActiveCfg = net_3_5_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_3_5_Release|Any CPU.Build.0 = net_3_5_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_0_Debug_ReadOnly|Any CPU.ActiveCfg = net_4_0_Debug_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_0_Debug_ReadOnly|Any CPU.Build.0 = net_4_0_Debug_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_0_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_0_Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.net_4_0_Release_ReadOnly|Any CPU.ActiveCfg = net_4_0_Release_ReadOnly|Any CPU
{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}.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
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.netstandard_Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.netstandard_Release_ReadOnly|Any CPU.ActiveCfg = netstandard_Release_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.netstandard_Release_ReadOnly|Any CPU.Build.0 = netstandard_Release_ReadOnly|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.netstandard_Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.netstandard_Release|Any CPU.Build.0 = netstandard_Release|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_3_5_Debug_ReadOnly|Any CPU.ActiveCfg = net_3_5_Debug_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_3_5_Debug_ReadOnly|Any CPU.Build.0 = net_3_5_Debug_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_3_5_Debug|Any CPU.ActiveCfg = net_3_5_Debug|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_3_5_Debug|Any CPU.Build.0 = net_3_5_Debug|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_3_5_Release_ReadOnly|Any CPU.ActiveCfg = net_3_5_Release_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_3_5_Release_ReadOnly|Any CPU.Build.0 = net_3_5_Release_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_3_5_Release|Any CPU.ActiveCfg = net_3_5_Release|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_3_5_Release|Any CPU.Build.0 = net_3_5_Release|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_4_0_Debug_ReadOnly|Any CPU.ActiveCfg = net_4_0_Debug_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_4_0_Debug_ReadOnly|Any CPU.Build.0 = net_4_0_Debug_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_4_0_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_4_0_Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.net_4_0_Release_ReadOnly|Any CPU.ActiveCfg = net_4_0_Release_ReadOnly|Any CPU
{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}.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
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.netstandard_Release_ReadOnly|Any CPU.ActiveCfg = netstandard_Release_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.netstandard_Release_ReadOnly|Any CPU.Build.0 = netstandard_Release_ReadOnly|Any CPU
{A47B1F49-A81A-43E8-BE6B-DD28AF2C4055}.netstandard_Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Debug_ReadOnly|Any CPU.ActiveCfg = net_3_5_Debug_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Debug_ReadOnly|Any CPU.Build.0 = net_3_5_Debug_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Debug|Any CPU.ActiveCfg = net_3_5_Debug|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Debug|Any CPU.Build.0 = net_3_5_Debug|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Release_ReadOnly|Any CPU.ActiveCfg = net_3_5_Release_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Release_ReadOnly|Any CPU.Build.0 = net_3_5_Release_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Release|Any CPU.ActiveCfg = net_3_5_Release|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Release|Any CPU.Build.0 = net_3_5_Release|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Debug_ReadOnly|Any CPU.ActiveCfg = net_4_0_Debug_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Debug_ReadOnly|Any CPU.Build.0 = net_4_0_Debug_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Release_ReadOnly|Any CPU.ActiveCfg = net_4_0_Release_ReadOnly|Any CPU
{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}.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
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Release_ReadOnly|Any CPU.ActiveCfg = netstandard_Release_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Release_ReadOnly|Any CPU.Build.0 = netstandard_Release_ReadOnly|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Release|Any CPU.Build.0 = netstandard_Release|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_3_5_Debug_ReadOnly|Any CPU.ActiveCfg = net_3_5_Debug_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_3_5_Debug_ReadOnly|Any CPU.Build.0 = net_3_5_Debug_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_3_5_Debug|Any CPU.ActiveCfg = net_3_5_Debug|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_3_5_Debug|Any CPU.Build.0 = net_3_5_Debug|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_3_5_Release_ReadOnly|Any CPU.ActiveCfg = net_3_5_Release_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_3_5_Release_ReadOnly|Any CPU.Build.0 = net_3_5_Release_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_3_5_Release|Any CPU.ActiveCfg = net_3_5_Release|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_3_5_Release|Any CPU.Build.0 = net_3_5_Release|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_4_0_Debug_ReadOnly|Any CPU.ActiveCfg = net_4_0_Debug_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_4_0_Debug_ReadOnly|Any CPU.Build.0 = net_4_0_Debug_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_4_0_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_4_0_Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.net_4_0_Release_ReadOnly|Any CPU.ActiveCfg = net_4_0_Release_ReadOnly|Any CPU
{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}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.netstandard_Debug_ReadOnly|Any CPU.Build.0 = 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
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.netstandard_Release_ReadOnly|Any CPU.Build.0 = netstandard_Release_ReadOnly|Any CPU
{AC71DF9C-99FA-4A63-990A-66C8010355A6}.netstandard_Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_3_5_Debug_ReadOnly|Any CPU.ActiveCfg = net_3_5_Debug_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_3_5_Debug_ReadOnly|Any CPU.Build.0 = net_3_5_Debug_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_3_5_Debug|Any CPU.ActiveCfg = net_3_5_Debug|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_3_5_Debug|Any CPU.Build.0 = net_3_5_Debug|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_3_5_Release_ReadOnly|Any CPU.ActiveCfg = net_3_5_Release_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_3_5_Release_ReadOnly|Any CPU.Build.0 = net_3_5_Release_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_3_5_Release|Any CPU.ActiveCfg = net_3_5_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_3_5_Release|Any CPU.Build.0 = net_3_5_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_4_0_Debug_ReadOnly|Any CPU.ActiveCfg = net_4_0_Debug_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_4_0_Debug_ReadOnly|Any CPU.Build.0 = net_4_0_Debug_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_4_0_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_4_0_Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.net_4_0_Release_ReadOnly|Any CPU.ActiveCfg = net_4_0_Release_ReadOnly|Any CPU
{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}.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
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.netstandard_Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.netstandard_Release_ReadOnly|Any CPU.ActiveCfg = netstandard_Release_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.netstandard_Release_ReadOnly|Any CPU.Build.0 = netstandard_Release_ReadOnly|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.netstandard_Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{63E6915C-7EA4-4D76-AB28-0D7191EEA626}.netstandard_Release|Any CPU.Build.0 = netstandard_Release|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_3_5_Debug_ReadOnly|Any CPU.ActiveCfg = net_3_5_Debug_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_3_5_Debug_ReadOnly|Any CPU.Build.0 = net_3_5_Debug_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_3_5_Debug|Any CPU.ActiveCfg = net_3_5_Debug|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_3_5_Debug|Any CPU.Build.0 = net_3_5_Debug|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_3_5_Release_ReadOnly|Any CPU.ActiveCfg = net_3_5_Release_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_3_5_Release_ReadOnly|Any CPU.Build.0 = net_3_5_Release_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_3_5_Release|Any CPU.ActiveCfg = net_3_5_Release|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_3_5_Release|Any CPU.Build.0 = net_3_5_Release|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_4_0_Debug_ReadOnly|Any CPU.ActiveCfg = net_4_0_Debug_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_4_0_Debug_ReadOnly|Any CPU.Build.0 = net_4_0_Debug_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_4_0_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_4_0_Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.net_4_0_Release_ReadOnly|Any CPU.ActiveCfg = net_4_0_Release_ReadOnly|Any CPU
{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}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.netstandard_Debug_ReadOnly|Any CPU.Build.0 = 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
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.netstandard_Release_ReadOnly|Any CPU.Build.0 = netstandard_Release_ReadOnly|Any CPU
{29300103-CB76-4A1D-B6FD-FFD91C1EC8AA}.netstandard_Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_3_5_Debug_ReadOnly|Any CPU.ActiveCfg = net_3_5_Debug_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_3_5_Debug_ReadOnly|Any CPU.Build.0 = net_3_5_Debug_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_3_5_Debug|Any CPU.ActiveCfg = net_3_5_Debug|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_3_5_Debug|Any CPU.Build.0 = net_3_5_Debug|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_3_5_Release_ReadOnly|Any CPU.ActiveCfg = net_3_5_Release_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_3_5_Release_ReadOnly|Any CPU.Build.0 = net_3_5_Release_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_3_5_Release|Any CPU.ActiveCfg = net_3_5_Release|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_3_5_Release|Any CPU.Build.0 = net_3_5_Release|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_4_0_Debug_ReadOnly|Any CPU.ActiveCfg = net_4_0_Debug_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_4_0_Debug_ReadOnly|Any CPU.Build.0 = net_4_0_Debug_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_4_0_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_4_0_Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.net_4_0_Release_ReadOnly|Any CPU.ActiveCfg = net_4_0_Release_ReadOnly|Any CPU
{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}.netstandard_Debug_ReadOnly|Any CPU.ActiveCfg = netstandard_Debug_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.netstandard_Debug_ReadOnly|Any CPU.Build.0 = 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
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.netstandard_Release_ReadOnly|Any CPU.Build.0 = netstandard_Release_ReadOnly|Any CPU
{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}.netstandard_Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_3_5_Debug_ReadOnly|Any CPU.ActiveCfg = net_3_5_Debug_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_3_5_Debug_ReadOnly|Any CPU.Build.0 = net_3_5_Debug_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_3_5_Debug|Any CPU.ActiveCfg = net_3_5_Debug|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_3_5_Debug|Any CPU.Build.0 = net_3_5_Debug|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_3_5_Release_ReadOnly|Any CPU.ActiveCfg = net_3_5_Release_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_3_5_Release_ReadOnly|Any CPU.Build.0 = net_3_5_Release_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_3_5_Release|Any CPU.ActiveCfg = net_3_5_Release|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_3_5_Release|Any CPU.Build.0 = net_3_5_Release|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_4_0_Debug_ReadOnly|Any CPU.ActiveCfg = net_4_0_Debug_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_4_0_Debug_ReadOnly|Any CPU.Build.0 = net_4_0_Debug_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_4_0_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_4_0_Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.net_4_0_Release_ReadOnly|Any CPU.ActiveCfg = net_4_0_Release_ReadOnly|Any CPU
{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}.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
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.netstandard_Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.netstandard_Release_ReadOnly|Any CPU.ActiveCfg = netstandard_Release_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.netstandard_Release_ReadOnly|Any CPU.Build.0 = netstandard_Release_ReadOnly|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.netstandard_Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU
{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}.netstandard_Release|Any CPU.Build.0 = netstandard_Release|Any CPU
EndGlobalSection

View File

@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using Mono.Collections.Generic;
@ -2856,12 +2857,22 @@ namespace Mono.Cecil {
if (signature == 0)
return new Collection<SequencePoint> (0);
var document = metadata.GetDocument (document_index);
var document = GetDocument (document_index);
var reader = ReadSignature (signature);
return reader.ReadSequencePoints (document);
}
public Document GetDocument (uint rid)
{
var document = metadata.GetDocument (rid);
if (document == null)
return null;
document.custom_infos = GetCustomDebugInformation (document);
return document;
}
void InitializeLocalScopes ()
{
if (metadata.LocalScopes != null)
@ -2943,14 +2954,20 @@ namespace Mono.Cecil {
if (record.Col2.Length > 0) {
scope.variables = new Collection<VariableDebugInformation> ((int) record.Col2.Length);
for (uint i = 0; i < record.Col2.Length; i++)
scope.variables.Add (ReadLocalVariable (record.Col2.Start + i));
for (uint i = 0; i < record.Col2.Length; i++) {
var variable = ReadLocalVariable (record.Col2.Start + i);
if (variable != null)
scope.variables.Add (variable);
}
}
if (record.Col3.Length > 0) {
scope.constants = new Collection<ConstantDebugInformation> ((int) record.Col3.Length);
for (uint i = 0; i < record.Col3.Length; i++)
scope.constants.Add (ReadLocalConstant (record.Col3.Start + i));
for (uint i = 0; i < record.Col3.Length; i++) {
var constant = ReadLocalConstant (record.Col3.Start + i);
if (constant != null)
scope.constants.Add (constant);
}
}
return scope;
@ -3187,6 +3204,31 @@ namespace Mono.Cecil {
async_body.move_next = GetMethodDefinition (move_next_rid);
infos.Add (async_body);
} else if (rows [i].Col1 == EmbeddedSourceDebugInformation.KindIdentifier) {
var signature = ReadSignature (rows [i].Col2);
var format = signature.ReadInt32 ();
var length = signature.sig_length - 4;
var info = null as CustomDebugInformation;
if (format == 0) {
info = new EmbeddedSourceDebugInformation (signature.ReadBytes ((int) length), compress: false);
} else if (format > 0) {
var compressed_stream = new MemoryStream (signature.ReadBytes ((int) length));
var decompressed_document = new byte [format]; // if positive, format is the decompressed length of the document
var decompressed_stream = new MemoryStream (decompressed_document);
using (var deflate_stream = new DeflateStream (compressed_stream, CompressionMode.Decompress, leaveOpen: true))
deflate_stream.CopyTo (decompressed_stream);
info = new EmbeddedSourceDebugInformation (decompressed_document, compress: true);
} else if (format < 0) {
info = new BinaryCustomDebugInformation (rows [i].Col1, ReadBlob (rows [i].Col2));
}
infos.Add (info);
} else if (rows [i].Col1 == SourceLinkDebugInformation.KindIdentifier) {
infos.Add (new SourceLinkDebugInformation (Encoding.UTF8.GetString (ReadBlob (rows [i].Col2))));
} else {
infos.Add (new BinaryCustomDebugInformation (rows [i].Col1, ReadBlob (rows [i].Col2)));
}
@ -3759,7 +3801,7 @@ namespace Mono.Cecil {
ReadCompressedUInt32 (); // local_sig_token
if (document == null)
document = reader.metadata.GetDocument (ReadCompressedUInt32 ());
document = reader.GetDocument (ReadCompressedUInt32 ());
var offset = 0;
var start_line = 0;
@ -3769,7 +3811,7 @@ namespace Mono.Cecil {
for (var i = 0; CanReadMore (); i++) {
var delta_il = (int) ReadCompressedUInt32 ();
if (i > 0 && delta_il == 0) {
document = reader.metadata.GetDocument (ReadCompressedUInt32 ());
document = reader.GetDocument (ReadCompressedUInt32 ());
continue;
}

View File

@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using Mono;
@ -72,7 +73,13 @@ namespace Mono.Cecil {
static class ModuleWriter {
public static void WriteModuleTo (ModuleDefinition module, Disposable<Stream> stream, WriterParameters parameters)
public static void WriteModule (ModuleDefinition module, Disposable<Stream> stream, WriterParameters parameters)
{
using (stream)
Write (module, stream, parameters);
}
static void Write (ModuleDefinition module, Disposable<Stream> stream, WriterParameters parameters)
{
if ((module.Attributes & ModuleAttributes.ILOnly) == 0)
throw new NotSupportedException ("Writing mixed-mode assemblies is not supported");
@ -90,13 +97,12 @@ namespace Mono.Cecil {
var name = module.assembly != null ? module.assembly.Name : null;
var fq_name = stream.value.GetFileName ();
var timestamp = parameters.Timestamp ?? module.timestamp;
var symbol_writer_provider = parameters.SymbolWriterProvider;
if (symbol_writer_provider == null && parameters.WriteSymbols)
symbol_writer_provider = new DefaultSymbolWriterProvider ();
var symbol_writer = GetSymbolWriter (module, fq_name, symbol_writer_provider, parameters);
#if !NET_CORE
if (parameters.StrongNameKeyPair != null && name != null) {
name.PublicKey = parameters.StrongNameKeyPair.PublicKey;
@ -104,26 +110,19 @@ namespace Mono.Cecil {
}
#endif
var timestamp = parameters.Timestamp ?? module.timestamp;
using (var symbol_writer = GetSymbolWriter (module, fq_name, symbol_writer_provider, parameters)) {
var metadata = new MetadataBuilder (module, fq_name, timestamp, symbol_writer_provider, symbol_writer);
BuildMetadata (module, metadata);
var metadata = new MetadataBuilder (module, fq_name, timestamp, symbol_writer_provider, symbol_writer);
BuildMetadata (module, metadata);
var writer = ImageWriter.CreateWriter (module, metadata, stream);
stream.value.SetLength (0);
writer.WriteImage ();
if (metadata.symbol_writer != null)
metadata.symbol_writer.Dispose ();
var writer = ImageWriter.CreateWriter (module, metadata, stream);
stream.value.SetLength (0);
writer.WriteImage ();
#if !NET_CORE
if (parameters.StrongNameKeyPair != null)
CryptoService.StrongName (stream.value, writer, parameters.StrongNameKeyPair);
if (parameters.StrongNameKeyPair != null)
CryptoService.StrongName (stream.value, writer, parameters.StrongNameKeyPair);
#endif
stream.Dispose ();
}
}
static void BuildMetadata (ModuleDefinition module, MetadataBuilder metadata)
@ -776,7 +775,7 @@ namespace Mono.Cecil {
}
}
sealed class CustomDebugInformationTable : MetadataTable<CustomDebugInformationRow> {
sealed class CustomDebugInformationTable : SortedTable<CustomDebugInformationRow> {
public override void Write (TableHeapBuffer buffer)
{
@ -786,6 +785,11 @@ namespace Mono.Cecil {
buffer.WriteBlob (rows [i].Col3); // Value
}
}
public override int Compare (CustomDebugInformationRow x, CustomDebugInformationRow y)
{
return Compare(x.Col1, y.Col1);
}
}
sealed class MetadataBuilder {
@ -1046,6 +1050,10 @@ namespace Mono.Cecil {
if (module.EntryPoint != null)
entry_point = LookupToken (module.EntryPoint);
var pdb_writer = symbol_writer as IMetadataSymbolWriter;
if (pdb_writer != null)
pdb_writer.WriteModule ();
}
void BuildAssembly ()
@ -2347,7 +2355,7 @@ namespace Mono.Cecil {
return signature;
}
void AddCustomDebugInformations (ICustomDebugInformationProvider provider)
public void AddCustomDebugInformations (ICustomDebugInformationProvider provider)
{
if (!provider.HasCustomDebugInformations)
return;
@ -2367,6 +2375,12 @@ namespace Mono.Cecil {
case CustomDebugInformationKind.StateMachineScope:
AddStateMachineScopeDebugInformation (provider, (StateMachineScopeDebugInformation) custom_info);
break;
case CustomDebugInformationKind.EmbeddedSource:
AddEmbeddedSourceDebugInformation (provider, (EmbeddedSourceDebugInformation) custom_info);
break;
case CustomDebugInformationKind.SourceLink:
AddSourceLinkDebugInformation (provider, (SourceLinkDebugInformation) custom_info);
break;
default:
throw new NotImplementedException ();
}
@ -2403,6 +2417,36 @@ namespace Mono.Cecil {
AddCustomDebugInformation (provider, async_method, signature);
}
void AddEmbeddedSourceDebugInformation (ICustomDebugInformationProvider provider, EmbeddedSourceDebugInformation embedded_source)
{
var signature = CreateSignatureWriter ();
var content = embedded_source.content ?? Empty<byte>.Array;
if (embedded_source.compress) {
signature.WriteInt32 (content.Length);
var decompressed_stream = new MemoryStream (content);
var content_stream = new MemoryStream ();
using (var compress_stream = new DeflateStream (content_stream, CompressionMode.Compress, leaveOpen: true))
decompressed_stream.CopyTo (compress_stream);
signature.WriteBytes (content_stream.ToArray ());
} else {
signature.WriteInt32 (0);
signature.WriteBytes (content);
}
AddCustomDebugInformation (provider, embedded_source, signature);
}
void AddSourceLinkDebugInformation (ICustomDebugInformationProvider provider, SourceLinkDebugInformation source_link)
{
var signature = CreateSignatureWriter ();
signature.WriteBytes (Encoding.UTF8.GetBytes (source_link.content));
AddCustomDebugInformation (provider, source_link, signature);
}
void AddCustomDebugInformation (ICustomDebugInformationProvider provider, CustomDebugInformation custom_info, SignatureWriter signature)
{
AddCustomDebugInformation (provider, custom_info, GetBlobIndex (signature));
@ -2507,6 +2551,8 @@ namespace Mono.Cecil {
document.token = token;
AddCustomDebugInformations (document);
document_map.Add (document.Url, token);
return token;

View File

@ -45,7 +45,12 @@ namespace Mono.Cecil {
}
public AssemblyResolutionException (AssemblyNameReference reference)
: base (string.Format ("Failed to resolve assembly: '{0}'", reference))
: this (reference, null)
{
}
public AssemblyResolutionException (AssemblyNameReference reference, Exception innerException)
: base (string.Format ("Failed to resolve assembly: '{0}'", reference), innerException)
{
this.reference = reference;
}
@ -123,9 +128,12 @@ namespace Mono.Cecil {
}
var framework_dir = Path.GetDirectoryName (typeof (object).Module.FullyQualifiedName);
var framework_dirs = on_mono
? new [] { framework_dir, Path.Combine (framework_dir, "Facades") }
: new [] { framework_dir };
if (IsZero (name.Version)) {
assembly = SearchDirectory (name, new [] { framework_dir }, parameters);
assembly = SearchDirectory (name, framework_dirs, parameters);
if (assembly != null)
return assembly;
}
@ -140,7 +148,7 @@ namespace Mono.Cecil {
if (assembly != null)
return assembly;
assembly = SearchDirectory (name, new [] { framework_dir }, parameters);
assembly = SearchDirectory (name, framework_dirs, parameters);
if (assembly != null)
return assembly;

View File

@ -24,6 +24,7 @@ namespace Mono.Cecil {
}
public interface IMetadataImporter {
AssemblyNameReference ImportReference (AssemblyNameReference reference);
TypeReference ImportReference (TypeReference type, IGenericParameterProvider context);
FieldReference ImportReference (FieldReference field, IGenericParameterProvider context);
MethodReference ImportReference (MethodReference method, IGenericParameterProvider context);
@ -34,6 +35,7 @@ namespace Mono.Cecil {
}
public interface IReflectionImporter {
AssemblyNameReference ImportReference (SR.AssemblyName reference);
TypeReference ImportReference (Type type, IGenericParameterProvider context);
FieldReference ImportReference (SR.FieldInfo field, IGenericParameterProvider context);
MethodReference ImportReference (SR.MethodBase method, IGenericParameterProvider context);
@ -122,11 +124,11 @@ namespace Mono.Cecil {
}
}
public class ReflectionImporter : IReflectionImporter {
public class DefaultReflectionImporter : IReflectionImporter {
readonly ModuleDefinition module;
readonly protected ModuleDefinition module;
public ReflectionImporter (ModuleDefinition module)
public DefaultReflectionImporter (ModuleDefinition module)
{
Mixin.CheckModule (module);
@ -294,14 +296,19 @@ namespace Mono.Cecil {
AssemblyNameReference ImportScope (SR.Assembly assembly)
{
AssemblyNameReference scope;
return ImportReference (assembly.GetName ());
}
var name = assembly.GetName ();
public virtual AssemblyNameReference ImportReference (SR.AssemblyName name)
{
Mixin.CheckName (name);
if (TryGetAssemblyNameReference (name, out scope))
return scope;
AssemblyNameReference reference;
if (TryGetAssemblyNameReference (name, out reference))
return reference;
scope = new AssemblyNameReference (name.Name, name.Version) {
reference = new AssemblyNameReference (name.Name, name.Version)
{
PublicKeyToken = name.GetPublicKeyToken (),
#if !NET_CORE
Culture = name.CultureInfo.Name,
@ -309,9 +316,9 @@ namespace Mono.Cecil {
#endif
};
module.AssemblyReferences.Add (scope);
module.AssemblyReferences.Add (reference);
return scope;
return reference;
}
bool TryGetAssemblyNameReference (SR.AssemblyName name, out AssemblyNameReference assembly_reference)
@ -477,11 +484,11 @@ namespace Mono.Cecil {
}
}
public class MetadataImporter : IMetadataImporter {
public class DefaultMetadataImporter : IMetadataImporter {
readonly ModuleDefinition module;
readonly protected ModuleDefinition module;
public MetadataImporter (ModuleDefinition module)
public DefaultMetadataImporter (ModuleDefinition module)
{
Mixin.CheckModule (module);
@ -515,10 +522,10 @@ namespace Mono.Cecil {
{
switch (scope.MetadataScopeType) {
case MetadataScopeType.AssemblyNameReference:
return ImportAssemblyName ((AssemblyNameReference) scope);
return ImportReference ((AssemblyNameReference) scope);
case MetadataScopeType.ModuleDefinition:
if (scope == module) return scope;
return ImportAssemblyName (((ModuleDefinition) scope).Assembly.Name);
return ImportReference (((ModuleDefinition) scope).Assembly.Name);
case MetadataScopeType.ModuleReference:
throw new NotImplementedException ();
}
@ -526,8 +533,10 @@ namespace Mono.Cecil {
throw new NotSupportedException ();
}
internal virtual AssemblyNameReference ImportAssemblyName (AssemblyNameReference name)
public virtual AssemblyNameReference ImportReference (AssemblyNameReference name)
{
Mixin.CheckName (name);
AssemblyNameReference reference;
if (module.TryGetAssemblyNameReference (name, out reference))
return reference;

View File

@ -171,11 +171,11 @@ namespace Mono.Cecil {
public MethodDebugInformation DebugInformation {
get {
Mixin.Read (Body);
if (debug_info != null)
return debug_info;
Mixin.Read (Body);
return debug_info ?? (debug_info = new MethodDebugInformation (this));
}
}
@ -416,6 +416,11 @@ namespace Mono.Cecil {
set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.NoOptimization, value); }
}
public bool AggressiveInlining {
get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.AggressiveInlining); }
set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.AggressiveInlining, value); }
}
#endregion
#region MethodSemanticsAttributes

View File

@ -31,5 +31,6 @@ namespace Mono.Cecil {
Synchronized = 0x0020, // Method is single threaded through the body
NoOptimization = 0x0040, // Method is not optimized by the JIT.
NoInlining = 0x0008, // Method may not be inlined
AggressiveInlining = 0x0100, // Method should be inlined, if possible.
}
}

View File

@ -254,7 +254,7 @@ namespace Mono.Cecil {
#endif
public sealed class ModuleDefinition : ModuleReference, ICustomAttributeProvider, IDisposable {
public sealed class ModuleDefinition : ModuleReference, ICustomAttributeProvider, ICustomDebugInformationProvider, IDisposable {
internal Image Image;
internal MetadataSystem MetadataSystem;
@ -294,6 +294,8 @@ namespace Mono.Cecil {
Collection<ExportedType> exported_types;
TypeDefinitionCollection types;
internal Collection<CustomDebugInformation> custom_infos;
public bool IsMain {
get { return kind != ModuleKind.NetModule; }
}
@ -386,7 +388,7 @@ namespace Mono.Cecil {
internal IReflectionImporter ReflectionImporter {
get {
if (reflection_importer == null)
Interlocked.CompareExchange (ref reflection_importer, new ReflectionImporter (this), null);
Interlocked.CompareExchange (ref reflection_importer, new DefaultReflectionImporter (this), null);
return reflection_importer;
}
@ -395,13 +397,13 @@ namespace Mono.Cecil {
internal IMetadataImporter MetadataImporter {
get {
if (metadata_importer == null)
Interlocked.CompareExchange (ref metadata_importer, new MetadataImporter (this), null);
Interlocked.CompareExchange (ref metadata_importer, new DefaultMetadataImporter (this), null);
return metadata_importer;
}
}
internal void SetMetadataImporter (MetadataImporter importer)
internal void SetMetadataImporter (IMetadataImporter importer)
{
if (this.metadata_importer != null)
throw new InvalidOperationException ();
@ -580,6 +582,18 @@ namespace Mono.Cecil {
set { entry_point = value; }
}
public bool HasCustomDebugInformations {
get {
return custom_infos != null && custom_infos.Count > 0;
}
}
public Collection<CustomDebugInformation> CustomDebugInformations {
get {
return custom_infos ?? (custom_infos = new Collection<CustomDebugInformation> ());
}
}
internal ModuleDefinition ()
{
this.MetadataSystem = new MetadataSystem ();
@ -1149,7 +1163,7 @@ namespace Mono.Cecil {
{
Mixin.CheckParameters (parameters);
var file = GetFileStream (fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
ModuleWriter.WriteModuleTo (this, Disposable.Owned (file), parameters);
ModuleWriter.WriteModule (this, Disposable.Owned (file), parameters);
}
public void Write ()
@ -1176,7 +1190,7 @@ namespace Mono.Cecil {
Mixin.CheckWriteSeek (stream);
Mixin.CheckParameters (parameters);
ModuleWriter.WriteModuleTo (this, Disposable.NotOwned (stream), parameters);
ModuleWriter.WriteModule (this, Disposable.NotOwned (stream), parameters);
}
#endif
@ -1237,17 +1251,15 @@ namespace Mono.Cecil {
public static void CheckWriteSeek (Stream stream)
{
if (!stream.CanWrite || !stream.CanSeek)
throw new ArgumentException ();
throw new ArgumentException ("Stream must be writable and seekable.");
}
public static void CheckReadSeek (Stream stream)
{
if (!stream.CanRead || !stream.CanSeek)
throw new ArgumentException ();
throw new ArgumentException ("Stream must be readable and seekable.");
}
#if !READ_ONLY
public static void CheckType (object type)
{
if (type == null)
@ -1272,8 +1284,6 @@ namespace Mono.Cecil {
throw new ArgumentNullException (Argument.method.ToString ());
}
#endif
public static void CheckParameters (object parameters)
{
if (parameters == null)

View File

@ -17,4 +17,4 @@ using System.Runtime.InteropServices;
[assembly: AssemblyVersion ("0.10.0.0")]
[assembly: AssemblyFileVersion ("0.10.0.0")]
[assembly: AssemblyInformationalVersion ("0.10.0.0-beta5")]
[assembly: AssemblyInformationalVersion ("0.10.0.0-beta6")]

View File

@ -87,7 +87,7 @@ namespace Mono.Cecil.Tests {
Assert.AreEqual (Normalize (expected), Normalize (Formatter.FormatMethodBody (method)));
}
static string Normalize (string str)
public static string Normalize (string str)
{
return str.Trim ().Replace ("\r\n", "\n");
}
@ -118,11 +118,13 @@ namespace Mono.Cecil.Tests {
if (testCase.ReadOnly)
return;
#if !READ_ONLY
using (var runner = new TestRunner (testCase, TestCaseType.WriteFromDeferred))
runner.RunTest ();
using (var runner = new TestRunner (testCase, TestCaseType.WriteFromImmediate))
runner.RunTest ();
#endif
}
}
@ -237,12 +239,14 @@ namespace Mono.Cecil.Tests {
case TestCaseType.ReadDeferred:
parameters.ReadingMode = ReadingMode.Deferred;
return ModuleDefinition.ReadModule (location, parameters);
#if !READ_ONLY
case TestCaseType.WriteFromImmediate:
parameters.ReadingMode = ReadingMode.Immediate;
return RoundTrip (location, parameters, "cecil-irt");
case TestCaseType.WriteFromDeferred:
parameters.ReadingMode = ReadingMode.Deferred;
return RoundTrip (location, parameters, "cecil-drt");
#endif
default:
return null;
}
@ -256,6 +260,7 @@ namespace Mono.Cecil.Tests {
return (ISymbolReaderProvider) Activator.CreateInstance (test_case.SymbolReaderProvider);
}
#if !READ_ONLY
ISymbolWriterProvider GetSymbolWriterProvider ()
{
if (test_case.SymbolReaderProvider == null)
@ -263,6 +268,7 @@ namespace Mono.Cecil.Tests {
return (ISymbolWriterProvider) Activator.CreateInstance (test_case.SymbolWriterProvider);
}
#endif
IAssemblyResolver GetAssemblyResolver ()
{
@ -275,6 +281,7 @@ namespace Mono.Cecil.Tests {
return test_resolver;
}
#if !READ_ONLY
ModuleDefinition RoundTrip (string location, ReaderParameters reader_parameters, string folder)
{
var rt_folder = Path.Combine (Path.GetTempPath (), folder);
@ -297,7 +304,7 @@ namespace Mono.Cecil.Tests {
return ModuleDefinition.ReadModule (rt_module, reader_parameters);
}
#endif
public void RunTest ()
{
var module = GetModule ();
@ -321,7 +328,9 @@ namespace Mono.Cecil.Tests {
enum TestCaseType {
ReadImmediate,
ReadDeferred,
#if !READ_ONLY
WriteFromImmediate,
WriteFromDeferred,
#endif
}
}

View File

@ -251,6 +251,10 @@ namespace Mono.Cecil.Tests {
static string WinSdkTool (string tool)
{
var sdks = new [] {
@"Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7 Tools",
@"Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools",
@"Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools",
@"Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools",
@"Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools",
@"Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools",
@"Microsoft SDKs\Windows\v7.0A\Bin",

View File

@ -449,6 +449,7 @@ namespace Mono.Cecil.Tests {
});
}
#if !READ_ONLY
[Test]
public void DefineCustomAttributeFromBlob ()
{
@ -486,7 +487,7 @@ namespace Mono.Cecil.Tests {
module.Dispose ();
}
#endif
static void AssertCustomAttribute (string expected, CustomAttribute attribute)
{
Assert.AreEqual (expected, PrettyPrint (attribute));

View File

@ -195,6 +195,7 @@ namespace Mono.Cecil.Tests {
});
}
#if !READ_ONLY
[Test]
public void ExternalPdbDeterministicAssembly ()
{
@ -223,5 +224,6 @@ namespace Mono.Cecil.Tests {
Assert.IsTrue (header.Entries.Any (e => e.Directory.Type == ImageDebugType.EmbeddedPortablePdb));
}, symbolReaderProvider: typeof (EmbeddedPortablePdbReaderProvider), symbolWriterProvider: typeof (EmbeddedPortablePdbWriterProvider));
}
#endif
}
}

View File

@ -1,3 +1,4 @@
#if !READ_ONLY
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -372,3 +373,4 @@ namespace Mono.Cecil.Tests {
}
}
}
#endif

View File

@ -1,3 +1,4 @@
#if !READ_ONLY
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -419,3 +420,4 @@ namespace Mono.Cecil.Tests {
}
}
}
#endif

View File

@ -12,6 +12,7 @@ namespace Mono.Cecil.Tests {
[TestFixture]
public class ModuleTests : BaseTestFixture {
#if !READ_ONLY
[Test]
public void CreateModuleEscapesAssemblyName ()
{
@ -21,6 +22,7 @@ namespace Mono.Cecil.Tests {
module = ModuleDefinition.CreateModule ("Test.exe", ModuleKind.Console);
Assert.AreEqual ("Test", module.Assembly.Name.Name);
}
#endif
[Test]
public void SingleModule ()
@ -277,6 +279,7 @@ namespace Mono.Cecil.Tests {
}
}
#if !READ_ONLY
[Test]
public void ReadAndWriteFile ()
{
@ -294,5 +297,21 @@ namespace Mono.Cecil.Tests {
using (var module = ModuleDefinition.ReadModule (path))
Assert.AreEqual ("Foo.Foo", module.Types [1].FullName);
}
[Test]
public void ExceptionInWriteDoesNotKeepLockOnFile ()
{
var path = Path.GetTempFileName ();
var module = ModuleDefinition.CreateModule ("FooFoo", ModuleKind.Dll);
// Mixed mode module that Cecil can not write
module.Attributes = (ModuleAttributes) 0;
Assert.Throws<NotSupportedException>(() => module.Write (path));
// Ensure you can still delete the file
File.Delete (path);
}
#endif
}
}

View File

@ -1,6 +1,8 @@
#if !READ_ONLY
using System;
using System.IO;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Mono.Cecil.Cil;
@ -337,6 +339,7 @@ namespace Mono.Cecil.Tests {
});
}
#if !READ_ONLY
[Test]
public void EmbeddedCompressedPortablePdb ()
{
@ -396,13 +399,135 @@ namespace Mono.Cecil.Tests {
var symbol = method.DebugInformation;
Assert.IsNotNull (symbol);
Assert.AreEqual(1, symbol.Scope.Constants.Count);
Assert.AreEqual (1, symbol.Scope.Constants.Count);
var a = symbol.Scope.Constants [0];
Assert.AreEqual ("a", a.Name);
}, symbolReaderProvider: typeof (PortablePdbReaderProvider), symbolWriterProvider: typeof (PortablePdbWriterProvider));
}
[Test]
public void InvalidConstantRecord ()
{
using (var module = GetResourceModule ("mylib.dll", new ReaderParameters { SymbolReaderProvider = new PortablePdbReaderProvider () })) {
var type = module.GetType ("mylib.Say");
var method = type.GetMethod ("hello");
var symbol = method.DebugInformation;
Assert.IsNotNull (symbol);
Assert.AreEqual (0, symbol.Scope.Constants.Count);
}
}
[Test]
public void SourceLink ()
{
TestModule ("TargetLib.dll", module => {
Assert.IsTrue (module.HasCustomDebugInformations);
Assert.AreEqual (1, module.CustomDebugInformations.Count);
var source_link = module.CustomDebugInformations [0] as SourceLinkDebugInformation;
Assert.IsNotNull (source_link);
Assert.AreEqual ("{\"documents\":{\"C:\\\\tmp\\\\SourceLinkProblem\\\\*\":\"https://raw.githubusercontent.com/bording/SourceLinkProblem/197d965ee7f1e7f8bd3cea55b5f904aeeb8cd51e/*\"}}", source_link.Content);
}, symbolReaderProvider: typeof (PortablePdbReaderProvider), symbolWriterProvider: typeof (PortablePdbWriterProvider));
}
[Test]
public void EmbeddedSource ()
{
TestModule ("embedcs.exe", module => {
var program = GetDocument (module.GetType ("Program"));
var program_src = GetSourceDebugInfo (program);
Assert.IsTrue (program_src.compress);
var program_src_content = Encoding.UTF8.GetString (program_src.Content);
Assert.AreEqual (Normalize (@"using System;
class Program
{
static void Main()
{
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
// Hello hello hello hello hello hello
Console.WriteLine(B.Do());
Console.WriteLine(A.Do());
}
}
"), Normalize (program_src_content));
var a = GetDocument (module.GetType ("A"));
var a_src = GetSourceDebugInfo (a);
Assert.IsFalse (a_src.compress);
var a_src_content = Encoding.UTF8.GetString (a_src.Content);
Assert.AreEqual (Normalize (@"class A
{
public static string Do()
{
return ""A::Do"";
}
}"), Normalize (a_src_content));
var b = GetDocument(module.GetType ("B"));
var b_src = GetSourceDebugInfo (b);
Assert.IsFalse (b_src.compress);
var b_src_content = Encoding.UTF8.GetString (b_src.Content);
Assert.AreEqual (Normalize (@"class B
{
public static string Do()
{
return ""B::Do"";
}
}"), Normalize (b_src_content));
}, symbolReaderProvider: typeof (PortablePdbReaderProvider), symbolWriterProvider: typeof (PortablePdbWriterProvider));
}
static Document GetDocument (TypeDefinition type)
{
foreach (var method in type.Methods) {
if (!method.HasBody)
continue;
foreach (var instruction in method.Body.Instructions) {
var sp = method.DebugInformation.GetSequencePoint (instruction);
if (sp != null && sp.Document != null)
return sp.Document;
}
}
return null;
}
static EmbeddedSourceDebugInformation GetSourceDebugInfo (Document document)
{
Assert.IsTrue (document.HasCustomDebugInformations);
Assert.AreEqual (1, document.CustomDebugInformations.Count);
var source = document.CustomDebugInformations [0] as EmbeddedSourceDebugInformation;
Assert.IsNotNull (source);
return source;
}
[Test]
public void PortablePdbLineInfo ()
{
@ -418,5 +543,7 @@ namespace Mono.Cecil.Tests {
IL_0001: ret", main);
}, symbolReaderProvider: typeof (PortablePdbReaderProvider), symbolWriterProvider: typeof (PortablePdbWriterProvider));
}
#endif
}
}
#endif

View File

@ -93,6 +93,7 @@ namespace Mono.Cecil.Tests {
});
}
#if !READ_ONLY
[Test]
public void DefineSecurityDeclarationByBlob ()
{
@ -125,6 +126,7 @@ namespace Mono.Cecil.Tests {
Assert.AreEqual ("System.String", argument.Type.FullName);
Assert.AreEqual (permission_set, argument.Value);
}
#endif
[Test]
public void SecurityDeclarationWithoutAttributes ()

View File

@ -1,3 +1,4 @@
#if !READ_ONLY
using System;
using System.IO;
@ -51,3 +52,4 @@ namespace Mono.Cecil.Tests {
}
}
}
#endif

View File

@ -63,6 +63,7 @@ namespace Mono.Cecil.Tests {
}, verify: false, assemblyResolver: WindowsRuntimeAssemblyResolver.CreateInstance (), applyWindowsRuntimeProjections: true);
}
#if !READ_ONLY
[Test]
public void CanStripType ()
{
@ -90,6 +91,7 @@ namespace Mono.Cecil.Tests {
}
}, readOnly: true, verify: false, assemblyResolver: assemblyResolver, applyWindowsRuntimeProjections: true);
}
#endif
}
[TestFixture]

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -58,10 +58,5 @@ namespace Mono.Cecil.Tests {
Assert.AreEqual (Normalize (permission_set_value), Normalize (permission_set.ToXml ().ToString ()));
});
}
static string Normalize (string s)
{
return s.Replace ("\n", "").Replace ("\r", "");
}
}
}

View File

@ -1,3 +1,4 @@
#if !READ_ONLY
using System;
using Mono.Cecil.Rocks;
@ -121,4 +122,5 @@ namespace Mono.Cecil.Tests {
return ModuleDefinition.ReadModule (typeof (TypeReferenceRocksTests).Module.FullyQualifiedName).ImportReference (type);
}
}
}
}
#endif

View File

@ -58,10 +58,12 @@ namespace Mono.Cecil.Mdb {
this.documents = new Dictionary<string, Document> ();
}
#if !READ_ONLY
public ISymbolWriterProvider GetWriterProvider ()
{
return new MdbWriterProvider ();
}
#endif
public bool ProcessDebugHeader (ImageDebugHeader header)
{

View File

@ -684,6 +684,7 @@ namespace Mono.CompilerServices.SymbolWriter
byte[] hash;
bool creating;
bool auto_generated;
readonly string sourceFile;
public static int Size {
get { return 8; }
@ -698,11 +699,17 @@ namespace Mono.CompilerServices.SymbolWriter
creating = true;
}
public SourceFileEntry (MonoSymbolFile file, string file_name, byte[] guid, byte[] checksum)
: this (file, file_name)
public SourceFileEntry (MonoSymbolFile file, string sourceFile, byte [] guid, byte [] checksum)
: this (file, sourceFile, sourceFile, guid, checksum)
{
}
public SourceFileEntry (MonoSymbolFile file, string fileName, string sourceFile, byte[] guid, byte[] checksum)
: this (file, fileName)
{
this.guid = guid;
this.hash = checksum;
this.sourceFile = sourceFile;
}
public byte[] Checksum {
@ -719,29 +726,22 @@ namespace Mono.CompilerServices.SymbolWriter
if (guid == null)
guid = new byte[16];
if (hash == null)
hash = ComputeHash ();
if (hash == null) {
try {
using (FileStream fs = new FileStream (sourceFile, FileMode.Open, FileAccess.Read)) {
MD5 md5 = MD5.Create ();
hash = md5.ComputeHash (fs);
}
} catch {
hash = new byte [16];
}
}
bw.Write (guid);
bw.Write (hash);
bw.Write ((byte) (auto_generated ? 1 : 0));
}
private byte [] ComputeHash ()
{
if (!File.Exists (file_name))
return new byte [16];
try {
using (FileStream fs = new FileStream (file_name, FileMode.Open, FileAccess.Read)) {
MD5 md5 = MD5.Create ();
return md5.ComputeHash (fs);
}
} catch {
return new byte [16];
}
}
internal void Write (BinaryWriter bw)
{
bw.Write (Index);
@ -758,7 +758,7 @@ namespace Mono.CompilerServices.SymbolWriter
int old_pos = (int) reader.BaseStream.Position;
reader.BaseStream.Position = DataOffset;
file_name = reader.ReadString ();
sourceFile = file_name = reader.ReadString ();
guid = reader.ReadBytes (16);
hash = reader.ReadBytes (16);
auto_generated = reader.ReadByte () == 1;
@ -787,7 +787,7 @@ namespace Mono.CompilerServices.SymbolWriter
public bool CheckChecksum ()
{
try {
using (FileStream fs = new FileStream (file_name, FileMode.Open)) {
using (FileStream fs = new FileStream (sourceFile, FileMode.Open)) {
MD5 md5 = MD5.Create ();
byte[] data = md5.ComputeHash (fs);
for (int i = 0; i < 16; i++)

View File

@ -28,6 +28,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
namespace Mono.CompilerServices.SymbolWriter
@ -89,6 +90,11 @@ namespace Mono.CompilerServices.SymbolWriter
}
public void StartBlock (CodeBlockEntry.Type type, int start_offset)
{
StartBlock (type, start_offset, _blocks == null ? 1 : _blocks.Count + 1);
}
public void StartBlock (CodeBlockEntry.Type type, int start_offset, int scopeIndex)
{
if (_block_stack == null) {
_block_stack = new Stack<CodeBlockEntry> ();
@ -100,7 +106,7 @@ namespace Mono.CompilerServices.SymbolWriter
int parent = CurrentBlock != null ? CurrentBlock.Index : -1;
CodeBlockEntry block = new CodeBlockEntry (
_blocks.Count + 1, parent, type, start_offset);
scopeIndex, parent, type, start_offset);
_block_stack.Push (block);
_blocks.Add (block);
@ -180,9 +186,59 @@ namespace Mono.CompilerServices.SymbolWriter
public void DefineMethod (MonoSymbolFile file, int token)
{
MethodEntry entry = new MethodEntry (
var blocks = Blocks;
if (blocks.Length > 0) {
//
// When index is provided by user it can be inserted in
// any order but mdb format does not store its value. It
// uses stored order as the index instead.
//
var sorted = new List<CodeBlockEntry> (blocks.Length);
int max_index = 0;
for (int i = 0; i < blocks.Length; ++i) {
max_index = System.Math.Max (max_index, blocks [i].Index);
}
for (int i = 0; i < max_index; ++i) {
var scope_index = i + 1;
//
// Common fast path
//
if (i < blocks.Length && blocks [i].Index == scope_index) {
sorted.Add (blocks [i]);
continue;
}
bool found = false;
for (int ii = 0; ii < blocks.Length; ++ii) {
if (blocks [ii].Index == scope_index) {
sorted.Add (blocks [ii]);
found = true;
break;
}
}
if (found)
continue;
//
// Ideally this should never happen but with current design we can
// generate scope index for unreachable code before reachable code
//
sorted.Add (new CodeBlockEntry (scope_index, -1, CodeBlockEntry.Type.CompilerGenerated, 0));
}
blocks = sorted.ToArray ();
//for (int i = 0; i < blocks.Length; ++i) {
// if (blocks [i].Index - 1 != i)
// throw new ArgumentException ("CodeBlocks cannot be converted to mdb format");
//}
}
var entry = new MethodEntry (
file, _comp_unit.Entry, token, ScopeVariables,
Locals, method_lines.ToArray (), Blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id);
Locals, method_lines.ToArray (), blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id);
file.AddMethod (entry);
}

View File

@ -1,4 +1,4 @@
#if !READ_ONLY
using Mono.Cecil.Mdb;
using NUnit.Framework;
@ -83,3 +83,4 @@ namespace Mono.Cecil.Tests {
}
}
}
#endif

View File

@ -35,11 +35,12 @@ namespace Mono.Cecil.Pdb {
this.pdb_file = file;
}
#if !READ_ONLY
public ISymbolWriterProvider GetWriterProvider ()
{
return new NativePdbWriterProvider ();
}
#endif
/*
uint Magic = 0x53445352;
Guid Signature;
@ -211,6 +212,7 @@ namespace Mono.Cecil.Pdb {
} else {
import = GetImport (scope, info.Method.Module);
imports.Add (scope, import);
parent.import = import;
}
}
@ -262,6 +264,9 @@ namespace Mono.Cecil.Pdb {
var import = new ImportDebugInformation ();
foreach (var used_namespace in scope.usedNamespaces) {
if (string.IsNullOrEmpty (used_namespace))
continue;
ImportTarget target = null;
var value = used_namespace.Substring (1);
switch (used_namespace [0]) {

View File

@ -80,6 +80,10 @@ namespace Mono.Cecil.Pdb {
this.metadata = metadata;
}
void IMetadataSymbolWriter.WriteModule ()
{
}
void DefineCustomMetadata (MethodDebugInformation info, MetadataToken import_parent)
{
var metadata = new CustomMetadataWriter (this.writer);

View File

@ -1,4 +1,4 @@
#if !READ_ONLY
using System.IO;
using System.Linq;
@ -153,6 +153,13 @@ namespace Mono.Cecil.Tests {
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
}
[Test]
public void EmptyRootNamespace ()
{
TestModule ("EmptyRootNamespace.dll", module => {
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof(PdbReaderProvider), symbolWriterProvider: typeof(PdbWriterProvider));
}
[Test]
public void LocalVariables ()
{
@ -358,6 +365,42 @@ namespace Mono.Cecil.Tests {
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
}
[Test]
public void ImportsForFirstMethod ()
{
TestModule ("CecilTest.exe", module => {
var type = module.GetType ("CecilTest.Program");
var method = type.GetMethod ("Main");
var debug = method.DebugInformation;
var scope = debug.Scope;
Assert.IsTrue (scope.End.IsEndOfMethod);
var import = scope.Import;
Assert.IsNotNull (import);
Assert.AreEqual (5, import.Targets.Count);
var ns = new [] {
"System",
"System.Collections.Generic",
"System.Linq",
"System.Text",
"System.Threading.Tasks",
};
for (int i = 0; i < import.Targets.Count; i++) {
var target = import.Targets [i];
Assert.AreEqual (ImportTargetKind.ImportNamespace, target.Kind);
Assert.AreEqual (ns [i], target.Namespace);
}
Assert.AreEqual ("System", import.Targets [0].Namespace);
}, readOnly: Platform.OnMono, symbolReaderProvider: typeof (PdbReaderProvider), symbolWriterProvider: typeof (PdbWriterProvider));
}
[Test]
public void CreateMethodFromScratch ()
{
@ -412,3 +455,4 @@ namespace Mono.Cecil.Tests {
}
}
}
#endif

View File

@ -39,10 +39,7 @@ namespace ILLink.Tasks
long totalUnlinked = 0;
foreach (string unlinkedFile in unlinkedFiles) {
try {
AssemblyName.GetAssemblyName (unlinkedFile);
}
catch (BadImageFormatException) {
if (!Utils.IsManagedAssembly (unlinkedFile)) {
continue;
}
string fileName = Path.GetFileName (unlinkedFile);
@ -54,10 +51,7 @@ namespace ILLink.Tasks
long totalLinked = 0;
foreach (string linkedFile in linkedFiles) {
try {
AssemblyName.GetAssemblyName (linkedFile);
}
catch (BadImageFormatException) {
if (!Utils.IsManagedAssembly (linkedFile)) {
continue;
}
string fileName = Path.GetFileName (linkedFile);
@ -71,15 +65,30 @@ namespace ILLink.Tasks
sizes[fileName] = assemblySizes;
}
Console.WriteLine ("{0, -60} {1,-20:N0} {2, -20:N0} {3, -10:P}",
"",
"Before linking (B)",
"After linking (B)",
"Size decrease");
Console.WriteLine ("{0, -60} {1,-20:N0} {2, -20:N0} {3, -10:P}",
"-----------",
"-----------",
"-----------",
"-----------"
);
Console.WriteLine ("{0, -60} {1,-20:N0} {2, -20:N0} {3, -10:P}",
"Total size of assemblies",
totalUnlinked,
totalLinked,
((double)totalUnlinked - (double)totalLinked) / (double)totalUnlinked);
Console.WriteLine ("-----------");
Console.WriteLine ("Details");
Console.WriteLine ("-----------");
Console.WriteLine ("{0, -60} {1,-20:N0} {2, -20:N0} {3, -10:P}",
"-----------",
"-----------",
"-----------",
"-----------"
);
foreach (string assembly in sizes.Keys) {
Console.WriteLine ("{0, -60} {1,-20:N0} {2, -20:N0} {3, -10:P}",

View File

@ -10,6 +10,7 @@ using Microsoft.Build.Framework; // MessageImportance
using Microsoft.NET.Build.Tasks; // LockFileCache
using NuGet.ProjectModel; // LockFileTargetLibrary
using NuGet.Frameworks; // NuGetFramework.Parse(targetframework)
using Mono.Cecil;
namespace ILLink.Tasks
{
@ -33,10 +34,8 @@ namespace ILLink.Tasks
{
var managedAssemblies = new List<ITaskItem>();
foreach (var f in Assemblies) {
try {
AssemblyName.GetAssemblyName(f.ItemSpec);
if (Utils.IsManagedAssembly(f.ItemSpec)) {
managedAssemblies.Add(f);
} catch (BadImageFormatException) {
}
}
ManagedAssemblies = managedAssemblies.ToArray();

View File

@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PropertyGroup>
<VersionPrefix>0.1.4-preview</VersionPrefix>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<RuntimeFrameworkVersion>2.0.0-beta-001509-00</RuntimeFrameworkVersion>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<PackageOutputPath>../nupkgs</PackageOutputPath>
@ -17,7 +18,7 @@
<!-- We want to package the tasks package together with its
package dependencies, the linker, and the linker's
dependencies, in order to prevent projects that contsume the
dependencies, in order to prevent projects that consume the
tasks package from pulling in the linker. To do this, we need
to include project references and package references in the
package, and prevent any of these references from being
@ -41,8 +42,8 @@
references from being marked as dependencies. -->
<!-- TODO: Remove the custom .nuspec once the P2P PrivateAssets
issue is fixed. -->
<NuspecFile>ILLink.Tasks.nuspec</NuspecFile>
<NuspecProperties>id=$(AssemblyName);authors=$(AssemblyName);description=linker tasks;tfm=$(TargetFramework);</NuspecProperties>
<NuspecFile>ILLink.Tasks.nuspec</NuspecFile>
<NuspecProperties>id=$(AssemblyName);authors=$(AssemblyName);description=linker tasks;</NuspecProperties>
</PropertyGroup>
<!-- TODO: Remove this workaround once we're able to avoid using a
@ -64,14 +65,25 @@
Instead, we use GenerateNuspecDependsOn. We could probably also
use BeforeTargets="GenerateNuspec". -->
<PropertyGroup>
<GenerateNuspecDependsOn>Publish;SetDynamicNuspecProperties;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
<GenerateNuspecDependsOn>SetDynamicNuspecProperties;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
</PropertyGroup>
<Target Name="SetDynamicNuspecProperties">
<Target Name="SetDynamicNuspecProperties"
DependsOnTargets="LayoutPackage">
<PropertyGroup>
<NuspecProperties>$(NuspecProperties)output=$(PublishDir);version=$(Version);</NuspecProperties>
<NuspecProperties>$(NuspecProperties)version=$(Version);</NuspecProperties>
</PropertyGroup>
</Target>
<Target Name="LayoutPackage">
<ItemGroup>
<TFMsToPublish Include="$(TargetFrameworks)" />
<ProjectsToPublish Include="$(MSBuildProjectFile)">
<AdditionalProperties>TargetFramework=%(TFMsToPublish.Identity);PublishDir=%(TFMsToPublish.Identity)</AdditionalProperties>
</ProjectsToPublish>
</ItemGroup>
<MSBuild Projects="@(ProjectsToPublish)" Targets="Publish" />
</Target>
<ItemGroup>
<Compile Include="LinkTask.cs" />
<Compile Include="DepsJsonLinker.cs" />
@ -79,6 +91,7 @@
<Compile Include="ComputeManagedAssemblies.cs" />
<Compile Include="GetRuntimeLibraries.cs" />
<Compile Include="CreateRootDescriptorFile.cs" />
<Compile Include="Utils.cs" />
<Compile Include="Microsoft.NET.Build.Tasks/LockFileCache.cs" />
<Compile Include="Microsoft.NET.Build.Tasks/BuildErrorException.cs" />
</ItemGroup>
@ -125,18 +138,17 @@
</ItemGroup>
-->
<ItemGroup>
<!-- TODO: Once https://github.com/dotnet/sdk/issues/952 is fixed,
use PrivateAssets="All" to prevent this project reference
from being marked as a dependency of the tasks package (while
still including it in the publish output). -->
<ProjectReference Include="../../../linker/Mono.Linker.csproj" />
<ProjectReference Include="../../../linker/Mono.Linker.csproj">
<!-- SetConfiguration isn't required when the configuration is
already set in the solution. However, it should be possible
to set it here to allow packing the tasks csproj on its
own. This would let us avoid some of the strange behavior
that shows up when trying to build from a .sln file.
already set in the solution. Setting it here allows packing
the tasks csproj on its own. This lets us avoid some of the
strange behavior that shows up when trying to build from a
.sln file.
There is a nuget bug that prevents this from working
properly during restore
@ -152,11 +164,21 @@
(because some target gets its reference information from
the lock file, which doesn't have configuration info).
-->
<!--
<SetConfiguration>Configuration=netcore_$(Configuration)</SetConfiguration>
-->
<SetConfiguration>Configuration=illink_$(Configuration)</SetConfiguration>
</ProjectReference>
<ProjectReference Include="../../../cecil/Mono.Cecil.csproj" />
</ItemGroup>
<!-- Workaround for the SetConfiguration issue described above. -->
<Target Name="SetCecilConfiguration"
AfterTargets="AssignProjectConfiguration">
<ItemGroup>
<ProjectReferenceWithConfiguration Condition=" '%(Filename)%(Extension)' == 'Mono.Cecil.csproj' Or '%(Filename)%(Extension)' == 'Mono.Cecil.Pdb.csproj' ">
<SetConfiguration>Configuration=netstandard_$(Configuration)</SetConfiguration>
</ProjectReferenceWithConfiguration>
</ItemGroup>
</Target>
<ItemGroup>
<!-- TODO: Once we can avoid using a custom .nuspec, we should be
@ -164,8 +186,13 @@
them from becoming package dependencies, and use an msbuild
itemgroup to include their assets in the package instead of
passing the publish path to the .nuspec. -->
<PackageReference Include="Microsoft.Build.Framework" Version="0.1.0-preview-00028-160627" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="0.1.0-preview-00028-160627" />
<!-- We use private assets for the Microsoft.Build packages to
prevent them from being published with the tasks dll, because
these are already a part of the SDK. -->
<PackageReference Include="Microsoft.Build.Framework" Version="15.1.1012"
PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.1.1012"
PrivateAssets="All" />
<PackageReference Include="NuGet.ProjectModel" Version="4.3.0-preview1-2500" />
</ItemGroup>
</Project>

View File

@ -8,6 +8,7 @@
</metadata>
<files>
<file src="ILLink.Tasks.targets" target="build" />
<file src="$output$*.dll" target="tools/$tfm$" />
<file src="netcoreapp2.0/**/*.dll" target="tools" />
<file src="net46/**/*.dll" target="tools" />
</files>
</package>

View File

@ -1,7 +1,11 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LinkTaskDllPath Condition=" '$(LinkTaskDllPath)' == '' ">$(MSBuildThisFileDirectory)../tools/$(TargetFramework)/ILLink.Tasks.dll</LinkTaskDllPath>
<_LinkTaskDirectoryRoot>$(MSBuildThisFileDirectory)../tools/</_LinkTaskDirectoryRoot>
<_LinkTaskTFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp2.0</_LinkTaskTFM>
<_LinkTaskTFM Condition=" '$(_LinkTaskTFM)' == '' ">net46</_LinkTaskTFM>
<_LinkTaskDirectory>$(_LinkTaskDirectoryRoot)$(_LinkTaskTFM)/</_LinkTaskDirectory>
<LinkTaskDllPath Condition=" '$(LinkTaskDllPath)' == '' ">$(_LinkTaskDirectory)ILLink.Tasks.dll</LinkTaskDllPath>
</PropertyGroup>
<PropertyGroup>
@ -54,10 +58,15 @@
which computes the ItemGroup ResolvedFileToPublish. To extend
this target, we insert a target before
ComputeFilesToPublish. Our target rewrites the relevant inputs
(@(IntermediateAssembly) and
@(ResolvedAssembliesToPublish)). This lets ComputeFilesToPublish
be ignorant of the linker, but changes the meaning of
IntermediateAssembly and ResolvedAssembliesToPublish.
(@(IntermediateAssembly), @(ResolvedAssembliesToPublish)). This
lets ComputeFilesToPublish be ignorant of the linker, but
changes the meaning of IntermediateAssembly and
ResolvedAssembliesToPublish.
To include linked pdbs in the publish output, we also rewrite
the ComputeFilesToPublish input
@(_DebugSymbolsIntermediatePath). Note that this is a private
itemgroup, so relying on this is not ideal.
-->
<!-- DependsOnTargets here doesn't include the targets that compute
ResolvedAssembliesToPublish or IntermediateAssembly, because
@ -82,6 +91,13 @@
<IntermediateAssembly Remove="@(IntermediateAssembly)" />
<IntermediateAssembly Include="@(_LinkedIntermediateAssembly)" />
</ItemGroup>
<!-- Rewrite _DebugSymbolsIntermediatePath, which is an input to
ComputeFilesToPublish. -->
<ItemGroup>
<_DebugSymbolsIntermediatePath Remove="@(_DebugSymbolsIntermediatePath)" Condition=" '$(_DebugSymbolsProduced)' == 'true' " />
<_DebugSymbolsIntermediatePath Include="@(_LinkedDebugSymbols)" Condition=" '$(_DebugSymbolsProduced)' == 'true' " />
</ItemGroup>
</Target>
@ -100,10 +116,11 @@
</Target>
<!-- Computes _LinkedResolvedAssemblies and
_LinkedIntermediateAssembly. _LinkedResolvedAssemblies needs to
keep metadata from _ManagedResolvedAssembliesToPublish, since
this is used by ComputeFilesToPublish. -->
<!-- Computes _LinkedResolvedAssemblies,
_LinkedIntermediateAssembly, and
_LinkedDebugSymbols. _LinkedResolvedAssemblies needs to keep
metadata from _ManagedResolvedAssembliesToPublish, since this
is used by ComputeFilesToPublish. -->
<Target Name="_ComputeLinkedAssemblies"
DependsOnTargets="_ComputeManagedResolvedAssembliesToPublish;ILLink">
<ItemGroup>
@ -115,6 +132,13 @@
<__LinkedIntermediateAssembly Include="@(IntermediateAssembly->'$(IntermediateLinkDir)/%(Filename)%(Extension)')" />
<_LinkedIntermediateAssembly Include="@(__LinkedIntermediateAssembly)" Condition="Exists('%(Identity)')" />
</ItemGroup>
<ItemGroup>
<__LinkedDebugSymbols Include="@(_DebugSymbolsIntermediatePath->'$(IntermediateLinkDir)/%(Filename)%(Extension)')"
Condition=" '$(_DebugSymbolsProduced)' == 'true' " />
<_LinkedDebugSymbols Include="@(__LinkedDebugSymbols)"
Condition="Exists('%(Identity)') And '$(_DebugSymbolsProduced)' == 'true' " />
</ItemGroup>
</Target>
@ -132,7 +156,7 @@
the future we will want to generate these depending on the
scenario in which the linker is invoked. -->
<PropertyGroup>
<ExtraLinkerArgs Condition=" '$(ExtraLinkerArgs)' == '' ">-t -c link -l none</ExtraLinkerArgs>
<ExtraLinkerArgs Condition=" '$(ExtraLinkerArgs)' == '' ">-t -c link -l none -b true</ExtraLinkerArgs>
</PropertyGroup>
<ILLink AssemblyPaths="@(_ManagedAssembliesToLink)"
RootAssemblyNames="@(LinkerRootAssemblies)"
@ -189,6 +213,11 @@
<ItemGroup>
<_ManagedResolvedAssembliesToPublish Remove="@(_ManagedResolvedAssembliesToPublish->WithMetadataValue('Filename', 'System.Private.CoreLib.ni'))" />
</ItemGroup>
<!-- Some of the managed dlls are satellite assemblies containing
binary resources that we don't want to link. -->
<ItemGroup>
<_ManagedResolvedAssembliesToPublish Remove="@(_ManagedResolvedAssembliesToPublish->WithMetadataValue('AssetType', 'resources'))" />
</ItemGroup>
</Target>

View File

@ -0,0 +1,15 @@
using System;
using Mono.Cecil;
public class Utils
{
public static bool IsManagedAssembly (string fileName)
{
try {
ModuleDefinition module = ModuleDefinition.ReadModule (fileName);
return true;
} catch (BadImageFormatException) {
return false;
}
}
}

View File

@ -22,18 +22,18 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.ActiveCfg = netcore_Debug|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.Build.0 = netcore_Debug|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.ActiveCfg = netcore_Debug|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.Build.0 = netcore_Debug|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.ActiveCfg = netcore_Debug|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.Build.0 = netcore_Debug|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.ActiveCfg = netcore_Release|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.Build.0 = netcore_Release|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.ActiveCfg = netcore_Release|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.Build.0 = netcore_Release|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.ActiveCfg = netcore_Release|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.Build.0 = netcore_Release|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.ActiveCfg = illink_Debug|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|Any CPU.Build.0 = illink_Debug|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.ActiveCfg = illink_Debug|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x64.Build.0 = illink_Debug|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.ActiveCfg = illink_Debug|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Debug|x86.Build.0 = illink_Debug|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.ActiveCfg = illink_Release|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|Any CPU.Build.0 = illink_Release|Any CPU
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.ActiveCfg = illink_Release|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x64.Build.0 = illink_Release|x64
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.ActiveCfg = illink_Release|x86
{DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46}.Release|x86.Build.0 = illink_Release|x86
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU
{D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|x64.ActiveCfg = netstandard_Debug|x64

View File

@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<RuntimeFrameworkVersion>2.0.0-beta-001509-00</RuntimeFrameworkVersion>
<DefineConstants>$(DefineConstants);NET_CORE</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>illink</AssemblyName>
<OutputType>exe</OutputType>
<OutputType>Library</OutputType>
</PropertyGroup>
</Project>

View File

@ -77,10 +77,15 @@ namespace Mono.Linker.Steps {
protected virtual void InitializeAssembly (AssemblyDefinition assembly)
{
MarkAssembly (assembly);
Annotations.Push (assembly);
try {
MarkAssembly (assembly);
foreach (TypeDefinition type in assembly.MainModule.Types)
InitializeType (type);
foreach (TypeDefinition type in assembly.MainModule.Types)
InitializeType (type);
} finally {
Annotations.Pop ();
}
}
void InitializeType (TypeDefinition type)
@ -152,9 +157,14 @@ namespace Mono.Linker.Steps {
}
if (!Annotations.IsMarked (type))
continue;
Annotations.Mark (exported);
if (_context.KeepTypeForwarderOnlyAssemblies) {
Annotations.Mark (assembly.MainModule);
Annotations.Push (type);
try {
Annotations.Mark (exported);
if (_context.KeepTypeForwarderOnlyAssemblies) {
Annotations.Mark (assembly.MainModule);
}
} finally {
Annotations.Pop ();
}
}
}
@ -245,8 +255,13 @@ namespace Mono.Linker.Steps {
if (!provider.HasCustomAttributes)
return;
foreach (CustomAttribute ca in provider.CustomAttributes)
MarkCustomAttribute (ca);
Annotations.Push (provider);
try {
foreach (CustomAttribute ca in provider.CustomAttributes)
MarkCustomAttribute (ca);
} finally {
Annotations.Pop ();
}
}
void LazyMarkCustomAttributes (ICustomAttributeProvider provider)
@ -508,9 +523,15 @@ namespace Mono.Linker.Steps {
while (_topLevelAttributes.Count != 0) {
var customAttribute = _topLevelAttributes.Dequeue ();
var resolved = customAttribute.AttributeType.Resolve ();
if (resolved == null) {
HandleUnresolvedType (customAttribute.AttributeType);
continue;
}
// If an attribute's module has not been marked after processing all types in all assemblies and the attribute itself has not been marked,
// then surely nothing is using this attribute and there is no need to mark it
if (!Annotations.IsMarked (customAttribute.AttributeType.Resolve ().Module) && !Annotations.IsMarked (customAttribute.AttributeType))
if (!Annotations.IsMarked (resolved.Module) && !Annotations.IsMarked (customAttribute.AttributeType))
continue;
MarkCustomAttribute (customAttribute);
@ -625,8 +646,10 @@ namespace Mono.Linker.Steps {
MarkFields (type, type.IsEnum);
if (type.HasInterfaces) {
foreach (var iface in type.Interfaces)
foreach (var iface in type.Interfaces) {
MarkCustomAttributes (iface);
MarkType (iface.InterfaceType);
}
}
if (type.HasMethods) {

View File

@ -123,6 +123,26 @@ namespace Mono.Linker.Steps
} catch (AssemblyResolutionException) {
continue;
}
if (resolvedExportedType == null) {
//
// It's quite common for assemblies to have broken exported types
//
// One source of them is from native csc which added all nested types of
// type-forwarded types automatically including private ones.
//
// Next source of broken type-forwarders is from custom metadata writers which
// simply write bogus information.
//
// Both cases are bugs not on our end but we still want to link all assemblies
// especially when such types cannot be used anyway
//
if (context.LogInternalExceptions)
System.Console.WriteLine ($"Cannot find declaration of exported type '{exported}' from the assembly '{assembly}'");
continue;
}
context.Resolve (resolvedExportedType.Scope);
MarkType (context, resolvedExportedType, rootVisibility);
context.Annotations.Mark (exported);

View File

@ -29,7 +29,7 @@
//
using System;
using SR = System.Reflection;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml.XPath;
@ -51,8 +51,12 @@ namespace Mono.Linker.Steps {
static readonly string _fullname = "fullname";
static readonly string _required = "required";
static readonly string _preserve = "preserve";
static readonly string _accessors = "accessors";
static readonly string _ns = string.Empty;
static readonly string[] _accessorsAll = new string[] { "all" };
static readonly char[] _accessorsSep = new char[] { ';' };
XPathDocument _document;
string _xmlDocumentLocation;
@ -161,7 +165,7 @@ namespace Mono.Linker.Steps {
static Regex CreateRegexFromPattern (string pattern)
{
return new Regex (pattern.Replace(".", @"\.").Replace("*", "(.*)"));
return new Regex (pattern.Replace (".", @"\.").Replace ("*", "(.*)"));
}
void MatchType (TypeDefinition type, Regex regex, XPathNavigator nav)
@ -204,7 +208,7 @@ namespace Mono.Linker.Steps {
if (assembly.MainModule.HasExportedTypes) {
foreach (var exported in assembly.MainModule.ExportedTypes) {
MatchExportedType(exported, assembly.MainModule, regex, nav);
MatchExportedType (exported, assembly.MainModule, regex, nav);
}
}
}
@ -234,6 +238,8 @@ namespace Mono.Linker.Steps {
if (nav.HasChildren) {
MarkSelectedFields (nav, type);
MarkSelectedMethods (nav, type);
MarkSelectedEvents (nav, type);
MarkSelectedProperties (nav, type);
}
}
@ -255,6 +261,24 @@ namespace Mono.Linker.Steps {
ProcessMethods (type, methods);
}
void MarkSelectedEvents (XPathNavigator nav, TypeDefinition type)
{
XPathNodeIterator events = nav.SelectChildren ("event", _ns);
if (events.Count == 0)
return;
ProcessEvents (type, events);
}
void MarkSelectedProperties (XPathNavigator nav, TypeDefinition type)
{
XPathNodeIterator properties = nav.SelectChildren ("property", _ns);
if (properties.Count == 0)
return;
ProcessProperties (type, properties);
}
static TypePreserve GetTypePreserve (XPathNavigator nav)
{
string attribute = GetAttribute (nav, _preserve);
@ -324,7 +348,7 @@ namespace Mono.Linker.Steps {
void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator)
{
while (iterator.MoveNext()) {
while (iterator.MoveNext ()) {
string value = GetSignature (iterator.Current);
if (!String.IsNullOrEmpty (value))
ProcessMethodSignature (type, value);
@ -344,12 +368,25 @@ namespace Mono.Linker.Steps {
void MarkMethod (TypeDefinition type, MethodDefinition method, string signature)
{
if (method != null) {
Annotations.Mark (method);
Annotations.SetAction (method, MethodAction.Parse);
MarkMethod (method);
} else
AddUnresolveMarker (string.Format ("T: {0}; M: {1}", type, signature));
}
void MarkMethod (MethodDefinition method)
{
Annotations.Mark (method);
Annotations.SetAction (method, MethodAction.Parse);
}
void MarkMethodIfNotNull (MethodDefinition method)
{
if (method == null)
return;
MarkMethod (method);
}
void ProcessMethodName (TypeDefinition type, string name)
{
if (!type.HasMethods)
@ -389,6 +426,141 @@ namespace Mono.Linker.Steps {
return sb.ToString ();
}
void ProcessEvents (TypeDefinition type, XPathNodeIterator iterator)
{
while (iterator.MoveNext ()) {
string value = GetSignature (iterator.Current);
if (!String.IsNullOrEmpty (value))
ProcessEventSignature (type, value);
value = GetAttribute (iterator.Current, "name");
if (!String.IsNullOrEmpty (value))
ProcessEventName (type, value);
}
}
void ProcessEventSignature (TypeDefinition type, string signature)
{
EventDefinition @event = GetEvent (type, signature);
MarkEvent (type, @event, signature);
}
void MarkEvent (TypeDefinition type, EventDefinition @event, string signature)
{
if (@event != null) {
Annotations.Mark (@event);
MarkMethod (@event.AddMethod);
MarkMethod (@event.RemoveMethod);
MarkMethodIfNotNull (@event.InvokeMethod);
} else
AddUnresolveMarker (string.Format ("T: {0}; E: {1}", type, signature));
}
void ProcessEventName (TypeDefinition type, string name)
{
if (!type.HasEvents)
return;
foreach (EventDefinition @event in type.Events)
if (@event.Name == name)
MarkEvent (type, @event, name);
}
static EventDefinition GetEvent (TypeDefinition type, string signature)
{
if (!type.HasEvents)
return null;
foreach (EventDefinition @event in type.Events)
if (signature == GetEventSignature (@event))
return @event;
return null;
}
static string GetEventSignature (EventDefinition @event)
{
return @event.EventType.FullName + " " + @event.Name;
}
void ProcessProperties (TypeDefinition type, XPathNodeIterator iterator)
{
while (iterator.MoveNext ()) {
string value = GetSignature (iterator.Current);
if (!String.IsNullOrEmpty (value))
ProcessPropertySignature (type, value, GetAccessors (iterator.Current));
value = GetAttribute (iterator.Current, "name");
if (!String.IsNullOrEmpty (value))
ProcessPropertyName (type, value, _accessorsAll);
}
}
void ProcessPropertySignature (TypeDefinition type, string signature, string[] accessors)
{
PropertyDefinition property = GetProperty (type, signature);
MarkProperty (type, property, signature, accessors);
}
void MarkProperty (TypeDefinition type, PropertyDefinition property, string signature, string[] accessors)
{
if (property != null) {
Annotations.Mark (property);
MarkPropertyAccessors (type, property, accessors);
} else
AddUnresolveMarker (string.Format ("T: {0}; P: {1}", type, signature));
}
void MarkPropertyAccessors (TypeDefinition type, PropertyDefinition property, string[] accessors)
{
if (Array.IndexOf (accessors, "all") >= 0) {
MarkMethodIfNotNull (property.GetMethod);
MarkMethodIfNotNull (property.SetMethod);
return;
}
if (property.GetMethod != null
&& Array.IndexOf (accessors, "get") >= 0)
MarkMethod (property.GetMethod);
else if (property.GetMethod == null)
AddUnresolveMarker (string.Format ("T: {0}' M: {1} get_{2}", type, property.PropertyType, property.Name));
if (property.SetMethod != null
&& Array.IndexOf (accessors, "set") >= 0)
MarkMethod (property.SetMethod);
else if (property.SetMethod == null)
AddUnresolveMarker (string.Format ("T: {0}' M: System.Void set_{2} ({1})", type, property.PropertyType, property.Name));
}
void ProcessPropertyName (TypeDefinition type, string name, string[] accessors)
{
if (!type.HasProperties)
return;
foreach (PropertyDefinition property in type.Properties)
if (property.Name == name)
MarkProperty (type, property, name, accessors);
}
static PropertyDefinition GetProperty (TypeDefinition type, string signature)
{
if (!type.HasProperties)
return null;
foreach (PropertyDefinition property in type.Properties)
if (signature == GetPropertySignature (property))
return property;
return null;
}
static string GetPropertySignature (PropertyDefinition property)
{
return property.PropertyType.FullName + " " + property.Name;
}
static AssemblyDefinition GetAssembly (LinkContext context, string assemblyName)
{
AssemblyNameReference reference = AssemblyNameReference.Parse (assemblyName);
@ -433,9 +605,32 @@ namespace Mono.Linker.Steps {
return GetAttribute (nav, _fullname);
}
static string[] GetAccessors (XPathNavigator nav)
{
string accessorsValue = GetAttribute (nav, _accessors);
if (accessorsValue != null) {
string[] accessors = accessorsValue.Split (
_accessorsSep, StringSplitOptions.RemoveEmptyEntries);
if (accessors.Length > 0) {
for (int i = 0; i < accessors.Length; ++i)
accessors[i] = accessors[i].ToLower ();
return accessors;
}
}
return _accessorsAll;
}
static string GetAttribute (XPathNavigator nav, string attribute)
{
return nav.GetAttribute (attribute, _ns);
}
public override string ToString ()
{
return "ResolveFromXmlStep: " + _xmlDocumentLocation;
}
}
}

View File

@ -10,11 +10,11 @@
targets.
-->
<PropertyGroup>
<NetCoreBuild Condition=" $(Configuration.StartsWith('netcore')) Or '$(NuGetRestoreTargets)' != '' ">true</NetCoreBuild>
<NetCoreBuild Condition=" '$(NetCoreBuild)' == '' ">false</NetCoreBuild>
<ILLinkBuild Condition=" $(Configuration.StartsWith('illink')) Or '$(NuGetRestoreTargets)' != '' ">true</ILLinkBuild>
<ILLinkBuild Condition=" '$(ILLinkBuild)' == '' ">false</ILLinkBuild>
<TargetFrameworkProfile />
</PropertyGroup>
<Import Project="NetCore.props" Condition=" $(NetCoreBuild) " />
<Import Project="ILLink.props" Condition=" $(ILLinkBuild) " />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -24,8 +24,8 @@
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Mono.Linker</RootNamespace>
<AssemblyName Condition=" ! $(NetCoreBuild) ">monolinker</AssemblyName>
<AssemblyName Condition=" $(NetCoreBuild) ">illink</AssemblyName>
<AssemblyName Condition=" ! $(ILLinkBuild) ">monolinker</AssemblyName>
<AssemblyName Condition=" $(ILLinkBuild) ">illink</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@ -45,7 +45,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" Condition=" ! $(NetCoreBuild) " />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" Condition=" ! $(ILLinkBuild) " />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@ -53,7 +53,7 @@
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup Condition=" ! $(NetCoreBuild) ">
<ItemGroup Condition=" ! $(ILLinkBuild) ">
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
@ -98,14 +98,14 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\cecil\Mono.Cecil.csproj">
<SetConfiguration Condition=" '$(Configuration)' == 'netcore_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
<SetConfiguration Condition=" '$(Configuration)' == 'netcore_Release' ">Configuration=netstandard_Release</SetConfiguration>
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Release' ">Configuration=netstandard_Release</SetConfiguration>
<Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project>
<Name>Mono.Cecil</Name>
</ProjectReference>
<ProjectReference Include="..\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj">
<SetConfiguration Condition=" '$(Configuration)' == 'netcore_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
<SetConfiguration Condition=" '$(Configuration)' == 'netcore_Release' ">Configuration=netstandard_Release</SetConfiguration>
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Debug' ">Configuration=netstandard_Debug</SetConfiguration>
<SetConfiguration Condition=" '$(Configuration)' == 'illink_Release' ">Configuration=netstandard_Release</SetConfiguration>
<Project>{63E6915C-7EA4-4D76-AB28-0D7191EEA626}</Project>
<Name>Mono.Cecil.Pdb</Name>
</ProjectReference>

View File

@ -302,10 +302,13 @@ namespace Mono.Linker {
return;
KeyValuePair<object, object> pair = new KeyValuePair<object, object> (dependency_stack.Count > 0 ? dependency_stack.Peek () : null, o);
writer.WriteStartElement ("edge");
writer.WriteAttributeString ("b", TokenString (pair.Key));
writer.WriteAttributeString ("e", TokenString (pair.Value));
writer.WriteEndElement ();
if (pair.Key != pair.Value)
{
writer.WriteStartElement ("edge");
writer.WriteAttributeString ("b", TokenString (pair.Key));
writer.WriteAttributeString ("e", TokenString (pair.Value));
writer.WriteEndElement ();
}
}
public void Push (object o)

View File

@ -33,7 +33,7 @@ using Mono.Cecil;
namespace Mono.Linker {
#if NET_CORE
#if FEATURE_ILLINK
public class AssemblyResolver : DirectoryAssemblyResolver {
#else
public class AssemblyResolver : BaseAssemblyResolver {

View File

@ -5,7 +5,7 @@ using System.IO;
using Mono.Collections.Generic;
using Mono.Cecil;
#if NET_CORE
#if FEATURE_ILLINK
namespace Mono.Linker {
public abstract class DirectoryAssemblyResolver : IAssemblyResolver {

View File

@ -37,7 +37,7 @@ namespace Mono.Linker {
public class Driver {
#if NET_CORE
#if FEATURE_ILLINK
static readonly string _linker = "IL Linker";
#else
static readonly string _linker = "Mono CIL Linker";
@ -284,7 +284,7 @@ namespace Mono.Linker {
Console.WriteLine (_linker);
if (msg != null)
Console.WriteLine ("Error: " + msg);
#if NET_CORE
#if FEATURE_ILLINK
Console.WriteLine ("illink [options] -x|-a|-i file");
#else
Console.WriteLine ("monolinker [options] -x|-a|-i file");

View File

@ -179,8 +179,8 @@ namespace Mono.Linker {
return assembly;
}
catch {
throw new AssemblyResolutionException (reference);
catch (Exception e) {
throw new AssemblyResolutionException (reference, e);
}
}
@ -272,7 +272,7 @@ namespace Mono.Linker {
}
}
public AssemblyDefinition [] GetAssemblies ()
public virtual AssemblyDefinition [] GetAssemblies ()
{
var cache = _resolver.AssemblyCache;
AssemblyDefinition [] asms = new AssemblyDefinition [cache.Count];

View File

@ -1,4 +1,30 @@
using System;
// The MIT License(MIT)
// =====================
//
// Copyright © `2015-2017` `Lucas Meijer`
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -283,6 +309,11 @@ namespace Mono.Linker.Tests.Extensions
return sb.ToString();
}
public static implicit operator string(NPath path)
{
return path.ToString();
}
static char Slash(SlashMode slashMode)
{
switch (slashMode)

View File

@ -0,0 +1,5 @@
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public abstract class BaseInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute {
}
}

View File

@ -1,8 +1,7 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Event, AllowMultiple = false, Inherited = false)]
public sealed class KeptBackingFieldAttribute : KeptAttribute {
}
}

View File

@ -2,7 +2,7 @@
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)]
public class KeptInterfaceAttribute : KeptAttribute
{

View File

@ -1,7 +1,7 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)]
public sealed class KeptMemberAttribute : KeptAttribute {
public KeptMemberAttribute (string name)

View File

@ -3,7 +3,7 @@
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
public class KeptMemberInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute {
public class KeptMemberInAssemblyAttribute : BaseInAssemblyAttribute {
public KeptMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames)
{

View File

@ -3,8 +3,7 @@
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
public class KeptTypeInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute
{
public class KeptTypeInAssemblyAttribute : BaseInAssemblyAttribute {
public KeptTypeInAssemblyAttribute (string assemblyFileName, Type type)
{
if (type == null)

View File

@ -0,0 +1,15 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public class RemovedForwarderAttribute : BaseInAssemblyAttribute
{
public RemovedForwarderAttribute (string assemblyFileName, string typeName)
{
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName));
if (string.IsNullOrEmpty (typeName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (typeName));
}
}
}

View File

@ -2,7 +2,7 @@
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
public class RemovedMemberInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute {
public class RemovedMemberInAssemblyAttribute : BaseInAssemblyAttribute {
public RemovedMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames)
{

View File

@ -3,7 +3,7 @@
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)]
public class RemovedTypeInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute {
public class RemovedTypeInAssemblyAttribute : BaseInAssemblyAttribute {
public RemovedTypeInAssemblyAttribute (string assemblyFileName, Type type)
{
if (type == null)

View File

@ -0,0 +1,25 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Assertions {
public enum SkipPeVerifyForToolchian
{
Pedump
}
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
public class SkipPeVerifyAttribute : BaseExpectedLinkedBehaviorAttribute
{
public SkipPeVerifyAttribute ()
{
}
public SkipPeVerifyAttribute (SkipPeVerifyForToolchian toolchain)
{
}
public SkipPeVerifyAttribute (string assemblyName)
{
}
}
}

View File

@ -0,0 +1,12 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Metadata {
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
public class DefineAttribute : BaseMetadataAttribute {
public DefineAttribute (string name)
{
if (string.IsNullOrEmpty (name))
throw new ArgumentException ("Value cannot be null or empty.", nameof (name));
}
}
}

View File

@ -1,8 +1,8 @@
namespace Mono.Linker.Tests.Cases.Expectations.Metadata {
public sealed class IncludeBlacklistStepAttribute : BaseMetadataAttribute {
public readonly string Value;
public readonly bool Value;
public IncludeBlacklistStepAttribute (string value)
public IncludeBlacklistStepAttribute (bool value)
{
Value = value;
}

View File

@ -2,12 +2,11 @@
namespace Mono.Linker.Tests.Cases.Expectations.Metadata {
[AttributeUsage (AttributeTargets.Class)]
public class CoreLinkAttribute : BaseMetadataAttribute {
public CoreLinkAttribute (string value)
public sealed class KeepTypeForwarderOnlyAssembliesAttribute : BaseMetadataAttribute {
public KeepTypeForwarderOnlyAssembliesAttribute (string value)
{
if (string.IsNullOrEmpty (value))
throw new ArgumentException ("Value cannot be null or empty.", nameof (value));
}
}
}
}

View File

@ -1,7 +1,7 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Metadata {
[AttributeUsage (AttributeTargets.Class)]
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct)]
public class NotATestCaseAttribute : BaseMetadataAttribute {
}
}

View File

@ -0,0 +1,18 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Metadata {
/// <summary>
/// Use to compile an assembly after compiling the main test case executabe
/// </summary>
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
public class SetupCompileAfterAttribute : BaseMetadataAttribute {
public SetupCompileAfterAttribute (string outputName, string[] sourceFiles, string[] references = null, string[] defines = null)
{
if (sourceFiles == null)
throw new ArgumentNullException (nameof (sourceFiles));
if (string.IsNullOrEmpty (outputName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (outputName));
}
}
}

View File

@ -0,0 +1,18 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Metadata {
/// <summary>
/// Use to compile an assembly before compiling the main test case executabe
/// </summary>
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
public class SetupCompileBeforeAttribute : BaseMetadataAttribute {
public SetupCompileBeforeAttribute (string outputName, string[] sourceFiles, string[] references = null, string[] defines = null, bool addAsReference = true)
{
if (sourceFiles == null)
throw new ArgumentNullException (nameof (sourceFiles));
if (string.IsNullOrEmpty (outputName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (outputName));
}
}
}

View File

@ -0,0 +1,18 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Metadata
{
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
public class SetupLinkerActionAttribute : BaseMetadataAttribute
{
public SetupLinkerActionAttribute (string action, string assembly)
{
switch (action) {
case "link": case "copy": case "skip":
break;
default:
throw new ArgumentOutOfRangeException (nameof (action));
}
}
}
}

View File

@ -0,0 +1,20 @@
using System;
namespace Mono.Linker.Tests.Cases.Expectations.Metadata
{
[AttributeUsage (AttributeTargets.Class, AllowMultiple = false)]
public class SetupLinkerCoreActionAttribute : BaseMetadataAttribute
{
public SetupLinkerCoreActionAttribute (string action)
{
switch (action) {
case "link":
case "copy":
case "skip":
break;
default:
throw new ArgumentOutOfRangeException (nameof (action));
}
}
}
}

View File

@ -37,6 +37,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Assertions\BaseInAssemblyAttribute.cs" />
<Compile Include="Assertions\IgnoreTestCaseAttribute.cs" />
<Compile Include="Assertions\KeptAssemblyAttribute.cs" />
<Compile Include="Assertions\KeptAttribute.cs" />
@ -48,16 +49,23 @@
<Compile Include="Assertions\RemovedAssemblyAttribute.cs" />
<Compile Include="Assertions\RemovedMemberInAssemblyAttribute.cs" />
<Compile Include="Assertions\RemovedTypeInAssemblyAttribute.cs" />
<Compile Include="Assertions\SkipPeVerifyAttribute.cs" />
<Compile Include="Metadata\BaseMetadataAttribute.cs" />
<Compile Include="Metadata\CoreLinkAttribute.cs" />
<Compile Include="Metadata\SetupCompileAfterAttribute.cs" />
<Compile Include="Metadata\SetupCompileBeforeAttribute.cs" />
<Compile Include="Metadata\DefineAttribute.cs" />
<Compile Include="Metadata\IncludeBlacklistStepAttribute.cs" />
<Compile Include="Metadata\Il8nAttribute.cs" />
<Compile Include="Metadata\KeepTypeForwarderOnlyAssembliesAttribute.cs" />
<Compile Include="Metadata\NotATestCaseAttribute.cs" />
<Compile Include="Metadata\ReferenceAttribute.cs" />
<Compile Include="Metadata\SandboxDependencyAttribute.cs" />
<Compile Include="Assertions\KeptBaseTypeAttribute.cs" />
<Compile Include="Assertions\KeptInterfaceAttribute.cs" />
<Compile Include="Assertions\KeptAttributeAttribute.cs" />
<Compile Include="Assertions\RemovedForwarderAttribute.cs" />
<Compile Include="Metadata\SetupLinkerActionAttribute.cs" />
<Compile Include="Metadata\SetupLinkerCoreActionAttribute.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -0,0 +1,21 @@
using Mono.Linker.Tests.Cases.Expectations.Assertions;
namespace Mono.Linker.Tests.Cases.Basic
{
class UsedStructIsKept {
public static void Main()
{
A a;
a.MethodVerifiedByKeptMember ();
}
[Kept]
// This KeptMember is here to make sure the test framework's support of KeptMember on value types is working correctly
[KeptMember ("MethodVerifiedByKeptMember()")]
struct A {
public void MethodVerifiedByKeptMember ()
{
}
}
}
}

View File

@ -4,11 +4,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.CoreLink
{
[CoreLink ("copy")]
[SetupLinkerCoreAction ("copy")]
[KeptAssembly ("mscorlib.dll")]
// These types are normally removed when the core libraries are linked
[KeptTypeInAssembly ("mscorlib.dll", typeof (ConsoleKeyInfo))]
[KeptTypeInAssembly ("mscorlib.dll", typeof (System.Collections.ObjectModel.KeyedCollection<,>))]
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
class CopyOfCoreLibrariesKeepsUnusedTypes
{
public static void Main()

View File

@ -6,13 +6,16 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.CoreLink
{
[CoreLink ("link")]
[SetupLinkerCoreAction ("link")]
[KeptAssembly ("mscorlib.dll")]
[KeptMemberInAssembly ("mscorlib.dll", typeof (Stack), ".ctor(System.Int32)", "Pop()", "Push(System.Object)")]
// We can't check everything that should be removed, but we should be able to check a few niche things that
// we known should be removed which will at least verify that the core library was processed
[RemovedMemberInAssembly ("mscorlib.dll", typeof (Stack), ".ctor(System.Collections.ICollection)")]
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
class LinkingOfCoreLibrariesRemovesUnusedMethods {
public static void Main()
{

View File

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.CoreLink {
[IgnoreTestCase("Requires mono 5.2 to pass. [Conditional] is not working with mcs on OSX agent")]
[CoreLink ("link")]
[SetupLinkerCoreAction ("link")]
[Reference("System.dll")]
[KeptAssembly ("mscorlib.dll")]
@ -12,19 +12,26 @@ namespace Mono.Linker.Tests.Cases.CoreLink {
// We can't check everything that should be removed, but we should be able to check a few niche things that
// we known should be removed which will at least verify that the core library was processed
[KeptTypeInAssembly ("mscorlib.dll", typeof (System.Collections.Generic.IEnumerable<>))]
[KeptTypeInAssembly ("System.dll", typeof (Uri))]
[KeptTypeInAssembly ("System.dll", typeof (System.Collections.Generic.SortedList<,>))]
[RemovedTypeInAssembly ("mscorlib.dll", typeof (System.Resources.ResourceWriter))]
[RemovedTypeInAssembly ("System.dll", typeof (System.CodeDom.Compiler.CodeCompiler))]
[RemovedTypeInAssembly ("System.dll", typeof (System.Collections.Generic.SortedDictionary<,>))]
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
// All sorts of stuff is flagged as invalid even in the original System.dll and System.Configuration.dll for mono class libraries
[SkipPeVerify("System.dll")]
[SkipPeVerify("System.Configuration.dll")]
class LinkingOfCoreLibrariesRemovesUnusedTypes {
public static void Main ()
{
// Use something from system that would normally be removed if we didn't use it
OtherMethods2 (new Uri ("dont care"));
OtherMethods2 (new SortedList<string, string>());
}
[Kept]
static void OtherMethods2 (Uri uri)
static void OtherMethods2 (SortedList<string, string> list)
{
}
}

View File

@ -0,0 +1,15 @@
using Mono.Linker.Tests.Cases.Expectations.Assertions;
namespace Mono.Linker.Tests.Cases.LinkXml {
[KeptMember (".ctor()")]
public class UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved {
public static void Main ()
{
}
[Kept]
[KeptMember (".ctor()")]
class Unused {
}
}
}

View File

@ -0,0 +1,4 @@
<linker>
<assembly fullname="test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
</assembly>
</linker>

View File

@ -0,0 +1,23 @@
using System;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
namespace Mono.Linker.Tests.Cases.LinkXml {
class UnusedEventPreservedByLinkXmlIsKept {
public static void Main ()
{
}
[Kept]
class Unused {
[Kept]
[KeptBackingField]
public event EventHandler<EventArgs> Preserved;
[Kept]
public event EventHandler<EventArgs> Preserved1 { [Kept] add { } [Kept] remove { } }
public event EventHandler<EventArgs> NotPreserved;
}
}
}

View File

@ -0,0 +1,8 @@
<linker>
<assembly fullname="test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<type fullname="Mono.Linker.Tests.Cases.LinkXml.UnusedEventPreservedByLinkXmlIsKept/Unused">
<event signature="System.EventHandler`1&lt;System.EventArgs&gt; Preserved" />
<event signature="System.EventHandler`1&lt;System.EventArgs&gt; Preserved1" />
</type>
</assembly>
</linker>

View File

@ -20,6 +20,22 @@ namespace Mono.Linker.Tests.Cases.LinkXml {
[KeptBackingField]
public int PreservedProperty3 { get; [Kept] set; }
[Kept]
[KeptBackingField]
public int PreservedProperty4 { [Kept] get; [Kept] set; }
[Kept]
[KeptBackingField]
public int PreservedProperty5 { [Kept] get; [Kept] set; }
[Kept]
[KeptBackingField]
public int PreservedProperty6 { [Kept] get; set; }
[Kept]
[KeptBackingField]
public int PreservedProperty7 { get; [Kept] set; }
public int NotPreservedProperty { get; set; }
}
}

View File

@ -5,6 +5,11 @@
<method signature="System.Void set_PreservedProperty1(System.Int32)" />
<method signature="System.Int32 get_PreservedProperty2()" />
<method signature="System.Void set_PreservedProperty3(System.Int32)" />
<property signature="System.Int32 PreservedProperty4" />
<property signature="System.Int32 PreservedProperty5" accessors="all" />
<property signature="System.Int32 PreservedProperty6" accessors="get" />
<property signature="System.Int32 PreservedProperty7" accessors="set" />
</type>
</assembly>
</linker>

View File

@ -0,0 +1,86 @@
using Mono.Linker.Tests.Cases.Expectations.Assertions;
namespace Mono.Linker.Tests.Cases.LinkXml {
class UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved
{
public static void Main ()
{
}
[Kept]
[KeptMember (".ctor()")]
class Unused {
[Kept]
public int Field1;
[Kept]
private int Field2;
[Kept]
internal int Field3;
[Kept]
public static int Field4;
[Kept]
private static int Field5;
[Kept]
internal static int Field6;
[Kept]
[KeptBackingField]
public string Property1 { [Kept] get; [Kept] set;}
[Kept]
[KeptBackingField]
private string Property2 { [Kept] get; [Kept] set; }
[Kept]
[KeptBackingField]
internal string Property3 { [Kept] get; [Kept] set; }
[Kept]
[KeptBackingField]
public static string Property4 { [Kept] get; [Kept] set; }
[Kept]
[KeptBackingField]
private static string Property5 { [Kept] get; [Kept] set; }
[Kept]
[KeptBackingField]
internal static string Property6 { [Kept] get; [Kept] set; }
[Kept]
public void Method1 ()
{
}
[Kept]
private void Method2 ()
{
}
[Kept]
internal void Method3 ()
{
}
[Kept]
public static void Method4 ()
{
}
[Kept]
private static void Method5 ()
{
}
[Kept]
internal static void Method6 ()
{
}
}
}
}

View File

@ -0,0 +1,5 @@
<linker>
<assembly fullname="test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<type fullname="Mono.Linker.Tests.Cases.LinkXml.UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved/Unused" />
</assembly>
</linker>

View File

@ -56,6 +56,22 @@
<Compile Include="Basic\UnusedPropertyGetsRemoved.cs" />
<Compile Include="Basic\UnusedPropertySetterRemoved.cs" />
<Compile Include="Basic\UsedPropertyIsKept.cs" />
<Compile Include="Basic\UsedStructIsKept.cs" />
<Compile Include="LinkXml\UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs" />
<Compile Include="LinkXml\UnusedEventPreservedByLinkXmlIsKept.cs" />
<Compile Include="LinkXml\UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs" />
<Compile Include="TestFramework\CanCompileILAssembly.cs" />
<Compile Include="TestFramework\VerifyDefineAttributeBehavior.cs" />
<None Include="TypeForwarding\Dependencies\ForwarderLibrary.cs" />
<Compile Include="TypeForwarding\Dependencies\ImplementationLibrary.cs" />
<Compile Include="TypeForwarding\Dependencies\LibraryUsingForwarder.cs" />
<Compile Include="TypeForwarding\Dependencies\ReferenceImplementationLibrary.cs" />
<Compile Include="TypeForwarding\TypeForwarderOnlyAssembliesRemoved.cs" />
<Compile Include="TypeForwarding\TypeForwarderOnlyAssembliesKept.cs" />
<Compile Include="VirtualMethods\ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs" />
<Compile Include="VirtualMethods\ClassUsedFromInterfaceHasInterfaceMethodKept.cs" />
<Compile Include="VirtualMethods\StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs" />
<Compile Include="VirtualMethods\StructUsedFromInterfaceHasInterfaceMethodKept.cs" />
<Compile Include="CoreLink\CopyOfCoreLibrariesKeepsUnusedTypes.cs" />
<Compile Include="CoreLink\LinkingOfCoreLibrariesRemovesUnusedMethods.cs" />
<Compile Include="CoreLink\LinkingOfCoreLibrariesRemovesUnusedTypes.cs" />
@ -122,15 +138,20 @@
<Compile Include="VirtualMethods\TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs" />
<Compile Include="VirtualMethods\VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs" />
<Compile Include="VirtualMethods\VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs" />
<Compile Include="TypeForwarding\MissingTargetReference.cs" />
<None Include="TypeForwarding\Dependencies\TypeForwarderMissingReference.il" />
</ItemGroup>
<ItemGroup>
<Content Include="LinkXml\TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.xml" />
<Content Include="LinkXml\UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.xml" />
<Content Include="LinkXml\UnusedEventPreservedByLinkXmlIsKept.xml" />
<Content Include="LinkXml\UnusedFieldPreservedByLinkXmlIsKept.xml" />
<Content Include="LinkXml\UnusedMethodPreservedByLinkXmlIsKept.xml" />
<Content Include="LinkXml\UnusedNestedTypePreservedByLinkXmlIsKept.xml" />
<Content Include="LinkXml\UnusedPropertyPreservedByLinkXmlIsKept.xml" />
<Content Include="LinkXml\UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.xml" />
<Content Include="LinkXml\UnusedTypePreservedByLinkXmlIsKept.xml" />
<Content Include="LinkXml\UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.xml" />
<Content Include="LinkXml\UnusedTypeWithPreserveAllHasAllMembersPreserved.xml" />
<Content Include="LinkXml\UnusedTypeWithPreserveFieldsHasMethodsRemoved.xml" />
<Content Include="LinkXml\UnusedTypeWithPreserveMethodsHasFieldsRemoved.xml" />
@ -143,6 +164,9 @@
<Name>Mono.Linker.Tests.Cases.Expectations</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="TestFramework\Dependencies\ILAssemblySample.il" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -3,13 +3,14 @@ using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.References {
[CoreLink ("link")]
[SetupLinkerCoreAction ("link")]
// Il8n & the blacklist step pollute the results with extra stuff that didn't need to be
// preserved for this test case so we need to disable them
[Il8n("none")]
[IncludeBlacklistStep("false")]
[Il8n ("none")]
[Reference ("System.dll")]
[RemovedAssembly ("System.dll")]
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
[SkipPeVerify(SkipPeVerifyForToolchian.Pedump)]
class ReferencesAreRemovedWhenAllUsagesAreRemoved {
public static void Main ()
{

View File

@ -0,0 +1,19 @@
using System;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.TestFramework
{
[Define ("IL_ASSEMBLY_AVAILABLE")]
[SetupCompileBefore ("ILAssembly.dll", new [] { "Dependencies/ILAssemblySample.il" })]
[KeptMemberInAssembly ("ILAssembly.dll", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample", "GiveMeAValue()")]
public class CanCompileILAssembly
{
static void Main ()
{
#if IL_ASSEMBLY_AVAILABLE
Console.WriteLine (new Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample ().GiveMeAValue ());
#endif
}
}
}

View File

@ -0,0 +1,42 @@
.assembly extern mscorlib
{
}
.assembly ILAssembly
{
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module ILAssembly.dll
// =============== CLASS MEMBERS DECLARATION ===================
.class public auto ansi beforefieldinit Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample
extends [mscorlib]System.Object
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method ILAssemblySample::.ctor
.method public hidebysig instance string
GiveMeAValue() cil managed
{
.maxstack 1
.locals init (string V_0)
IL_0000: nop
IL_0001: ldstr "Bar"
IL_0006: stloc.0
IL_0007: br IL_000c
IL_000c: ldloc.0
IL_000d: ret
} // end of method ILAssemblySample::GiveMeAValue
}

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